/Makefile (011b8a79ab2b8596df6afbb49fcbc4e912fb5b0c) (12770 bytes) (mode 100644) (type blob)
PROGRAM=confec
PROGRAM_DRMFREE=cave-confec
INCLUDES=include/fworld.h include/civilian.h
# Change the value of CXXSTD depending on what is supported by your compiler. Older compilers may require c++1z
CXXSTD=c++17
# SDL2
SDL2_VER=2.0.16
SDL2_DIR=SDL2-$(SDL2_VER)
SDL2_TAR=$(SDL2_DIR).tar.gz
SDL2_WIN_TAR=SDL2-devel-$(SDL2_VER)-mingw.tar.gz
# Boost
BOOST_VER_MAJOR=1
BOOST_VER_MINOR=76
BOOST_VER_PATCH=0
BOOST_VER_DOTTED=$(BOOST_VER_MAJOR).$(BOOST_VER_MINOR).$(BOOST_VER_PATCH)
BOOST_DIR=boost_$(BOOST_VER_MAJOR)_$(BOOST_VER_MINOR)_$(BOOST_VER_PATCH)
BOOST_TAR=$(BOOST_DIR).tar.bz2
# OpenSSL
OPENSSL_VER_MAJOR=1
OPENSSL_VER_MINOR=1
OPENSSL_VER_PATCH=1g
OPENSSL_VER_DOTTED=$(OPENSSL_VER_MAJOR).$(OPENSSL_VER_MINOR).$(OPENSSL_VER_PATCH)
OPENSSL_DIR=openssl-$(OPENSSL_VER_DOTTED)
OPENSSL_TAR=$(OPENSSL_DIR).tar.gz
LINCC := gcc -march=x86-64 -include $(shell readlink -f include/force_link_glibc_2.25.h)
LINCXX := $(CXX) -march=x86-64 -include $(shell readlink -f include/force_link_glibc_2.25.h)
#CXXDYNAMIC=$(LINCXX) $(CXXFLAGS) -O3 -D__LIGHT__ -D__BEAST__ -o $(PROGRAM)-dynamic $(PROGRAM).cpp libs.o libboost_system.a -Wl,-rpath,. -L. -l:libSDL2.so -lssl -lcrypto -pthread
CXXDYNAMIC=$(LINCXX) $(CXXFLAGS) -O3 -D__LIGHT__ -o $(PROGRAM)-dynamic $(PROGRAM).cpp libs.o -Wl,-rpath,. -L. -l:libSDL2.so -pthread
MACCXX=clang++ -march=x86-64
WINCXX=i686-w64-mingw32-g++-posix -march=pentium4 -static-libgcc -static-libstdc++
#CXXFLAGS=-Iinclude -I$(OPENSSL_DIR)/include -I$(BOOST_DIR) -std=$(CXXSTD) -Wall -Wextra -Wfatal-errors
CXXFLAGS=-Iinclude -I$(BOOST_DIR) -std=$(CXXSTD) -Wall -Wextra -Wfatal-errors
WIN_CMAKE_FLAGS=-DCMAKE_C_COMPILER=i686-w64-mingw32-gcc-win32 -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++-win32 -DCMAKE_C_COMPILER_WORKS=1 -DCMAKE_CXX_COMPILER_WORKS=1
MAC_OPENSSL_SSL=libssl-mac.a
MAC_OPENSSL_CRYPTO=libcrypto-mac.a
WIN_OPENSSL_SSL=libssl-$(OPENSSL_VER_MAJOR)_$(OPENSSL_VER_MINOR).dll
WIN_OPENSSL_CRYPTO=libcrypto-$(OPENSSL_VER_MAJOR)_$(OPENSSL_VER_MINOR).dll
WEB_PREFIX=sudo docker run --rm -v $(shell pwd):/src -u emscripten trzeci/emscripten
WEB_FLAGS_LEGACY=-s TOTAL_MEMORY=134217728
WEB_FLAGS_NEW=-s INITIAL_MEMORY=134217728
WEB_FLAGS=$(WEB_FLAGS_LEGACY) -fno-rtti -fno-exceptions --llvm-lto 1 -s ELIMINATE_DUPLICATE_FUNCTIONS=1 -s "ENVIRONMENT='web'" -s USE_SDL=0 -s SIMD=0 -s WASM=0 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['Pointer_stringify']" --preload-file data
WEB_SDL_OPT=--disable-render --disable-render-d3d --disable-directx --disable-video-vulkan --disable-filesystem --disable-diskaudio --disable-dummyaudio --disable-libudev --disable-haptic
WEB_SDL_CONFIGURE=emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo $(WEB_SDL_OPT)
# Uncomment the line below to default to the DRM-free version.
drmfree-gnu: $(PROGRAM_DRMFREE)
steam-gnu: $(PROGRAM)-static
$(PROGRAM)-static: libs.o libboost_system.a libSDL2.a $(PROGRAM).cpp $(INCLUDES)
# Building Steam version with Boost::Beast for GNU/Linux.
$(LINCXX) $(CXXFLAGS) -static-libgcc -static-libstdc++ -O3 -D__LIGHT__ -D__BEAST__ -D__STEAM__ -o $@ $(PROGRAM).cpp libs.o libboost_system.a libSDL2.a \
-Wl,-rpath,. -L. -ldl -lssl -lcrypto -pthread -lsteam_api
#$(PROGRAM_DRMFREE): libs.o libboost_system.a libSDL2.a $(PROGRAM).cpp $(INCLUDES)
# Building DRM-free version with Boost::Beast for GNU/Linux.
#$(LINCXX) $(CXXFLAGS) -static-libgcc -static-libstdc++ -O3 -D__LIGHT__ -D__BEAST__ -o $@ $(PROGRAM).cpp libs.o libboost_system.a libSDL2.a \
#-Wl,-rpath,. -L. -ldl -lssl -lcrypto -pthread
$(PROGRAM_DRMFREE): libs.o libSDL2.a $(PROGRAM).cpp $(INCLUDES)
# Building DRM-free version for GNU/Linux.
$(LINCXX) $(CXXFLAGS) -static-libgcc -static-libstdc++ -O3 -D__LIGHT__ -o $@ $(PROGRAM).cpp libs.o libSDL2.a -Wl,-rpath,. -L. -ldl -pthread
#$(PROGRAM)-dynamic: libs.o libboost_system.a $(PROGRAM).cpp $(INCLUDES)
$(PROGRAM)-dynamic: libs.o $(PROGRAM).cpp $(INCLUDES)
$(CXXDYNAMIC)
# VR support, lol. Not currently implemented.
ccvr: libs.o libboost_system.a libSDL2.a $(PROGRAM).cpp $(INCLUDES)
$(LINCXX) $(CXXFLAGS) -static-libgcc -static-libstdc++ -O3 -D__LIGHT__ -D__BEAST__ -D__STEAM__ -o $@ $(PROGRAM).cpp libs.o libboost_system.a libSDL2.a \
-Wl,-rpath,. -L. -ldl -lssl -lcrypto -pthread -lopenxr_loader -lsteam_api
# debug build settings may be outdated and broken
debug: clean libs.o libboost_system.a libSDL2.a $(PROGRAM).cpp
$(LINCXX) -Iinclude -I$(BOOST_DIR) -std=$(CXXSTD) -Wall -Wextra -Wfatal-errors -g -D__STEAM__ -o $@ $(PROGRAM).cpp libs.o libboost_system.a libSDL2.a -Wl,-rpath,. -L. -ldl -lssl -lcrypto -pthread -lsteam_api
lint:
clang-tidy $(PROGRAM).cpp -checks=cert-*-cpp -header-filter=fdungeon.h -- $(CXXDYNAMIC)
drmfree: $(PROGRAM_DRMFREE) $(PROGRAM_DRMFREE).exe
demo: $(PROGRAM)-demo-static $(PROGRAM)-demo.exe
# demo build settings may be outdated and broken
$(PROGRAM)-demo-static: libs.o libboost_system.a libSDL2.a $(PROGRAM).cpp $(INCLUDES)
$(LINCXX) $(CXXFLAGS) -static-libgcc -static-libstdc++ -O3 -D__LIGHT__ -D__STEAM__ -D__DEMO__ -o $@ $(PROGRAM).cpp libs.o libboost_system.a libSDL2.a \
-Wl,-rpath,. -L. -ldl -lssl -lcrypto -pthread -lsteam_api
$(PROGRAM)-demo.exe: libs-win.o libboost_system-win.a $(WIN_OPENSSL_SSL) $(WIN_OPENSSL_CRYPTO) $(PROGRAM).cpp $(INCLUDES)
$(WINCXX) $(CXXFLAGS) -I$(OPENSSL_DIR)/include -O3 -D__LIGHT__ -D__STEAM__ -D__DEMO__ -o $@ $(PROGRAM).cpp libs-win.o libboost_system-win.a \
-L. -l:$(WIN_OPENSSL_SSL) -l:$(WIN_OPENSSL_CRYPTO) -lwsock32 -lws2_32 -lmingw32 -l:SDL2.dll -l:libSDL2main.a -l:steam_api.dll \
-static -lpthread
# TODO: Rewrite server.
ccserver: ccserver.cpp $(INCLUDES)
$(LINCXX) $(CXXFLAGS) -O3 -o $@ ccserver.cpp -Wl,-rpath,. -L. -pthread
# Uncomment the line with the $(BOOST_DIR) dependency when building with Boost::Beast.
#libs.o: libs.cpp micropather.cpp include/tm_json.h $(BOOST_DIR)
libs.o: libs.cpp micropather.cpp include/tm_json.h
$(LINCXX) $(CXXFLAGS) -O3 -o $@ libs.cpp -c
# Build SDL2 for Linux as compatibly as possible.
libSDL2.a: $(SDL2_DIR)
rm -r -f $(SDL2_DIR)/build
mkdir -p $(SDL2_DIR)/build
export CC="$(LINCC)" ;\
cd $(SDL2_DIR)/build; ../configure --disable-sndio --disable-esd \
--disable-arts --disable-video-directfb --disable-rpath \
--enable-alsa --enable-alsa-shared --enable-pulseaudio \
--enable-pulseaudio-shared --enable-x11-shared --enable-sdl-dlopen \
--disable-input-tslib CFLAGS="-O3" && make
cp $(SDL2_DIR)/build/build/.libs/libSDL2.a $@
touch $@
# Mac builds currently link boost::filesystem regardless of C++ standard version. The assumption on Mac is c++1z
$(PROGRAM)-mac: libs-mac.o SDL2.framework libboost_filesystem.a $(MAC_OPENSSL_SSL) $(MAC_OPENSSL_CRYPTO) $(PROGRAM).cpp $(INCLUDES)
# Building Steam version with Boost::Beast for Mac.
$(MACCXX) $(CXXFLAGS) -O3 -D__LIGHT__ -D__BEAST__ -D__STEAM__ -o $@ $(PROGRAM).cpp libs-mac.o $(MAC_OPENSSL_SSL) $(MAC_OPENSSL_CRYPTO) \
-F. -L. -Wl,-rpath,"." -framework SDL2 -ldl -pthread -lboost_filesystem -lsteam_api
#$(PROGRAM_DRMFREE)-mac: libs-mac.o SDL2.framework libboost_filesystem.a $(MAC_OPENSSL_SSL) $(MAC_OPENSSL_CRYPTO) $(PROGRAM).cpp $(INCLUDES)
# Building DRM-free version with Boost::Beast for Mac.
#$(MACCXX) $(CXXFLAGS) -O3 -D__LIGHT__ -D__BEAST__ -o $@ $(PROGRAM).cpp libs-mac.o $(MAC_OPENSSL_SSL) $(MAC_OPENSSL_CRYPTO) \
#-F. -L. -Wl,-rpath,"." -framework SDL2 -ldl -pthread -lboost_filesystem
$(PROGRAM_DRMFREE)-mac: libs-mac.o SDL2.framework libboost_filesystem.a $(PROGRAM).cpp $(INCLUDES)
# Building DRM-free version for Mac.
$(MACCXX) $(CXXFLAGS) -O3 -D__LIGHT__ -o $@ $(PROGRAM).cpp libs-mac.o -F. -L. -Wl,-rpath,"." -framework SDL2 -ldl -pthread -lboost_filesystem
libs-mac.o: libs.cpp micropather.cpp include/tm_json.h $(BOOST_DIR)
$(MACCXX) $(CXXFLAGS) -O3 -o $@ libs.cpp -c
$(PROGRAM).exe: libs-win.o libboost_system-win.a $(WIN_OPENSSL_SSL) $(WIN_OPENSSL_CRYPTO) $(PROGRAM).cpp $(INCLUDES)
# Building Steam version with Boost::Beast for Windows.
$(WINCXX) $(CXXFLAGS) -I$(OPENSSL_DIR)/include -O3 -D__LIGHT__ -D__BEAST__ -D__STEAM__ -o $@ $(PROGRAM).cpp libs-win.o libboost_system-win.a \
-L. -l:$(WIN_OPENSSL_SSL) -l:$(WIN_OPENSSL_CRYPTO) -lwsock32 -lws2_32 -lmingw32 -l:SDL2.dll -l:libSDL2main.a -l:steam_api.dll \
-static -lpthread
#$(PROGRAM_DRMFREE).exe: libs-win.o libboost_system-win.a $(WIN_OPENSSL_SSL) $(WIN_OPENSSL_CRYPTO) $(PROGRAM).cpp $(INCLUDES)
# Building DRM-free version with Boost::Beast for Windows.
#$(WINCXX) $(CXXFLAGS) -I$(OPENSSL_DIR)/include -O3 -D__LIGHT__ -D__BEAST__ -o $@ $(PROGRAM).cpp libs-win.o libboost_system-win.a \
#-L. -l:$(WIN_OPENSSL_SSL) -l:$(WIN_OPENSSL_CRYPTO) -lwsock32 -lws2_32 -lmingw32 -l:SDL2.dll -l:libSDL2main.a \
#-static -lpthread
$(PROGRAM_DRMFREE).exe: libs-win.o $(PROGRAM).cpp $(INCLUDES)
# Building DRM-free version for Windows.
$(WINCXX) $(CXXFLAGS) -O3 -D__LIGHT__ -o $@ $(PROGRAM).cpp libs-win.o -L. -lmingw32 -l:SDL2.dll -l:libSDL2main.a -static -lpthread
# You get the picture.
#libs-win.o: include/SDL2 libSDL2main.a SDL2.dll libs.cpp micropather.cpp include/tm_json.h $(BOOST_DIR) $(OPENSSL_DIR)
#$(WINCXX) $(CXXFLAGS) -I$(OPENSSL_DIR)/include -O3 -o $@ libs.cpp -c
libs-win.o: include/SDL2 libSDL2main.a SDL2.dll libs.cpp micropather.cpp include/tm_json.h
$(WINCXX) $(CXXFLAGS) -O3 -o $@ libs.cpp -c
include/SDL2: $(SDL2_WIN_TAR)
$(RM) -r $@
tar xzvf $(SDL2_WIN_TAR) --strip-components=2 SDL2-$(SDL2_VER)/i686-w64-mingw32/$@
touch $@
libSDL2main.a: $(SDL2_WIN_TAR)
tar xzvf $(SDL2_WIN_TAR) --strip-components=3 SDL2-$(SDL2_VER)/i686-w64-mingw32/lib/$@
touch $@
SDL2.dll: $(SDL2_WIN_TAR)
tar xzvf $(SDL2_WIN_TAR) --strip-components=3 SDL2-$(SDL2_VER)/i686-w64-mingw32/bin/$@
touch $@
$(SDL2_WIN_TAR):
wget https://libsdl.org/release/$(SDL2_WIN_TAR)
html: libs-web.o libSDL2-web.a $(PROGRAM).cpp $(INCLUDES)
mkdir -p $@
$(WEB_PREFIX) emcc $(WEB_FLAGS) $(CXXFLAGS) --closure 1 -Oz -D__LIGHT__ -o $@/index.html $(PROGRAM).cpp libs-web.o libSDL2-web.a -lwebsocket.js
web: index-template.html web/index.js
cp -f index-template.html $@/index.html
cp -f favicon.ico $@
touch $@
web/index.js: libs-web.o libSDL2-web.a $(PROGRAM).cpp $(INCLUDES)
mkdir -p web
$(WEB_PREFIX) emcc $(WEB_FLAGS) $(CXXFLAGS) --closure 1 -Oz -D__LIGHT__ -o $@ $(PROGRAM).cpp libs-web.o libSDL2-web.a -lwebsocket.js
libs-web.o: libs.cpp micropather.cpp include/tm_json.h
$(WEB_PREFIX) emcc $(WEB_FLAGS) $(CXXFLAGS) -Oz -o $@ libs.cpp -c
libSDL2-web.a: $(SDL2_DIR)
rm -r -f $(SDL2_DIR)/build
mkdir -p $(SDL2_DIR)/build
$(WEB_PREFIX) /bin/bash -c "cd $(SDL2_DIR)/build; $(WEB_SDL_CONFIGURE) CFLAGS=\"-Oz\" && emmake make"
cp $(SDL2_DIR)/build/build/.libs/libSDL2.a $@
touch $@
$(SDL2_DIR): $(SDL2_TAR)
$(RM) -r $@
tar xvf $(SDL2_TAR)
touch $@
$(SDL2_TAR):
wget https://libsdl.org/release/$(SDL2_TAR)
libboost_system.a: $(BOOST_DIR)
cp $(BOOST_DIR)/stage/lib/$@ .
touch $@
libboost_filesystem.a: $(BOOST_DIR)
# POSIX target
cd $(BOOST_DIR) && ./b2 --with-filesystem cxxflags="-std=$(CXXSTD)" release
cp $(BOOST_DIR)/stage/lib/$@ .
touch $@
libboost_system-win.a: $(BOOST_DIR)
# Windows target
# https://stackoverflow.com/questions/5411282#11907834
# https://stackoverflow.com/questions/27342524#55919915
cd $(BOOST_DIR) && \
echo "using gcc : mingw32 : i686-w64-mingw32-g++-posix ;" > win-config.jam && \
./bootstrap.sh && \
./b2 --with-system --user-config=win-config.jam toolset=gcc-mingw32 target-os=windows cxxflags="-std=$(CXXSTD)" --layout=tagged architecture=x86 address-model=32 release
touch $(BOOST_DIR)
cp $(BOOST_DIR)/stage/lib/libboost_system-mt-x32.a $@
touch $@
$(BOOST_DIR): $(BOOST_TAR)
$(RM) -r $@
tar xvf $(BOOST_TAR)
# POSIX target
cd $@ && ./bootstrap.sh && ./b2 --with-system cxxflags="-std=$(CXXSTD)" release
touch $@
$(BOOST_TAR):
wget https://boostorg.jfrog.io/artifactory/main/release/$(BOOST_VER_DOTTED)/source/$(BOOST_TAR)
$(MAC_OPENSSL_SSL): $(OPENSSL_DIR)
# Mac target
cd $(OPENSSL_DIR) && ./Configure gcc && make
touch $(OPENSSL_DIR)
cp $(OPENSSL_DIR)/libssl.a $(MAC_OPENSSL_SSL)
touch $(MAC_OPENSSL_SSL)
cp $(OPENSSL_DIR)/libcrypto.a $(MAC_OPENSSL_CRYPTO)
touch $(MAC_OPENSSL_CRYPTO)
$(WIN_OPENSSL_SSL): $(OPENSSL_DIR)
# Windows target
cd $(OPENSSL_DIR) && ./Configure mingw --cross-compile-prefix=i686-w64-mingw32- && make
touch $(OPENSSL_DIR)
cp $(OPENSSL_DIR)/$(WIN_OPENSSL_SSL) .
touch $(WIN_OPENSSL_SSL)
cp $(OPENSSL_DIR)/$(WIN_OPENSSL_CRYPTO) .
touch $(WIN_OPENSSL_CRYPTO)
$(OPENSSL_DIR): $(OPENSSL_TAR)
$(RM) -r $@
tar xvf $(OPENSSL_TAR)
touch $@
$(OPENSSL_TAR):
wget https://www.openssl.org/source/$(OPENSSL_TAR)
clean:
$(RM) debug $(PROGRAM)-static $(PROGRAM)-dynamic $(PROGRAM_DRMFREE) $(PROGRAM)-demo-static libs.o \
$(PROGRAM).exe $(PROGRAM_DRMFREE).exe $(PROGRAM)-demo.exe libs-win.o libs-web.o ccserver
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
98 |
227abf3bfa53b2530dcc74495da7bd0ccdcb0775 |
.gitignore |
100644 |
blob |
225 |
9b00c2c2e7b4f0c1e338fdead65f17ba0af089c1 |
COPYING |
100755 |
blob |
43 |
45aea818a4a3202b2467509f28a481cce08834d2 |
Confectioner.command |
100644 |
blob |
12770 |
011b8a79ab2b8596df6afbb49fcbc4e912fb5b0c |
Makefile |
100644 |
blob |
2723 |
b5a3f573f076ef740ca742ec9598043732e10c0e |
README.md |
040000 |
tree |
- |
781b033f2546d7a65bec8435d80e7bafc86910d8 |
base |
100755 |
blob |
156 |
84cb1387849f2ca98e53e43536d00af2dfabf7d3 |
caveconfec |
100755 |
blob |
28 |
41b0ef285892c86306eaa269f366dd04cb633d21 |
caveconfec.bat |
100644 |
blob |
195429 |
40584daf1c63b0bc4733322b04f61f44103f1fd6 |
confec.cpp |
100644 |
blob |
394292 |
58014e976e71fc93215705a89d95056adbe976b0 |
gamecontrollerdb.txt |
040000 |
tree |
- |
ab3258f65b44e305a586e41e56e101392119ad95 |
include |
100755 |
blob |
1065 |
a460e3c74b8fa53a6f609944ef7e41558479e73f |
libs.cpp |
100755 |
blob |
27581 |
8350a63e947e8a4a55608fd090d128fef7b969a1 |
micropather.cpp |
100644 |
blob |
141235 |
f54e2d2631a628876a631456c043b77da5db78bd |
openjdk.pem |
100755 |
blob |
8 |
e9a74187b02a27b165dfa4f93bf6f060376d0ee6 |
steam_appid.txt |
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"
Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/mse/ConfectionerEngine
Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/mse/ConfectionerEngine
Clone this repository using git:
git clone git://git.rocketgit.com/user/mse/ConfectionerEngine
You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a
merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main