Added high score code by Adam Czachorowski.
[supertux.git] / Makefile
1 # Makefile for supertux
2
3 # by Bill Kendrick
4 # bill@newbreedsoftware.com
5 # http://www.newbreedsoftware.com/
6
7 # Version 0.0.5
8
9 # April 11, 2000 - December 10, 2003
10
11
12 # User-definable stuff:
13
14 PREFIX=/usr/local/
15 DATA_PREFIX=$(PREFIX)supertux/
16 JOY=YES
17
18
19 # Defaults for Linux:
20
21 TARGET=supertux
22 TARGET_DEF=LINUX
23
24
25 CFLAGS=-Wall -O2 $(SDL_CFLAGS) -DDATA_PREFIX=\"$(DATA_PREFIX)\" \
26         -D$(NOSOUNDFLAG) -D$(TARGET_DEF) -DJOY_$(JOY)
27
28
29 # Other definitions:
30
31 SDL_MIXER=-lSDL_mixer
32 SDL_IMAGE=-lSDL_image
33 NOSOUNDFLAG=__SOUND
34 SDL_LIB=$(SDL_LDFLAGS) $(SDL_MIXER) $(SDL_IMAGE)
35 SDL_CFLAGS := $(shell sdl-config --cflags)
36 SDL_LDFLAGS := $(shell sdl-config --libs)
37 installbin = install -g root -o root -m 755 
38 installdat = install -g root -o root -m 644
39
40
41 OBJECTS=obj/supertux.o obj/setup.o obj/intro.o obj/title.o obj/gameloop.o \
42         obj/screen.o obj/sound.o obj/high_scores.o
43
44 # Make commands:
45
46 all:    $(TARGET)
47
48 install: $(TARGET)
49         -mkdir -p $(DATA_PREFIX)
50         cp -R data/* $(DATA_PREFIX)
51         chown -R root.root $(DATA_PREFIX)
52         chmod -R a+rX $(DATA_PREFIX)
53         cp $(TARGET) $(PREFIX)bin/
54         chown root.root $(PREFIX)bin/$(TARGET)
55         chmod a+rx $(PREFIX)bin/$(TARGET)
56
57
58 nosound:
59         make supertux SDL_MIXER= NOSOUNDFLAG=NOSOUND
60
61 win32:
62         make TARGET_DEF=WIN32 TARGET=supertux.exe \
63                 DATA_PREFIX=data
64         cp /usr/local/cross-tools/i386-mingw32/lib/SDL*.dll .
65         chmod 644 SDL*.dll
66
67 clean:
68         -rm supertux supertux.exe
69         -rm obj/*.o
70         -rm SDL*.dll
71
72
73 # Main executable:
74
75 $(TARGET):      $(OBJECTS)
76         $(CC) $(CFLAGS) $(OBJECTS) -o $(TARGET) $(SDL_LIB)
77
78
79 # Objects:
80
81 obj/supertux.o: src/supertux.c src/defines.h src/globals.h \
82                 src/setup.h src/intro.h src/title.h src/gameloop.h \
83                 src/screen.h src/sound.h
84         $(CC) $(CFLAGS) src/supertux.c -c -o obj/supertux.o
85
86 obj/setup.o:    src/setup.c src/setup.h \
87                 src/defines.h src/globals.h src/screen.h
88         $(CC) $(CFLAGS) src/setup.c -c -o obj/setup.o
89
90 obj/intro.o:    src/intro.c src/intro.h \
91                 src/defines.h src/globals.h src/screen.h
92         $(CC) $(CFLAGS) src/intro.c -c -o obj/intro.o
93
94 obj/title.o:    src/title.c src/title.h \
95                 src/defines.h src/globals.h src/screen.h
96         $(CC) $(CFLAGS) src/title.c -c -o obj/title.o
97
98 obj/gameloop.o: src/gameloop.c src/gameloop.h \
99                 src/defines.h src/globals.h src/screen.h src/sound.h \
100                 src/setup.h
101         $(CC) $(CFLAGS) src/gameloop.c -c -o obj/gameloop.o
102
103 obj/screen.o:   src/screen.c src/defines.h src/globals.h src/screen.h
104         $(CC) $(CFLAGS) src/screen.c -c -o obj/screen.o
105
106 obj/sound.o:    src/sound.c src/defines.h src/globals.h src/sound.h
107         $(CC) $(CFLAGS) src/sound.c -c -o obj/sound.o
108
109 obj/high_scores.o:      src/high_scores.c src/defines.h src/globals.h \
110                         src/sound.h
111         $(CC) $(CFLAGS) src/high_scores.c -c -o obj/high_scores.o
112