-
Notifications
You must be signed in to change notification settings - Fork 37
/
makefile
99 lines (64 loc) · 2.33 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
DESTDIR ?= /opt
GPRMAKE = gprbuild
GPRINSTALL = gprinstall
GPRCLEAN = gprclean
INSTALL = install
SDL_MODE ?= debug
SDL_PLATFORM ?= linux
SRC_DIR = ../..
SRCS = src/sdl.ads
GEN_KB = gen/src/sdl-events-keyboards.ads
ifeq (,$(filter $(SDL_PLATFORM), "linux" "windows" "bsd" "android"))
SDL2_CONFIG = -cargs `sdl2-config --cflags` -largs `sdl2-config --libs` -lSDL2_ttf -lSDL2_image -lSDL2_mixer
else ifeq ($(SDL_PLATFORM),macosx)
SDL2_CONFIG =
endif
# With GNAT, all static libs end with .a
LIB_NAME = lib/libadasdl.a
.PHONY: sdlada.gpr test_maths_build.gpr test.gpr tools.gpr
all: tools $(LIB_NAME)
# TODO: Fix the compiler so we actually get shared libs!
#
#####################################################################################
# SDL library
$(LIB_NAME): sdlada.gpr $(GEN_KB)
$(GPRMAKE) -p -XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) \
-Psdlada.gpr
.PHONY: clean-lib
clean-lib:
$(GPRCLEAN) -XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) \
-Psdlada.gpr
#####################################################################################
# Tools
tools: mk_dirs $(GEN_KB)
.PHONY: gen/src
mk_dirs: gen/src
mkdir -p gen/src/
$(GEN_KB): gen/$(SDL_MODE)/tools/gen_keyboard
./gen/$(SDL_MODE)/tools/gen_keyboard > $@
gen/$(SDL_MODE)/tools/gen_keyboard:
$(GPRMAKE) -p -XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) \
-Ptools.gpr
.PHONY: clean-kb clean-tools
clean-kb:
-rm $(GEN_KB)
clean-tools:
$(GPRCLEAN) -XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) -Ptools.gpr
#####################################################################################
# Unit tests
unit_tests: $(LIB_NAME) build_unit_tests/unit_tests
build_unit_tests/unit_tests:
$(GPRMAKE) -p -XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) \
-Punit_tests.gpr ${SDL2_CONFIG}
.PHONY: clean-unit_tests
clean-unit_tests:
-$(GPRCLEAN) -XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) -Punit_tests.gpr
#####################################################################################
.PHONY: install
install: all
$(GPRINSTALL) --prefix=$(DESTDIR) --build-name=$(SDL_MODE) -p -f \
-XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) \
-Psdlada.gpr
#####################################################################################
.PHONY: clean
clean: clean-kb clean-tools clean-unit_tests clean-lib