Use Tennix Archive Format instead in-executable data
[tennix.git] / makefile
blob5707452ce2d3773731797b06d4eb489fe72eb20a
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 ($(DELUXE),1)
34 CFLAGS += -DDELUXE_EDITION
35 endif
37 ifeq ($(DEBUG),1)
38 CFLAGS += -DDEBUG
39 endif
41 ifeq ($(MAEMO),1)
42 CFLAGS += -DMAEMO
43 endif
45 ifeq ($(TARGET),cocoa)
46 LIBS += SDLmain.m -framework SDL -framework Cocoa -framework SDL_image -framework SDL_mixer
47 CFLAGS += -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_mixer.framework/Headers -DMACOSX
48 else
49 LIBS += $$(sdl-config --libs) -lSDL_mixer -lSDL_image
50 CFLAGS += $$(sdl-config --cflags)
51 endif
53 SRC = tennix.c game.c graphics.c input.c sound.c
54 OBJ = tennix.o game.o graphics.o input.o sound.o archive-lib.o
55 ifeq ($(MSYSTEM),MINGW32)
56 OBJ += tennixres.o
57 endif
59 TOARCHIVE=$(wildcard data/*.ogg wildcard data/*.png voice/*.ogg)
61 WIN32LIBS = *.dll
62 OSXAPP = Tennix.app
64 DATAFILES = README README.*
65 ifeq ($(TARGET),cocoa)
66 DATAFILES += data/Tennix.icns
67 endif
69 tennix: $(OBJ) tennix.tnx
70 $(CC) $(CFLAGS) -o tennix $(OBJ) $(LIBS)
71 test -f tennix.exe && upx tennix.exe || true
73 ChangeLog:
74 git log >ChangeLog
76 install: tennix
77 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
78 install -s tennix $(DESTDIR)/$(BINARY_INSTALL_DIR)/tennix
79 install tennix.6 $(DESTDIR)/$(PREFIX)/share/man/man6/tennix.6
80 install -m644 data/icon.png $(DESTDIR)/$(PREFIX)/share/pixmaps/tennix.png
81 install -m644 data/icon.svg $(DESTDIR)/$(PREFIX)/share/icons/hicolor/scalable/apps/tennix.svg
82 install -m644 tennix.desktop $(DESTDIR)/$(PREFIX)/share/applications/
84 tennix.o: tennix.c tennix.h game.h graphics.h input.h sound.h
85 graphics.o: graphics.c graphics.h tennix.h archive.h
86 game.o: game.c game.h graphics.h tennix.h sound.h input.h
87 sound.o: sound.c sound.h tennix.h archive.h
89 archive-lib.o: archive.c archive.h
90 $(CC) -c -o $@ $<
92 tennixar: archive dump
94 archive.o: archive.c archive.h
95 $(CC) -DTENNIXAR_STANDALONE -c -o $@ $<
97 dump: archive
98 ln -s archive dump
100 tennix.tnx: archive $(TOARCHIVE)
101 rm -f tennix.tnx
102 ./archive $@ $(TOARCHIVE)
104 # Mac OS X-specific targets
105 release-osx: tennix ChangeLog
106 mkdir -p $(OSXAPP)/Contents/{MacOS,/Resources}
107 cp -rpv tennix $(OSXAPP)/Contents/MacOS/Tennix
108 cp -rpv $(DATAFILES) ChangeLog $(OSXAPP)/Contents/Resources/
109 sed -e 's/TENNIX_VERSION/$(RELEASE)/' osxapp.plist >$(OSXAPP)/Contents/Info.plist
110 echo 'APPL????' >$(OSXAPP)/Contents/PkgInfo
111 zip -r tennix-$(RELEASE)-macosx.zip $(OSXAPP)
112 # End Mac OS X-specific targets
114 # Windows-specific targets
115 release-win32: tennix ChangeLog
116 zip tennix-$(RELEASE)-win32.zip tennix.exe $(WIN32LIBS) $(DATAFILES) ChangeLog
118 tennix-installer.iss: tennix-installer.iss.in
119 sed tennix-installer.iss.in -e 's/{version}/$(RELEASE)/g' >tennix-installer.iss
121 release-win32-setup: tennix ChangeLog tennix-installer.iss
122 iscc tennix-installer.iss
124 tennixres.o: tennix.res
125 windres tennix.res tennixres.o
126 # End Windows-specific targets
128 release-bin: tennix ChangeLog
129 tar czvf tennix-$(RELEASE)-bin.tar.gz tennix $(DATAFILES) ChangeLog
131 release: distclean ChangeLog
132 mkdir -p .release-tmp/tennix-$(RELEASE)/
133 cp -rv * .release-tmp/tennix-$(RELEASE)/
134 rm -rf .release-tmp/tennix-$(RELEASE)/.git
135 tar czvf tennix-$(RELEASE).tar.gz -C .release-tmp tennix-$(RELEASE)
136 rm -rf .release-tmp
138 clean:
139 rm -f *.o tennix tennix.exe archive archive.exe dump dump.exe
140 rm -rf $(OSXAPP) tennix-*-macosx.zip
141 rm -f tennixres.o tennix-installer.iss tennix-*-win32-setup.exe
142 rm -f tennix.tnx
144 distclean: clean
145 rm -rf tennix-$(RELEASE).zip tennix-$(RELEASE)-bin.tar.gz ChangeLog .release-tmp tennix-$(RELEASE).tar.gz
147 .PHONY: distclean clean release-bin release-win32 release-win32-setup release-osx install tennixar