~quf/tocs3planner

ref: ffad140d2c7952007ff2e7cf03eaa0c851f16d78 tocs3planner/GNUmakefile -rw-r--r-- 1.5 KiB
ffad140dLukas Himbert better download link 1 year, 4 months ago
                                                                                
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
.SUFFIXES: # remove all default rules
.PRECIOUS: obj/%.o # do not remove intermediate object files
.PHONY: default tests runtests clean purge # always run these targets if specified, even when "up to date"

CXXFLAGS:=-std=c++20 -W -Wall -Wextra -Werror -Wfatal-errors -Isrc $(CXXFLAGS)
LDFLAGS:=-flto -W -Wall -Wextra -Werror -Wfatal-errors $(LDFLAGS)
WXCXXFLAGS!=wx-config --cxxflags --libs | sed 's/-I/-isystem/g'
WXLFLAGS!=wx-config --libs

DATAOBJS=$(patsubst %,obj/%.o,data chars items magic mstqrt notemons orb quartz difficulty)
APPOBJS=$(patsubst %,obj/%.o,equipbox quartzbox statbox pcstats npcstats main)
TESTBINS=$(patsubst %,bin/test_%,monsstats charstats)

.DEFAULT: default
default: bin/tocs3planner

-include obj/*.dep

tests: $(TESTBINS)

runtests: $(TESTBINS)
	$(foreach bin,$^,./$(bin);)

bin/%: $(DATAOBJS) obj/%.o obj/calc_stats.o
	$(CXX) $(LDFLAGS) -o $@ $^

bin/tocs3planner: $(DATAOBJS) obj/calc_stats.o $(APPOBJS)
	$(CXX) -o $@ $^ $(WXLFLAGS) $(LDFLAGS)
	$(CXX) $(CXXFLAGS) -MM -MF $(patsubst %.o,%.dep,$@) $<

obj/%.o: app/%.c++
	$(CXX) $(WXCXXFLAGS) $(CXXFLAGS) -o $@ -c $<
	$(CXX) $(WXCXXFLAGS) $(CXXFLAGS) -MM -MF $(patsubst %.o,%.dep,$@) $<

obj/%.o: src/%.c++
	$(CXX) $(CXXFLAGS) -o $@ -c $<
	$(CXX) $(CXXFLAGS) -MM -MF $(patsubst %.o,%.dep,$@) $<

obj/%.o: test/%.c++
	$(CXX) $(CXXFLAGS) -o $@ -c $<
	$(CXX) $(CXXFLAGS) -MM -MF $(patsubst %.o,%.dep,$@) $<

obj/%.o: data/%.c++
	$(CXX) $(CXXFLAGS) -o $@ -c $<
	$(CXX) $(CXXFLAGS) -MM -MF $(patsubst %.o,%.dep,$@) $<

clean:
	-rm obj/*.o
	-rm obj/*.dep

purge: clean
	-rm bin/*