Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (60 loc) · 1.88 KB
/
Copy pathMakefile
File metadata and controls
69 lines (60 loc) · 1.88 KB
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
SRCS = $(wildcard ./src/*.cpp) $(wildcard ./src/*/*.cpp)
OBJS = $(SRCS:.cpp=.o)
CPP = g++
CPPFLAGS = -Wall -Wextra -Wpedantic
SFMLFLAGS = -l sfml-window -l sfml-graphics -l sfml-system
# Style
ifeq ($(OS), Windows_NT)
DEF =
BOLD =
GREEN =
else
ifneq ($(shell tput setaf 1 2>/dev/null),)
DEF = \033[0m
BOLD = \033[1m
GREEN = \033[32m
endif
endif
.PHONY: all clean run-packer
# Rules
all: prepare set-default-flags $(OBJS) link clean
set-default-flags:
@echo "$(BOLD)$(GREEN)---> OPTIMIZED COMPILATION$(DEF)"
$(eval CPPFLAGS += -Ofast -s)
$(eval SFMLFLAGS = -l sfml-window -l sfml-graphics -l sfml-system)
release: prepare set-release-flags $(OBJS) link clean
set-release-flags:
@echo "$(BOLD)$(GREEN)---> RELEASE COMPILATION$(DEF)"
$(eval CPPFLAGS += -Ofast -s -static -static-libgcc -static-libstdc++ -DSFML_STATIC)
$(eval SFMLFLAGS = -l sfml-graphics-s -l sfml-window-s -l sfml-system-s -l freetype -l harfbuzz -l graphite2 -l png -l bz2 -l z -l brotlidec -l brotlicommon -l opengl32 -l winmm -l gdi32 -lole32 -lusp10 -l Rpcrt4)
debug: prepare set-debug-flags $(OBJS) link clean
set-debug-flags:
@echo "$(BOLD)$(GREEN)---> DEBUG COMPILATION$(DEF)"
$(eval CPPFLAGS += -g3)
$(eval SFMLFLAGS = -l sfml-window -l sfml-graphics -l sfml-system)
# Prepare
prepare:
@echo "$(BOLD)$(GREEN)---> PREPARE$(DEF)"
$(RM) -r build
mkdir build
cp src/anon.ttf build/anon.ttf
# Compile
$(OBJS): %.o: %.cpp
$(CPP) $(CPPFLAGS) -c $<
# Link
link: print-link packer bench generate
print-link:
@echo "$(BOLD)$(GREEN)---> LINKING$(DEF)"
bench: benchmark.o packer.o instance_gen.o
$(CPP) $(CPPFLAGS) $^ -o $@
mv -f $@ build
generate: generate.o instance_gen.o
$(CPP) $(CPPFLAGS) $^ -o $@
mv -f $@ build
packer: solve_input.o packer.o visualizer.o
$(CPP) $(CPPFLAGS) $^ -o $@ $(SFMLFLAGS)
mv -f $@ build
# Clean
clean:
@echo "$(BOLD)$(GREEN)---> CLEANING$(DEF)"
$(RM) *.o