Makefile.in 11.9 KB
Newer Older
Michel Kaempf's avatar
Michel Kaempf committed
1
2
3
4
5
6
7
8
9
10
11
################################################################################
# vlc (VideoLAN Client) main makefile
# (c)1998 VideoLAN
################################################################################
# This makefile is the main makefile for the VideoLAN client.
################################################################################

################################################################################
# Configuration
################################################################################

Vincent Seguin's avatar
Vincent Seguin committed
12
# Debugging mode on or off (set to 1 to activate)
Michel Lespinasse's avatar
   
Michel Lespinasse committed
13
DEBUG=0
Jean-Marc Dressler's avatar
   
Jean-Marc Dressler committed
14

15
16
17
18
19
20
SYS=@SYS@
ARCH=@ARCH@
AOUT=@AOUT@
VOUT=@VOUT@
INTF=@VOUT@
SNAPSHOTDIR=vlc-@VLC_VERSION@
21
INSTALL=@INSTALL@
22
23
24
prefix=@prefix@

#----------------- do not change anything below this line ----------------------
25

Vincent Seguin's avatar
Vincent Seguin committed
26
27
28
29
################################################################################
# Configuration pre-processing
################################################################################

Vincent Seguin's avatar
Vincent Seguin committed
30
# PROGRAM_OPTIONS is an identification string of the compilation options
31
PROGRAM_OPTIONS = $(SYS) $(ARCH)
Vincent Seguin's avatar
Vincent Seguin committed
32
ifeq ($(DEBUG),1)
Vincent Seguin's avatar
Vincent Seguin committed
33
34
35
36
PROGRAM_OPTIONS += DEBUG
endif

# PROGRAM_BUILD is a complete identification of the build
37
38
# ( we can't use fancy options with date since OSes like Solaris
# or FreeBSD have strange date implementations )
39
40
41
PROGRAM_BUILD = `date` $(USER)
# XXX: beos does not support hostname
#PROGRAM_BUILD = `date` $(USER)@`hostname`
Vincent Seguin's avatar
Vincent Seguin committed
42
43

# DEFINE will contain some of the constants definitions decided in Makefile, 
44
# including SYS_xx. It will be passed to C compiler.
45
DEFINE += -DSYS_$(shell echo $(SYS) | sed 's/-.*//' | tr a-z A-Z)
46
47
DEFINE += -DPLUGIN_PATH="\"$(prefix)/lib/videolan/vlc\""
DEFINE += -DDATA_PATH="\"$(prefix)/share/videolan/vlc\""
48
49
#DEFINE += -DPROGRAM_OPTIONS="\"$(shell echo $(PROGRAM_OPTIONS) | tr 'A-Z' 'a-z')\""
#DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
Vincent Seguin's avatar
Vincent Seguin committed
50
ifeq ($(DEBUG),1)
Vincent Seguin's avatar
Vincent Seguin committed
51
52
DEFINE += -DDEBUG
endif
Vincent Seguin's avatar
Vincent Seguin committed
53

Michel Kaempf's avatar
Michel Kaempf committed
54
################################################################################
55
# Tuning and other variables - do not change anything except if you know
Vincent Seguin's avatar
Vincent Seguin committed
56
# exactly what you are doing
Michel Kaempf's avatar
Michel Kaempf committed
57
58
59
60
61
################################################################################

#
# C headers directories
#
62
INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
Vincent Seguin's avatar
Vincent Seguin committed
63

Michel Kaempf's avatar
Michel Kaempf committed
64
65
66
#
# Libraries
#
67

68
ifeq ($(SYS),gnu)
69
70
71
LIB += -lthreads -ldl
endif

72
ifneq (,$(findstring bsd,$(SYS)))
73
74
LIB += -pthread -lgnugetopt
LIB += -L/usr/local/lib
75
endif
76

77
ifneq (,$(findstring linux,$(SYS)))
78
79
80
LIB += -lpthread -ldl
endif

81
ifeq ($(SYS),beos)
82
83
LIB += -lbe -lroot -lgame
else
84
LIB += -lm
85
endif
86

