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
100
CCFLAGS += -O6
CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
Michel Lespinasse's avatar
   
Michel Lespinasse committed
101
CCFLAGS += -fomit-frame-pointer
102

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

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

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

Michel Kaempf's avatar
Michel Kaempf committed
129
130
131
132
133
134
135
136
137
138
139
#
# C compiler flags: dependancies
#
DCFLAGS += $(INCLUDE)
DCFLAGS += -MM

#
# C compiler flags: linking
#
LCFLAGS += $(LIB)
LCFLAGS += -Wall
Vincent Seguin's avatar
Vincent Seguin committed
140
#LCFLAGS += -s
Michel Kaempf's avatar
Michel Kaempf committed
141
142
143
144

#
# Additionnal debugging flags
#
Vincent Seguin's avatar
Vincent Seguin committed
145
146

# Debugging support
Vincent Seguin's avatar
Vincent Seguin committed
147
ifeq ($(DEBUG),1)
Vincent Seguin's avatar
Vincent Seguin committed
148
CFLAGS += -g
149
CFLAGS += -pg
Vincent Seguin's avatar
Vincent Seguin committed
150
endif
Michel Kaempf's avatar
Michel Kaempf committed
151
152
153
154
155
156

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

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

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

175
audio_output_obj = 		audio_output/audio_output.o
Michel Kaempf's avatar
Michel Kaempf committed
176

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

Michel Lespinasse's avatar
   
Michel Lespinasse committed
182
183
ac3_decoder_obj =		ac3_decoder/ac3_decoder_thread.o \
						ac3_decoder/ac3_decoder.o \
184
185
186
187
188
189
190
						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
191
192
193
						
lpcm_decoder_obj =		lpcm_decoder/lpcm_decoder_thread.o \
						lpcm_decoder/lpcm_decoder.o
Michel Kaempf's avatar
Michel Kaempf committed
194

Michel Lespinasse's avatar
   
Michel Lespinasse committed
195
196
audio_decoder_obj =		audio_decoder/audio_decoder_thread.o \
						audio_decoder/audio_decoder.o \
197
						audio_decoder/audio_math.o
Michel Kaempf's avatar
Michel Kaempf committed
198

199
spu_decoder_obj =		spu_decoder/spu_decoder.o
200

Vincent Seguin's avatar
Vincent Seguin committed
201
202
#??generic_decoder_obj =		generic_decoder/generic_decoder.o
# remeber to add it to OBJ 
203

Jean-Marc Dressler's avatar
   
Jean-Marc Dressler committed
204
205
206
207
208
209
210
211
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
212
						video_decoder/vdec_motion_inner.o \
Vincent Seguin's avatar
Vincent Seguin committed
213
			                        video_decoder/vdec_idct.o
214

Michel Kaempf's avatar
Michel Kaempf committed
215
216
misc_obj =			misc/mtime.o \
						misc/rsc_files.o \
217
						misc/netutils.o \
218
						misc/plugins.o \
219
						misc/decoder_fifo.o
Michel Kaempf's avatar
Michel Kaempf committed
220

221

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

236
ifeq ($(SYS),beos)
237
238
239
CPP_OBJ =			misc/beos_specific.o
endif

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

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

257
PLUGIN_OBJ = $(intf_plugin) $(aout_plugin) $(vout_plugin)
258

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

# All symbols must be exported
export

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

#
# Virtual targets
#
278
all: vlc plugins
Michel Kaempf's avatar
Michel Kaempf committed
279
280

clean:
281
	rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
Michel Kaempf's avatar
Michel Kaempf committed
282
283

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

install:
291
292
	$(INSTALL) vlc $(prefix)/bin
	mkdir -p $(prefix)/lib/videolan/vlc
Sam Hocevar's avatar
Sam Hocevar committed
293
	mkdir -p $(prefix)/share/videolan/vlc
294
295
296
	$(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
297

Vincent Seguin's avatar
Vincent Seguin committed
298
299
300
301
302
303
304
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
305
306
307
308
# ugliest of all, but I have no time to do it -- sam
snapshot:
	rm -rf /tmp/${SNAPSHOTDIR}
	mkdir /tmp/${SNAPSHOTDIR}
309
	cp -r * /tmp/${SNAPSHOTDIR}
Sam Hocevar's avatar
Sam Hocevar committed
310
311
312
313
314
315
316
317
318
319
		(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
320
321
322
323
324
FORCE:

#
# Real targets
#
325
vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
326
ifeq ($(SYS),beos)
327
328
329
330
331
332
333
	$(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
334
335
336
337
338

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

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

346
$(CPP_OBJ): %.o: %.cpp
347
	$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
348

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

353
354
#$(PLUGIN_OBJ): %.so: Makefile.dep
#$(PLUGIN_OBJ): %.so: .dep/%.d
355
356

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

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

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

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

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

386
plugins/intf/intf_gnome.so: %.so: %.c
387
	$(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
388
389

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

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

395
plugins/intf/intf_ggi.so plugins/vout/vout_ggi.so: %.so: %.c
396
	$(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<
397

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

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

Michel Kaempf's avatar
Michel Kaempf committed
405
406
407
408
409
################################################################################
# Note on generic rules and dependancies
################################################################################

# Note on dependancies: each .c file is associated with a .d file, which
410
411
# 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
412
413
414
# directory.
# The dep directory should be ignored by CVS.

415
# Note on inclusions: depending of the target, the dependancies files must
Michel Kaempf's avatar
Michel Kaempf committed
416
# or must not be included. The problem is that if we ask make to include a file,
417
418
# 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
419
420
421
422
423
# 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
424
425
# The object Makefile known how to make a .o from a .c, and includes
# dependancies for the target, but only those required.