# HG changeset patch # User Matti Hamalainen # Date 1670411965 -7200 # Node ID 3a3e4fc53ac7df7a3819fe02218b86c92d7fe7e3 # Parent 6b79b3438818d2b9cb8843bbf5e0b89dc8d069b9 Refactor the build system a bit. diff -r 6b79b3438818 -r 3a3e4fc53ac7 Makefile --- a/Makefile Wed Dec 07 13:18:06 2022 +0200 +++ b/Makefile Wed Dec 07 13:19:25 2022 +0200 @@ -4,10 +4,14 @@ # # C-compiler, flags and linker flags -CFLAGS = -DHAVE_STRING_H -DHAVE_STDINT_H -DUSE_XDG=1 -LDFLAGS = -lncurses +#CFLAGS += -fsanitize=address +#LDFLAGS +== -lasan +LDFLAGS += -lncurses -#CFLAGS += -DHAVE_STDINT_H +CFLAGS += -DUSE_XDG=1 + +CFLAGS += -DHAVE_STRING_H +CFLAGS += -DHAVE_INTTYPES_H #CFLAGS += -DHAVE_SYS_TYPES_H include Makefile.unix diff -r 6b79b3438818 -r 3a3e4fc53ac7 Makefile.cross-mingw --- /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 $@ + diff -r 6b79b3438818 -r 3a3e4fc53ac7 Makefile.w32 --- a/Makefile.w32 Wed Dec 07 13:18:06 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -# -# For win32 version cross-compilation with MinGW suite @ Linux -# -BINTOOL_PREFIX = i686-w64-mingw32- - -PREFIX = ./win32/ -BINPATH = ./installer/ -OBJPATH = ./obj/win32/ -BINEXT = .exe -INSTALL = -DOC = $(BINPATH)/README.html - -WINDRES ?= $(BINTOOL_PREFIX)windres - -CFLAGS += -DHAVE_STRING_H -Ipdcurses -mwindows -DTH_BYTEORDER=TH_LITTLE_ENDIAN -D_NO_BOOL_TYPEDEF -LDFLAGS += -lws2_32 -lole32 -mwindows pdcurses/libpdcurses.a -s - -### -### Miscellaneous -### -EXTRAOBJS = resource.o -ICON = resource.ico - -include Makefile.gen - -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" < $< > $@ - -resource.o: resource.rc - $(WINDRES) $< -O coff -o $@ -