Michel Kaempf's avatar
Michel Kaempf committed
87
88
89
#
# C compiler flags: compilation
#
Vincent Seguin's avatar
Vincent Seguin committed
90
CCFLAGS += $(DEFINE) $(INCLUDE)
Michel Kaempf's avatar
Michel Kaempf committed
91
92
93
94
CCFLAGS += -Wall
CCFLAGS += -D_REENTRANT
CCFLAGS += -D_GNU_SOURCE

95
96
97
# flags needed for clean beos compilation
CCFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual

Michel Kaempf's avatar
Michel Kaempf committed
98
# Optimizations : don't compile debug versions with them
99
ifeq ($(DEBUG),0)
100
101
CCFLAGS += -O6
CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
Michel Lespinasse's avatar
   
Michel Lespinasse committed
102
CCFLAGS += -fomit-frame-pointer
103

104
# Optimizations for x86 familiy
105
ifneq (,$(findstring 86,$(ARCH)))
106
CCFLAGS += -malign-double
107
#CCFLAGS += -march=pentium
108
# Eventual Pentium Pro optimizations
109
ifneq (,$(findstring pentiumpro,$(ARCH)))
110
ifneq ($(SYS), BSD)
111
112
CCFLAGS += -march=pentiumpro
endif
113
endif
114
# Eventual MMX optimizations for x86
115
ifneq (,$(findstring mmx,$(ARCH)))
116
117
CFLAGS += -DHAVE_MMX
endif
Vincent Seguin's avatar
Vincent Seguin committed
118
endif
119

Vincent Seguin's avatar
Vincent Seguin committed
120
# Optimizations for PowerPC
121
ifneq (,$(findstring ppc,$(ARCH)))
Vincent Seguin's avatar
Vincent Seguin committed
122
123
CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
endif
Michel Kaempf's avatar
Michel Kaempf committed
124

125
# Optimizations for Sparc
126
ifneq (,$(findstring sparc,$(ARCH)))
127
128
129
CCFLAGS += -mhard-float
endif

130
131
132
# End of optimizations
endif

Michel Kaempf's avatar
Michel Kaempf committed
133
134
135
136
137
138
139
140
141
142
143
#
# C compiler flags: dependancies
#
DCFLAGS += $(INCLUDE)
DCFLAGS += -MM

#
# C compiler flags: linking
#
LCFLAGS += $(LIB)
LCFLAGS += -Wall
Vincent Seguin's avatar
Vincent Seguin committed
144
#LCFLAGS += -s
Michel Kaempf's avatar
Michel Kaempf committed
145
146
147
148

#
# Additionnal debugging flags
#
Vincent Seguin's avatar
Vincent Seguin committed
149

150
151
# Debugging and profiling support
ifneq ($(DEBUG),0)
152
CFLAGS += -pg
Vincent Seguin's avatar
Vincent Seguin committed
153
endif
Michel Kaempf's avatar
Michel Kaempf committed
154
155
156
157
158
159

#################################################################################
# Objects and files
#################################################################################

#
Vincent Seguin's avatar
Vincent Seguin committed
160
# C Objects
Michel Kaempf's avatar
Michel Kaempf committed
161
162
163
164
165
166
# 
interface_obj =  		interface/main.o \
						interface/interface.o \
						interface/intf_msg.o \
						interface/intf_cmd.o \
						interface/intf_ctrl.o \
167
						interface/intf_console.o
Michel Kaempf's avatar
Michel Kaempf committed
168
169
170
171
172
173
174
175
176
177

input_obj =         		input/input_vlan.o \
						input/input_file.o \
						input/input_netlist.o \
						input/input_network.o \
						input/input_ctrl.o \
						input/input_pcr.o \
						input/input_psi.o \
						input/input.o

178
audio_output_obj = 		audio_output/audio_output.o
Michel Kaempf's avatar
Michel Kaempf committed
179

Vincent Seguin's avatar
Vincent Seguin committed
180
video_output_obj = 		video_output/video_output.o \
Vincent Seguin's avatar
Vincent Seguin committed
181
						video_output/video_text.o \
