blob: 25e0cecaeb7caeff50fb4a53be36dc90e7de2b43 (
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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
ifndef config
config=debug_gnu64
endif
.PHONY: all clean
sanitise =
defines =
includes = ./
data_dir = data
int_dir = intermediate
cflags = \
$(includes) $(defines) $(conf_cflags) \
-Wall -std=c90 -pedantic -static-libgcc $(sanitise)
lflags = $(conf_lflags) $(libs) -static-libgcc $(sanitise)
pack_cmd = ./packer
bmpconv_cmd = ./bmpconv
target=mallocbullet
ifeq ($(config), debug_gnu64)
compiler = gcc
defines = -DDEBUG -Dplat_sdl2 -Dplat_posix -Dplat_x86 -Dallow_floats
includes = -I./
conf_cflags = -g -O0 -m64
conf_lflags = -m64
libs = -lm -lSDL2
endif
ifeq ($(config), release_gnu64)
compiler = gcc
defines = -DNDEBUG -Dplat_sdl2 -Dplat_posix -Dplat_x86 -Dallow_floats
includes = -I./
conf_cflags = -s -O3 -m64
conf_lflags = -s -O3 -m64
libs = -lm -lSDL2
endif
ifeq ($(config), debug_gnu32)
compiler = gcc
defines = -DDEBUG -Dplat_sdl2 -Dplat_posix -Dplat_x86 -Dallow_floats
includes = -I./
conf_cflags = -g -O0 -m32
conf_lflags = -m32
libs = -lm -lSDL2
endif
ifeq ($(config), release_gnu32)
compiler = gcc
defines = -DNDEBUG -Dplat_sdl2 -Dplat_posix -Dplat_x86 -Dallow_floats
includes = -I./
conf_cflags = -s -O3 -m32
conf_lflags = -s -O3 -m32
libs = -lm -lSDL2
endif
ifeq ($(config), release_win32)
target = mallocbullet.exe
compiler = i686-w64-mingw32-gcc
defines = -DNDEBUG -DSDL_MAIN_HANDLED -Dplat_sdl2 -Dplat_x86 -Dplat_windows -Dallow_floats
includes = -I./ -I win/extern/SDL2/include
conf_clfags = -s -O3 -m32 -static
conf_lflags = -s -O3 -m32 -static
libs = -Lwin/extern/SDL2/lib/gcc/x86 -lSDL2.dll -lSDL2main -lkernel32 -luser32 -lsetupapi
pack_cmd = wine packer.exe
bmpconv_cmd = wine bmpconv.exe
postbuild = cp win/extern/SDL2/lib/gcc/x86/SDL2.dll ./
endif
ifeq ($(config), release_win64)
target = mallocbullet.exe
compiler = x86_64-w64-mingw32-gcc
defines = -DNDEBUG -DSDL_MAIN_HANDLED -Dplat_sdl2 -Dplat_x86 -Dplat_windows -Dallow_floats
includes = -I./ -I win/extern/SDL2/include
conf_clfags = -s -O3 -m64 -static
conf_lflags = -s -O3 -m64 -static -mwindows
libs = -Lwin/extern/SDL2/lib/gcc/x64 -lSDL2.dll -lSDL2main -lkernel32 -luser32 -lsetupapi
pack_cmd = wine packer.exe
bmpconv_cmd = wine bmpconv.exe
postbuild = cp win/extern/SDL2/lib/gcc/x64/SDL2.dll ./
endif
.PHONY: all clean pack_assets
all: $(target)
sources = \
animation.c \
animation_system.c \
asset.c \
bullet.c \
collision_system.c \
enemy.c \
fx.c \
game.c \
main.c \
malware.c \
map.c \
menu.c \
platform.c \
player.c \
rect.c \
render.c \
solid.c \
sprite.c \
sprite_system.c \
standard.c \
world.c \
assets = $(wildcard $(data_dir)/*)
objects = $(sources:%.c=%.o)
bitmaps = $(wildcard $(int_dir)/*.bmp)
images = $(bitmaps:$(int_dir)/%.bmp=$(data_dir)/%.img)
$(objects): %.o : %.c
$(compiler) $(cflags) -MMD -MF $(@:%.o=%.d) -c $< -o $@
$(images): $(data_dir)%.img : $(int_dir)%.bmp | bmp_converter $(data_dir)
$(bmpconv_cmd) $< $@
bmp_converter:
$(compiler) -O3 -Wall bmpconv.c -o bmpconv
assets: $(images)
$(data_dir):
mkdir -p data
pack_assets:
$(compiler) -O3 -Wall pack.c -o packer
$(pack_cmd) $(assets)
-include $(objects:%.o=%.d)
$(target): $(objects) assets pack_assets
$(compiler) $(objects) $(lflags) -o $@
$(postbuild)
clean:
rm -f $(target)
rm -f $(objects)
rm -f $(objects:%.o=%.d)
rm -f $(images)
rm -f pack packer
rm -f bmpconv
|