changeset 1432:a9516570cc26

Improve build, so that we can build the tools and tests with minimal depencies (e.g. without libSDL linking when possible.) And this also on Win32 MinGW.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 22 Nov 2017 01:33:21 +0200
parents ed04fb6da07c
children d8a83582f78f
files Makefile Makefile.cross-mingw Makefile.gen src/dmmutex.h src/dmtool.h tests/evaltest.c tests/fptest.c tests/vecmattest.c tools/data2inc.c tools/dumpmod.c tools/gentab.c tools/gfxconv.c tools/mod2wav.c tools/objlink.c tools/packed.c tools/xm2jss.c
diffstat 16 files changed, 32 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Nov 22 01:04:41 2017 +0200
+++ b/Makefile	Wed Nov 22 01:33:21 2017 +0200
@@ -26,7 +26,7 @@
 ZLIB_LDFLAGS ?= $(shell pkg-config --libs zlib)
 
 
-TOOL_LDFLAGS ?= $(SDL_LDFLAGS)
+TOOL_LDFLAGS ?=
 
 include $(DMLIB)Makefile.gen
 
--- a/Makefile.cross-mingw	Wed Nov 22 01:04:41 2017 +0200
+++ b/Makefile.cross-mingw	Wed Nov 22 01:33:21 2017 +0200
@@ -31,6 +31,6 @@
 ZLIB_CFLAGS ?=
 ZLIB_LDFLAGS ?= $(MINGW_PATH)/lib/libz.a
 
-TOOL_LDFLAGS ?= -lmingw32 -lSDLmain -lSDL -mconsole
+TOOL_LDFLAGS ?= -mconsole -lmingw32
 
 include $(DMLIB)Makefile.gen
--- a/Makefile.gen	Wed Nov 22 01:04:41 2017 +0200
+++ b/Makefile.gen	Wed Nov 22 01:33:21 2017 +0200
@@ -476,7 +476,7 @@
 ###
 $(TOOL_BINPATH)fontconv$(EXEEXT): $(OBJPATH)fontconv.o $(DMLIB_A)
 	@echo " LINK $+"
-	@$(CC) -o $@ $(filter %.o %.a,$+) $(DM_LDFLAGS) $(TOOL_LDFLAGS) $(SDL_TTF_LDFLAGS) $(ZLIB_LDFLAGS) -lm
+	@$(CC) -o $@ $(filter %.o %.a,$+) $(DM_LDFLAGS) $(TOOL_LDFLAGS) $(SDL_LDFLAGS) $(SDL_TTF_LDFLAGS) $(ZLIB_LDFLAGS) -lm
 
 $(TOOL_BINPATH)data2inc$(EXEEXT): $(OBJPATH)data2inc.o $(DMLIB_A)
 	@echo " LINK $+"
--- a/src/dmmutex.h	Wed Nov 22 01:04:41 2017 +0200
+++ b/src/dmmutex.h	Wed Nov 22 01:33:21 2017 +0200
@@ -4,6 +4,8 @@
  * Programmed and designed by Matti 'ccr' Hamalainen
  * (C) Copyright 2012 Tecnic Software productions (TNSP)
  */
