X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2FMakefile;h=ee335d9b0013817edf041d88082c9d8a8a9d2cea;hb=252f4ca05841fb1d01caa95e266fd8fe1db68c58;hp=3e98265a9521945ec5049ac54d552d2d2dc62e40;hpb=7eb9a7c4ea3b9aff3a780584931a75a1fe25a8ad;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/Makefile b/qcsrc/Makefile index 3e98265a9..ee335d9b0 100644 --- a/qcsrc/Makefile +++ b/qcsrc/Makefile @@ -1,76 +1,114 @@ -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 -VERSION_MESSAGE = $(shell cd server && $(QCC) --version --help) -ifneq (,$(findstring GMQCC,$(VERSION_MESSAGE))) -# this is gmqcc +PROGS_OUT ?= $(CURDIR)/.. +WORKDIR ?= ../.tmp + +QCCFLAGS_WATERMARK ?= $(shell git describe --tags --dirty='~') +VER = $(subst *,\*,$(QCCFLAGS_WATERMARK)) +NDEBUG ?= 1 +BUILD_MOD ?= 0 + +ifndef ZIP + ifneq ($(shell which zip),) + ZIP := zip -9 + endif + ifneq ($(shell which 7z),) + ZIP := 7z a -tzip -mx=9 + endif + ifneq ($(shell which 7za),) + ZIP := 7za a -tzip -mx=9 + endif + ifndef ZIP + $(warning "No zip in ($(PATH))") + ZIP := : zip_not_found + endif +endif + +# We eventually need to get rid of these +QCCFLAGS_WTFS ?= \ + -Wno-field-redeclared + +QCCDEFS ?= \ + -DWATERMARK="$(QCCFLAGS_WATERMARK)" \ + -DNDEBUG=$(NDEBUG) \ + -DBUILD_MOD=$(BUILD_MOD) \ + $(QCCDEFS_EXTRA) + +# -Ooverlap-locals is required QCCFLAGS ?= \ - -std=fteqcc \ - -Werror -Wall \ - -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) -else -# this. is. fteqccccccccccccccccccc! -QCCFLAGS ?= -Werror -Wno-Q302 -O3 -Ono-return_only -fno-fastarrays $(QCCFLAGS_EXTRA) $(QCCFLAGS_WATERMARK) -endif + -Werror -Wall \ + $(QCCFLAGS_WTFS) \ + -flno -futf8 -fno-bail-on-werror \ + -frelaxed-switch -freturn-assignments \ + $(QCCFLAGS_EXTRA) -# xonotic build system overrides this by command line argument to turn off the update-cvarcount step -XON_BUILDSYSTEM = -all: qc -.PHONY: qc -qc: - $(MAKE) qc-recursive +.PHONY: all +all: qc pk3 -.PHONY: qc-recursive -qc-recursive: ../menu.dat ../progs.dat ../csprogs.dat +$(WORKDIR): + @mkdir -p $@ .PHONY: clean -clean: - rm -f ../progs.dat ../menu.dat ../csprogs.dat - -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) - @echo make[1]: Entering directory \`$(PWD)/client\' - cd client && $(QCC) $(QCCFLAGS) - -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) - @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) - @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