diff Makefile.cross-mingw @ 712:3a3e4fc53ac7

Refactor the build system a bit.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 07 Dec 2022 13:19:25 +0200
parents Makefile.w32@f1df1cf69a38
children 93d0e1547842
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile.cross-mingw	Wed Dec 07 13:19:25 2022 +0200
@@ -0,0 +1,62 @@
+###
+### For Win32/Win64 version cross-compilation via MinGW
+### compiler suite under Linux/Unix
+###
+#
+# This Makefile assumes that you have MinGW installed under /usr
+# the way Debian MinGW packages do. It also assumes that you have
+# built/installed SDL2 and PDCurses 3.9 (SDL2 variant) under
+# /usr/local (not /usr!) in similar fashion.
+#
+# For differing configurations you will have to either edit this
+# file or alternatively provide make parameters, e.g.
+#
+# make -f Makefile.cross-mingw MINGW=64 BINTOOL_PREFIX=foo-bar-zoo
+#
+ifeq ($(MINGW),64)
+BINTOOL_PREFIX ?= x86_64-w64-mingw32-
+MINGW_SYS_PATH ?= /usr/x86_64-w64-mingw32
+MINGW_LOCAL_PATH ?= /usr/local/x86_64-w64-mingw32
+OBJPATH ?= ./obj/win64/
+else
+BINTOOL_PREFIX ?= i686-w64-mingw32-
+MINGW_SYS_PATH ?= /usr/i686-w64-mingw32
+MINGW_LOCAL_PATH ?= /usr/local/i686-w64-mingw32
+OBJPATH ?= ./obj/win32/
+endif
+
+BINPATH ?= ./exe/
+BINEXT ?= .exe
+CC = $(BINTOOL_PREFIX)gcc
+AR = $(BINTOOL_PREFIX)ar
+RANLIB = $(BINTOOL_PREFIX)ranlib
+RM ?= rm
+DOC = $(BINPATH)/README.html
+WINDRES ?= $(BINTOOL_PREFIX)windres
+
+
+SDL_CFLAGS ?= $(shell $(MINGW_LOCAL_PATH)/bin/sdl2-config --cflags)
+SDL_LDFLAGS ?= $(shell $(MINGW_LOCAL_PATH)/bin/sdl2-config --libs)
+
+CFLAGS += -mwindows -DTH_BYTEORDER=TH_LITTLE_ENDIAN -I$(MINGW_LOCAL_PATH)/include $(SDL_CFLAGS)
+LDFLAGS += -lws2_32 -lole32 -mwindows $(MINGW_LOCAL_PATH)/lib/libpdcurses.a $(SDL_LDFLAGS)
+LDFLAGS += -s
+
+CFLAGS += -DHAVE_STRING_H
+CFLAGS += -DHAVE_INTTYPES_H
+
+
+###
+### Miscellaneous
+###
+EXTRAOBJS = $(OBJPATH)resource.o
+ICON = resource.ico
+
+include Makefile.gen
+
+$(OBJPATH)resource.rc: resource.rc.in $(ICON) VERSION
+	sed -e "s/@VERSION@/$(NN_VERSION)/g;s/@VERSION_COM@/$(NN_VERSION_COM)/g;s/@ICON@/$(ICON)/g;s#@EXE@#$(notdir $(NNCHAT_BIN))#g" < $< > $@
+
+$(OBJPATH)resource.o: $(OBJPATH)resource.rc
+	$(WINDRES) $< -O coff -o $@
+