Mac OS X-specific release changes for Tennix
[tennix.git] / makefile
bloba7f07e7cae30334bc1d7dbcf8d8e475fbca581a7
3 # Tennix! SDL Port
4 # Copyright (C) 2003, 2007, 2008, 2009 Thomas Perl <thp@thpinfo.com>
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.
23 ifeq ($(MKCALLGRAPH),1)
24 CC = nccgen -ncgcc -ncld -ncfabs
25 LD = nccld
26 endif
28 RELEASE = 1.0
30 TARGET ?= default
32 PREFIX ?= /usr/local
33 BINDIR ?= $(PREFIX)/bin
34 DATAROOTDIR ?= $(PREFIX)/share
35 DATADIR ?= $(DATAROOTDIR)/games
37 LIBS =
38 CFLAGS += -std=c99 -W -Wall -ansi -pedantic -Wcast-qual -Wwrite-strings -DVERSION=\"$(RELEASE)\" -O2 -DPREFIX=\"$(PREFIX)\" -g
40 USE_PYTHON ?= 1
41 PYTHON_VERSION = 2.5
43 ifeq ($(USE_PYTHON),1)
44 CFLAGS += -I/usr/include/python$(PYTHON_VERSION)/ -DTENNIX_PYTHON
45 LIBS += -lpython$(PYTHON_VERSION)
46 endif
48 ifeq ($(NONFREE_LOCATIONS),1)
49 CFLAGS += -DNONFREE_LOCATIONS
50 endif
52 ifeq ($(UPDRECTANGLE),1)
53 CFLAGS += -DDRAW_UPDATE_RECTANGLE
54 endif
56 ifeq ($(DELUXE),1)
57 CFLAGS += -DDELUXE_EDITION
58 endif
60 ifeq ($(DEBUG),1)
61 CFLAGS += -DDEBUG
62 endif
64 ifeq ($(MAEMO),1)
65 CFLAGS += -DMAEMO
66 endif
68 ifeq ($(TARGET),cocoa)
69 LIBS += SDLmain.m -framework SDL -framework Cocoa -framework SDL_image -framework SDL_mixer -framework SDL_ttf
70 CFLAGS += -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_mixer.framework/Headers -I/Library/Frameworks/SDL_ttf.framework/Headers -DMACOSX
71 else
72 LIBS += $$(sdl-config --libs) -lSDL_mixer -lSDL_image -lSDL_ttf
73 CFLAGS += $$(sdl-config --cflags)
74 endif
76 SRC = tennix.c game.c graphics.c input.c util.c sound.c animation.c
77 OBJ = tennix.o game.o graphics.o input.o util.o sound.o animation.o archive-lib.o SDL_rotozoom.o
78 ifeq ($(MSYSTEM),MINGW32)
79 OBJ += tennixres.o
80 endif
81 ifeq ($(USE_PYTHON),1)
82 OBJ += tennixpy.o
83 endif
85 TOARCHIVE=$(wildcard data/*.ogg data/*.ttf wildcard data/*.png voice/*.ogg *.py)
87 WIN32LIBS = *.dll
88 OSXAPP = Tennix.app
90 DATAFILES = README README.*
91 ifeq ($(TARGET),cocoa)
92 DATAFILES += data/Tennix.icns
93 endif
95 tennix: $(OBJ) tennix.tnx
96 $(CC) $(CFLAGS) -o tennix $(OBJ) $(LIBS)
97 test -f tennix.exe && upx tennix.exe || true
99 ChangeLog:
100 git log >ChangeLog
102 install: tennix
103 install -d -m 755 $(DESTDIR)$(BINDIR)
104 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/pixmaps
105 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/applications
106 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/man/man6
107 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps
108 install -d -m 755 $(DESTDIR)$(DATADIR)/tennix
109 install -m 755 tennix $(DESTDIR)$(BINDIR)/
110 install -m 644 tennix.6 $(DESTDIR)$(DATAROOTDIR)/man/man6/
111 install -m 644 data/icon.png $(DESTDIR)$(DATAROOTDIR)/pixmaps/tennix.png
112 install -m 644 data/icon.svg $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps/tennix.svg
113 install -m 644 tennix.desktop $(DESTDIR)$(DATAROOTDIR)/applications/
114 install -m 644 tennix.tnx $(DESTDIR)$(DATADIR)/tennix/
116 tennix.o: tennix.c tennix.h game.h graphics.h input.h util.h animation.h sound.h locations.h util.h
117 graphics.o: graphics.c graphics.h tennix.h archive.h sound.h
118 game.o: game.c game.h graphics.h tennix.h sound.h input.h util.h
119 sound.o: sound.c sound.h tennix.h archive.h graphics.h
120 input.o: input.c input.h tennix.h graphics.h game.h util.h tennixpy.h
121 util.o: util.c util.h tennix.h
122 animation.o: animation.c animation.h graphics.h tennix.h credits.h
123 tennixpy.o: tennix.c tennix.h game.h archive.h
124 SDL_rotozoom.o: SDL_rotozoom.c SDL_rotozoom.h
126 archive-lib.o: archive.c archive.h
127 $(CC) -c -o $@ $<
129 tennixar: archive dump
131 archive.o: archive.c archive.h
132 $(CC) $(CFLAGS) -DTENNIXAR_STANDALONE -c -o $@ $<
134 dump: archive
135 ln -s archive dump
137 tennix.tnx: archive $(TOARCHIVE)
138 rm -f tennix.tnx
139 ./archive $@ $(TOARCHIVE)
141 # Mac OS X-specific targets
142 release-osx: tennix tennix.tnx ChangeLog
143 mkdir -p $(OSXAPP)/Contents/{MacOS,/Resources}
144 cp -rpv tennix $(OSXAPP)/Contents/MacOS/Tennix
145 cp -rpv tennix.tnx $(DATAFILES) ChangeLog $(OSXAPP)/Contents/Resources/
146 sed -e 's/TENNIX_VERSION/$(RELEASE)/' osxapp.plist >$(OSXAPP)/Contents/Info.plist
147 echo 'APPL????' >$(OSXAPP)/Contents/PkgInfo
148 zip -r tennix-$(RELEASE)-macosx.zip $(OSXAPP)
149 # End Mac OS X-specific targets
151 # Windows-specific targets
152 release-win32: tennix ChangeLog
153 zip tennix-$(RELEASE)-win32.zip tennix.exe $(WIN32LIBS) $(DATAFILES) ChangeLog
155 tennix-installer.iss: tennix-installer.iss.in
156 sed tennix-installer.iss.in -e 's/{version}/$(RELEASE)/g' >tennix-installer.iss
158 release-win32-setup: tennix ChangeLog tennix-installer.iss
159 iscc tennix-installer.iss
161 tennixres.o: tennix.res
162 windres tennix.res tennixres.o
163 # End Windows-specific targets
165 release-bin: tennix ChangeLog
166 tar czvf tennix-$(RELEASE)-bin.tar.gz tennix $(DATAFILES) ChangeLog
168 release: distclean ChangeLog
169 mkdir -p .release-tmp/tennix-$(RELEASE)/
170 cp -rv * .release-tmp/tennix-$(RELEASE)/
171 rm -rf .release-tmp/tennix-$(RELEASE)/.git
172 tar czvf tennix-$(RELEASE).tar.gz -C .release-tmp tennix-$(RELEASE)
173 rm -rf .release-tmp
175 clean:
176 rm -f *.o tennix tennix.exe archive archive.exe dump dump.exe
177 rm -rf $(OSXAPP) tennix-*-macosx.zip
178 rm -f tennixres.o tennix-installer.iss tennix-*-win32-setup.exe
179 rm -f tennix.tnx
181 distclean: clean
182 rm -rf tennix-$(RELEASE).zip tennix-$(RELEASE)-bin.tar.gz ChangeLog .release-tmp tennix-$(RELEASE).tar.gz
184 .PHONY: distclean clean release-bin release-win32 release-win32-setup release-osx install tennixar