Tennix 0.3.4
[tennix.git] / makefile
blobc7d7df6d45d97f54491dad3b4dc762f4402d60b7
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.3.4
25 TARGET ?= default
27 LIBS =
28 CFLAGS += -Wall -DVERSION=\"$(RELEASE)\"
30 ifeq ($(DEBUG),1)
31 CFLAGS += -DDEBUG
32 endif
34 ifeq ($(TARGET),cocoa)
35 LIBS += SDLmain.m -framework SDL -framework Cocoa -framework SDL_image -framework SDL_mixer
36 CFLAGS += -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_mixer.framework/Headers -DMACOSX
37 else
38 LIBS += $$(sdl-config --libs) -lSDL_mixer -lSDL_image
39 CFLAGS += $$(sdl-config --cflags)
40 endif
42 SRC = tennix.c game.c graphics.c input.c sound.c
43 OBJ = tennix.o game.o graphics.o input.o sound.o
45 WIN32LIBS = *.dll
46 OSXAPP = Tennix.app
48 DATAFILES = README README.*
49 ifeq ($(TARGET),cocoa)
50 DATAFILES += data/Tennix.icns
51 endif
53 tennix: $(OBJ)
54 $(CC) $(CFLAGS) -o tennix $(OBJ) $(LIBS)
55 test -f tennix.exe && upx tennix.exe || true
57 tennix.o: tennix.c tennix.h game.h graphics.h input.h sound.h
58 graphics.o: graphics.c graphics.h tennix.h input.h data/graphics_data.c
59 game.o: game.c game.h graphics.h tennix.h sound.h
60 sound.o: sound.c sound.h tennix.h data/sounds_data.c
62 data/graphics_data.c:
63 make -C data graphics_data.c
65 data/sounds_data.c:
66 make -C data sounds_data.c
68 release-osx: tennix
69 mkdir -p $(OSXAPP)/Contents/{MacOS,/Resources}
70 cp -rpv tennix $(OSXAPP)/Contents/MacOS/Tennix
71 cp -rpv $(DATAFILES) $(OSXAPP)/Contents/Resources/
72 cp -rpv osxapp.plist $(OSXAPP)/Contents/Info.plist
73 echo 'APPL????' >$(OSXAPP)/Contents/PkgInfo
74 zip -r tennix-$(RELEASE)-macosx.zip $(OSXAPP)
76 release-win32: tennix
77 zip tennix-$(RELEASE)-win32.zip tennix.exe $(WIN32LIBS) $(DATAFILES)
79 release-bin: tennix
80 tar czvf tennix-$(RELEASE)-bin.tar.gz tennix $(DATAFILES)
82 clean:
83 rm -f *.o tennix{,.exe}
84 rm -rf $(OSXAPP)
85 make -C data clean
87 distclean: clean
88 rm -f tennix-$(RELEASE).zip tennix-$(RELEASE)-bin.tar.gz
90 .PHONY: distclean clean release-bin release-win32 release-osx