Tennix 0.6.1
[tennix.git] / makefile
blob1fdf512d13271382930635f9e9388fa319454c18
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.1
25 TARGET ?= default
27 PREFIX ?= usr/local/
28 BINARY_INSTALL_DIR ?= $(PREFIX)/bin
30 LIBS =
31 CFLAGS += -Wall -DVERSION=\"$(RELEASE)\"
33 ifeq ($(DEBUG),1)
34 CFLAGS += -DDEBUG
35 endif
37 ifeq ($(TARGET),cocoa)
38 LIBS += SDLmain.m -framework SDL -framework Cocoa -framework SDL_image -framework SDL_mixer
39 CFLAGS += -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_mixer.framework/Headers -DMACOSX
40 else
41 LIBS += $$(sdl-config --libs) -lSDL_mixer -lSDL_image
42 CFLAGS += $$(sdl-config --cflags)
43 endif
45 SRC = tennix.c game.c graphics.c input.c sound.c
46 OBJ = tennix.o game.o graphics.o input.o sound.o
47 ifeq ($(MSYSTEM),MINGW32)
48 OBJ += tennixres.o
49 endif
51 WIN32LIBS = *.dll
52 OSXAPP = Tennix.app
54 DATAFILES = README README.*
55 ifeq ($(TARGET),cocoa)
56 DATAFILES += data/Tennix.icns
57 endif
59 tennix: $(OBJ)
60 $(CC) $(CFLAGS) -o tennix $(OBJ) $(LIBS)
61 test -f tennix.exe && upx tennix.exe || true
63 ChangeLog:
64 git log >ChangeLog
66 install: tennix
67 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
68 install -s tennix $(DESTDIR)/$(BINARY_INSTALL_DIR)/tennix
69 install tennix.6 $(DESTDIR)/$(PREFIX)/share/man/man6/tennix.6
70 install -m644 data/icon.png $(DESTDIR)/$(PREFIX)/share/pixmaps/tennix.png
71 install -m644 data/icon.svg $(DESTDIR)/$(PREFIX)/share/icons/hicolor/scalable/apps/tennix.svg
72 install -m644 tennix.desktop $(DESTDIR)/$(PREFIX)/share/applications/
74 tennix.o: tennix.c tennix.h game.h graphics.h input.h sound.h
75 graphics.o: graphics.c graphics.h tennix.h data/graphics_data.c
76 game.o: game.c game.h graphics.h tennix.h sound.h input.h
77 sound.o: sound.c sound.h tennix.h data/sounds_data.c
79 data/graphics_data.c: data/*.png
80 make -C data graphics_data.c
82 data/sounds_data.c: data/*.ogg
83 make -C data sounds_data.c
85 # Mac OS X-specific targets
86 release-osx: tennix ChangeLog
87 mkdir -p $(OSXAPP)/Contents/{MacOS,/Resources}
88 cp -rpv tennix $(OSXAPP)/Contents/MacOS/Tennix
89 cp -rpv $(DATAFILES) ChangeLog $(OSXAPP)/Contents/Resources/
90 sed -e 's/TENNIX_VERSION/$(RELEASE)/' osxapp.plist >$(OSXAPP)/Contents/Info.plist
91 echo 'APPL????' >$(OSXAPP)/Contents/PkgInfo
92 zip -r tennix-$(RELEASE)-macosx.zip $(OSXAPP)
93 # End Mac OS X-specific targets
95 # Windows-specific targets
96 release-win32: tennix ChangeLog
97 zip tennix-$(RELEASE)-win32.zip tennix.exe $(WIN32LIBS) $(DATAFILES) ChangeLog
99 tennix-installer.iss: tennix-installer.iss.in
100 sed tennix-installer.iss.in -e 's/{version}/$(RELEASE)/g' >tennix-installer.iss
102 release-win32-setup: tennix ChangeLog tennix-installer.iss
103 iscc tennix-installer.iss
105 tennixres.o: tennix.res
106 windres tennix.res tennixres.o
107 # End Windows-specific targets
109 release-bin: tennix ChangeLog
110 tar czvf tennix-$(RELEASE)-bin.tar.gz tennix $(DATAFILES) ChangeLog
112 release: distclean ChangeLog
113 mkdir -p .release-tmp/tennix-$(RELEASE)/
114 cp -rv * .release-tmp/tennix-$(RELEASE)/
115 rm -rf .release-tmp/tennix-$(RELEASE)/.git
116 tar czvf tennix-$(RELEASE).tar.gz -C .release-tmp tennix-$(RELEASE)
117 rm -rf .release-tmp
119 clean:
120 rm -f *.o tennix tennix.exe
121 rm -rf $(OSXAPP) tennix-*-macosx.zip
122 rm -f tennixres.o tennix-installer.iss tennix-*-win32-setup.exe
123 make -C data clean
125 distclean: clean
126 rm -rf tennix-$(RELEASE).zip tennix-$(RELEASE)-bin.tar.gz ChangeLog .release-tmp tennix-$(RELEASE).tar.gz
128 .PHONY: distclean clean release-bin release-win32 release-win32-setup release-osx install