changeset 53:554e3f02ba6f

Unify / update build system.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 03 Oct 2016 09:20:32 +0300
parents 1e1d256a55b3
children b8bbed30748b
files Makefile build-data.sh build.sh config.mak
diffstat 4 files changed, 34 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Mon Oct 03 08:51:31 2016 +0300
+++ b/Makefile	Mon Oct 03 09:20:32 2016 +0300
@@ -1,23 +1,27 @@
 #
-# Generic UNIX targets
+# Generic build target
 #
-SDL_CFLAGS=`sdl-config --cflags`
-SDL_LDFLAGS=`sdl-config --static-libs`
+DMLIB = ./dmlib/
+MAKE ?= make
 
-TREMOR_CFLAGS=-I/usr/local/lib/
-TREMOR_LDFLAGS=/usr/local/lib/libvorbisidec.a /usr/lib/i386-linux-gnu/libogg.a
+export DMLIB
 
-LIBPNG_CFLAGS=`pkg-config --cflags libpng`
-LIBPNG_LDFLAGS=`pkg-config --libs libpng`
+unix:
+	$(MAKE) -f $(DMLIB)Makefile EXEEXT=.bin
 
-ZLIB_CFLAGS=`pkg-config --cflags zlib`
-ZLIB_LDFLAGS=`pkg-config --libs zlib`
-
-RANLIB=ranlib
+mingw-win32:
+	$(MAKE) -f $(DMLIB)Makefile.cross-mingw \
+	OBJPATH=./obj/win32/ \
+	MINGW_PREFIX=i686-w64-mingw32- \
+	MINGW_PATH=/usr/i686-w64-mingw32
 
-DMLIB = ./dmlib/
-BINPATH ?= ./
-OBJPATH ?= ./obj/unix/
-EXEEXT ?= .bin
+mingw-win64:
+	$(MAKE) -f $(DMLIB)Makefile.cross-mingw \
+	OBJPATH=./obj/win64/ \
+	MINGW_PREFIX=x86_64-w64-mingw32- \
+	MINGW_PATH=/usr/x86_64-w64-mingw32
 
-include $(DMLIB)Makefile.gen
+clean:
+	-$(MAKE) -f $(DMLIB)Makefile clean EXEEXT=.bin
+	-$(MAKE) -f $(DMLIB)Makefile.cross-mingw clean
+	
\ No newline at end of file
--- a/build-data.sh	Mon Oct 03 08:51:31 2016 +0300
+++ b/build-data.sh	Mon Oct 03 09:20:32 2016 +0300
@@ -5,11 +5,11 @@
 
 if test ! -x "$CPACKED"; then
 	make -f Makefile clean
-	make -f Makefile EXEEXT=".bin" BINPATH="$CPWD/" "$CPACKED"
+	make -f Makefile EXEEXT=".bin" TOOL_BINPATH="$CPWD/" "$CPACKED"
 fi
 
-cd "$CPWD/data" && $CPACKED -c -p "$CPWD/exe/$CPACKFILE" *
+cd "$CPWD/data" && $CPACKED -c -p "$CPWD/$CBINPATH/$CPACKFILE" *
 
 if test ! -e "$CPWD/$CPACKFILE"; then
-	ln -s "$CPWD/exe/$CPACKFILE" "$CPWD/$CPACKFILE"
+	ln -s "$CPWD/$CBINPATH/$CPACKFILE" "$CPWD/$CPACKFILE"
 fi
--- a/build.sh	Mon Oct 03 08:51:31 2016 +0300
+++ b/build.sh	Mon Oct 03 09:20:32 2016 +0300
@@ -2,24 +2,24 @@
 . ./build.cfg
 CPWD=`pwd`
 
-for build in amd:k8 intel:core2; do
+for build in intel:core2; do
 	# Split into platform and march
 	platform=`echo "$build"|cut -d ':' -f 1`
 	march=`echo "$build"|cut -d ':' -f 2`
 	
 	# Build Unix binary
 	make -f Makefile clean
-	make -f Makefile EXTRA_CFLAGS="-march=$march" EXEEXT=".bin" BINPATH="$CPWD/"
-	(strip "$CPWD/${CEXE}.bin" && mv "$CPWD/${CEXE}.bin" "$CPWD/${CBINPATH}${CEXE}-${platform}-linux32.bin") || exit 1
+	make -f Makefile EXTRA_CFLAGS="-O3 -march=$march" EXEEXT=".bin" BINPATH="$CPWD/"
+	(strip "$CPWD/${CEXE}.bin" && mv "$CPWD/${CEXE}.bin" "$CPWD/${CBINPATH}/${CEXE}-linux-x86.bin") || exit 1
 
 	# Build Win32 executable
 	make -f Makefile.w32 clean
-	make -f Makefile.w32 EXTRA_CFLAGS="-march=$march" EXEEXT=".exe" BINPATH="$CPWD/"
-	(mv "$CPWD/${CEXE}.exe" "$CPWD/${CBINPATH}${CEXE}_${platform}_win32.exe") || exit 1
+	make -f Makefile.w32 EXTRA_CFLAGS="-O3 -march=$march" EXEEXT=".exe" BINPATH="$CPWD/"
+	(mv "$CPWD/${CEXE}.exe" "$CPWD/${CBINPATH}/${CEXE}-win32.exe") || exit 1
 done
 
 (cd "$CPWD" && exec ./build-data.sh) || exit 1
 
 rm -f "$CPWD/$CZIP"
 
-cd "$CPWD/${CBINPATH}" && zip -9 "$CPWD/$CZIP" *
+cd "$CPWD/${CBINPATH}/" && zip -9 "$CPWD/$CZIP" *
--- a/config.mak	Mon Oct 03 08:51:31 2016 +0300
+++ b/config.mak	Mon Oct 03 09:20:32 2016 +0300
@@ -1,7 +1,9 @@
 # Additional binaries (aka the demo)
 DEMO_BIN=krapula
-DEMO_OBJS=krapula.o dmsimple.o
-BINARIES=$(DEMO_BIN)
+DEMO_OBJS=demo.o dmsimple.o
+
+TOOL_BINPATH=bin/
+TESTS_BINPATH=$(TOOL_BINPATH)
 
 # Build engine tests and tools? (Please notice that what
 # actually gets built it also affected by other options)
@@ -29,7 +31,6 @@
 DM_USE_STDIO=no
 DM_USE_MEMIO=no
 
-
 DM_GFX_BM_TEXT=yes
 DM_GFX_TTF_TEXT=no
 DM_GFX_LINES=no
@@ -46,7 +47,7 @@
 JSS=yes
 
 # Build a special "light"/minimized version by removing all
-# error messages and few other things.
+# error messages and few other things. (disabled by DM_DEBUG=yes)
 JSS_LIGHT=yes
 
 # Build with extra debugging code? (disabled by JSS_LIGHT=yes)
@@ -83,5 +84,3 @@
 ### Locking/thread support
 ###
 JSS_SUP_THREADS=yes
-
-