Sam Hocevar's avatar
NEWS:    
Sam Hocevar committed
182
						video_output/video_spu.o \
183
						video_output/video_yuv.o
Michel Kaempf's avatar
Michel Kaempf committed
184

Michel Lespinasse's avatar
   
Michel Lespinasse committed
185
186
ac3_decoder_obj =		ac3_decoder/ac3_decoder_thread.o \
						ac3_decoder/ac3_decoder.o \
187
188
189
190
191
192
193
						ac3_decoder/ac3_parse.o \
						ac3_decoder/ac3_exponent.o \
						ac3_decoder/ac3_bit_allocate.o \
						ac3_decoder/ac3_mantissa.o \
						ac3_decoder/ac3_rematrix.o \
						ac3_decoder/ac3_imdct.o \
						ac3_decoder/ac3_downmix.o
194
195
196
						
lpcm_decoder_obj =		lpcm_decoder/lpcm_decoder_thread.o \
						lpcm_decoder/lpcm_decoder.o
Michel Kaempf's avatar
Michel Kaempf committed
197

Michel Lespinasse's avatar
   
Michel Lespinasse committed
198
199
audio_decoder_obj =		audio_decoder/audio_decoder_thread.o \
						audio_decoder/audio_decoder.o \
200
						audio_decoder/audio_math.o
Michel Kaempf's avatar
Michel Kaempf committed
201

202
spu_decoder_obj =		spu_decoder/spu_decoder.o
203

Vincent Seguin's avatar
Vincent Seguin committed
204
205
#??generic_decoder_obj =		generic_decoder/generic_decoder.o
# remeber to add it to OBJ 
206

Jean-Marc Dressler's avatar
   
Jean-Marc Dressler committed
207
208
209
210
211
212
213
214
video_parser_obj = 		video_parser/video_parser.o \
						video_parser/vpar_headers.o \
						video_parser/vpar_blocks.o \
						video_parser/vpar_synchro.o \
						video_parser/video_fifo.o

video_decoder_obj =		video_decoder/video_decoder.o \
						video_decoder/vdec_motion.o \
Michel Lespinasse's avatar
   
Michel Lespinasse committed
215
						video_decoder/vdec_motion_inner.o \
Vincent Seguin's avatar
Vincent Seguin committed
216
			                        video_decoder/vdec_idct.o
217

Michel Kaempf's avatar
Michel Kaempf committed
218
219
misc_obj =			misc/mtime.o \
						misc/rsc_files.o \
220
						misc/netutils.o \
221
						misc/plugins.o \
222
						misc/decoder_fifo.o
Michel Kaempf's avatar
Michel Kaempf committed
223

224

Jean-Marc Dressler's avatar
   
Jean-Marc Dressler committed
225
C_OBJ = $(interface_obj) \
Michel Kaempf's avatar
Michel Kaempf committed
226
227
228
		$(input_obj) \
		$(audio_output_obj) \
		$(video_output_obj) \
Michel Kaempf's avatar
Michel Kaempf committed
229
		$(ac3_decoder_obj) \
230
		$(lpcm_decoder_obj) \
Michel Kaempf's avatar
Michel Kaempf committed
231
		$(audio_decoder_obj) \
232
		$(spu_decoder_obj) \
Michel Kaempf's avatar
Michel Kaempf committed
233
		$(generic_decoder_obj) \
234
		$(video_parser_obj) \
Michel Kaempf's avatar
Michel Kaempf committed
235
236
		$(video_decoder_obj) \
		$(vlan_obj) \
Vincent Seguin's avatar
Vincent Seguin committed
237
		$(misc_obj)
Michel Kaempf's avatar
Michel Kaempf committed
238

239
ifeq ($(SYS),beos)
240
241
242
CPP_OBJ =			misc/beos_specific.o
endif

Vincent Seguin's avatar
Vincent Seguin committed
243
244
245
#
# Assembler Objects
# 
246
247
ifneq (,$(findstring 86,$(ARCH)))
ifneq (,$(findstring mmx,$(ARCH)))
248
ASM_OBJ = 			video_decoder/vdec_idctmmx.o \
Vincent Seguin's avatar
Vincent Seguin committed
249
250
						video_output/video_yuv_mmx.o
