Tennix 0.4.2
[tennix.git] / makefile
blob24512051dcbd7aac1266982454c46f97249878a1
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.4.2
25 TARGET ?= default
27 PREFIX ?= usr/local/
29 LIBS =
30 CFLAGS += -Wall -DVERSION=\"$(RELEASE)\"
32 ifeq ($(DEBUG),1)
33 CFLAGS += -DDEBUG
34 endif
36 ifeq ($(TARGET),cocoa)
37 LIBS += SDLmain.m -framework SDL -framework Cocoa -framework SDL_image -framework SDL_mixer
38 CFLAGS += -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_mixer.framework/Headers -DMACOSX
39 else
40 LIBS += $$(sdl-config --libs) -lSDL_mixer -lSDL_image
41 CFLAGS += $$(sdl-config --cflags)
42 endif
44 SRC = tennix.c game.c graphics.c input.c sound.c
45 OBJ = tennix.o game.o graphics.o input.o sound.o
47 WIN32LIBS = *.dll
48 OSXAPP = Tennix.app
50 DATAFILES = README README.*
51 ifeq ($(TARGET),cocoa)
52 DATAFILES += data/Tennix.icns
53 endif
55 tennix: $(OBJ)
56 $(CC) $(CFLAGS) -o tennix $(OBJ) $(LIBS)
57 test -f tennix.exe && upx tennix.exe || true
59 install: tennix
60 install -d $(DESTDIR)/$(PREFIX)/bin $(DESTDIR)/$(PREFIX)/share/pixmaps $(DESTDIR)/$(PREFIX)/share/applications
61 install -s tennix $(DESTDIR)/$(PREFIX)/bin/tennix
62 install -m644 data/icon.png $(DESTDIR)/$(PREFIX)/share/pixmaps/tennix.png
63 install -m644 tennix.desktop $(DESTDIR)/$(PREFIX)/share/applications/
65 tennix.o: tennix.c tennix.h game.h graphics.h input.h sound.h
66 graphics.o: graphics.c graphics.h tennix.h input.h data/graphics_data.c
67 game.o: game.c game.h graphics.h tennix.h sound.h
68 sound.o: sound.c sound.h tennix.h data/sounds_data.c
70 data/graphics_data.c: data/*.png
71 make -C data graphics_data.c
73 data/sounds_data.c: data/*.wav
74 make -C data sounds_data.c
76 release-osx: tennix
77 mkdir -p $(OSXAPP)/Contents/{MacOS,/Resources}
78 cp -rpv tennix $(OSXAPP)/Contents/MacOS/Tennix
79 cp -rpv $(DATAFILES) $(OSXAPP)/Contents/Resources/
80 cp -rpv osxapp.plist $(OSXAPP)/Contents/Info.plist
81 echo 'APPL????' >$(OSXAPP)/Contents/PkgInfo
82 zip -r tennix-$(RELEASE)-macosx.zip $(OSXAPP)
84 release-win32: tennix
85 zip tennix-$(RELEASE)-win32.zip tennix.exe $(WIN32LIBS) $(DATAFILES)
87 release-bin: tennix
88 tar czvf tennix-$(RELEASE)-bin.tar.gz tennix $(DATAFILES)
90 clean:
91 rm -f *.o tennix{,.exe}
92 rm -rf $(OSXAPP)
93 make -C data clean
95 distclean: clean
96 rm -f tennix-$(RELEASE).zip tennix-$(RELEASE)-bin.tar.gz
98 .PHONY: distclean clean release-bin release-win32 release-osx install