+#ifndef DMMUTEX_H
+#define DMMUTEX_H 1
 
 Uint32 SDL_ThreadID()
 {
@@ -31,3 +33,5 @@
 {
     (void) p;
 }
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/dmtool.h	Wed Nov 22 01:33:21 2017 +0200
@@ -0,0 +1,14 @@
+/*
+ * DMLib
+ * Get rid of the SDL_main for some commandline tools
+ * Programmed and designed by Matti 'ccr' Hamalainen
+ * (C) Copyright 2012 Tecnic Software productions (TNSP)
+ */
+#ifndef DMTOOL_H
+#define DMTOOL_H 1
+
+// Get rid of the SDL_main mess for some commandline tools
+#define _SDL_main_h
+#define SDL_main main
+
+#endif
--- a/tests/evaltest.c	Wed Nov 22 01:04:41 2017 +0200
+++ b/tests/evaltest.c	Wed Nov 22 01:33:21 2017 +0200
@@ -1,3 +1,4 @@
+#include "dmtool.h"
 #include "dmlib.h"
 #include "dmeval.h"
 #include "dmargs.h"
--- a/tests/fptest.c	Wed Nov 22 01:04:41 2017 +0200
+++ b/tests/fptest.c	Wed Nov 22 01:33:21 2017 +0200
@@ -1,3 +1,4 @@
+#include "dmtool.h"
 #include "dmlib.h"
 #include <stdio.h>
 
--- a/tests/vecmattest.c	Wed Nov 22 01:04:41 2017 +0200
+++ b/tests/vecmattest.c	Wed Nov 22 01:33:21 2017 +0200
@@ -1,6 +1,6 @@
+#include "dmtool.h"
 #include "dmlib.h"
 #include "dmvecmat.h"
-#include "dmmutex.h"
 
 void printTest(const char *test, int expected, int result)
 {
--- a/tools/data2inc.c	Wed Nov 22 01:04:41 2017 +0200
+++ b/tools/data2inc.c	Wed Nov 22 01:33:21 2017 +0200
@@ -5,6 +5,7 @@
  *
  * Please read file 'COPYING' for information on license and distribution.
  */
+#include "dmtool.h"
 #include "dmlib.h"
 #include "dmargs.h"
 #include "dmmutex.h"
--- a/tools/dumpmod.c	Wed Nov 22 01:04:41 2017 +0200
+++ b/tools/dumpmod.c	Wed Nov 22 01:33:21 2017 +0200
@@ -5,6 +5,7 @@
  *
  * Please read file 'COPYING' for information on license and distribution.
  */
+#include "dmtool.h"
 #include "jss.h"
 #include "jssmod.h"
 #include "dmargs.h"
--- a/tools/gentab.c	Wed Nov 22 01:04:41 2017 +0200
+++ b/tools/gentab.c	Wed Nov 22 01:33:21 2017 +0200
@@ -1,3 +1,4 @@
+#include "dmtool.h"
 #include "dmlib.h"
 #include "dmargs.h"
 #include "dmcurves.h"
--- a/tools/gfxconv.c	Wed Nov 22 01:04:41 2017 +0200
+++ b/tools/gfxconv.c	Wed Nov 22 01:33:21 2017 +0200
@@ -5,6 +5,7 @@
  *
  * Please read file 'COPYING' for information on license and distribution.
  */
+#include "dmtool.h"
 #include "dmlib.h"
 #include "dmargs.h"
 #include "dmfile.h"
--- a/tools/mod2wav.c	Wed Nov 22 01:04:41 2017 +0200
+++ b/tools/mod2wav.c	Wed Nov 22 01:33:21 2017 +0200
@@ -5,6 +5,7 @@
  *
  * Please read file 'COPYING' for information on license and distribution.
  */
+#include "dmtool.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
--- a/tools/objlink.c	Wed Nov 22 01:04:41 2017 +0200
+++ b/tools/objlink.c	Wed Nov 22 01:33:21 2017 +0200
@@ -5,10 +5,10 @@
  *
  * Please read file 'COPYING' for information on license and distribution.
  */
+#include "dmtool.h"
 #include "dmlib.h"
 #include "dmargs.h"
 #include "dmfile.h"
-#include "dmmutex.h"
 
 #define MAX_FILENAMES    (128)
 #define MAX_MEMBLOCKS    (128)
--- a/tools/packed.c	Wed Nov 22 01:04:41 2017 +0200
+++ b/tools/packed.c	Wed Nov 22 01:33:21 2017 +0200
@@ -3,12 +3,12 @@
  * Programmed and designed by Matti 'ccr' Hamalainen
  * (C) Copyright 2011 Tecnic Software productions (TNSP)
  */
+#include "dmtool.h"
 #include "dmlib.h"
 #include "dmargs.h"
 #include "dmpack.h"
 #include "dmfile.h"
 #include "dmres.h"
-#include "dmmutex.h"
 #include <zlib.h>
 
 
--- a/tools/xm2jss.c	Wed Nov 22 01:04:41 2017 +0200
+++ b/tools/xm2jss.c	Wed Nov 22 01:33:21 2017 +0200
@@ -5,6 +5,7 @@
  *
  * Please read file 'COPYING' for information on license and distribution.
  */
+#include "dmtool.h"
 #include <stdio.h>
 #include "jss.h"
 #include "jssmod.h"