Remove trailing whitespace from source code.
[neverball] / Makefile
1
2 #------------------------------------------------------------------------------
3
4 # Maybe you need one of these.  Maybe you don't.
5
6 #X11_PATH= -L/usr/X11/lib
7 #X11_PATH= -L/usr/X11R6/lib
8
9 OGL_LIBS= -lGL -lm
10 #OGL_LIBS= -lm                                                # Think Different
11
12 #------------------------------------------------------------------------------
13 # Configuration constants
14 #------------------------------------------------------------------------------
15
16 CFLAGS= -Wall -g -O3 -ansi -pedantic $(shell sdl-config --cflags)
17 #CFLAGS= -Wall -g -O1 -ansi -pedantic $(shell sdl-config --cflags)
18 #CFLAGS= -Wall -pg -ansi $(shell sdl-config --cflags)
19
20 SDL_LIBS= $(shell sdl-config --libs)
21 FT2_LIBS= $(shell freetype-config --libs)
22
23 MAPC_TARG= mapc
24 MAPC_EXEC = ./$(MAPC_TARG)
25 BALL_TARG= neverball
26 PUTT_TARG= neverputt
27
28 LOCALEDIR= locale
29 LOCALEDOM= neverball
30
31 POTFILE= po/neverball.pot
32
33 #-------------------------------------------------------------------------------
34
35 MAPC_OBJS= \
36         share/vec3.o   \
37         share/base_image.o  \
38         share/solid.o  \
39         share/binary.o \
40         share/base_config.o \
41         share/mapc.o
42 BALL_OBJS= \
43         share/i18n.o    \
44         share/st_lang.o \
45         share/st_resol.o \
46         share/vec3.o    \
47         share/base_image.o   \
48         share/image.o   \
49         share/solid.o   \
50         share/solid_gl.o\
51         share/part.o    \
52         share/back.o    \
53         share/geom.o    \
54         share/gui.o     \
55         share/base_config.o  \
56         share/config.o  \
57         share/binary.o  \
58         share/state.o   \
59         share/audio.o   \
60         ball/hud.o      \
61         ball/game.o     \
62         ball/level.o    \
63         ball/levels.o   \
64         ball/set.o      \
65         ball/demo.o     \
66         ball/util.o     \
67         ball/st_conf.o  \
68         ball/st_demo.o  \
69         ball/st_save.o  \
70         ball/st_play_end.o  \
71         ball/st_done.o  \
72         ball/st_level.o \
73         ball/st_over.o  \
74         ball/st_play.o  \
75         ball/st_set.o   \
76         ball/st_start.o \
77         ball/st_title.o \
78         ball/st_help.o  \
79         ball/st_name.o  \
80         ball/st_shared.o  \
81         ball/main.o
82 PUTT_OBJS= \
83         share/i18n.o    \
84         share/st_lang.o \
85         share/st_resol.o \
86         share/vec3.o   \
87         share/base_image.o  \
88         share/image.o  \
89         share/solid.o  \
90         share/solid_gl.o  \
91         share/part.o   \
92         share/geom.o   \
93         share/back.o   \
94         share/base_config.o  \
95         share/config.o \
96         share/binary.o \
97         share/audio.o  \
98         share/state.o  \
99         share/gui.o    \
100         putt/hud.o     \
101         putt/game.o    \
102         putt/hole.o    \
103         putt/course.o  \
104         putt/st_all.o  \
105         putt/st_conf.o \
106         putt/main.o
107
108 BALL_DEPS= $(BALL_OBJS:.o=.d)
109 PUTT_DEPS= $(PUTT_OBJS:.o=.d)
110 MAPC_DEPS= $(MAPC_OBJS:.o=.d)
111
112 BASE_LIBS= $(SDL_LIBS) -lSDL_image
113 LIBS= $(X11_PATH) $(BASE_LIBS) -lSDL_ttf -lSDL_mixer $(FT2_LIBS) $(OGL_LIBS)
114
115 MESSAGEPART= /LC_MESSAGES/$(LOCALEDOM).mo
116 MESSAGES= $(LINGUAS:%=$(LOCALEDIR)/%$(MESSAGEPART))
117
118 MAPS= $(shell find data/ -name '*.map')
119 SOLS= $(MAPS:%.map=%.sol)
120
121 POS= $(shell echo po/*.po)
122 LINGUAS= $(POS:po/%.po=%)
123
124 #------------------------------------------------------------------------------
125 # Implicit rules
126 #------------------------------------------------------------------------------
127
128 %.d : %.c
129         $(CC) $(CFLAGS) -Ishare -MM -MF $@ -MT '$*.o $@' $<
130
131 %.o : %.c
132         $(CC) $(CFLAGS) -Ishare -o $@ -c $<
133
134 %.sol : %.map $(MAPC_TARG)
135         $(MAPC_EXEC) $< data
136
137 $(LOCALEDIR)/%$(MESSAGEPART) : po/%.po
138         mkdir -p `dirname $@`
139         msgfmt -c -v -o $@ $<
140
141 #------------------------------------------------------------------------------
142 # Main rules
143 #------------------------------------------------------------------------------
144
145 all : $(BALL_TARG) $(PUTT_TARG) $(MAPC_TARG) sols locales
146
147 $(BALL_TARG) : $(BALL_OBJS)
148         $(CC) $(CFLAGS) -o $(BALL_TARG) $(BALL_OBJS) $(LIBS)
149
150 $(PUTT_TARG) : $(PUTT_OBJS)
151         $(CC) $(CFLAGS) -o $(PUTT_TARG) $(PUTT_OBJS) $(LIBS)
152
153 $(MAPC_TARG) : $(MAPC_OBJS)
154         $(CC) $(CFLAGS) -o $(MAPC_TARG) $(MAPC_OBJS) $(BASE_LIBS)
155
156 sols : $(SOLS)
157
158 locales : $(MESSAGES)
159
160 clean-src :
161         rm -f $(BALL_TARG) $(BALL_OBJS) $(BALL_DEPS)
162         rm -f $(PUTT_TARG) $(PUTT_OBJS) $(PUTT_DEPS)
163         rm -f $(MAPC_TARG) $(MAPC_OBJS) $(MAPC_DEPS)
164
165 clean : clean-src
166         rm -f $(SOLS)
167         rm -rf $(LOCALEDIR)
168
169 test : all
170         ./neverball
171
172 #------------------------------------------------------------------------------
173 # PO update rules
174 #------------------------------------------------------------------------------
175
176 po/%.po : $(POTFILE)
177         msgmerge -U $@ $<
178         touch $@
179         
180 po-update-extract :
181         bash extractpo.sh $(POTFILE) $(LOCALEDOM)
182
183 po-update-merge : $(POS)
184
185 po-update : po-update-extract po-update-merge
186
187 #------------------------------------------------------------------------------
188
189 .PHONY : all sols locales clean-src clean test \
190         po-update-extract po-update-merge po-update
191
192 -include $(BALL_DEPS) $(PUTT_DEPS) $(MAPC_DEPS)