annotate Makefile @ 33:8b2b0677eb99

Build system changes for SDL/Win32 cross-build via MinGW hosted on Linux.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 24 May 2010 00:22:37 +0300
parents 78235ee17b69
children 678924af9149
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
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
78235ee17b69 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 23
diff changeset
3 LDFLAGS +=
33
8b2b0677eb99 Build system changes for SDL/Win32 cross-build via MinGW hosted on Linux.
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
4 MINGW_PATH=/usr/local/i386-mingw32
23
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
5
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
6 ### Subdirectories to build
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
7 SUBDIRS=pwplib peluce nykyaeka oldchsool pwpzax
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
23
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
9 ### Show some help
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
10 help:
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
11 @if test ! -f config.mak; then \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
12 echo "PWPLib build system"; \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
13 echo "Usage: make <target>"; \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
14 echo ""; \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
15 echo "sdl - LibSDL video/audio for POSIX style systems"; \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
16 echo "unix - Terminal only POSIX style systems"; \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
17 echo "linux - Like unix, but with Linux console and OSS audio support"; \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
18 echo "hpux - HP-UX (untested now)"; \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
19 echo "sdl-win32 - LibSDL for Win32, cross compilation via MinGW toolchain"; \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
20 echo "sdl-win64 - Like above, but for Win64 via MinGW64"; \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
21 echo ""; \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
22 else \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
23 echo "Configured as:"; \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
24 cat config.mak; \
24
78235ee17b69 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 23
diff changeset
25 echo "To re-build: 'make all'"; \
78235ee17b69 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 23
diff changeset
26 echo "To reconfigure: 'make clean' and 'make <target>'"; \
23
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
27 fi
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28
23
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
29 endianchk: endianchk.c
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
30 $(CC) -o $@ $<
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31
23
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
32 config.mak:
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
33 @echo "" > $@
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
34 @echo "# Build target: $(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
35 @echo "PATH=$(PATH)" >> $@
23
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
36 @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
37 @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
38 @echo "LD=$(LD)" >> $@
23
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
39 @echo "CFLAGS=$(CFLAGS) $(XCFLAGS)" >> $@
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
40 @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
41 @echo "BINEXT=$(BINEXT)" >> $@
23
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
42 @echo "" >> $@
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
43
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
44 ### Build sub targets
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
45 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
46 @for subdir in $(SUBDIRS); do if ! $(MAKE) -C "$$subdir"; then echo "Make returned $?"; exit 1; fi; done
23
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
47
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
48 pwplib.a:
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
49 $(MAKE) -C pwplib
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 clean:
23
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
52 @for subdir in $(SUBDIRS); do $(MAKE) -C "$$subdir" clean; done
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
53 $(RM) config.mak endianchk
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54
23
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
55 ### Major targets
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
56 unix: endianchk
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
57 $(RM) config.mak && endianflags=`./endianchk` && \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
58 $(MAKE) config.mak XTARGET="$@" XCFLAGS="-DUNIX $$endianflags" XLDFLAGS="-lm" && \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
59 $(MAKE) all
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60
23
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
61 hpux:
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
62 $(RM) config.mak && \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
63 $(MAKE) config.mak XTARGET="$@" XCFLAGS="-DUNIX -DBIG_ENDIAN -DDRIVE_HPUX" XLDFLAGS="-lm" && \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
64 $(MAKE) all
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65
23
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
66 linux: endianchk
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
67 $(RM) config.mak && endianflags=`./endianchk` && \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
68 $(MAKE) config.mak XTARGET="$@" XCFLAGS="-DUNIX -DDRIVE_LINUXCON -DDRIVE_OSS $$endianflags" XLDFLAGS="-lm" && \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
69 $(MAKE) all
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70
23
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
71 sdl: endianchk
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
72 $(RM) config.mak && endianflags=`./endianchk` && \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
73 $(MAKE) config.mak XTARGET="$@" XCFLAGS="-DUNIX -DDRIVE_SDL $$endianflags `sdl-config --cflags`" XLDFLAGS="`sdl-config --libs` -lm" && \
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
74 $(MAKE) all
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75
23
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
76 sdl-win32: endianchk
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
77 $(RM) config.mak && \
33
8b2b0677eb99 Build system changes for SDL/Win32 cross-build via MinGW hosted on Linux.
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
78 $(MAKE) config.mak PATH="$(MINGW_PATH)/bin:/usr/bin:/bin" BINEXT=".exe" CC="gcc" \
8b2b0677eb99 Build system changes for SDL/Win32 cross-build via MinGW hosted on Linux.
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
79 XTARGET="$@" XCFLAGS="-DDRIVE_SDL `$(MINGW_PATH)/bin/sdl-config --cflags`" \
8b2b0677eb99 Build system changes for SDL/Win32 cross-build via MinGW hosted on Linux.
Matti Hamalainen <ccr@tnsp.org>
parents: 24
diff changeset
80 XLDFLAGS="-s -L$(MINGW_PATH)/lib/ `$(MINGW_PATH)/bin/sdl-config --libs` -lwinmm" && \
23
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
81 $(MAKE) all
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82
23
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
83 .dummy:
c3622b53a23e Clean up the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
84