-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (44 loc) · 1.21 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
CC=gcc
INC_PATH=-I. -I$(MAKECMDGOALS)
LIB_PATH=#-L/home/dev_tools/apr/lib
LIBS=#-lapr-1 -laprutil-1
CFLAGS=-Wall -Wextra -O3 -mcmodel=medium -mlarge-data-threshold=1023 $(INC_PATH)
MAGICKFLAGS=$(shell MagickWand-config --cflags --ldflags)
ifneq ($(MAKECMDGOALS),clean)
ifeq ($(MAKECMDGOALS),)
MAKECMDGOALS=RW
endif
ifeq ($(MAKECMDGOALS),all)
MAKECMDGOALS=RW
endif
WORLD_DEF=
ifeq ($(MAKECMDGOALS),RW)
WORLD_DEF=-DRW
endif
ifeq ($(MAKECMDGOALS),ESA)
WORLD_DEF=-DESA
endif
$(info $(shell $(MAKE) -C $(MAKECMDGOALS) run))
$(info Done generating map)
SOURCES=$(wildcard ./$(MAKECMDGOALS)/Merged_Screenshots_C/*.c) $(wildcard ./$(MAKECMDGOALS)/Merged_Screenshots_C/*/*/*.c)
OBJECTS=$(patsubst %.c, %.o, $(SOURCES))
endif
.PHONY: all
all: main
.PHONY: RW
RW: main
.PHONY: ESA
ESA: main
# won't build for different game without phony
.PHONY: main
main: main.c $(OBJECTS)
$(info $(CC) $(CFLAGS) $(WORLD_DEF) $(MAGICKFLAGS) -lm -o $@ [email protected] SCREENSHOTS $(LIB_PATH) $LIBS)
@$(CC) $(CFLAGS) $(WORLD_DEF) $(MAGICKFLAGS) -lm -o $@ [email protected] $(OBJECTS) $(LIB_PATH) $(LIBS)
$(OBJECTS): %.o : %.c
$(CC) $(CFLAGS) -c -o $@ $< $(LIB_PATH) $(LIBS)
.PHONY: clean
clean:
rm -f main
for game in RW ESA; do \
$(MAKE) -C $$game $(MAKECMDGOALS); \
done