endif
251
endif
Vincent Seguin's avatar
Vincent Seguin committed
252

253
254
255
#
# Plugins
#
256
257
258
intf_plugin =           $(INTF:%=plugins/intf/intf_%.so)
aout_plugin =           $(AOUT:%=plugins/aout/aout_%.so)
vout_plugin =           $(VOUT:%=plugins/vout/vout_%.so)
259

260
PLUGIN_OBJ = $(intf_plugin) $(aout_plugin) $(vout_plugin)
261

Michel Kaempf's avatar
Michel Kaempf committed
262
263
264
#
# Other lists of files
#
265
C_OBJ := $(C_OBJ:%.o=src/%.o)
266
CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
267
ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
268
269
sources_c := $(C_OBJ:%.o=%.c)
dependancies := $(sources_c:%.c=.dep/%.d)
Michel Kaempf's avatar
Michel Kaempf committed
270
271
272
273
274
275
276
277
278
279
280

# All symbols must be exported
export

################################################################################
# Targets
################################################################################

#
# Virtual targets
#
281
all: vlc plugins
Michel Kaempf's avatar
Michel Kaempf committed
282
283

clean:
284
	rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
Michel Kaempf's avatar
Michel Kaempf committed
285
286

distclean: clean
287
	rm -f */*/*.o plugins/*/*.so **/*~ *.log
288
289
	rm -f Makefile include/defs.h include/config.h
	rm -f config.status config.cache config.log
Sam Hocevar's avatar
Sam Hocevar committed
290
	rm -f vlc gmon.out core
291
292
293
	rm -rf .dep

install:
294
295
	$(INSTALL) vlc $(prefix)/bin
	mkdir -p $(prefix)/lib/videolan/vlc
Sam Hocevar's avatar
Sam Hocevar committed
296
	mkdir -p $(prefix)/share/videolan/vlc
297
298
299
	$(INSTALL) $(PLUGIN_OBJ) $(prefix)/lib/videolan/vlc
	$(INSTALL) share/*.psf $(prefix)/share/videolan/vlc
	$(INSTALL) share/*.png $(prefix)/share/videolan/vlc
Michel Kaempf's avatar
Michel Kaempf committed
300

Vincent Seguin's avatar
Vincent Seguin committed
301
302
303
304
305
306
307
show:
	@echo "Command line for C objects:"
	@echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
	@echo
	@echo "Command line for assembler objects:"
	@echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"

Sam Hocevar's avatar
Sam Hocevar committed
308
309
310
311
# ugliest of all, but I have no time to do it -- sam
snapshot:
	rm -rf /tmp/${SNAPSHOTDIR}
	mkdir /tmp/${SNAPSHOTDIR}
312
	cp -r * /tmp/${SNAPSHOTDIR}
Sam Hocevar's avatar
Sam Hocevar committed
313
314
315
316
317
318
319
320
321
322
		(cd /tmp/${SNAPSHOTDIR} ; \
		make distclean ; \
		find . -type d -name CVS | xargs rm -rf ; \
		find . -type f -name '.*.swp' | xargs rm -f ; \
		cd .. ; \
		tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} )
	rm -rf /tmp/${SNAPSHOTDIR}
	mv /tmp/${SNAPSHOTDIR}.tar.gz ..
	@echo "Sources are in ../${SNAPSHOTDIR}.tar.gz"

Michel Kaempf's avatar
Michel Kaempf committed
323
324
325
326
327
FORCE:

#
# Real targets
#
328
vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
329
ifeq ($(SYS),beos)
330
331
332
333
334
335
336
	$(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
#	ln -s ../vlc ./plugins/_APP_
else
	$(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)	
endif

plugins: $(PLUGIN_OBJ)
Michel Kaempf's avatar
Michel Kaempf committed
337
338
339
340
341

#
# Generic rules (see below)
#
$(dependancies): %.d: FORCE
342
	@$(MAKE) -s --no-print-directory -f Makefile.dep $@
Michel Kaempf's avatar
Michel Kaempf committed
343

344
$(C_OBJ): %.o: Makefile.dep
345
$(C_OBJ): %.o: .dep/%.d
Jean-Marc Dressler's avatar
   
Jean-Marc Dressler committed
346
$(C_OBJ): %.o: %.c
347
	$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
Vincent Seguin's avatar
Vincent Seguin committed
348

349
$(CPP_OBJ): %.o: %.cpp
350
	$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
351

352
$(ASM_OBJ): %.o: Makefile.dep
Jean-Marc Dressler's avatar
   
Jean-Marc Dressler committed
353
$(ASM_OBJ): %.o: %.S
354
	$(CC) $(CFLAGS) -c -o $@ $<
Michel Kaempf's avatar
Michel Kaempf committed
355

356
357
#$(PLUGIN_OBJ): %.so: Makefile.dep
#$(PLUGIN_OBJ): %.so: .dep/%.d
358
359

# audio plugins
360
plugins/aout/aout_dummy.so plugins/aout/aout_dsp.so: %.so: %.c
361
ifeq ($(SYS),beos)
362
	$(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
363
else
364
	$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
365
endif
366

367
plugins/aout/aout_esd.so: %.so: %.c
368
ifneq (,$(findstring bsd,$(SYS)))
369
	$(CC) $(CCFLAGS) $(CFLAGS) -lesd -shared -o $@ $<
370
else
371
	$(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
372
endif
373
374

# video plugins
375
376
plugins/intf/intf_dummy.so plugins/vout/vout_dummy.so \
	plugins/intf/intf_fb.so plugins/vout/vout_fb.so: %.so: %.c
377
ifeq ($(SYS),beos)
378
	$(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
379
else
380
	$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
381
endif
382

383
plugins/intf/intf_x11.so plugins/vout/vout_x11.so: %.so: %.c
384
	$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
385

386
plugins/intf/intf_mga.so plugins/vout/vout_mga.so: %.so: %.c
387
	$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
388

389
plugins/intf/intf_gnome.so: %.so: %.c
390
	$(CC) $(CCFLAGS) $(CFLAGS) $(LCFLAGS) `gnome-config --libs --cflags gnomeui` -shared -o $@ $< plugins/intf/intf_gnome_callbacks.c plugins/intf/intf_gnome_interface.c plugins/intf/intf_gnome_support.c
391
392

plugins/vout/vout_gnome.so: %.so: %.c
393
	$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
394

395
plugins/intf/intf_glide.so plugins/vout/vout_glide.so: %.so: %.c
396
	$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $<
397

398
plugins/intf/intf_ggi.so plugins/vout/vout_ggi.so: %.so: %.c
399
	$(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<
400

401
plugins/intf/intf_beos.so: %.so: %.cpp
402
	$(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
403
404

plugins/vout/vout_beos.so: %.so: %.cpp
405
	$(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
406
		
407

Michel Kaempf's avatar
Michel Kaempf committed
408
409
410
411
412
################################################################################
# Note on generic rules and dependancies
################################################################################

# Note on dependancies: each .c file is associated with a .d file, which
413
414
# depends of it. The .o file associated with a .c file depends of the .d, of the
# .c itself, and of Makefile. The .d files are stored in a separate .dep/
Michel Kaempf's avatar
Michel Kaempf committed
415
416
417
# directory.
# The dep directory should be ignored by CVS.

418
# Note on inclusions: depending of the target, the dependancies files must
Michel Kaempf's avatar
Michel Kaempf committed
419
# or must not be included. The problem is that if we ask make to include a file,
420
421
# and this file does not exist, it is made before it can be included. In a
# general way, a .d file should be included if and only if the corresponding .o
Michel Kaempf's avatar
Michel Kaempf committed
422
423
424
425
426
# needs to be re-made.

# Two makefiles are used: the main one (this one) has regular generic rules,
# except for .o files, for which it calls the object Makefile. Dependancies
# are not included in this file.
Michel Kaempf's avatar
Michel Kaempf committed
427
428
# The object Makefile known how to make a .o from a .c, and includes
# dependancies for the target, but only those required.