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