]> git.xonotic.org Git - xonotic/xonotic.git/blob - Makefile
Change gameversion_min logic per xonotic-data.pk3dir!1034 and update xonotic-release...
[xonotic/xonotic.git] / Makefile
1 DPSRC = source/darkplaces
2 D0SRC = source/d0_blind_id
3 CLIENT = xonotic-local-sdl
4 SERVER = xonotic-local-dedicated
5
6 # CC and MAKEFLAGS are always set so ?= has no effect, therefore
7 # use CFLAGS to set default optimisations and support user override
8 CFLAGS ?= -pipe -march=native -mtune=native -flto=auto
9 # user can override this with make -j
10 MAKEFLAGS := -j$(shell nproc)
11 # DP makefile overrides CFLAGS (exporting CFLAGS does work for d0_blind_id but so does this)
12 export CC += $(CFLAGS)
13
14 # d0_blind_id header location
15 export CC += -I$(PWD)/source/
16 # d0_blind_id static libs location
17 export CC += -L$(PWD)/$(D0SRC)/.libs/
18 # Player IDs: DP_LINK_CRYPTO needs to be set (else it defaults to "dlopen"),
19 # it should be set to "shared" but then LIB_CRYPTO gets overridden in DP makefile,
20 # and we need to set LIB_CRYPTO such that libgmp gets linked
21 export DP_LINK_CRYPTO=foo
22 export CFLAGS_CRYPTO=-DLINK_TO_CRYPTO
23 export LIB_CRYPTO=-ld0_blind_id -lgmp
24 # AES
25 export DP_LINK_CRYPTO_RIJNDAEL=shared
26
27
28 .PHONY: help
29 help:
30         @echo
31         @printf "     \e[1;33m===== Xonotic Makefile for stable and beta releases =====\e[m\n"
32         @echo
33         @printf "The DarkPlaces Engine builds will be named \e[1m$(CLIENT) \e[mand \e[1m$(SERVER)\e[m\n"
34         @printf "and will be preferred by \e[1mxonotic-linux-sdl.sh \e[mand \e[1mxonotic-linux-dedicated.sh \e[mscripts.\n"
35         @echo
36         @printf "More info is available at \e[1;36mhttps://gitlab.com/xonotic/xonotic/-/wikis/Compiling\e[m\n"
37         @echo
38         @echo   "-O3 is already enabled for DarkPlaces Engine. Do not add any math flags!"
39         @echo
40         @echo   "MAKEFLAGS=$(MAKEFLAGS)"
41         @echo   "CFLAGS= $(CFLAGS)"
42         @echo
43         @echo   "  make clean-sources         Delete build objects"
44         @echo   "  make clean                 Delete engine builds and build objects"
45         @echo
46         @echo   "  make update-stable         Update to the latest stable release via rsync"
47         @echo   "  make update-beta           Update to the latest daily autobuild via rsync"
48         @echo
49         @printf "  make server                Compile \e[1m$(SERVER)\e[m\n"
50         @printf "  make client                Compile \e[1m$(CLIENT)\e[m\n"
51         @echo   "  make both"
52         @echo
53
54 GIT := $(shell [ -d .git ] && printf "\e[1;31mTo compile from git, please read https://gitlab.com/xonotic/xonotic/-/wikis/Repository_Access\e[m")
55 ifdef GIT
56   $(error $(GIT))
57 endif
58
59 .EXTRA_PREREQS := $(findstring update-stable,$(MAKECMDGOALS)) $(findstring update-beta,$(MAKECMDGOALS))
60
61 .PHONY: clean-sources
62 clean-sources:
63         $(MAKE) -C $(DPSRC) clean
64         $(MAKE) -C $(D0SRC) clean
65
66 .PHONY: clean
67 clean: clean-sources
68         $(RM) $(CLIENT) $(SERVER)
69
70 .PHONY: update-stable
71 update-stable:
72         misc/tools/rsync-updater/update-to-release.sh
73
74 .PHONY: update-beta
75 update-beta:
76         misc/tools/rsync-updater/update-to-autobuild.sh
77
78 $(D0SRC)/Makefile:
79         ( cd $(D0SRC) && ./autogen.sh && ./configure --enable-static --disable-shared )
80
81 .PHONY: d0_blind_id
82 d0_blind_id: $(D0SRC)/Makefile
83         $(MAKE) -C $(D0SRC)
84
85 .PHONY: server
86 server: d0_blind_id
87         $(MAKE) -C $(DPSRC) sv-release
88         cp -v $(DPSRC)/darkplaces-dedicated $(SERVER)
89
90 .PHONY: client
91 client: d0_blind_id
92         $(MAKE) -C $(DPSRC) sdl-release
93         cp -v $(DPSRC)/darkplaces-sdl $(CLIENT)
94
95 .PHONY: both
96 both: client server
97