Mercurial > hg > nnchat
annotate Makefile.cross-mingw @ 718:1ab9b538c0bb default tip
Rename Makefile.gen to Makefile.common
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 03 Aug 2023 19:17:58 +0300 |
parents | 93d0e1547842 |
children |
rev | line source |
---|---|
712
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
1 ### |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
2 ### For Win32/Win64 version cross-compilation via MinGW |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
3 ### compiler suite under Linux/Unix |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
4 ### |
0 | 5 # |
712
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
6 # This Makefile assumes that you have MinGW installed under /usr |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
7 # the way Debian MinGW packages do. It also assumes that you have |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
8 # built/installed SDL2 and PDCurses 3.9 (SDL2 variant) under |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
9 # /usr/local (not /usr!) in similar fashion. |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
10 # |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
11 # For differing configurations you will have to either edit this |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
12 # file or alternatively provide make parameters, e.g. |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
13 # |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
14 # make -f Makefile.cross-mingw MINGW=64 BINTOOL_PREFIX=foo-bar-zoo |
0 | 15 # |
712
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
16 ifeq ($(MINGW),64) |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
17 BINTOOL_PREFIX ?= x86_64-w64-mingw32- |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
18 MINGW_SYS_PATH ?= /usr/x86_64-w64-mingw32 |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
19 MINGW_LOCAL_PATH ?= /usr/local/x86_64-w64-mingw32 |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
20 OBJPATH ?= ./obj/win64/ |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
21 else |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
22 BINTOOL_PREFIX ?= i686-w64-mingw32- |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
23 MINGW_SYS_PATH ?= /usr/i686-w64-mingw32 |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
24 MINGW_LOCAL_PATH ?= /usr/local/i686-w64-mingw32 |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
25 OBJPATH ?= ./obj/win32/ |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
26 endif |
0 | 27 |
712
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
28 BINPATH ?= ./exe/ |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
29 BINEXT ?= .exe |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
30 CC = $(BINTOOL_PREFIX)gcc |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
31 AR = $(BINTOOL_PREFIX)ar |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
32 RANLIB = $(BINTOOL_PREFIX)ranlib |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
33 RM ?= rm |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
34 DOC = $(BINPATH)/README.html |
688
264cada93ae9
Slight MinGW Windows cross-build Makefile cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents:
674
diff
changeset
|
35 WINDRES ?= $(BINTOOL_PREFIX)windres |
119
4bc63a535acb
Fix some PDCurses incompatibilities and remove some Win32/PDCurses specific hacks.
Matti Hamalainen <ccr@tnsp.org>
parents:
110
diff
changeset
|
36 |
712
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
37 |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
38 SDL_CFLAGS ?= $(shell $(MINGW_LOCAL_PATH)/bin/sdl2-config --cflags) |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
39 SDL_LDFLAGS ?= $(shell $(MINGW_LOCAL_PATH)/bin/sdl2-config --libs) |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
40 |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
41 CFLAGS += -mwindows -DTH_BYTEORDER=TH_LITTLE_ENDIAN -I$(MINGW_LOCAL_PATH)/include $(SDL_CFLAGS) |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
42 LDFLAGS += -lws2_32 -lole32 -mwindows $(MINGW_LOCAL_PATH)/lib/libpdcurses.a $(SDL_LDFLAGS) |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
43 LDFLAGS += -s |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
44 |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
45 CFLAGS += -DHAVE_STRING_H |
713
93d0e1547842
th-libs now uses stdbool.h if possible, so we need to rename all
Matti Hamalainen <ccr@tnsp.org>
parents:
712
diff
changeset
|
46 CFLAGS += -DHAVE_STDBOOL_H |
712
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
47 CFLAGS += -DHAVE_INTTYPES_H |
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
48 |
0 | 49 |
673
358cdc4c9178
Fix and improve Windows Makefile.
Matti Hamalainen <ccr@tnsp.org>
parents:
647
diff
changeset
|
50 ### |
358cdc4c9178
Fix and improve Windows Makefile.
Matti Hamalainen <ccr@tnsp.org>
parents:
647
diff
changeset
|
51 ### Miscellaneous |
358cdc4c9178
Fix and improve Windows Makefile.
Matti Hamalainen <ccr@tnsp.org>
parents:
647
diff
changeset
|
52 ### |
712
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
53 EXTRAOBJS = $(OBJPATH)resource.o |
673
358cdc4c9178
Fix and improve Windows Makefile.
Matti Hamalainen <ccr@tnsp.org>
parents:
647
diff
changeset
|
54 ICON = resource.ico |
0 | 55 |
718
1ab9b538c0bb
Rename Makefile.gen to Makefile.common
Matti Hamalainen <ccr@tnsp.org>
parents:
713
diff
changeset
|
56 include Makefile.common |
159
1b6bc8bf6ac3
Create win32/ subdirectory if needed.
Matti Hamalainen <ccr@tnsp.org>
parents:
158
diff
changeset
|
57 |
712
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
58 $(OBJPATH)resource.rc: resource.rc.in $(ICON) VERSION |
213 | 59 sed -e "s/@VERSION@/$(NN_VERSION)/g;s/@VERSION_COM@/$(NN_VERSION_COM)/g;s/@ICON@/$(ICON)/g;s#@EXE@#$(notdir $(NNCHAT_BIN))#g" < $< > $@ |
195
829457be9eea
Build system changes to support (in a big kludgy manner) icon and version information resource generation for Win32 binaries.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
60 |
712
3a3e4fc53ac7
Refactor the build system a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
695
diff
changeset
|
61 $(OBJPATH)resource.o: $(OBJPATH)resource.rc |
537 | 62 $(WINDRES) $< -O coff -o $@ |
227 | 63 |