From ca94d11a6d421eecc50b1d1fb25957d450a73b1d Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Mon, 10 Aug 2015 14:11:47 +0200 Subject: [PATCH] Fix compilation using mingw. This doesn't mean it is actually running. --- Makefile.windows | 57 ++++++++++++++++++++++++++------------------ src/CPersistData.cpp | 2 +- src/headers.h | 1 + 3 files changed, 36 insertions(+), 24 deletions(-) diff --git a/Makefile.windows b/Makefile.windows index babe258..ec57cef 100755 --- a/Makefile.windows +++ b/Makefile.windows @@ -2,28 +2,32 @@ PROG = blobwars.exe PAKNAME = blobwars.pak DOCS = doc/* ICONS = icons/ +DATA = data gfx sound music VERSION = 1.19 -RELEASE = 1 -USEPAK = 1 - -PREFIX=$(DESTDIR)/usr -BINDIR = $(PREFIX)/games/ -DATADIR = $(PREFIX)/share/games/blobwars/ -DOCDIR = $(PREFIX)/share/doc/$(PROG)/ -ICONDIR = $(PREFIX)/share/icons/hicolor/ -DESKTOPDIR = $(PREFIX)/share/applications/ -LOCALEDIR = $(PREFIX)/share/locale/ +RELEASE ?= 1 +USEPAK ?= 1 + +PREFIX ?= /usr +BINDIR ?= $(PREFIX)/games/ +DATADIR ?= $(PREFIX)/share/games/blobwars/ +DOCDIR ?= $(PREFIX)/share/doc/$(PROG)/ +ICONDIR ?= $(PREFIX)/share/icons/hicolor/ +DESKTOPDIR ?= $(PREFIX)/share/applications/ +LOCALEDIR ?= $(PREFIX)/share/locale/ MEDAL_SERVER_HOST = www.parallelrealities.co.uk MEDAL_SERVER_PORT = 80 -CXX = i586-mingw32msvc-g++ -SDLC ?= sdl-config +CXX = i686-w64-mingw32-g++ -CXXFLAGS += `$(SDLC) --cflags` -DVERSION=$(VERSION) -DRELEASE=$(RELEASE) -DUSEPAK=$(USEPAK) +CXXFLAGS += -std=c++11 -Dmain=SDL_main +CXXFLAGS += -I/your/mingw/include +CXXFLAGS += -DVERSION=$(VERSION) -DRELEASE=$(RELEASE) -DUSEPAK=$(USEPAK) CXXFLAGS += -DPAKNAME=\"$(PAKNAME)\" -DPAKLOCATION=\"\" -DGAMEPLAYMANUAL=\"doc/index.html\" -Wall CXXFLAGS += -DLOCALEDIR=\"\" $(CFLAGS) -DMEDAL_SERVER_HOST=\"$(MEDAL_SERVER_HOST)\" -DMEDAL_SERVER_PORT=$(MEDAL_SERVER_PORT) -Werror -LIBS = -lmingw32 `$(SDLC) --libs` -lz -lSDL_mixer -lSDL_image -lSDL_ttf -lSDL_net -lSDLmain -lSDL -lwinmm -lgdi32 -mwindows +LIBS = -lmingw32 -lz -lSDL2_mixer -lSDL2_image -lSDL2_ttf -lSDL2_net -lSDL2main -lSDL2 -lwinmm -lgdi32 +PAKLIBS = -lmingw32 -lz +LDFLAGS = -L/your/mingw/lib -mwindows OBJS += CAudio.o OBJS += CBoss.o @@ -69,6 +73,11 @@ PAKOBJS = CFileData.o pak.o LOCALE_MO = $(patsubst %.po,%.mo,$(wildcard locale/*.po)) +ALL = $(PROG) $(LOCALE_MO) +ifeq ($(USEPAK), 1) + ALL += $(PAKNAME) +endif + # top-level rule to create the program. all: $(PROG) $(LOCALE_MO) @@ -78,20 +87,22 @@ all: $(PROG) $(LOCALE_MO) # linking the program. $(PROG): $(GAMEOBJS) - $(CXX) $(GAMEOBJS) $(LIBS) -o $(PROG) - -pak: $(PAKOBJS) - $(CXX) $(PAKOBJS) $(LIBS) -o pak.exe + $(CXX) $(LDFLAGS) $(GAMEOBJS) -o $(PROG) $(LIBS) -buildpak: pak - ./pak data gfx music sound $(PAKNAME) +pak: $(PAKOBJS) + $(CXX) $(LDFLAGS) $(PAKOBJS) -o pak.exe $(PAKLIBS) %.mo: %.po msgfmt -c -o $@ $< -mapeditor: $(MAPOBJS) - $(CXX) $(LIBS) $(MAPOBJS) -o mapeditor +mapeditor.exe: $(MAPOBJS) + $(CXX) $(LDFLAGS) $(MAPOBJS) -o mapeditor.exe $(LIBS) # cleaning everything that can be automatically recreated with "make". clean: - $(RM) $(GAMEOBJS) mapEditor.o pak.o $(PROG) $(PAKNAME) pak mapeditor $(LOCALE_MO) + $(RM) $(GAMEOBJS) mapEditor.o pak.o $(PROG) $(PAKNAME) pak.exe mapeditor.exe $(LOCALE_MO) + +$(PAKNAME): pak + ./pak $(DATA) $(PAKNAME) + +buildpak: $(PAKNAME) diff --git a/src/CPersistData.cpp b/src/CPersistData.cpp index 3a913ba..403b68e 100644 --- a/src/CPersistData.cpp +++ b/src/CPersistData.cpp @@ -34,7 +34,7 @@ bool PersistData::setData(const char *data) { if (strlen(data) > 149) { - debug(("ERROR: PERSISTANT DATA LINE EXCEEDS 150 CHARACTERS! IS %zd!\n", strlen(data))); + debug(("ERROR: PERSISTANT DATA LINE EXCEEDS 150 CHARACTERS! IS %lu!\n", (unsigned long)strlen(data))); return false; } diff --git a/src/headers.h b/src/headers.h index be2ce83..aea64aa 100644 --- a/src/headers.h +++ b/src/headers.h @@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include +#include #include #include #include -- 2.39.5