aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 90e1138ab55579c83ebf6230a5928e397d55bfbf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/make -f
# Don't fucking touch this without a good reason or I will fucking strangle you

CFLAGS   := -std=gnu23
CPPFLAGS := -Iinclude
LDFLAGS  := -lm

DEBUG := 1

ifeq (${DEBUG},1)
        CFLAGS += -Og -ggdb -pg -fno-inline -Wall -Wextra -Wpedantic -Wshadow -Wundef
else
        CFLAGS   += -O2 -flto=auto
        CPPFLAGS += -DNDEBUG -D_FORTIFY_SOURCE=2
endif

SOURCE.dir	:= source
OBJECT.dir	:= object
HEADER		:= $(wildcard *.h) # yeah it's duplicative however that is unimportant
SOURCE.orig	:= $(wildcard ${SOURCE.dir}/*.c)
SOURCE.orig	:= $(SOURCE.orig:${SOURCE.dir}/%=%)
SOURCE		:= $(addprefix ${SOURCE.dir}/, $(SOURCE.orig))
OBJECT		:= $(addprefix ${OBJECT.dir}/, $(SOURCE.orig:.c=.o))

${OBJECT.dir}/%.o: ${SOURCE.dir}/%.c
	@echo "CC	$<"
	@${COMPILE.c} $(CPPFLAGS) -o $@ $<

all: EUROPA\|XI

clean:
	rm -f $(OBJECT) EUROPA\|XI

EUROPA|XI: $(HEADER) | $(OBJECT)
	@echo "LD	$@"
	@${LINK.c} -o "$@" $| library/libraylib.amd64.a $(LDFLAGS)

library/libraylib.amd64.a:
	@rm -rf /tmp/raylib-5.5_linux_amd64
	wget -P /tmp/ "https://github.com/raysan5/raylib/releases/download/5.5/raylib-5.5_linux_amd64.tar.gz"
	@tar xvC /tmp/ -f /tmp/raylib-5.5_linux_amd64.tar.gz \
	raylib-5.5_linux_amd64/lib/libraylib.a \
	raylib-5.5_linux_amd64/LICENSE \
	raylib-5.5_linux_amd64/include
	@cp -f /tmp/raylib-5.5_linux_amd64/lib/libraylib.a library/libraylib.amd64.a
	@cp -f /tmp/raylib-5.5_linux_amd64/include/* include/
	@cp -n /tmp/raylib-5.5_linux_amd64/LICENSE library/libraylib.LICENSE.a