e9c2ae156194427a41a8eab582bdd68bd246ab6e
[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/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/image.o   \
48         share/solid.o   \
49         share/part.o    \
50         share/back.o    \
51         share/geom.o    \
52         share/gui.o     \
53         share/base_config.o  \
54         share/config.o  \
55         share/binary.o  \
56         share/state.o   \
57         share/audio.o   \
58         ball/hud.o      \
59         ball/game.o     \
60         ball/level.o    \
61         ball/levels.o   \
62         ball/set.o      \
63         ball/demo.o     \
64         ball/util.o     \
65         ball/st_conf.o  \
66         ball/st_demo.o  \
67         ball/st_save.o  \
68         ball/st_fail.o  \
69         ball/st_goal.o  \
70         ball/st_done.o  \
71         ball/st_level.o \
72         ball/st_over.o  \
73         ball/st_play.o  \
74         ball/st_set.o   \
75         ball/st_start.o \
76         ball/st_title.o \
77         ball/st_name.o  \
78         ball/st_shared.o  \
79         ball/main.o
80 PUTT_OBJS= \
81         share/i18n.o    \
82         share/st_lang.o \
83         share/st_resol.o \
84         share/vec3.o   \
85         share/image.o  \
86         share/solid.o  \
87         share/part.o   \
88         share/geom.o   \
89         share/back.o   \
90         share/base_config.o  \
91         share/config.o \
92         share/binary.o \
93         share/audio.o  \
94         share/state.o  \
95         share/gui.o    \
96         putt/hud.o     \
97         putt/game.o    \
98         putt/hole.o    \
99         putt/course.o  \
100         putt/st_all.o  \
101         putt/st_conf.o \
102         putt/main.o
103
104 BALL_DEPS= $(BALL_OBJS:.o=.d)
105 PUTT_DEPS= $(PUTT_OBJS:.o=.d)
106 MAPC_DEPS= $(MAPC_OBJS:.o=.d)
107
108 LIBS= $(X11_PATH) $(SDL_LIBS) -lSDL_image -lSDL_ttf -lSDL_mixer $(FT2_LIBS) $(OGL_LIBS)
109
110 MESSAGEPART= /LC_MESSAGES/$(LOCALEDOM).mo
111 MESSAGES= $(LINGUAS:%=$(LOCALEDIR)/%$(MESSAGEPART))
112
113 MAPS= $(shell find data/ -name '*.map')
114 SOLS= $(MAPS:%.map=%.sol)
115
116 POS= $(shell echo po/*.po)
117 LINGUAS= $(POS:po/%.po=%)
118
119 #------------------------------------------------------------------------------
120 # Implicit rules
121 #------------------------------------------------------------------------------
122
123 %.d : %.c
124         $(CC) $(CFLAGS) -Ishare -MM -MF $@ $<
125
126 %.o : %.c
127         $(CC) $(CFLAGS) -Ishare -o $@ -c $<
128
129 %.sol : %.map $(MAPC_TARG)
130         $(MAPC_EXEC) $< data
131
132 $(LOCALEDIR)/%$(MESSAGEPART) : po/%.po
133         mkdir -p `dirname $@`
134         msgfmt -c -v -o $@ $<
135
136 #------------------------------------------------------------------------------
137 # Main rules
138 #------------------------------------------------------------------------------
139
140 all : $(BALL_TARG) $(PUTT_TARG) $(MAPC_TARG) sols locales
141
142 $(BALL_TARG) : $(BALL_OBJS)
143         $(CC) $(CFLAGS) -o $(BALL_TARG) $(BALL_OBJS) $(LIBS)
144
145 $(PUTT_TARG) : $(PUTT_OBJS)
146         $(CC) $(CFLAGS) -o $(PUTT_TARG) $(PUTT_OBJS) $(LIBS)
147
148 $(MAPC_TARG) : $(MAPC_OBJS)
149         $(CC) $(CFLAGS) -o $(MAPC_TARG) $(MAPC_OBJS) $(LIBS)
150
151 sols : $(SOLS)
152
153 locales : $(MESSAGES)
154
155 clean-src :
156         rm -f $(BALL_TARG) $(BALL_OBJS) $(BALL_DEPS)
157         rm -f $(PUTT_TARG) $(PUTT_OBJS) $(PUTT_DEPS)
158         rm -f $(MAPC_TARG) $(MAPC_OBJS) $(MAPC_DEPS)
159
160 clean : clean-src
161         rm -f $(SOLS)
162         rm -rf $(LOCALEDIR)
163
164 test : all
165         ./neverball
166
167 #------------------------------------------------------------------------------
168 # PO update rules
169 #------------------------------------------------------------------------------
170
171 po/%.po : $(POTFILE)
172         msgmerge -U $@ $<
173         touch $@
174         
175 po-update-extract :
176         bash extractpo.sh $(POTFILE) $(LOCALEDOM)
177
178 po-update-merge : $(POS)
179
180 po-update : po-update-extract po-update-merge
181
182 #------------------------------------------------------------------------------