Mercurial > hg > forks > pwpunix
annotate Makefile @ 84:969fff31e495
Fix mingw cross build.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 19 Feb 2013 00:40:26 +0200 |
parents | 1096f6ffd15c |
children | 011e65a6367b |
rev | line source |
---|---|
23 | 1 ### Global settings |
33
8b2b0677eb99
Build system changes for SDL/Win32 cross-build via MinGW hosted on Linux.
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
2 CFLAGS += -W -Wall -O3 |
24 | 3 LDFLAGS += |
49
4698627de33d
Use ranlib when building pwplib.a.
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
4 RANLIB=ranlib |
4698627de33d
Use ranlib when building pwplib.a.
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
5 |
73 | 6 # Prefix for x86-32 win32 MinGW tools (gcc, ar, ld, ranlib) |
71
a87eb778f225
Improvements to the MinGW crossbuild. Should now build with default tools
Matti Hamalainen <ccr@tnsp.org>
parents:
66
diff
changeset
|
7 MINGW32_PREFIX=i686-w64-mingw32- |
a87eb778f225
Improvements to the MinGW crossbuild. Should now build with default tools
Matti Hamalainen <ccr@tnsp.org>
parents:
66
diff
changeset
|
8 MINGW32_PATH=/usr/i686-w64-mingw32 |
73 | 9 |
10 # Prefix for x86-64 win64 MinGW tools | |
71
a87eb778f225
Improvements to the MinGW crossbuild. Should now build with default tools
Matti Hamalainen <ccr@tnsp.org>
parents:
66
diff
changeset
|
11 MINGW64_PREFIX=x86_64-w64-mingw32- |
73 | 12 MINGW64_PATH=/usr/x86_64-w64-mingw32 |
23 | 13 |
14 ### Subdirectories to build | |
15 SUBDIRS=pwplib peluce nykyaeka oldchsool pwpzax | |
0 | 16 |
23 | 17 ### Show some help |
18 help: | |
19 @if test ! -f config.mak; then \ | |
20 echo "PWPLib build system"; \ | |
21 echo "Usage: make <target>"; \ | |
22 echo ""; \ | |
23 echo "sdl - LibSDL video/audio for POSIX style systems"; \ | |
24 echo "unix - Terminal only POSIX style systems"; \ | |
25 echo "linux - Like unix, but with Linux console and OSS audio support"; \ | |
26 echo "hpux - HP-UX (untested now)"; \ | |
27 echo "sdl-win32 - LibSDL for Win32, cross compilation via MinGW toolchain"; \ | |
28 echo "sdl-win64 - Like above, but for Win64 via MinGW64"; \ | |
29 echo ""; \ | |
30 else \ | |
31 echo "Configured as:"; \ | |
32 cat config.mak; \ | |
24 | 33 echo "To re-build: 'make all'"; \ |
34 echo "To reconfigure: 'make clean' and 'make <target>'"; \ | |
23 | 35 fi |
0 | 36 |
23 | 37 endianchk: endianchk.c |
38 $(CC) -o $@ $< | |
0 | 39 |
23 | 40 config.mak: |
41 @echo "" > $@ | |
42 @echo "# Build target: $(XTARGET)" >> $@ | |
38
678924af9149
Buildsystem changes, build zaxplay or orig only when the target probably allows it.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
43 @echo "XTARGET=$(XTARGET)" >> $@ |
71
a87eb778f225
Improvements to the MinGW crossbuild. Should now build with default tools
Matti Hamalainen <ccr@tnsp.org>
parents:
66
diff
changeset
|
44 @echo "CC=$(PREFIX)$(CC)" >> $@ |
a87eb778f225
Improvements to the MinGW crossbuild. Should now build with default tools
Matti Hamalainen <ccr@tnsp.org>
parents:
66
diff
changeset
|
45 @echo "AR=$(PREFIX)$(AR)" >> $@ |
a87eb778f225
Improvements to the MinGW crossbuild. Should now build with default tools
Matti Hamalainen <ccr@tnsp.org>
parents:
66
diff
changeset
|
46 @echo "LD=$(PREFIX)$(LD)" >> $@ |
a87eb778f225
Improvements to the MinGW crossbuild. Should now build with default tools
Matti Hamalainen <ccr@tnsp.org>
parents:
66
diff
changeset
|
47 @echo "RANLIB=$(PREFIX)$(RANLIB)" >> $@ |
23 | 48 @echo "CFLAGS=$(CFLAGS) $(XCFLAGS)" >> $@ |
49 @echo "LDFLAGS=$(LDFLAGS) $(XLDFLAGS)" >> $@ | |
33
8b2b0677eb99
Build system changes for SDL/Win32 cross-build via MinGW hosted on Linux.
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
50 @echo "BINEXT=$(BINEXT)" >> $@ |
23 | 51 @echo "" >> $@ |
52 | |
53 ### Build sub targets | |
54 all: | |
33
8b2b0677eb99
Build system changes for SDL/Win32 cross-build via MinGW hosted on Linux.
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
55 @for subdir in $(SUBDIRS); do if ! $(MAKE) -C "$$subdir"; then echo "Make returned $?"; exit 1; fi; done |
23 | 56 |
57 pwplib.a: | |
58 $(MAKE) -C pwplib | |
0 | 59 |
60 clean: | |
23 | 61 @for subdir in $(SUBDIRS); do $(MAKE) -C "$$subdir" clean; done |
62 $(RM) config.mak endianchk | |
0 | 63 |
23 | 64 ### Major targets |
65 unix: endianchk | |
66 $(RM) config.mak && endianflags=`./endianchk` && \ | |
67 $(MAKE) config.mak XTARGET="$@" XCFLAGS="-DUNIX $$endianflags" XLDFLAGS="-lm" && \ | |
68 $(MAKE) all | |
0 | 69 |
23 | 70 hpux: |
71 $(RM) config.mak && \ | |
72 $(MAKE) config.mak XTARGET="$@" XCFLAGS="-DUNIX -DBIG_ENDIAN -DDRIVE_HPUX" XLDFLAGS="-lm" && \ | |
73 $(MAKE) all | |
0 | 74 |
23 | 75 linux: endianchk |
76 $(RM) config.mak && endianflags=`./endianchk` && \ | |
77 $(MAKE) config.mak XTARGET="$@" XCFLAGS="-DUNIX -DDRIVE_LINUXCON -DDRIVE_OSS $$endianflags" XLDFLAGS="-lm" && \ | |
78 $(MAKE) all | |
0 | 79 |
23 | 80 sdl: endianchk |
81 $(RM) config.mak && endianflags=`./endianchk` && \ | |
82 $(MAKE) config.mak XTARGET="$@" XCFLAGS="-DUNIX -DDRIVE_SDL $$endianflags `sdl-config --cflags`" XLDFLAGS="`sdl-config --libs` -lm" && \ | |
83 $(MAKE) all | |
0 | 84 |
38
678924af9149
Buildsystem changes, build zaxplay or orig only when the target probably allows it.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
85 sdl-win32: |
23 | 86 $(RM) config.mak && \ |
71
a87eb778f225
Improvements to the MinGW crossbuild. Should now build with default tools
Matti Hamalainen <ccr@tnsp.org>
parents:
66
diff
changeset
|
87 $(MAKE) config.mak PREFIX="$(MINGW32_PREFIX)" BINEXT=".exe" CC="gcc" \ |
38
678924af9149
Buildsystem changes, build zaxplay or orig only when the target probably allows it.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
88 XTARGET="$@" XCFLAGS="-DDRIVE_SDL `$(MINGW32_PATH)/bin/sdl-config --cflags`" \ |
84 | 89 XLDFLAGS="-s -L$(MINGW32_PATH)/lib/ `$(MINGW32_PATH)/bin/sdl-config --libs` -lSDL -lmingw32 -lm" && \ |
38
678924af9149
Buildsystem changes, build zaxplay or orig only when the target probably allows it.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
90 $(MAKE) all |
678924af9149
Buildsystem changes, build zaxplay or orig only when the target probably allows it.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
91 |
678924af9149
Buildsystem changes, build zaxplay or orig only when the target probably allows it.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
92 sdl-win64: |
678924af9149
Buildsystem changes, build zaxplay or orig only when the target probably allows it.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
93 $(RM) config.mak && \ |
71
a87eb778f225
Improvements to the MinGW crossbuild. Should now build with default tools
Matti Hamalainen <ccr@tnsp.org>
parents:
66
diff
changeset
|
94 $(MAKE) config.mak PREFIX="$(MINGW64_PREFIX)" BINEXT=".exe" CC="gcc" \ |
38
678924af9149
Buildsystem changes, build zaxplay or orig only when the target probably allows it.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
95 XTARGET="$@" XCFLAGS="-DDRIVE_SDL `$(MINGW64_PATH)/bin/sdl-config --cflags`" \ |
84 | 96 XLDFLAGS="-s -L$(MINGW64_PATH)/lib/ `$(MINGW64_PATH)/bin/sdl-config --libs` -lSDL -lmingw32 -lm" && \ |
23 | 97 $(MAKE) all |
0 | 98 |
66 | 99 PACKAGE=pwpunix-1.96-sdl |
47
b556bdc2a365
Add 'hg-tar' target for making a tarball from the Mercurial repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
100 ZIPFILE=$(PACKAGE)-win32-bin.zip |
46
1a01445cc0a7
Improve the zip packaging a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
101 |
45
728a691ffe65
"Hidden" targets for win32 binary zip generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
38
diff
changeset
|
102 README.txt: README |
728a691ffe65
"Hidden" targets for win32 binary zip generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
38
diff
changeset
|
103 unix2dos -n $< $@ |
728a691ffe65
"Hidden" targets for win32 binary zip generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
38
diff
changeset
|
104 |
728a691ffe65
"Hidden" targets for win32 binary zip generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
38
diff
changeset
|
105 sdl-win32-zip: clean sdl-win32 README.txt SDL.dll |
46
1a01445cc0a7
Improve the zip packaging a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
106 $(RM) $(ZIPFILE) |
45
728a691ffe65
"Hidden" targets for win32 binary zip generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
38
diff
changeset
|
107 for subdir in $(SUBDIRS); do tmp=`ls $$subdir/*.exe`; if test -f "$$tmp"; then cp "$$tmp" .; fi; done; \ |
46
1a01445cc0a7
Improve the zip packaging a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
108 zip -9vv $(ZIPFILE) *.exe README.txt SDL.dll |
47
b556bdc2a365
Add 'hg-tar' target for making a tarball from the Mercurial repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
109 |
b556bdc2a365
Add 'hg-tar' target for making a tarball from the Mercurial repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
110 hg-tar: |
b556bdc2a365
Add 'hg-tar' target for making a tarball from the Mercurial repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
111 hg archive -t tgz $(PACKAGE).tar.gz |
b556bdc2a365
Add 'hg-tar' target for making a tarball from the Mercurial repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
112 |
23 | 113 .dummy: |
114 |