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