1# NOTE: This Makefile requires GNU make
2# Location to put the targets.
3TARGETBINDIR = .
4TARGETLIBDIR = .
5# DLL version information. Currently this must be updated manually.
6# Fields are: major, minor, build number, QFE version
7VERSION_FIELD = 1,0,0,0
8VERSION_STRING = \\\"1.0\\\"
9# Name of the targets
10# Hooray for Windows DLL hell.
11LIBTHEORAENC_TARGET = libtheoraenc.dll
12LIBTHEORAENCD_TARGET = libtheoraencd.dll
13LIBTHEORAENC70_TARGET = libtheoraenc70.dll
14LIBTHEORAENC70D_TARGET = libtheoraenc70d.dll
15LIBTHEORAENC71_TARGET = libtheoraenc71.dll
16LIBTHEORAENC71D_TARGET = libtheoraenc71d.dll
17LIBTHEORAENC80_TARGET = libtheoraenc80.dll
18LIBTHEORAENC80D_TARGET = libtheoraenc80d.dll
19
20LIBTHEORADEC_TARGET = libtheoradec.dll
21LIBTHEORADECD_TARGET = libtheoradecd.dll
22LIBTHEORADEC70_TARGET = libtheoradec70.dll
23LIBTHEORADEC70D_TARGET = libtheoradec70d.dll
24LIBTHEORADEC71_TARGET = libtheoradec71.dll
25LIBTHEORADEC71D_TARGET = libtheoradec71d.dll
26LIBTHEORADEC80_TARGET = libtheoradec80.dll
27LIBTHEORADEC80D_TARGET = libtheoradec80d.dll
28
29DUMP_VIDEO_TARGET = dump_video.exe
30PLAYER_EXAMPLE_TARGET = player_example.exe
31ENCODER_EXAMPLE_TARGET = encoder_example.exe
32
33# The compiler tools to use
34# The is no standard mingw prefix, so try to guess
35MINGW_PREFIX := $(or $(strip $(foreach exeprefix, \
36	i686-mingw32 i686-pc-mingw32 i586-mingw32msvc i386-mingw32 \
37	no-mingw32, \
38	$(if $(shell which $(exeprefix)-gcc 2>/dev/null), $(exeprefix) ))))
39CC = $(MINGW_PREFIX)-gcc
40RC = $(MINGW_PREFIX)-windres
41DLLTOOL = $(MINGW_PREFIX)-dlltool
42LD = $(MINGW_PREFIX)-ld
43SDLCONFIG = $(MINGW_PREFIX)-sdl-config
44# The command to use to generate dependency information
45MAKEDEPEND = ${CC} -MM
46#MAKEDEPEND = makedepend -f- -Y --
47
48# The location of include files.
49# Modify these to point to your Ogg and Vorbis include directories if they are
50#  not installed in a standard location.
51CINCLUDE = -D_REENTRANT
52# Extra compilation flags.
53# You may get speed increases by including flags such as -O2 or -O3 or
54#  -ffast-math, or additional flags, depending on your system and compiler.
55# The correct -march=<architecture> flag will also generate much better code
56#  on newer architectures.
57CFLAGS = -Wall -Wno-parentheses -DOC_X86_ASM
58RELEASE_CFLAGS = ${CFLAGS} -mtune=native -O3 -fomit-frame-pointer -fforce-addr \
59 -finline-functions
60# The -g flag will generally include debugging information.
61DEBUG_CFLAGS = ${CFLAGS} -g
62# Libraries to link with, and the location of library files.
63LIBS = -logg -lvorbis -lvorbisenc
64
65# ANYTHING BELOW THIS LINE PROBABLY DOES NOT NEED EDITING
66CINCLUDE := -I../../include ${CINCLUDE}
67LIBSRCDIR = ../../lib
68BINSRCDIR = ../../examples
69WORKDIR = objs
70
71# C source file lists
72
73LIBTHEORADEC_CSOURCES = \
74apiwrapper.c \
75bitpack.c \
76decapiwrapper.c \
77decinfo.c \
78decode.c \
79dequant.c \
80fragment.c \
81huffdec.c \
82idct.c \
83info.c \
84internal.c \
85quant.c \
86state.c \
87$(if $(findstring -DOC_X86_ASM,${CFLAGS}), \
88x86/mmxidct.c \
89x86/mmxfrag.c \
90x86/mmxstate.c \
91x86/x86state.c \
92)
93
94LIBTHEORAENC_CSOURCES = \
95apiwrapper.c \
96fragment.c \
97idct.c \
98internal.c \
99state.c \
100quant.c \
101analyze.c \
102fdct.c \
103encfrag.c \
104encapiwrapper.c \
105encinfo.c \
106encode.c \
107enquant.c \
108huffenc.c \
109mathops.c \
110mcenc.c \
111rate.c \
112tokenize.c \
113$(if $(findstring -DOC_X86_ASM,${CFLAGS}), \
114x86/mmxfrag.c \
115x86/mmxidct.c \
116x86/mmxstate.c \
117x86/x86state.c \
118x86/mmxencfrag.c \
119x86/mmxfdct.c \
120x86/x86enc.c \
121)
122
123
124DUMP_VIDEO_CSOURCES = dump_video.c
125ENCODER_EXAMPLE_CSOURCES = encoder_example.c
126PLAYER_EXAMPLE_CSOURCES = player_example.c
127
128# Create object file list.
129LIBTHEORADEC_OBJS:= ${LIBTHEORADEC_CSOURCES:%.c=${WORKDIR}/%.o}
130LIBTHEORADECD_OBJS:= ${LIBTHEORADEC_CSOURCES:%.c=${WORKDIR}/%.do}
131LIBTHEORAENC_OBJS:=  ${LIBTHEORAENC_CSOURCES:%.c=${WORKDIR}/%.o}
132LIBTHEORAENCD_OBJS:= ${LIBTHEORAENC_CSOURCES:%.c=${WORKDIR}/%.do}
133DUMP_VIDEO_OBJS:= ${DUMP_VIDEO_CSOURCES:%.c=${WORKDIR}/%.o}
134ENCODER_EXAMPLE_OBJS:= ${ENCODER_EXAMPLE_CSOURCES:%.c=${WORKDIR}/%.o}
135PLAYER_EXAMPLE_OBJS:= ${PLAYER_EXAMPLE_CSOURCES:%.c=${WORKDIR}/%.o}
136RC_OBJS:= ${LIBTHEORADEC_TARGET} ${LIBTHEORAENC_TARGET} \
137 ${LIBTHEORADECD_TARGET} ${LIBTHEORAENCD_TARGET} \
138 ${LIBTHEORADEC70_TARGET} ${LIBTHEORAENC70_TARGET} \
139 ${LIBTHEORADEC70D_TARGET} ${LIBTHEORAENC70D_TARGET} \
140 ${LIBTHEORADEC71_TARGET} ${LIBTHEORAENC71_TARGET} \
141 ${LIBTHEORADEC71D_TARGET} ${LIBTHEORAENC71D_TARGET} \
142 ${LIBTHEORADEC80_TARGET} ${LIBTHEORAENC80_TARGET} \
143 ${LIBTHEORADEC80D_TARGET} ${LIBTHEORAENC80D_TARGET}
144RC_OBJS:= ${RC_OBJS:%.dll=${WORKDIR}/%.rco}
145ALL_OBJS:= ${LIBTHEORADEC_OBJS} ${LIBTHEORAENC_OBJS} \
146 ${LIBTHEORADECD_OBJS} ${LIBTHEORAENCD_OBJS} ${RC_OBJS} \
147 ${DUMP_VIDEO_OBJS} ${ENCODER_EXAMPLE_OBJS} #${PLAYER_EXAMPLE_OBJS}
148# Create the dependency file list
149ALL_DEPS:= ${ALL_OBJS:%.o=%.d}
150ALL_DEPS:= ${ALL_DEPS:%.do=%.dd}
151ALL_DEPS:= ${ALL_DEPS:%.rco=%.d}
152# Prepend source path to file names.
153LIBTHEORADEC_CSOURCES:= ${LIBTHEORADEC_CSOURCES:%=${LIBSRCDIR}/%}
154LIBTHEORAENC_CSOURCES:= ${LIBTHEORAENC_CSOURCES:%=${LIBSRCDIR}/%}
155DUMP_VIDEO_CSOURCES:= ${DUMP_VIDEO_CSOURCES:%=${BINSRCDIR}/%}
156ENCODER_EXAMPLE_CSOURCES:= ${ENCODER_EXAMPLE_CSOURCES:%=${BINSRCDIR}/%}
157PLAYER_EXAMPLE_CSOURCES:= ${PLAYER_EXAMPLE_CSOURCES:%=${BINSRCDIR}/%}
158ALL_CSOURCES:= ${LIBTHEORADEC_CSOURCES} ${LIBTHEORAENC_CSOURCES} \
159 ${DUMP_VIDEO_CSOURCES} ${PLAYER_EXAMPLE_CSOURCES} \
160 ${ENCODER_EXAMPLE_CSOURCES}
161LIBTHEORAENC_RCO:= ${WORKDIR}/${LIBTHEORAENC_TARGET:%.dll=%.rco}
162LIBTHEORAENCD_RCO:= ${WORKDIR}/${LIBTHEORAENCD_TARGET:%.dll=%.rco}
163LIBTHEORAENC70_RCO:= ${WORKDIR}/${LIBTHEORAENC70_TARGET:%.dll=%.rco}
164LIBTHEORAENC70D_RCO:= ${WORKDIR}/${LIBTHEORAENC70D_TARGET:%.dll=%.rco}
165LIBTHEORAENC71_RCO:= ${WORKDIR}/${LIBTHEORAENC71_TARGET:%.dll=%.rco}
166LIBTHEORAENC71D_RCO:= ${WORKDIR}/${LIBTHEORAENC71D_TARGET:%.dll=%.rco}
167LIBTHEORAENC80_RCO:= ${WORKDIR}/${LIBTHEORAENC80_TARGET:%.dll=%.rco}
168LIBTHEORAENC80D_RCO:= ${WORKDIR}/${LIBTHEORAENC80D_TARGET:%.dll=%.rco}
169LIBTHEORADEC_RCO:= ${WORKDIR}/${LIBTHEORADEC_TARGET:%.dll=%.rco}
170LIBTHEORADECD_RCO:= ${WORKDIR}/${LIBTHEORADECD_TARGET:%.dll=%.rco}
171LIBTHEORADEC70_RCO:= ${WORKDIR}/${LIBTHEORADEC70_TARGET:%.dll=%.rco}
172LIBTHEORADEC70D_RCO:= ${WORKDIR}/${LIBTHEORADEC70D_TARGET:%.dll=%.rco}
173LIBTHEORADEC71_RCO:= ${WORKDIR}/${LIBTHEORADEC71_TARGET:%.dll=%.rco}
174LIBTHEORADEC71D_RCO:= ${WORKDIR}/${LIBTHEORADEC71D_TARGET:%.dll=%.rco}
175LIBTHEORADEC80_RCO:= ${WORKDIR}/${LIBTHEORADEC80_TARGET:%.dll=%.rco}
176LIBTHEORADEC80D_RCO:= ${WORKDIR}/${LIBTHEORADEC80D_TARGET:%.dll=%.rco}
177# Prepand target path to file names.
178LIBTHEORAENC_TARGET:= ${TARGETLIBDIR}/${LIBTHEORAENC_TARGET}
179LIBTHEORAENCD_TARGET:= ${TARGETLIBDIR}/${LIBTHEORAENCD_TARGET}
180LIBTHEORAENC70_TARGET:= ${TARGETLIBDIR}/${LIBTHEORAENC70_TARGET}
181LIBTHEORAENC70D_TARGET:= ${TARGETLIBDIR}/${LIBTHEORAENC70D_TARGET}
182LIBTHEORAENC71_TARGET:= ${TARGETLIBDIR}/${LIBTHEORAENC71_TARGET}
183LIBTHEORAENC71D_TARGET:= ${TARGETLIBDIR}/${LIBTHEORAENC71D_TARGET}
184LIBTHEORAENC80_TARGET:= ${TARGETLIBDIR}/${LIBTHEORAENC80_TARGET}
185LIBTHEORAENC80D_TARGET:= ${TARGETLIBDIR}/${LIBTHEORAENC80D_TARGET}
186LIBTHEORADEC_TARGET:= ${TARGETLIBDIR}/${LIBTHEORADEC_TARGET}
187LIBTHEORADECD_TARGET:= ${TARGETLIBDIR}/${LIBTHEORADECD_TARGET}
188LIBTHEORADEC70_TARGET:= ${TARGETLIBDIR}/${LIBTHEORADEC70_TARGET}
189LIBTHEORADEC70D_TARGET:= ${TARGETLIBDIR}/${LIBTHEORADEC70D_TARGET}
190LIBTHEORADEC71_TARGET:= ${TARGETLIBDIR}/${LIBTHEORADEC71_TARGET}
191LIBTHEORADEC71D_TARGET:= ${TARGETLIBDIR}/${LIBTHEORADEC71D_TARGET}
192LIBTHEORADEC80_TARGET:= ${TARGETLIBDIR}/${LIBTHEORADEC80_TARGET}
193LIBTHEORADEC80D_TARGET:= ${TARGETLIBDIR}/${LIBTHEORADEC80D_TARGET}
194DUMP_VIDEO_TARGET:= ${TARGETBINDIR}/${DUMP_VIDEO_TARGET}
195ENCODER_EXAMPLE_TARGET:= ${TARGETBINDIR}/${ENCODER_EXAMPLE_TARGET}
196PLAYER_EXAMPLE_TARGET:= ${TARGETBINDIR}/${PLAYER_EXAMPLE_TARGET}
197DLL_TARGETS:= ${LIBTHEORADEC_TARGET} ${LIBTHEORAENC_TARGET} \
198 ${LIBTHEORADECD_TARGET} ${LIBTHEORAENCD_TARGET} \
199 ${LIBTHEORADEC70_TARGET} ${LIBTHEORAENC70_TARGET} \
200 ${LIBTHEORADEC70D_TARGET} ${LIBTHEORAENC70D_TARGET} \
201 ${LIBTHEORADEC71_TARGET} ${LIBTHEORAENC71_TARGET} \
202 ${LIBTHEORADEC71D_TARGET} ${LIBTHEORAENC71D_TARGET} \
203 ${LIBTHEORADEC80_TARGET} ${LIBTHEORAENC80_TARGET} \
204 ${LIBTHEORADEC80D_TARGET} ${LIBTHEORAENC80D_TARGET}
205ALL_TARGETS:= ${DLL_TARGETS} ${DLL_TARGETS:%.dll=%.dll.a} \
206 ${DUMP_VIDEO_TARGET} ${ENCODER_EXAMPLE_TARGET} #${PLAYER_EXAMPLE_TARGET}
207IMPLIB_TARGETS:= ${DLL_TARGETS:%.dll=%.def} ${DLL_TARGETS:%.dll=%.lib} \
208 ${DLL_TARGETS:%.dll=%.exp}
209
210# Targets:
211# Everything (default)
212all: ${ALL_TARGETS}
213
214# These require Microsoft's lib.exe to build, and so are not made by default.
215implibs: ${IMPLIB_TARGETS}
216
217# libtheoradec
218${LIBTHEORADEC_TARGET}: ${LIBTHEORADEC_OBJS} ${LIBTHEORADEC_RCO} \
219 libtheoradec-all.def
220	mkdir -p ${TARGETLIBDIR}
221	${CC} -shared -o $@ ${LIBTHEORADEC_OBJS} -logg -lmsvcrt \
222         ${LIBTHEORADEC_RCO} \
223         -Wl,--output-def,${@:.dll=.def},--out-implib,$@.a,libtheoradec-all.def
224${LIBTHEORADECD_TARGET}: ${LIBTHEORADECD_OBJS} ${LIBTHEORADECD_RCO} \
225 libtheoradec-all.def
226	mkdir -p ${TARGETLIBDIR}
227	${CC} -shared -o $@ ${LIBTHEORADECD_OBJS} -logg -lmsvcrtd \
228         ${LIBTHEORADECD_RCO} \
229         -Wl,--output-def,${@:.dll=.def},--out-implib,$@.a,libtheoradec-all.def
230${LIBTHEORADEC70_TARGET}: ${LIBTHEORADEC_OBJS} ${LIBTHEORADEC70_RCO} \
231 libtheoradec-all.def
232	mkdir -p ${TARGETLIBDIR}
233	${CC} -shared -o $@ ${LIBTHEORADEC_OBJS} -logg -lmsvcr70 \
234         ${LIBTHEORADEC70_RCO} \
235         -Wl,--output-def,${@:.dll=.def},--out-implib,$@.a,libtheoradec-all.def
236${LIBTHEORADEC70D_TARGET}: ${LIBTHEORADECD_OBJS} ${LIBTHEORADEC70D_RCO} \
237 libtheoradec-all.def
238	mkdir -p ${TARGETLIBDIR}
239	${CC} -shared -o $@ ${LIBTHEORADECD_OBJS} -logg -lmsvcr70d \
240         ${LIBTHEORADEC70D_RCO} \
241         -Wl,--output-def,${@:.dll=.def},--out-implib,$@.a,libtheoradec-all.def
242${LIBTHEORADEC71_TARGET}: ${LIBTHEORADEC_OBJS} ${LIBTHEORADEC71_RCO} \
243 libtheoradec-all.def
244	mkdir -p ${TARGETLIBDIR}
245	${CC} -shared -o $@ ${LIBTHEORADEC_OBJS} -logg -lmsvcr71 \
246         ${LIBTHEORADEC71_RCO} \
247         -Wl,--output-def,${@:.dll=.def},--out-implib,$@.a,libtheoradec-all.def
248${LIBTHEORADEC71D_TARGET}: ${LIBTHEORADECD_OBJS} ${LIBTHEORADEC71D_RCO} \
249 libtheoradec-all.def
250	mkdir -p ${TARGETLIBDIR}
251	${CC} -shared -o $@ ${LIBTHEORADECD_OBJS} -logg -lmsvcr71d \
252         ${LIBTHEORADEC71D_RCO} \
253         -Wl,--output-def,${@:.dll=.def},--out-implib,$@.a,libtheoradec-all.def
254${LIBTHEORADEC80_TARGET}: ${LIBTHEORADEC_OBJS} ${LIBTHEORADEC80_RCO} \
255 libtheoradec-all.def
256	mkdir -p ${TARGETLIBDIR}
257	${CC} -shared -o $@ ${LIBTHEORADEC_OBJS} -logg -lmsvcr80 \
258         ${LIBTHEORADEC80_RCO} \
259         -Wl,--output-def,${@:.dll=.def},--out-implib,$@.a,libtheoradec-all.def
260${LIBTHEORADEC80D_TARGET}: ${LIBTHEORADECD_OBJS} ${LIBTHEORADEC80D_RCO} \
261 libtheoradec-all.def
262	mkdir -p ${TARGETLIBDIR}
263	${CC} -shared -o $@ ${LIBTHEORADECD_OBJS} -logg -lmsvcr80d \
264         ${LIBTHEORADEC80D_RCO} \
265         -Wl,--output-def,${@:.dll=.def},--out-implib,$@.a,libtheoradec-all.def
266
267# libtheoraenc
268${LIBTHEORAENC_TARGET}: ${LIBTHEORAENC_OBJS} ${LIBTHEORAENC_RCO} \
269 libtheoraenc-all.def
270	mkdir -p ${TARGETLIBDIR}
271	${CC} -shared -o $@ \
272         ${LIBTHEORAENC_OBJS} ${LIBTHEORADEC_TARGET} -logg -lmsvcrt \
273         ${LIBTHEORAENC_RCO} \
274         -Wl,--output-def,${@:.dll=.def},--out-implib,$@.a,libtheoraenc-all.def
275${LIBTHEORAENCD_TARGET}: ${LIBTHEORAENCD_OBJS} ${LIBTHEORAENCD_RCO} \
276 libtheoraenc-all.def
277	mkdir -p ${TARGETLIBDIR}
278	${CC} -shared -o $@ \
279         ${LIBTHEORAENCD_OBJS} ${LIBTHEORADECD_TARGET} -logg -lmsvcrtd \
280         ${LIBTHEORAENCD_RCO} \
281         -Wl,--output-def,${@:.dll=.def},--out-implib,$@.a,libtheoraenc-all.def
282${LIBTHEORAENC70_TARGET}: ${LIBTHEORAENC_OBJS} ${LIBTHEORAENC70_RCO} \
283 libtheoraenc-all.def
284	mkdir -p ${TARGETLIBDIR}
285	${CC} -shared -o $@ \
286         ${LIBTHEORAENC_OBJS} ${LIBTHEORADEC70_TARGET} -logg -lmsvcr70 \
287         ${LIBTHEORAENC70_RCO} \
288         -Wl,--output-def,${@:.dll=.def},--out-implib,$@.a,libtheoraenc-all.def
289${LIBTHEORAENC70D_TARGET}: ${LIBTHEORAENCD_OBJS} ${LIBTHEORAENC70D_RCO} \
290 libtheoraenc-all.def
291	mkdir -p ${TARGETLIBDIR}
292	${CC} -shared -o $@ \
293         ${LIBTHEORAENCD_OBJS} ${LIBTHEORADEC70D_TARGET} -logg -lmsvcr70d \
294         ${LIBTHEORAENC70D_RCO} \
295         -Wl,--output-def,${@:.dll=.def},--out-implib,$@.a,libtheoraenc-all.def
296${LIBTHEORAENC71_TARGET}: ${LIBTHEORAENC_OBJS} ${LIBTHEORAENC71_RCO} \
297 libtheoraenc-all.def
298	mkdir -p ${TARGETLIBDIR}
299	${CC} -shared -o $@ \
300         ${LIBTHEORAENC_OBJS} ${LIBTHEORADEC71_TARGET} -logg -lmsvcr71 \
301         ${LIBTHEORAENC71_RCO} \
302         -Wl,--output-def,${@:.dll=.def},--out-implib,$@.a,libtheoraenc-all.def
303${LIBTHEORAENC71D_TARGET}: ${LIBTHEORAENCD_OBJS} ${LIBTHEORAENC71D_RCO} \
304 libtheoraenc-all.def
305	mkdir -p ${TARGETLIBDIR}
306	${CC} -shared -o $@ \
307         ${LIBTHEORAENCD_OBJS} ${LIBTHEORADEC71D_TARGET} -logg -lmsvcr71d \
308         ${LIBTHEORAENC71D_RCO} \
309         -Wl,--output-def,${@:.dll=.def},--out-implib,$@.a,libtheoraenc-all.def
310${LIBTHEORAENC80_TARGET}: ${LIBTHEORAENC_OBJS} ${LIBTHEORAENC80_RCO} \
311 libtheoraenc-all.def
312	mkdir -p ${TARGETLIBDIR}
313	${CC} -shared -o $@ \
314         ${LIBTHEORAENC_OBJS} ${LIBTHEORADEC80_TARGET} -logg -lmsvcr80 \
315         ${LIBTHEORAENC80_RCO} \
316         -Wl,--output-def,${@:.dll=.def},--out-implib,$@.a,libtheoraenc-all.def
317${LIBTHEORAENC80D_TARGET}: ${LIBTHEORAENCD_OBJS} ${LIBTHEORAENC80D_RCO} \
318 libtheoraenc-all.def
319	mkdir -p ${TARGETLIBDIR}
320	${CC} -shared -o $@ \
321         ${LIBTHEORAENCD_OBJS} ${LIBTHEORADEC80D_TARGET} -logg -lmsvcr80d \
322         ${LIBTHEORAENC80D_RCO} \
323         -Wl,--output-def,${@:.dll=.def},--out-implib,$@.a,libtheoraenc-all.def
324
325# dump_video
326${DUMP_VIDEO_TARGET}: ${DUMP_VIDEO_OBJS} ${LIBTHEORADEC_TARGET}
327	mkdir -p ${TARGETBINDIR}
328	${CC} ${CFLAGS} -o $@ ${DUMP_VIDEO_OBJS} ${LIBS} \
329         ${LIBTHEORADEC_TARGET}.a
330
331# encoder_example
332${ENCODER_EXAMPLE_TARGET}: ${ENCODER_EXAMPLE_OBJS} ${LIBTHEORADEC_TARGET} \
333                            ${LIBTHEORAENC_TARGET}
334	mkdir -p ${TARGETBINDIR}
335	${CC} ${CFLAGS} -o $@ ${ENCODER_EXAMPLE_OBJS} ${LIBS} \
336         ${LIBTHEORAENC_TARGET}.a ${LIBTHEORADEC_TARGET}.a
337
338# player_example
339${PLAYER_EXAMPLE_TARGET}: CINCLUDE += $(SDLCONFIG) --cflags
340${PLAYER_EXAMPLE_TARGET}: ${PLAYER_EXAMPLE_OBJS} ${LIBTHEORADEC_TARGET}
341	mkdir -p ${TARGETBINDIR}
342	${CC} ${CFLAGS} -o $@ ${PLAYER_EXAMPLE_OBJS} ${LIBS} \
343         ${LIBTHEORADEC_TARGET}.a `${SDLCONFIG} --libs`
344
345# Remove all targets.
346clean:
347	-rm $(sort ${ALL_OBJS} ${ALL_DEPS} ${ALL_TARGETS} ${IMPLIB_TARGETS})
348	-rmdir ${WORKDIR}/x86
349	-rmdir ${WORKDIR}
350
351# Make everything depend on changes in the Makefile
352${ALL_OBJS} ${ALL_DEPS} ${ALL_TARGETS} : Makefile
353
354# Specify which targets are phony for GNU make
355.PHONY : all clean
356
357# Rules
358# Windows-specific rules
359%.dll.a : %.dll
360%.def : %.dll
361%.exp : %.lib
362%.lib : %.def
363	wine lib /machine:i386 /def:$<
364${WORKDIR}/%.d : %.rc
365	mkdir -p ${dir $@}
366	${MAKEDEPEND} -x c-header ${CINCLUDE} $< -MT ${@:%.d=%.rco} > $@
367${WORKDIR}/%.rco : %.rc
368	mkdir -p ${dir $@}
369	${RC} ${CINCLUDE} -DTH_VERSION_FIELD=${VERSION_FIELD} \
370         -DTH_VERSION_STRING=${VERSION_STRING} $< $@
371# Normal compilation
372${WORKDIR}/%.d : ${LIBSRCDIR}/%.c
373	mkdir -p ${dir $@}
374	${MAKEDEPEND} ${CINCLUDE} ${RELEASE_CFLAGS} $< -MT ${@:%.d=%.o} > $@
375${WORKDIR}/%.d : ${BINSRCDIR}/%.c
376	mkdir -p ${dir $@}
377	${MAKEDEPEND} ${CINCLUDE} ${RELEASE_CFLAGS} $< -MT ${@:%.d=%.o} > $@
378${WORKDIR}/%.o : ${LIBSRCDIR}/%.c
379	mkdir -p ${dir $@}
380	${CC} ${CINCLUDE} ${RELEASE_CFLAGS} -c -o $@ $<
381${WORKDIR}/%.o : ${BINSRCDIR}/%.c
382	mkdir -p ${dir $@}
383	${CC} ${CINCLUDE} ${RELEASE_CFLAGS} -c -o $@ $<
384# Debug versions
385${WORKDIR}/%.dd : ${LIBSRCDIR}/%.c
386	mkdir -p ${dir $@}
387	${MAKEDEPEND} ${CINCLUDE} ${DEBUG_CFLAGS} $< -MT ${@:%.d=%.do} > $@
388${WORKDIR}/%.do : ${LIBSRCDIR}/%.c
389	mkdir -p ${dir $@}
390	${CC} ${CINCLUDE} ${DEBUG_CFLAGS} -c -o $@ $<
391
392# Include header file dependencies
393-include ${ALL_DEPS}
394