Add compiler flags for Maemo
[tennix.git] / makefile
blobae97f75e07d814c6ffcbdf238f0627f32689af11
3 # Tennix! SDL Port
4 # Copyright (C) 2003, 2007 Thomas Perl <thp@perli.net>
5 #
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 # MA 02110-1301, USA.
22 CC = gcc
23 RELEASE = 0.6.9
25 TARGET ?= default
27 PREFIX ?= usr/local/
28 BINARY_INSTALL_DIR ?= $(PREFIX)/bin
30 LIBS =
31 CFLAGS += -Wall -DVERSION=\"$(RELEASE)\" -O2
33 ifeq ($(UPDRECTANGLE),1)
34 CFLAGS += -DDRAW_UPDATE_RECTANGLE
35 endif
37 ifeq ($(FPSLIMIT),1)
38 CFLAGS += -DENABLE_FPS_LIMIT
39 endif
41 ifeq ($(DELUXE),1)
42 CFLAGS += -DDELUXE_EDITION
43 endif
45 ifeq ($(DEBUG),1)
46 CFLAGS += -DDEBUG
47 endif
49 ifeq ($(MAEMO),1)
50 CFLAGS += -DMAEMO -mfpu=vfp -mfloat-abi=softfp -mcpu=arm1136j-s
51 endif
53 ifeq ($(TARGET),cocoa)
54 LIBS += SDLmain.m -framework SDL -framework Cocoa -framework SDL_image -framework SDL_mixer
55 CFLAGS += -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_mixer.framework/Headers -DMACOSX
56 else
57 LIBS += $$(sdl-config --libs) -lSDL_mixer -lSDL_image
58 CFLAGS += $$(sdl-config --cflags)
59 endif
61 SRC = tennix.c game.c graphics.c input.c sound.c
62 OBJ = tennix.o game.o graphics.o input.o sound.o archive-lib.o
63 ifeq ($(MSYSTEM),MINGW32)
64 OBJ += tennixres.o
65 endif
67 TOARCHIVE=$(wildcard data/*.ogg wildcard data/*.png voice/*.ogg)
69 WIN32LIBS = *.dll
70 OSXAPP = Tennix.app
72 DATAFILES = README README.*
73 ifeq ($(TARGET),cocoa)
74 DATAFILES += data/Tennix.icns
75 endif
77 tennix: $(OBJ) tennix.tnx
78 $(CC) $(CFLAGS) -o tennix $(OBJ) $(LIBS)
79 test -f tennix.exe && upx tennix.exe || true
81 ChangeLog:
82 git log >ChangeLog
84 install: tennix
85 install -d $(DESTDIR)/$(BINARY_INSTALL_DIR) $(DESTDIR)/$(PREFIX)/share/pixmaps $(DESTDIR)/$(PREFIX)/share/applications $(DESTDIR)/$(PREFIX)/share/man/man6 $(DESTDIR)/$(PREFIX)/share/icons/hicolor/scalable/apps
86 install -s tennix $(DESTDIR)/$(BINARY_INSTALL_DIR)/tennix
87 install tennix.6 $(DESTDIR)/$(PREFIX)/share/man/man6/tennix.6
88 install -m644 data/icon.png $(DESTDIR)/$(PREFIX)/share/pixmaps/tennix.png
89 install -m644 data/icon.svg $(DESTDIR)/$(PREFIX)/share/icons/hicolor/scalable/apps/tennix.svg
90 install -m644 tennix.desktop $(DESTDIR)/$(PREFIX)/share/applications/
92 tennix.o: tennix.c tennix.h game.h graphics.h input.h sound.h
93 graphics.o: graphics.c graphics.h tennix.h archive.h
94 game.o: game.c game.h graphics.h tennix.h sound.h input.h
95 sound.o: sound.c sound.h tennix.h archive.h
97 archive-lib.o: archive.c archive.h
98 $(CC) -c -o $@ $<
100 tennixar: archive dump
102 archive.o: archive.c archive.h
103 $(CC) -DTENNIXAR_STANDALONE -c -o $@ $<
105 dump: archive
106 ln -s archive dump
108 tennix.tnx: archive $(TOARCHIVE)
109 rm -f tennix.tnx
110 ./archive $@ $(TOARCHIVE)
112 # Mac OS X-specific targets
113 release-osx: tennix ChangeLog
114 mkdir -p $(OSXAPP)/Contents/{MacOS,/Resources}
115 cp -rpv tennix $(OSXAPP)/Contents/MacOS/Tennix
116 cp -rpv $(DATAFILES) ChangeLog $(OSXAPP)/Contents/Resources/
117 sed -e 's/TENNIX_VERSION/$(RELEASE)/' osxapp.plist >$(OSXAPP)/Contents/Info.plist
118 echo 'APPL????' >$(OSXAPP)/Contents/PkgInfo
119 zip -r tennix-$(RELEASE)-macosx.zip $(OSXAPP)
120 # End Mac OS X-specific targets
122 # Windows-specific targets
123 release-win32: tennix ChangeLog
124 zip tennix-$(RELEASE)-win32.zip tennix.exe $(WIN32LIBS) $(DATAFILES) ChangeLog
126 tennix-installer.iss: tennix-installer.iss.in
127 sed tennix-installer.iss.in -e 's/{version}/$(RELEASE)/g' >tennix-installer.iss
129 release-win32-setup: tennix ChangeLog tennix-installer.iss
130 iscc tennix-installer.iss
132 tennixres.o: tennix.res
133 windres tennix.res tennixres.o
134 # End Windows-specific targets
136 release-bin: tennix ChangeLog
137 tar czvf tennix-$(RELEASE)-bin.tar.gz tennix $(DATAFILES) ChangeLog
139 release: distclean ChangeLog
140 mkdir -p .release-tmp/tennix-$(RELEASE)/
141 cp -rv * .release-tmp/tennix-$(RELEASE)/
142 rm -rf .release-tmp/tennix-$(RELEASE)/.git
143 tar czvf tennix-$(RELEASE).tar.gz -C .release-tmp tennix-$(RELEASE)
144 rm -rf .release-tmp
146 clean:
147 rm -f *.o tennix tennix.exe archive archive.exe dump dump.exe
148 rm -rf $(OSXAPP) tennix-*-macosx.zip
149 rm -f tennixres.o tennix-installer.iss tennix-*-win32-setup.exe
150 rm -f tennix.tnx
152 distclean: clean
153 rm -rf tennix-$(RELEASE).zip tennix-$(RELEASE)-bin.tar.gz ChangeLog .release-tmp tennix-$(RELEASE).tar.gz
155 .PHONY: distclean clean release-bin release-win32 release-win32-setup release-osx install tennixar