forked from vygr/ChrysaLisp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (33 loc) · 888 Bytes
/
Makefile
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
OS := $(shell uname)
CPU := $(shell uname -m)
all: obj/$(OS)/$(CPU)/main
snapshot:
rm -f snapshot.zip
zip -r9oq -x*.o snapshot.zip obj/*
boot:
rm -f snapshot.zip
zip -9q snapshot.zip `find obj -type d` `find obj -name "boot_image"`
obj/$(OS)/$(CPU)/main: obj/$(OS)/$(CPU)/main.o
ifeq ($(OS),Darwin)
cc -o $@ [email protected] -Wl,-framework,SDL2 -Wl,-framework,SDL2_ttf
endif
ifeq ($(OS),Linux)
cc -o $@ [email protected] $(shell sdl2-config --libs) -lSDL2_ttf
endif
obj/$(OS)/$(CPU)/main.o: main.c Makefile
echo $(CPU) > arch
echo $(OS) > platform
unzip -nq snapshot.zip
ifeq ($(OS),Darwin)
cc -c -nostdlib -fno-exceptions \
-I/Library/Frameworks/SDL2.framework/Headers/ \
-I/Library/Frameworks/SDL2_ttf.framework/Headers/ \
-o $@ $<
endif
ifeq ($(OS),Linux)
cc -c -nostdlib -fno-exceptions \
-I/usr/include/SDL2/ \
-o $@ $<
endif
clean:
rm -rf obj/