Add makefile option for update rectangles mode
[tennix.git] / makefile
blobbe2fa0e66836ca886097f9547a2df59d5de61b85
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 = nccgen -ncgcc -ncld -ncfabs
23 LD = nccld
25 RELEASE = 0.6.9
27 TARGET ?= default
29 PREFIX ?= usr/local/
30 BINARY_INSTALL_DIR ?= $(PREFIX)/bin
32 LIBS =
33 CFLAGS += -Wall -DVERSION=\"$(RELEASE)\" -O2 -pg
35 ifeq ($(UPDRECTANGLE),1)
36 CFLAGS += -DDRAW_UPDATE_RECTANGLE
37 endif
39 ifeq ($(DELUXE),1)
40 CFLAGS += -DDELUXE_EDITION
41 endif
43 ifeq ($(DEBUG),1)
44 CFLAGS += -DDEBUG
45 endif
47 ifeq ($(MAEMO),1)
48 CFLAGS += -DMAEMO -mfpu=vfp -mfloat-abi=softfp -mcpu=arm1136j-s
49 endif
51 ifeq ($(TARGET),cocoa)
52 LIBS += SDLmain.m -framework SDL -framework Cocoa -framework SDL_image -framework SDL_mixer
53 CFLAGS += -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_mixer.framework/Headers -DMACOSX
54 else
55 LIBS += $$(sdl-config --libs) -lSDL_mixer -lSDL_image
56 CFLAGS += $$(sdl-config --cflags)
57 endif
59 SRC = tennix.c game.c graphics.c input.c sound.c
60 OBJ = tennix.o game.o graphics.o input.o sound.o archive-lib.o
61 ifeq ($(MSYSTEM),MINGW32)
62 OBJ += tennixres.o
63 endif
65 TOARCHIVE=$(wildcard data/*.ogg wildcard data/*.png voice/*.ogg)
67 WIN32LIBS = *.dll
68 OSXAPP = Tennix.app
70 DATAFILES = README README.*
71 ifeq ($(TARGET),cocoa)
72 DATAFILES += data/Tennix.icns
73 endif
75 tennix: $(OBJ) tennix.tnx
76 $(CC) $(CFLAGS) -o tennix $(OBJ) $(LIBS)
77 test -f tennix.exe && upx tennix.exe || true
79 ChangeLog:
80 git log >ChangeLog
82 install: tennix
83 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
84 install -s tennix $(DESTDIR)/$(BINARY_INSTALL_DIR)/tennix
85 install tennix.6 $(DESTDIR)/$(PREFIX)/share/man/man6/tennix.6
86 install -m644 data/icon.png $(DESTDIR)/$(PREFIX)/share/pixmaps/tennix.png
87 install -m644 data/icon.svg $(DESTDIR)/$(PREFIX)/share/icons/hicolor/scalable/apps/tennix.svg
88 install -m644 tennix.desktop $(DESTDIR)/$(PREFIX)/share/applications/
90 tennix.o: tennix.c tennix.h game.h graphics.h input.h sound.h
91 graphics.o: graphics.c graphics.h tennix.h archive.h sound.h
92 game.o: game.c game.h graphics.h tennix.h sound.h input.h
93 sound.o: sound.c sound.h tennix.h archive.h graphics.h
95 archive-lib.o: archive.c archive.h
96 $(CC) -c -o $@ $<
98 tennixar: archive dump
100 archive.o: archive.c archive.h
101 $(CC) -DTENNIXAR_STANDALONE -c -o $@ $<
103 dump: archive
104 ln -s archive dump
106 tennix.tnx: archive $(TOARCHIVE)
107 rm -f tennix.tnx
108 ./archive $@ $(TOARCHIVE)
110 # Mac OS X-specific targets
111 release-osx: tennix ChangeLog
112 mkdir -p $(OSXAPP)/Contents/{MacOS,/Resources}
113 cp -rpv tennix $(OSXAPP)/Contents/MacOS/Tennix
114 cp -rpv $(DATAFILES) ChangeLog $(OSXAPP)/Contents/Resources/
115 sed -e 's/TENNIX_VERSION/$(RELEASE)/' osxapp.plist >$(OSXAPP)/Contents/Info.plist
116 echo 'APPL????' >$(OSXAPP)/Contents/PkgInfo
117 zip -r tennix-$(RELEASE)-macosx.zip $(OSXAPP)
118 # End Mac OS X-specific targets
120 # Windows-specific targets
121 release-win32: tennix ChangeLog
122 zip tennix-$(RELEASE)-win32.zip tennix.exe $(WIN32LIBS) $(DATAFILES) ChangeLog
124 tennix-installer.iss: tennix-installer.iss.in
125 sed tennix-installer.iss.in -e 's/{version}/$(RELEASE)/g' >tennix-installer.iss
127 release-win32-setup: tennix ChangeLog tennix-installer.iss
128 iscc tennix-installer.iss
130 tennixres.o: tennix.res
131 windres tennix.res tennixres.o
132 # End Windows-specific targets
134 release-bin: tennix ChangeLog
135 tar czvf tennix-$(RELEASE)-bin.tar.gz tennix $(DATAFILES) ChangeLog
137 release: distclean ChangeLog
138 mkdir -p .release-tmp/tennix-$(RELEASE)/
139 cp -rv * .release-tmp/tennix-$(RELEASE)/
140 rm -rf .release-tmp/tennix-$(RELEASE)/.git
141 tar czvf tennix-$(RELEASE).tar.gz -C .release-tmp tennix-$(RELEASE)
142 rm -rf .release-tmp
144 clean:
145 rm -f *.o tennix tennix.exe archive archive.exe dump dump.exe
146 rm -rf $(OSXAPP) tennix-*-macosx.zip
147 rm -f tennixres.o tennix-installer.iss tennix-*-win32-setup.exe
148 rm -f tennix.tnx
150 distclean: clean
151 rm -rf tennix-$(RELEASE).zip tennix-$(RELEASE)-bin.tar.gz ChangeLog .release-tmp tennix-$(RELEASE).tar.gz
153 .PHONY: distclean clean release-bin release-win32 release-win32-setup release-osx install tennixar