X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2FMakefile;h=d09b2c5ccffa730255a6545d0f411a11adc05fc5;hb=2d30ce639fd8525a6f22d383f44c4c9af89fe873;hp=a92b06bc645b4f814cee7ddf1cedb2cda0de54a3;hpb=46227d344e48c3a06cf4a736046103722adb82f2;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/Makefile b/qcsrc/Makefile index a92b06bc6..d09b2c5cc 100644 --- a/qcsrc/Makefile +++ b/qcsrc/Makefile @@ -1,79 +1,127 @@ -SCM := $(shell if [ -d .svn ]; then echo svn; elif [ -d ../.git ]; then echo git; fi) -PERL ?= perl -QCCFLAGS_WATERMARK ?= -DWATERMARK='"$(shell git describe)"' -DCVAR_POPCON=1 +CPP := cc -xc -E QCC ?= gmqcc -QCCVERSIONFILE := qccversion.$(shell $(QCC) --version > qccversion.txt && git hash-object qccversion.txt) +PROGS_OUT ?= .. +WORKDIR ?= ../.tmp +QCCFLAGS_WATERMARK ?= $(shell git describe --tags --dirty='~') +VER = $(subst *,\*,$(QCCFLAGS_WATERMARK)) +NDEBUG ?= 1 +XONOTIC ?= 1 +ENABLE_EFFECTINFO ?= 0 +ENABLE_DEBUGDRAW ?= 0 +ENABLE_DEBUGTRACE ?= 0 +BUILD_MOD ?= + +ifndef ZIP + ifneq ($(shell which zip 2>/dev/null),) + ZIP := zip -9 + endif + ifneq ($(shell which 7z 2>/dev/null),) + ZIP := 7z a -tzip -mx=9 + endif + ifneq ($(shell which 7za 2>/dev/null),) + ZIP := 7za a -tzip -mx=9 + endif + ifndef ZIP + $(warning "No zip / 7z / 7za in ($(PATH))") + ZIP := : zip_not_found + endif +endif + +# Set to empty string to temporarily enable warnings when debugging +QCCFLAGS_WERROR ?= \ + -Werror + +# We eventually need to get rid of these +QCCFLAGS_WTFS ?= \ + -Wno-field-redeclared + +QCCDEFS ?= \ + -DXONOTIC=$(XONOTIC) \ + -DWATERMARK="$(QCCFLAGS_WATERMARK)" \ + -DNDEBUG=$(NDEBUG) \ + -DENABLE_EFFECTINFO=$(ENABLE_EFFECTINFO) \ + -DENABLE_DEBUGDRAW=$(ENABLE_DEBUGDRAW) \ + -DENABLE_DEBUGTRACE=$(ENABLE_DEBUGTRACE) \ + $(if $(BUILD_MOD), -DBUILD_MOD="$(BUILD_MOD)" -I$(BUILD_MOD), ) \ + $(QCCDEFS_EXTRA) + +# -Ooverlap-locals is required QCCFLAGS ?= \ - -std=fteqcc \ - -Werror -Wall \ - -Wcpp \ - -Wno-field-redeclared \ - -Wno-double-declaration \ - -Wno-uninitialized-global \ + -std=gmqcc \ + -Ooverlap-locals \ -O3 \ - -fadjust-vector-fields \ - -fftepp \ - -fftepp-predefs \ - -frelaxed-switch \ - -fshort-logic \ - -fno-perl-logic \ - -ftranslatable-strings \ - -fno-initialized-nonconstants \ - -fno-assign-function-types \ - -flno \ - -fcorrect-ternary \ - -fno-single-vector-defs \ - -fcorrect-logic \ - -ftrue-empty-strings \ - -fno-false-empty-strings \ - -futf8 \ - -fno-bail-on-werror \ - -floop-labels \ - -funtyped-nil \ - -fno-permissive \ - -fvariadic-args \ - $(QCCFLAGS_EXTRA) $(QCCFLAGS_WATERMARK) - -# xonotic build system overrides this by command line argument to turn off the update-cvarcount step -XON_BUILDSYSTEM = - -all: qc + $(QCCFLAGS_WERROR) \ + -Wall \ + $(QCCFLAGS_WTFS) \ + -flno -futf8 -fno-bail-on-werror \ + -frelaxed-switch -freturn-assignments \ + $(QCCFLAGS_EXTRA) -.PHONY: qc -qc: - $(MAKE) qc-recursive -.PHONY: qc-recursive -qc-recursive: ../menu.dat ../progs.dat ../csprogs.dat + +.PHONY: all +all: qc pk3 + +$(WORKDIR): + @mkdir -p $@ .PHONY: clean -clean: - rm -f ../progs.dat ../menu.dat ../csprogs.dat server/precache-for-csqc.inc - -$(QCCVERSIONFILE): - $(RM) qccversion.* - echo This file intentionally left blank. > $@ - -FILES_CSPROGS = $(shell find client common warpzonelib csqcmodellib -type f -not -name fteqcc.log -not -name qc.asm) $(wildcard server/w_*.qc) -../csprogs.dat: $(FILES_CSPROGS) $(QCCVERSIONFILE) - @echo make[1]: Entering directory \`$(PWD)/client\' - cd client && $(QCC) $(QCCFLAGS) - -server/precache-for-csqc.inc: $(FILES_CSPROGS) - sh collect-precache.sh - -FILES_PROGS = $(shell find server common warpzonelib csqcmodellib -type f -not -name fteqcc.log -not -name qc.asm) $(wildcard server/w_*.qc) -../progs.dat: $(FILES_PROGS) $(QCCVERSIONFILE) server/precache-for-csqc.inc - @echo make[1]: Entering directory \`$(PWD)/server\' - cd server && $(QCC) $(QCCFLAGS) - -FILES_MENU = $(shell find menu common warpzonelib -type f -not -name fteqcc.log -not -name qc.asm) $(wildcard server/w_*.qc) -../menu.dat: $(FILES_MENU) $(QCCVERSIONFILE) - @echo make[1]: Entering directory \`$(PWD)/menu\' - cd menu && $(QCC) $(QCCFLAGS) - -.PHONY: testcase -testcase: - cd testcase && $(QCC) $(QCCFLAGS) -DTESTCASE="$$TESTCASE" +clean: | $(WORKDIR) + $(RM) $(PROGS_OUT)/csprogs.dat + $(RM) $(PROGS_OUT)/menu.dat + $(RM) $(PROGS_OUT)/progs.dat + $(RM) $(WORKDIR)/*.d + $(RM) $(WORKDIR)/*.qc + $(RM) $(WORKDIR)/*.txt + +.PHONY: qc +qc: $(PROGS_OUT)/csprogs.dat $(PROGS_OUT)/menu.dat $(PROGS_OUT)/progs.dat + +.PHONY: pk3 +pk3: csprogs-$(VER).pk3 + + + + + +%-$(VER).pk3: $(PROGS_OUT)/%.dat + $(eval PROG=$*) + $(eval PK3=$(PROG)-$(VER).pk3) + $(eval TXT=$(PROG)-$(VER).txt) + $(eval DAT=$(PROG)-$(VER).dat) + $(eval LNO=$(PROG)-$(VER).lno) + @ echo "http://xonotic.org" > $(TXT) + @ ln -f $(PROGS_OUT)/$(PROG).dat $(DAT) + @ ln -f $(PROGS_OUT)/$(PROG).lno $(LNO) + @ $(RM) *.pk3 + $(ZIP) $(PK3) $(TXT) $(DAT) $(LNO) + @ $(RM) $(TXT) $(DAT) $(LNO) + +QCCVERSION := $(shell cd lib && $(QCC) --version) +QCCVERSIONFILE := $(WORKDIR)/qccversion.$(shell echo ${QCCVERSION} | git hash-object --stdin) +$(QCCVERSIONFILE): | $(WORKDIR) + @ $(RM) $(WORKDIR)/qccversion.* + @ echo $(QCCVERSION) > $@ + +export WORKDIR +export CPP +export QCC +export QCCDEFS +export QCCFLAGS + +$(PROGS_OUT)/csprogs.dat: client/progs.inc $(QCCVERSIONFILE) | $(WORKDIR) + @ echo make[1]: Entering directory \`$(CURDIR)/client\' + ./tools/qcc.sh client $@ $< +-include $(WORKDIR)/client.d + +$(PROGS_OUT)/progs.dat: server/progs.inc $(QCCVERSIONFILE) | $(WORKDIR) + @ echo make[1]: Entering directory \`$(CURDIR)/server\' + ./tools/qcc.sh server $@ $< +-include $(WORKDIR)/server.d + +$(PROGS_OUT)/menu.dat: menu/progs.inc $(QCCVERSIONFILE) | $(WORKDIR) + @ echo make[1]: Entering directory \`$(CURDIR)/menu\' + ./tools/qcc.sh menu $@ $< +-include $(WORKDIR)/menu.d