summaryrefslogtreecommitdiff
path: root/Makefile
blob: b86f8dce6d6f95b7a948ee7b8726c68dcc349e03 (plain)
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
CC ?= gcc
CFLAGS += -g3 -O3 -Wall -std=gnu++14
CPPFLAGS += -MMD
LDFLAGS += -lstdc++ -lm -lsfml-system -lsfml-window -lsfml-graphics -lsfml-audio

PP_BOLD := $(shell tput bold)
PP_RESET := $(shell tput sgr0)
PP_CC := $(PP_BOLD)$(shell tput setf 6)CC$(PP_RESET)
PP_LD := $(PP_BOLD)$(shell tput setf 2)LD$(PP_RESET)
PP_RM := $(PP_BOLD)$(shell tput setf 4)RM$(PP_RESET)

SRC := src/game/assets.cpp \
       src/game/decos.cpp \
       src/game/effects.cpp \
       src/game/game.cpp \
       src/game/interface.cpp \
       src/game/rocket.cpp \
       src/game/text.cpp \
       src/game/units.cpp \
       src/game/unit_nest.cpp \
       src/game/unit_repl.cpp \
       src/game/unit_soldier.cpp \
       src/game/unit_spider.cpp \
       src/game/worldgen.cpp \
       src/audio.cpp \
       src/main.cpp \
       src/path_finder.cpp \
       src/procgen.cpp \
       src/render.cpp \
       src/world.cpp
       
OBJ := $(SRC:src/%.cpp=obj/%.o)
OUT := minitrem

all: $(OUT)

-include $(OBJ:.o=.d)

obj/%.o : src/%.cpp
	@echo "$(PP_CC) src/$*.cpp"
	@mkdir -p $(@D)
	@$(CC) $(CFLAGS) $(CPPFLAGS) -c src/$*.cpp -o obj/$*.o

$(OUT): $(OBJ)
	@echo "$(PP_LD) $(OUT)"
	@$(CC) $(OBJ) -o $(OUT) $(LDFLAGS)

clean:
	@echo "${PP_RM} obj"
	@rm -rf obj
	@echo "${PP_RM} ${OUT}"
	@rm -rf ${OUT}

.PHONY: clean