2022-02-01 23:11:37 +00:00
DPSRC = source/darkplaces
D0SRC = source/d0_blind_id
CLIENT = xonotic-local-sdl
SERVER = xonotic-local-dedicated
# CC and MAKEFLAGS are always set so ?= has no effect, therefore
2023-05-31 03:40:29 +00:00
# we use CFLAGS to set default optimisations which users may override
2022-02-01 23:11:37 +00:00
CFLAGS ?= -pipe -march= native -mtune= native -flto= auto
# user can override this with make -j
2022-04-14 11:42:22 +00:00
MAKEFLAGS := -j$( shell nproc)
2022-02-01 23:11:37 +00:00
# DP makefile overrides CFLAGS (exporting CFLAGS does work for d0_blind_id but so does this)
export CC += $( CFLAGS)
# d0_blind_id header location
export CC += -I$( PWD) /source/
# d0_blind_id static libs location
export CC += -L$( PWD) /$( D0SRC) /.libs/
# Player IDs: DP_LINK_CRYPTO needs to be set (else it defaults to "dlopen"),
# it should be set to "shared" but then LIB_CRYPTO gets overridden in DP makefile,
# and we need to set LIB_CRYPTO such that libgmp gets linked
export DP_LINK_CRYPTO = foo
export CFLAGS_CRYPTO = -DLINK_TO_CRYPTO
export LIB_CRYPTO = -ld0_blind_id -lgmp
# AES
export DP_LINK_CRYPTO_RIJNDAEL = shared
.PHONY : help
help :
@echo
2022-04-15 08:51:36 +00:00
@printf " \e[1;33m===== Xonotic Makefile for stable and beta releases =====\e[m\n"
2022-02-01 23:11:37 +00:00
@echo
2022-04-15 08:51:36 +00:00
@printf " The DarkPlaces Engine builds will be named \e[1m $( CLIENT) \e[mand \e[1m $( SERVER) \e[m\n "
@printf "and will be preferred by \e[1mxonotic-linux-sdl.sh \e[mand \e[1mxonotic-linux-dedicated.sh \e[mscripts.\n"
2022-02-01 23:11:37 +00:00
@echo
2022-04-15 08:51:36 +00:00
@printf "More info is available at \e[1;36mhttps://gitlab.com/xonotic/xonotic/-/wikis/Compiling\e[m\n"
2022-02-01 23:11:37 +00:00
@echo
2022-04-15 08:51:36 +00:00
@echo "-O3 is already enabled for DarkPlaces Engine. Do not add any math flags!"
2022-02-01 23:11:37 +00:00
@echo
2022-04-15 08:51:36 +00:00
@echo " MAKEFLAGS= $( MAKEFLAGS) "
@echo " CFLAGS= $( CFLAGS) "
2022-02-01 23:11:37 +00:00
@echo
2022-04-15 08:51:36 +00:00
@echo " make clean-sources Delete build objects"
@echo " make clean Delete engine builds and build objects"
2022-02-01 23:11:37 +00:00
@echo
2022-04-15 08:51:36 +00:00
@echo " make update-stable Update to the latest stable release via rsync"
@echo " make update-beta Update to the latest daily autobuild via rsync"
2022-02-01 23:11:37 +00:00
@echo
2022-04-15 08:51:36 +00:00
@printf " make server Compile \e[1m $( SERVER) \e[m\n "
@printf " make client Compile \e[1m $( CLIENT) \e[m\n "
@echo " make both"
2022-02-01 23:11:37 +00:00
@echo
2023-01-24 04:12:39 +00:00
GIT := $( shell [ -d .git ] && printf "\e[1;31mThis Makefile only supports stable releases and autobuilds, whereas you are using a git repository. To compile from git, please read https://gitlab.com/xonotic/xonotic/-/wikis/Repository_Access\e[m" )
2022-04-14 11:42:22 +00:00
i f d e f G I T
$( error $( GIT) )
e n d i f
.EXTRA_PREREQS := $( findstring update-stable,$( MAKECMDGOALS) ) $( findstring update-beta,$( MAKECMDGOALS) )
2022-02-01 23:11:37 +00:00
.PHONY : clean -sources
2022-04-14 11:42:22 +00:00
clean-sources :
2022-02-01 23:11:37 +00:00
$( MAKE) -C $( DPSRC) clean
$( MAKE) -C $( D0SRC) clean
2011-10-29 18:58:18 +00:00
2011-10-29 18:41:11 +00:00
.PHONY : clean
2022-02-01 23:11:37 +00:00
clean : clean -sources
$( RM) $( CLIENT) $( SERVER)
2011-10-29 18:41:11 +00:00
2022-02-01 23:11:37 +00:00
.PHONY : update -stable
2022-04-14 11:42:22 +00:00
update-stable :
2022-02-01 23:11:37 +00:00
misc/tools/rsync-updater/update-to-release.sh
2012-04-21 13:26:10 +00:00
2022-02-01 23:11:37 +00:00
.PHONY : update -beta
2022-04-14 11:42:22 +00:00
update-beta :
2022-02-01 23:11:37 +00:00
misc/tools/rsync-updater/update-to-autobuild.sh
2011-10-29 18:41:11 +00:00
2022-04-14 11:17:29 +00:00
$(D0SRC)/Makefile :
2022-02-01 23:11:37 +00:00
( cd $( D0SRC) && ./autogen.sh && ./configure --enable-static --disable-shared )
2022-04-14 11:17:29 +00:00
.PHONY : d 0_blind_id
2022-04-14 11:42:22 +00:00
d0_blind_id : $( D 0SRC ) /Makefile
2022-02-01 23:11:37 +00:00
$( MAKE) -C $( D0SRC)
2011-10-29 18:41:11 +00:00
2022-02-01 23:11:37 +00:00
.PHONY : server
2022-04-14 11:17:29 +00:00
server : d 0_blind_id
2022-02-01 23:11:37 +00:00
$( MAKE) -C $( DPSRC) sv-release
cp -v $( DPSRC) /darkplaces-dedicated $( SERVER)
2011-10-29 18:58:18 +00:00
2022-02-01 23:11:37 +00:00
.PHONY : client
2022-04-14 11:17:29 +00:00
client : d 0_blind_id
2022-02-01 23:11:37 +00:00
$( MAKE) -C $( DPSRC) sdl-release
cp -v $( DPSRC) /darkplaces-sdl $( CLIENT)
2011-10-29 18:41:11 +00:00
2022-02-01 23:11:37 +00:00
.PHONY : both
both : client server
2011-10-29 18:58:18 +00:00