Mercurial > hg > forks > pwpunix
annotate Makefile @ 47:b556bdc2a365
Add 'hg-tar' target for making a tarball from the Mercurial repository.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 24 May 2010 05:48:57 +0300 |
parents | 1a01445cc0a7 |
children | 4698627de33d |
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 += |
38
678924af9149
Buildsystem changes, build zaxplay or orig only when the target probably allows it.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
4 MINGW32_PATH=/usr/local/i386-mingw32 |
678924af9149
Buildsystem changes, build zaxplay or orig only when the target probably allows it.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
5 MINGW64_PATH=/foo/bar |
23 | 6 |
7 ### Subdirectories to build | |
8 SUBDIRS=pwplib peluce nykyaeka oldchsool pwpzax | |
0 | 9 |
23 | 10 ### Show some help |
11 help: | |
12 @if test ! -f config.mak; then \ | |
13 echo "PWPLib build system"; \ | |
14 echo "Usage: make <target>"; \ | |
15 echo ""; \ | |
16 echo "sdl - LibSDL video/audio for POSIX style systems"; \ | |
17 echo "unix - Terminal only POSIX style systems"; \ | |
18 echo "linux - Like unix, but with Linux console and OSS audio support"; \ | |
19 echo "hpux - HP-UX (untested now)"; \ | |
20 echo "sdl-win32 - LibSDL for Win32, cross compilation via MinGW toolchain"; \ | |
21 echo "sdl-win64 - Like above, but for Win64 via MinGW64"; \ | |
22 echo ""; \ | |
23 else \ | |
24 echo "Configured as:"; \ | |
25 cat config.mak; \ | |
24 | 26 echo "To re-build: 'make all'"; \ |
27 echo "To reconfigure: 'make clean' and 'make <target>'"; \ | |
23 | 28 fi |
0 | 29 |
23 | 30 endianchk: endianchk.c |
31 $(CC) -o $@ $< | |
0 | 32 |
23 | 33 config.mak: |
34 @echo "" > $@ | |
35 @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
|
36 @echo "XTARGET=$(XTARGET)" >> $@ |
33
8b2b0677eb99
Build system changes for SDL/Win32 cross-build via MinGW hosted on Linux.
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
37 @echo "PATH=$(PATH)" >> $@ |
23 | 38 @echo "CC=$(CC)" >> $@ |
33
8b2b0677eb99
Build system changes for SDL/Win32 cross-build via MinGW hosted on Linux.
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
39 @echo "AR=$(AR)" >> $@ |
8b2b0677eb99
Build system changes for SDL/Win32 cross-build via MinGW hosted on Linux.
Matti Hamalainen <ccr@tnsp.org>
parents:
24
diff
changeset
|
40 @echo "LD=$(LD)" >> $@ |
23 | 41 @echo "CFLAGS=$(CFLAGS) $(XCFLAGS)" >> $@ |
42 @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
|
43 @echo "BINEXT=$(BINEXT)" >> $@ |
23 | 44 @echo "" >> $@ |
45 | |
46 ### Build sub targets | |
47 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
|
48 @for subdir in $(SUBDIRS); do if ! $(MAKE) -C "$$subdir"; then echo "Make returned $?"; exit 1; fi; done |
23 | 49 |
50 pwplib.a: | |
51 $(MAKE) -C pwplib | |
0 | 52 |
53 clean: | |
23 | 54 @for subdir in $(SUBDIRS); do $(MAKE) -C "$$subdir" clean; done |
55 $(RM) config.mak endianchk | |
0 | 56 |
23 | 57 ### Major targets |
58 unix: endianchk | |
59 $(RM) config.mak && endianflags=`./endianchk` && \ | |
60 $(MAKE) config.mak XTARGET="$@" XCFLAGS="-DUNIX $$endianflags" XLDFLAGS="-lm" && \ | |
61 $(MAKE) all | |
0 | 62 |
23 | 63 hpux: |
64 $(RM) config.mak && \ | |
65 $(MAKE) config.mak XTARGET="$@" XCFLAGS="-DUNIX -DBIG_ENDIAN -DDRIVE_HPUX" XLDFLAGS="-lm" && \ | |
66 $(MAKE) all | |
0 | 67 |
23 | 68 linux: endianchk |
69 $(RM) config.mak && endianflags=`./endianchk` && \ | |
70 $(MAKE) config.mak XTARGET="$@" XCFLAGS="-DUNIX -DDRIVE_LINUXCON -DDRIVE_OSS $$endianflags" XLDFLAGS="-lm" && \ | |
71 $(MAKE) all | |
0 | 72 |
23 | 73 sdl: endianchk |
74 $(RM) config.mak && endianflags=`./endianchk` && \ | |
75 $(MAKE) config.mak XTARGET="$@" XCFLAGS="-DUNIX -DDRIVE_SDL $$endianflags `sdl-config --cflags`" XLDFLAGS="`sdl-config --libs` -lm" && \ | |
76 $(MAKE) all | |
0 | 77 |
38
678924af9149
Buildsystem changes, build zaxplay or orig only when the target probably allows it.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
78 sdl-win32: |
23 | 79 $(RM) config.mak && \ |
38
678924af9149
Buildsystem changes, build zaxplay or orig only when the target probably allows it.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
80 $(MAKE) config.mak PATH="$(MINGW32_PATH)/bin:/usr/bin:/bin" BINEXT=".exe" CC="gcc" \ |
678924af9149
Buildsystem changes, build zaxplay or orig only when the target probably allows it.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
81 XTARGET="$@" XCFLAGS="-DDRIVE_SDL `$(MINGW32_PATH)/bin/sdl-config --cflags`" \ |
678924af9149
Buildsystem changes, build zaxplay or orig only when the target probably allows it.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
82 XLDFLAGS="-s -L$(MINGW32_PATH)/lib/ `$(MINGW32_PATH)/bin/sdl-config --libs` -lwinmm" && \ |
678924af9149
Buildsystem changes, build zaxplay or orig only when the target probably allows it.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
83 $(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
|
84 |
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-win64: |
678924af9149
Buildsystem changes, build zaxplay or orig only when the target probably allows it.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
86 $(RM) config.mak && \ |
678924af9149
Buildsystem changes, build zaxplay or orig only when the target probably allows it.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
87 $(MAKE) config.mak PATH="$(MINGW64_PATH)/bin:/usr/bin:/bin" BINEXT=".exe" CC="gcc" \ |
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 `$(MINGW64_PATH)/bin/sdl-config --cflags`" \ |
678924af9149
Buildsystem changes, build zaxplay or orig only when the target probably allows it.
Matti Hamalainen <ccr@tnsp.org>
parents:
33
diff
changeset
|
89 XLDFLAGS="-s -L$(MINGW64_PATH)/lib/ `$(MINGW64_PATH)/bin/sdl-config --libs` -lwinmm" && \ |
23 | 90 $(MAKE) all |
0 | 91 |
47
b556bdc2a365
Add 'hg-tar' target for making a tarball from the Mercurial repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
92 PACKAGE=pwpunix-1.95-sdl |
b556bdc2a365
Add 'hg-tar' target for making a tarball from the Mercurial repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
93 ZIPFILE=$(PACKAGE)-win32-bin.zip |
46
1a01445cc0a7
Improve the zip packaging a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
94 |
45
728a691ffe65
"Hidden" targets for win32 binary zip generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
38
diff
changeset
|
95 README.txt: README |
728a691ffe65
"Hidden" targets for win32 binary zip generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
38
diff
changeset
|
96 unix2dos -n $< $@ |
728a691ffe65
"Hidden" targets for win32 binary zip generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
38
diff
changeset
|
97 |
728a691ffe65
"Hidden" targets for win32 binary zip generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
38
diff
changeset
|
98 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
|
99 $(RM) $(ZIPFILE) |
45
728a691ffe65
"Hidden" targets for win32 binary zip generation.
Matti Hamalainen <ccr@tnsp.org>
parents:
38
diff
changeset
|
100 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
|
101 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
|
102 |
b556bdc2a365
Add 'hg-tar' target for making a tarball from the Mercurial repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
103 hg-tar: |
b556bdc2a365
Add 'hg-tar' target for making a tarball from the Mercurial repository.
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
104 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
|
105 |
23 | 106 .dummy: |
107 |