2 QCC ?= ../../../../gmqcc/gmqcc
7 QCCFLAGS_WATERMARK ?= $(shell git describe --tags --dirty='~')
8 VER = $(subst *,\*,$(QCCFLAGS_WATERMARK))
11 ENABLE_EFFECTINFO ?= 0
13 ENABLE_DEBUGTRACE ?= 0
17 ifneq ($(shell which zip 2>/dev/null),)
20 ifneq ($(shell which 7z 2>/dev/null),)
21 ZIP := 7z a -tzip -mx=9 -sdel
23 ifneq ($(shell which 7za 2>/dev/null),)
24 ZIP := 7za a -tzip -mx=9 -sdel
27 $(warning "No zip / 7z / 7za in ($(PATH))")
28 ZIP := : zip_not_found
32 # Set to empty string to temporarily enable warnings when debugging
36 # We eventually need to get rid of these
41 -DXONOTIC=$(XONOTIC) \
42 -DWATERMARK="$(QCCFLAGS_WATERMARK)" \
44 -DENABLE_EFFECTINFO=$(ENABLE_EFFECTINFO) \
45 -DENABLE_DEBUGDRAW=$(ENABLE_DEBUGDRAW) \
46 -DENABLE_DEBUGTRACE=$(ENABLE_DEBUGTRACE) \
47 $(if $(BUILD_MOD), -DBUILD_MOD="$(BUILD_MOD)" -I$(BUILD_MOD), ) \
50 # -Ooverlap-locals is required
58 -flno -futf8 -fno-bail-on-werror \
59 -frelaxed-switch -freturn-assignments \
72 $(RM) $(PROGS_OUT)/csprogs.dat
73 $(RM) $(PROGS_OUT)/menu.dat
74 $(RM) $(PROGS_OUT)/progs.dat
75 $(RM) $(PROGS_OUT)/csprogs.lno
76 $(RM) $(PROGS_OUT)/menu.lno
77 $(RM) $(PROGS_OUT)/progs.lno
80 $(RM) $(WORKDIR)/*.txt
81 $(RM) $(WORKDIR)/qccversion.*
82 $(RM) $(WORKDIR)/csprogs-*
83 $(RM) $(WORKDIR)/autoexec/csprogs-*.cfg
87 qc: $(PROGS_OUT)/csprogs.dat $(PROGS_OUT)/menu.dat $(PROGS_OUT)/progs.dat
90 sv: $(PROGS_OUT)/csprogs.dat $(PROGS_OUT)/progs.dat
93 pk3: csprogs-$(VER).pk3
99 %-$(VER).pk3: $(PROGS_OUT)/%.dat
101 $(eval PK3=$(PROG)-$(VER).pk3)
102 $(eval CFG=autoexec/$(PROG)-$(VER).cfg)
103 $(eval DAT=$(PROG)-$(VER).dat)
104 $(eval LNO=$(PROG)-$(VER).lno)
105 @ mkdir -p $(WORKDIR)/autoexec
106 @ echo "// http://xonotic.org" > $(WORKDIR)/$(CFG)
107 @ echo "set csqc_progname $(DAT)" >> $(WORKDIR)/$(CFG)
108 @ cp -f $(PROGS_OUT)/$(PROG).dat $(WORKDIR)/$(DAT)
109 @ cp -f $(PROGS_OUT)/$(PROG).lno $(WORKDIR)/$(LNO)
110 @ $(RM) $(PROG)-*.pk3
111 cd $(WORKDIR) && $(ZIP) $(CURDIR)/$(PK3) $(CFG) $(DAT) $(LNO)
113 QCCVERSION := $(shell cd lib && $(QCC) --version)
114 QCCVERSIONFILE := $(WORKDIR)/qccversion.$(shell echo ${QCCVERSION} | git hash-object --stdin)
115 $(QCCVERSIONFILE): | $(WORKDIR)
116 @ $(RM) $(WORKDIR)/qccversion.*
117 @ echo $(QCCVERSION) > $@
125 $(PROGS_OUT)/csprogs.dat: client/progs.inc $(QCCVERSIONFILE) | $(WORKDIR)
126 @ echo make[1]: Entering directory \`$(CURDIR)/client\'
127 ./tools/qcc.sh client $@ $<
128 -include $(WORKDIR)/client.d
130 $(PROGS_OUT)/progs.dat: server/progs.inc $(QCCVERSIONFILE) | $(WORKDIR)
131 @ echo make[1]: Entering directory \`$(CURDIR)/server\'
132 ./tools/qcc.sh server $@ $<
133 -include $(WORKDIR)/server.d
135 $(PROGS_OUT)/menu.dat: menu/progs.inc $(QCCVERSIONFILE) | $(WORKDIR)
136 @ echo make[1]: Entering directory \`$(CURDIR)/menu\'
137 ./tools/qcc.sh menu $@ $<
138 -include $(WORKDIR)/menu.d