Initial revision
[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.0
8
9 # April 11, 2000 - December 26, 2000
10
11
12 # User-definable stuff:
13
14 DATA_PREFIX=$(PWD)/data
15 JOY=YES
16
17
18 # Defaults for Linux:
19
20 TARGET=supertux
21 TARGET_DEF=LINUX
22
23
24 CFLAGS=-Wall -O2 $(SDL_CFLAGS) -DDATA_PREFIX=\"$(DATA_PREFIX)\" \
25         -D$(NOSOUNDFLAG) -D$(TARGET_DEF) -DJOY_$(JOY)
26
27
28 # Other definitions:
29
30 SDL_MIXER=-lSDL_mixer
31 SDL_IMAGE=-lSDL_image
32 NOSOUNDFLAG=__SOUND
33 SDL_LIB=$(SDL_LDFLAGS) $(SDL_MIXER) $(SDL_IMAGE)
34 SDL_CFLAGS := $(shell sdl-config --cflags)
35 SDL_LDFLAGS := $(shell sdl-config --libs)
36 installbin = install -g root -o root -m 755 
37 installdat = install -g root -o root -m 644
38
39
40 OBJECTS=obj/supertux.o obj/setup.o obj/intro.o obj/title.o obj/gameloop.o \
41         obj/screen.o obj/sound.o
42
43 # Make commands:
44
45 all:    $(TARGET)
46
47 #install: $(TARGET)
48 #       -$(installdat) data $(DESTDIR)/usr/share/games/$(TARGET)/data
49 #       -$(installbin) $(TARGET) $(DESTDIR)/usr/games/
50
51
52 nosound:
53         make supertux SDL_MIXER= NOSOUNDFLAG=NOSOUND
54
55 win32:
56         make TARGET_DEF=WIN32 TARGET=supertux.exe \
57                 DATA_PREFIX=data
58         cp /usr/local/cross-tools/i386-mingw32/lib/SDL*.dll .
59         chmod 644 SDL*.dll
60
61 clean:
62         -rm supertux supertux.exe
63         -rm obj/*.o
64         -rm SDL*.dll
65
66
67 # Main executable:
68
69 $(TARGET):      $(OBJECTS)
70         $(CC) $(CFLAGS) $(OBJECTS) -o $(TARGET) $(SDL_LIB)
71
72
73 # Objects:
74
75 obj/supertux.o: src/supertux.c src/defines.h src/globals.h \
76                 src/setup.h src/intro.h src/title.h src/gameloop.h \
77                 src/screen.h src/sound.h
78         $(CC) $(CFLAGS) src/supertux.c -c -o obj/supertux.o
79
80 obj/setup.o:    src/setup.c src/setup.h \
81                 src/defines.h src/globals.h src/screen.h
82         $(CC) $(CFLAGS) src/setup.c -c -o obj/setup.o
83
84 obj/intro.o:    src/intro.c src/intro.h \
85                 src/defines.h src/globals.h src/screen.h
86         $(CC) $(CFLAGS) src/intro.c -c -o obj/intro.o
87
88 obj/title.o:    src/title.c src/title.h \
89                 src/defines.h src/globals.h src/screen.h
90         $(CC) $(CFLAGS) src/title.c -c -o obj/title.o
91
92 obj/gameloop.o: src/gameloop.c src/gameloop.h \
93                 src/defines.h src/globals.h src/screen.h src/sound.h \
94                 src/setup.h
95         $(CC) $(CFLAGS) src/gameloop.c -c -o obj/gameloop.o
96
97 obj/screen.o:   src/screen.c src/defines.h src/globals.h src/screen.h
98         $(CC) $(CFLAGS) src/screen.c -c -o obj/screen.o
99
100 obj/sound.o:    src/sound.c src/defines.h src/globals.h src/sound.h
101         $(CC) $(CFLAGS) src/sound.c -c -o obj/sound.o