forked from SFTtech/openage
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
174 lines (144 loc) · 5.28 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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# type 'make help' for a list/explaination of recipes.
BUILDDIR = bin
MAKEARGS += $(if $(VERBOSE),,--no-print-directory)
.PHONY: default
default: build
$(BUILDDIR):
@echo "call ./configure to initialize the build directory."
@echo "also see ./configure --help, and doc/building.md"
@echo ""
@false
.PHONY: install
install: $(BUILDDIR)
$(MAKE) $(MAKEARGS) -C $(BUILDDIR) install
.PHONY: run
run: build
./run game
.PHONY: test
test: tests checkfast
.PHONY: tests
tests: build
./run test -a
.PHONY: build
build: $(BUILDDIR)
@$(MAKE) $(MAKEARGS) -C $(BUILDDIR)
.PHONY: libopenage
libopenage: $(BUILDDIR)
@$(MAKE) $(MAKEARGS) -C $(BUILDDIR) libopenage
.PHONY: codegen
codegen: $(BUILDDIR)
$(MAKE) $(MAKEARGS) -C $(BUILDDIR) codegen
.PHONY: pxdgen
pxdgen: $(BUILDDIR)
$(MAKE) $(MAKEARGS) -C $(BUILDDIR) pxdgen
.PHONY: compilepy
compilepy: $(BUILDDIR)
$(MAKE) $(MAKEARGS) -C $(BUILDDIR) compilepy
.PHONY: inplacemodules
inplacemodules:
$(MAKE) $(MAKEARGS) -C $(BUILDDIR) inplacemodules
.PHONY: cythonize
cythonize: $(BUILDDIR)
$(MAKE) $(MAKEARGS) -C $(BUILDDIR) cythonize
.PHONY: doc
doc: $(BUILDDIR)
$(MAKE) $(MAKEARGS) -C $(BUILDDIR) doc
.PHONY: cleanelf
cleanelf: $(BUILDDIR)
@# removes all object files and binaries
$(MAKE) $(MAKEARGS) -C $(BUILDDIR) clean
.PHONY: cleancodegen
cleancodegen: $(BUILDDIR)
@# removes all sourcefiles created by codegen
$(MAKE) $(MAKEARGS) -C $(BUILDDIR) cleancodegen
.PHONY: cleanpxdgen
cleanpxdgen: $(BUILDDIR)
@# removes all generated .pxd files
$(MAKE) $(MAKEARGS) -C $(BUILDDIR) cleanpxdgen
.PHONY: cleancython
cleancython: $(BUILDDIR)
@# removes all .cpp files created by Cython
$(MAKE) $(MAKEARGS) -C $(BUILDDIR) cleancython
.PHONY: clean
clean: $(BUILDDIR) cleancodegen cleanpxdgen cleancython cleanelf
@# removes object files, binaries, py modules, generated code
.PHONY: cleaninsourcebuild
cleaninsourcebuild:
@echo "cleaning remains of in-source builds"
rm -rf DartConfiguration.tcl codegen_depend_cache codegen_target_cache Doxyfile Testing
@find . -not -path "./.bin/*" -type f -name CTestTestfile.cmake -print -delete
@find . -not -path "./.bin/*" -type f -name cmake_install.cmake -print -delete
@find . -not -path "./.bin/*" -type f -name CMakeCache.txt -print -delete
@find . -not -path "./.bin/*" -type f -name Makefile -not -path "./Makefile" -print -delete
@find . -not -path "./.bin/*" -type d -name CMakeFiles -print -exec rm -r {} +
.PHONY: cleanbuilddirs
cleanbuilddirs: cleaninsourcebuild
@if test -d bin; then $(MAKE) $(MAKEARGS) -C bin clean cleancython cleanpxdgen cleancodegen || true; fi
@echo cleaning symlinks to build directories
rm -f bin
@echo cleaning build directories
rm -rf .bin
@echo cleaning cmake-time generated code
rm -f Doxyfile py/openage/config.py libopenage/config.h libopenage/config.cpp
.PHONY: mrproper
mrproper: cleanbuilddirs
@echo cleaning converted assets
rm -rf userassets
.PHONY: mrproperer
mrproperer: mrproper
@if ! test -d .git; then echo "mrproperer is only available for gitrepos."; false; fi
@echo removing ANYTHING that is not checked into the git repo
@echo ENTER to confirm
@read val
git clean -x -d -f
.PHONY: checkfast
checkfast:
python3 -m buildsystem.codecompliance --fast
.PHONY: checkall
checkall:
python3 -m buildsystem.codecompliance --all
.PHONY: checkchanged
checkchanged:
python3 -m buildsystem.codecompliance --all --only-changed-files=origin/master
.PHONY: checkuncommited
checkuncommited:
python3 -m buildsystem.codecompliance --all --only-changed-files=HEAD
.PHONY: help
help: $(BUILDDIR)/Makefile
@echo "openage Makefile"
@echo ""
@echo "wrapper that mostly forwards recipes to the cmake-generated Makefile in bin/"
@echo ""
@echo "targets:"
@echo ""
@echo "build -> build entire project"
@echo "libopenage -> build libopenage"
@echo "pxdgen -> generate .pxd files"
@echo "cythonize -> compile .pyx files to .cpp"
@echo "compilepy -> compile .py files to .pyc"
@echo "inplacemodules -> create in-place modules"
@echo "codegen -> generate cpp sources"
@echo "doc -> create documentation files"
@echo ""
@echo "cleanelf -> remove C++ ELF files"
@echo "cleancodegen -> undo 'make codegen'"
@echo "cleancython -> undo 'make cythonize inplacemodules'"
@echo "cleanpxdgen -> undo 'make pxdgen'"
@echo "clean -> undo 'make' (all of the above)"
@echo "cleanbuilddirs -> undo 'make' and './configure'"
@echo "cleaninsourcebuild -> undo in-source build accidents"
@echo "mrproper -> as above, but additionally delete user assets"
@echo "mrproperer -> leaves nothing but ashes"
@echo ""
@echo "run -> run openage"
@echo "tests -> run the tests (py + cpp)"
@echo ""
@echo "checkall -> full code compliance check"
@echo "checkfast -> fast checks only"
@echo "checkchanged -> full check for all files changed since origin/master"
@echo "checkuncommited -> full check for all currently uncommited files"
@echo ""
@echo "test -> tests + checkfast. this is what you should use for regular devbuilds"
@echo ""
@echo "CMake help:"
@test -d $(BUILDDIR) && $(MAKE) -C $(BUILDDIR) help || echo "no builddir is configured"