Makefile.in 12.3 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
################################################################################

12
# Debugging mode on or off (set to 1 to activate)
13
DEBUG=0
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)
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 45
# including SYS_xx. It will be passed to C compiler.
DEFINE += -DSYS_`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)\""
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
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
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 \
178
						video_output/video_text.o \
Sam Hocevar's avatar
Sam Hocevar committed
179
						video_output/video_spu.o \
180
						video_output/video_yuv.o
Michel Kaempf's avatar
Michel Kaempf committed
181

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

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

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 \
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

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 **/*.so **/*~ *.log
285 286
	rm -f Makefile include/defs.h include/config.h
	rm -f config.status config.cache config.log
Vincent Seguin's avatar
Vincent Seguin committed
287
	rm -f vlc gmon.out core
288 289 290
	rm -rf .dep

install:
291 292 293 294 295
	$(INSTALL) vlc $(prefix)/bin
	mkdir -p $(prefix)/lib/videolan/vlc
	$(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
296

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

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

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

340
$(C_OBJ): %.o: Makefile.dep
341
$(C_OBJ): %.o: .dep/%.d
342
$(C_OBJ): %.o: %.c
343
	@echo "compiling $*.o from $*.c"
Vincent Seguin's avatar
Vincent Seguin committed
344 345
	@$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<

346 347 348 349
$(CPP_OBJ): %.o: %.cpp
	@echo "compiling $*.o from $*.cpp"
	@$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<

350
$(ASM_OBJ): %.o: Makefile.dep
351
$(ASM_OBJ): %.o: %.S
352
	@echo "assembling $*.o from $*.S"
Vincent Seguin's avatar
Vincent Seguin committed
353
	@$(CC) $(CFLAGS) -c -o $@ $<
Michel Kaempf's avatar
Michel Kaempf committed
354

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

# audio plugins
359
plugins/aout/aout_dummy.so plugins/aout/aout_dsp.so: %.so: %.c
360
		@echo "compiling $*.so from $*.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
		@echo "compiling $*.so from $*.c"
369
ifneq (,$(findstring bsd,$(SYS)))
370 371
		@$(CC) $(CCFLAGS) $(CFLAGS) -lesd -shared -o $@ $<
else
372
		@$(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
373
endif
374 375

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

385
plugins/intf/intf_x11.so plugins/vout/vout_x11.so: %.so: %.c
386 387 388
		@echo "compiling $*.so from $*.c"
		@$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<

389 390 391 392
plugins/intf/intf_mga.so plugins/vout/vout_mga.so: %.so: %.c
		@echo "compiling $*.so from $*.c"
		@$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<

393 394 395 396 397 398 399 400
plugins/intf/intf_gnome.so: %.so: %.c
		@echo "compiling $*.so from $*.c"
		@$(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

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

401
plugins/intf/intf_glide.so plugins/vout/vout_glide.so: %.so: %.c
402 403 404
		@echo "compiling $*.so from $*.c"
		@$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $<

405
plugins/intf/intf_ggi.so plugins/vout/vout_ggi.so: %.so: %.c
406 407 408
		@echo "compiling $*.so from $*.c"
		@$(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<

409 410 411 412 413 414 415 416
plugins/intf/intf_beos.so: %.so: %.cpp
		@echo "compiling $*.so from $*.cpp"
		@$(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_

plugins/vout/vout_beos.so: %.so: %.cpp
		@echo "compiling $*.so from $*.cpp"
		@$(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
		
417

Michel Kaempf's avatar
Michel Kaempf committed
418 419 420 421 422
################################################################################
# Note on generic rules and dependancies
################################################################################

# Note on dependancies: each .c file is associated with a .d file, which
423 424
# 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
425 426 427
# directory.
# The dep directory should be ignored by CVS.

428
# Note on inclusions: depending of the target, the dependancies files must
Michel Kaempf's avatar
Michel Kaempf committed
429
# or must not be included. The problem is that if we ask make to include a file,
430 431
# 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
432 433 434 435 436
# 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
437 438
# The object Makefile known how to make a .o from a .c, and includes
# dependancies for the target, but only those required.