Scaled the weapon models down about 30% to match 2.5.2 sizes. Except the tuba, I...
[divverent/nexuiz.git] / data / Makefile
1 SCM := $(shell if [ -d .svn ]; then echo svn; elif [ -d ../.git ]; then echo git; fi)
2 FTEQCC ?= fteqcc
3 PERL ?= perl
4 PK3NAME ?= `date +../data%Y%m%d.pk3`
5 ZIP ?= 7za a -tzip -mx=9
6 ZIPEXCLUDE ?= -x\!*.pk3 -xr\!\.svn -x\!qcsrc
7 DIFF ?= diff
8
9 FTEQCCFLAGS ?= -Werror -Wall -Wno-mundane -O3 -Ono-c -Ono-cs -flo
10 FTEQCCFLAGS_PROGS ?= 
11 FTEQCCFLAGS_MENU ?= 
12
13 # NOTE: use -DUSE_FTE instead of -TFTE here!
14 # It will automagically add an engine check with -TID and then change back to -TFTE
15 FTEQCCFLAGS_CSPROGS ?= 
16
17 # nexuiz svn build system overrides this by command line argument
18 NEX_BUILDSYSTEM =
19
20 all: qc
21
22 .PHONY: update-cvarcount
23 update-cvarcount:
24         [ "$(NEX_BUILDSYSTEM)" = "" ] || [ "$(NEX_BUILDSYSTEM)" = "1" ]
25         [ "$(NEX_BUILDSYSTEM)" != "" ] || { ! [ -f ../misc/netradiant-NexuizPack/nexuiz.game/data/entities.def ] || $(DIFF) scripts/entities.def ../misc/netradiant-NexuizPack/nexuiz.game/data/entities.def || { echo entities.def mismatch, please merge ../misc/netradiant-NexuizPack/nexuiz.game/data/entities.def and scripts/entities.def; exit 1; }; }
26         [ "$(NEX_BUILDSYSTEM)" != "" ] || { DO_NOT_RUN_MAKE=1 sh update-cvarcount.sh; }
27
28 .PHONY: qc
29 qc: update-cvarcount
30         $(MAKE) qc-recursive
31
32 .PHONY: qc-recursive
33 qc-recursive: menu.dat progs.dat csprogs.dat
34
35 .PHONY: skin
36 skin: gfx/menu/default/skinvalues.txt
37
38 .PHONY: pk3
39 pk3: $(PK3NAME)
40
41 .PHONY: pk3here
42 pk3here: qc
43         $(RM) $(PK3NAME); \
44         set -ex; \
45                 ABSPK3NAME=$(PK3NAME); \
46                 case $$ABSPK3NAME in \
47                         /*) \
48                                 ;; \
49                         *) \
50                                 ABSPK3NAME=$$PWD/$$ABSPK3NAME; \
51                                 ;; \
52                 esac; \
53                 $(ZIP) $(ZIPEXCLUDE) $$ABSPK3NAME .
54
55 .PHONY: clean
56 clean:
57         rm -f progs.dat menu.dat csprogs.dat
58
59 csprogs.dat: qcsrc/client/*.* qcsrc/common/*.* qcsrc/warpzonelib/*.*
60         cd qcsrc/client && $(FTEQCC) $(FTEQCCFLAGS) $(FTEQCCFLAGS_CSPROGS)
61
62 progs.dat: qcsrc/server/*.* qcsrc/common/*.* qcsrc/server/*/*.* qcsrc/server/*/*/*.* qcsrc/warpzonelib/*.*
63         cd qcsrc/server && $(FTEQCC) $(FTEQCCFLAGS) $(FTEQCCFLAGS_PROGS)
64
65 menu.dat: qcsrc/menu/*.* qcsrc/menu/*/*.* qcsrc/common/*.*
66         cd qcsrc/menu && $(FTEQCC) $(FTEQCCFLAGS) $(FTEQCCFLAGS_MENU)
67
68 gfx/menu/default/skinvalues.txt: qcsrc/menu/skin-customizables.inc
69         $(PERL) qcsrc/menu/skin-customizables.inc > gfx/menu/default/skinvalues.txt
70
71 $(PK3NAME): qc
72         $(RM) $(PK3NAME)
73         set -ex; \
74                 ABSPK3NAME=$(PK3NAME); \
75                 case $$ABSPK3NAME in \
76                         /*) \
77                                 ;; \
78                         *) \
79                                 ABSPK3NAME=$$PWD/$$ABSPK3NAME; \
80                                 ;; \
81                 esac; \
82                 TDIR=`mktemp -d -t nexuizpk3.XXXXXX`; \
83                 cp -v progs.dat csprogs.dat menu.dat $$TDIR/; \
84                 svn export --force . $$TDIR; \
85                 cd $$TDIR; \
86                 $(ZIP) $$ABSPK3NAME .
87
88 .PHONY: testcase
89 testcase:
90         cd qcsrc/testcase && $(FTEQCC) $(FTEQCCFLAGS) $(FTEQCCFLAGS_CSPROGS) -DTESTCASE="$$TESTCASE"
91
92 .PHONY: update commit diff log logv logupdate logvupdate revert
93 update: $(SCM)-update
94 commit: $(SCM)-commit
95 diff: $(SCM)-diff
96 log: $(SCM)-log
97 logv: $(SCM)-logv
98 revert: $(SCM)-revert
99 logupdate: log update
100 logvupdate: logv update
101
102 .PHONY: svn-update
103 svn-update:
104         cd .. && svn update
105
106 .PHONY: svn-commit
107 svn-commit:
108         cd .. && svn commit
109
110 .PHONY: svn-diff
111 svn-diff:
112         cd .. && svn diff
113
114 .PHONY: svn-log
115 svn-log:
116         cd .. && svn log -r HEAD:BASE
117
118 .PHONY: svn-logv
119 svn-logv:
120         cd .. && svn log -r HEAD:BASE -v
121
122 .PHONY: svn-revert
123 svn-revert:
124         svn revert -- $(FILE)
125
126 .PHONY: git-update
127 git-update:
128         git pull origin
129
130 .PHONY: git-commit
131 git-commit:
132         git commit -a || true
133         if echo -n 'Also send to server? Hit Enter for yes, ^C for no. '; read -r L; then \
134                 git config svn-remote.svn.url svn://svn.icculus.org/nexuiz; \
135                 git config svn-remote.svn.fetch trunk:refs/remotes/origin/master; \
136                 git svn dcommit; \
137         fi
138
139 .PHONY: git-diff
140 git-diff:
141         git diff; git diff origin/master..HEAD; true
142
143 .PHONY: git-log
144 git-log:
145         git fetch && git log HEAD..origin/master
146
147 .PHONY: git-logv
148 git-logv:
149         git fetch && git log -v HEAD..origin/master
150
151 .PHONY: git-revert
152 git-revert:
153         git checkout -- $(FILE)