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

12
# Debugging mode on or off (set to 1 to activate)
13 14 15
DEBUG=@DEBUG@
STATS=@STATS@
OPTIMS=@OPTIMS@
16

17
SYS=@SYS@
18
PLUGINS=@PLUGINS@
19
INSTALL=@INSTALL@
20
ARCH=@ARCH@
21

22
exec_prefix=@exec_prefix@
23
prefix=@prefix@
24 25 26 27
bindir=@bindir@
datadir=@datadir@
libdir=@libdir@

28 29 30
CC=@CC@
SHELL=@SHELL@

31 32 33
LIB_SDL=@LIB_SDL@
LIB_GLIDE=@LIB_GLIDE@
LIB_GGI=@LIB_GGI@
34 35

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

Vincent Seguin's avatar
Vincent Seguin committed
37 38 39 40
################################################################################
# Configuration pre-processing
################################################################################

Vincent Seguin's avatar
Vincent Seguin committed
41
# PROGRAM_OPTIONS is an identification string of the compilation options
42
PROGRAM_OPTIONS = $(SYS) $(ARCH)
43
ifeq ($(DEBUG),1)
Vincent Seguin's avatar
Vincent Seguin committed
44
PROGRAM_OPTIONS += DEBUG
45 46 47 48 49
DEFINE += -DDEBUG
endif
ifeq ($(STATS),1)
PROGRAM_OPTIONS += DEBUG
DEFINE += -DSTATS
Vincent Seguin's avatar
Vincent Seguin committed
50 51 52
endif

# PROGRAM_BUILD is a complete identification of the build
53 54
# (we can't use fancy options with date since OSes like Solaris
# or FreeBSD have strange date implementations)
55
PROGRAM_BUILD = `date` $(USER)
56
# XXX: beos does not support hostname (how lame...)
57
#PROGRAM_BUILD = `date` $(USER)@`hostname`
Vincent Seguin's avatar
Vincent Seguin committed
58 59

# DEFINE will contain some of the constants definitions decided in Makefile, 
60
# including SYS_xx. It will be passed to C compiler.
61
DEFINE += -DSYS_$(shell echo $(SYS) | sed 's/-.*//' | tr '[a-z].' '[A-Z]_')
Vincent Seguin's avatar
Vincent Seguin committed
62

63 64 65 66 67
# On Linux activate 64-bit off_t (by default under BSD)
ifneq (,$(findstring linux,$(SYS)))
DEFINE += -D_FILE_OFFSET_BITS=64 -D__USE_UNIX98
endif

Michel Kaempf's avatar
Michel Kaempf committed
68
################################################################################
69
# Tuning and other variables - do not change anything except if you know
Vincent Seguin's avatar
Vincent Seguin committed
70
# exactly what you are doing
Michel Kaempf's avatar
Michel Kaempf committed
71 72 73 74 75
################################################################################

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

Michel Kaempf's avatar
Michel Kaempf committed
78 79 80
#
# Libraries
#
81
ifeq ($(SYS),gnu)
82 83 84
LIB += -lthreads -ldl
endif

85
ifneq (,$(findstring bsd,$(SYS)))
86 87
LIB += -pthread -lgnugetopt
LIB += -L/usr/local/lib
88
endif
89

90
ifneq (,$(findstring linux,$(SYS)))
91 92 93
LIB += -lpthread -ldl
endif

94
ifneq (,$(findstring solaris,$(SYS)))
Benoit Steiner's avatar
Benoit Steiner committed
95
LIB += -ldl -lsocket -lnsl -lpthread
96 97
endif

98 99 100 101
ifneq (,$(findstring darwin,$(SYS)))
LIB += -ldl -dyn
endif

102
ifeq ($(SYS),beos)
103 104
LIB += -lbe -lroot -lgame
else
105
LIB += -lm
106
endif
107

Michel Kaempf's avatar
Michel Kaempf committed
108
#
109
# C compiler flags: mainstream compilation
Michel Kaempf's avatar
Michel Kaempf committed
110
#
111 112 113 114
CFLAGS += $(DEFINE) $(INCLUDE)
CFLAGS += -Wall -Winline
CFLAGS += -D_REENTRANT
CFLAGS += -D_GNU_SOURCE
Michel Kaempf's avatar
Michel Kaempf committed
115

116
# flags needed for clean beos compilation
117
ifeq ($(SYS),beos)
118
CFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual
119
endif
120

121 122 123 124
ifneq (,$(findstring darwin,$(SYS)))
CFLAGS += -traditional-cpp
endif

Michel Kaempf's avatar
Michel Kaempf committed
125
# Optimizations : don't compile debug versions with them
126
ifeq ($(OPTIMS),1)
127 128
CFLAGS += -O3
CFLAGS += -ffast-math -funroll-loops
129
CFLAGS += -fomit-frame-pointer
130

131
# Optimizations for x86 familiy
132
ifneq (,$(findstring 86,$(ARCH)))
133
# Optional Pentium Pro optimizations
134
ifneq (,$(findstring ppro,$(ARCH)))
135
CFLAGS += -march=pentiumpro -mcpu=pentiumpro
136
else
137
CFLAGS += -march=pentium -mcpu=pentium
138
endif
Vincent Seguin's avatar
Vincent Seguin committed
139
endif
140

Vincent Seguin's avatar
Vincent Seguin committed
141
# Optimizations for PowerPC
142
ifneq (,$(findstring powerpc,$(ARCH)))
143
CFLAGS += -mmultiple -mhard-float -mstring
Vincent Seguin's avatar
Vincent Seguin committed
144
endif
Michel Kaempf's avatar
Michel Kaempf committed
145

146
# Optimizations for Sparc
147
ifneq (,$(findstring sparc,$(ARCH)))
148
CFLAGS += -mhard-float
149 150
endif

151
#end of optimisations
152 153
endif

154
# Optional MMX optimizations for x86
155 156
ifneq (,$(findstring mmx,$(ARCH)))
CFLAGS += -DHAVE_MMX
157 158
endif

159 160 161
#
# C compiler flags: plugin compilation
#
162 163 164
ifneq (,$(findstring darwin,$(SYS)))
PCFLAGS += -bundle -undefined suppress
else
165
PCFLAGS += -fPIC
166 167
PLCFLAGS += -shared
endif
168

Michel Kaempf's avatar
Michel Kaempf committed
169 170 171 172 173 174 175 176 177 178 179
#
# C compiler flags: dependancies
#
DCFLAGS += $(INCLUDE)
DCFLAGS += -MM

#
# C compiler flags: linking
#
LCFLAGS += $(LIB)
LCFLAGS += -Wall
Vincent Seguin's avatar
Vincent Seguin committed
180
#LCFLAGS += -s
Michel Kaempf's avatar
Michel Kaempf committed
181 182

#
183
# Debugging and profiling support (unless optimisations are active)
Michel Kaempf's avatar
Michel Kaempf committed
184
#
185
ifneq ($(OPTIMS),1)
186 187
CFLAGS += -g
endif
Michel Kaempf's avatar
Michel Kaempf committed
188 189 190 191 192 193

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

#
Vincent Seguin's avatar
Vincent Seguin committed
194
# C Objects
Michel Kaempf's avatar
Michel Kaempf committed
195
# 
196 197 198 199 200
INTERFACE =	src/interface/main.o \
		src/interface/interface.o \
		src/interface/intf_msg.o \
		src/interface/intf_cmd.o \
		src/interface/intf_ctrl.o \
201
		src/interface/intf_playlist.o \
202
		src/interface/intf_channels.o \
Pierre Baillet's avatar
Pierre Baillet committed
203 204
		src/interface/intf_console.o \
		src/interface/intf_urldecode.o \
205

206
INPUT =		src/input/input_ext-dec.o \
207
		src/input/input_ext-intf.o \
208
		src/input/input_dec.o \
209
		src/input/input_programs.o \
Henri Fallon's avatar
Henri Fallon committed
210
		src/input/input_netlist.o \
211
		src/input/input_clock.o \
212 213
		src/input/input.o \
		src/input/mpeg_system.o
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229

AUDIO_OUTPUT = 	src/audio_output/audio_output.o

VIDEO_OUTPUT = 	src/video_output/video_output.o \
		src/video_output/video_text.o \
		src/video_output/video_spu.o \
		src/video_output/video_yuv.o

AC3_DECODER =	src/ac3_decoder/ac3_decoder_thread.o \
		src/ac3_decoder/ac3_decoder.o \
		src/ac3_decoder/ac3_parse.o \
		src/ac3_decoder/ac3_exponent.o \
		src/ac3_decoder/ac3_bit_allocate.o \
		src/ac3_decoder/ac3_mantissa.o \
		src/ac3_decoder/ac3_rematrix.o \
		src/ac3_decoder/ac3_imdct.o \
230 231
		src/ac3_decoder/ac3_downmix.o \
		src/ac3_decoder/ac3_downmix_c.o
232 233 234 235

LPCM_DECODER =	src/lpcm_decoder/lpcm_decoder_thread.o \
		src/lpcm_decoder/lpcm_decoder.o

236 237 238 239 240
AUDIO_DECODER =	src/audio_decoder/audio_decoder.o \
		src/audio_decoder/adec_generic.o \
		src/audio_decoder/adec_layer1.o \
		src/audio_decoder/adec_layer2.o \
		src/audio_decoder/adec_math.o
241 242 243 244 245 246 247 248 249 250

SPU_DECODER =	src/spu_decoder/spu_decoder.o

#GEN_DECODER =	src/generic_decoder/generic_decoder.o

VIDEO_PARSER = 	src/video_parser/video_parser.o \
		src/video_parser/vpar_headers.o \
		src/video_parser/vpar_blocks.o \
		src/video_parser/vpar_synchro.o \
		src/video_parser/video_fifo.o
251

252
VIDEO_DECODER =	src/video_decoder/video_decoder.o
253 254 255 256

MISC =		src/misc/mtime.o \
		src/misc/tests.o \
		src/misc/rsc_files.o \
257
		src/misc/modules.o \
258
		src/misc/netutils.o
259 260 261 262 263 264 265 266 267


C_OBJ =		$(INTERFACE) \
		$(INPUT) \
		$(VIDEO_OUTPUT) \
		$(AUDIO_OUTPUT) \
		$(AC3_DECODER) \
		$(LPCM_DECODER) \
		$(AUDIO_DECODER) \
268
		$(SPU_DECODER) \
269 270 271 272 273
		$(GEN_DECODER) \
		$(VIDEO_PARSER) \
		$(VIDEO_DECODER) \
		$(MISC)

Michel Kaempf's avatar
Michel Kaempf committed
274

275 276 277
#
# CPP Objects
# 
278
ifeq ($(SYS),beos)
279
CPP_OBJ =	src/misc/beos_specific.o
280 281
endif

Vincent Seguin's avatar
Vincent Seguin committed
282 283 284
#
# Assembler Objects
# 
285 286
ifneq (,$(findstring 86,$(ARCH)))
ifneq (,$(findstring mmx,$(ARCH)))
287
ASM_OBJ =		
Vincent Seguin's avatar
Vincent Seguin committed
288
endif
289
endif
Vincent Seguin's avatar
Vincent Seguin committed
290

291 292 293
#
# Plugins
#
294 295
PLUGIN_ALSA =	plugins/alsa/alsa.o \
		plugins/alsa/aout_alsa.o
296

297
PLUGIN_BEOS =	plugins/beos/beos.o \
298
		plugins/beos/aout_beos.o \
299
		plugins/beos/intf_beos.o \
300 301 302
		plugins/beos/vout_beos.o \
		plugins/beos/DrawingTidbits.o \
		plugins/beos/TransportButton.o
303

304 305 306
PLUGIN_DARWIN =	plugins/darwin/darwin.o \
		plugins/darwin/aout_darwin.o

307
PLUGIN_DSP =	plugins/dsp/dsp.o \
308 309
		plugins/dsp/aout_dsp.o

310
PLUGIN_DUMMY =	plugins/dummy/dummy.o \
311
		plugins/dummy/aout_dummy.o \
312 313 314
		plugins/dummy/intf_dummy.o \
		plugins/dummy/vout_dummy.o

315 316
PLUGIN_DVD =	plugins/dvd/dvd.o \
		plugins/dvd/input_dvd.o \
317
		plugins/dvd/dvd_netlist.o \
318
		plugins/dvd/dvd_ioctl.o \
319
		plugins/dvd/dvd_ifo.o \
320
		plugins/dvd/dvd_udf.o \
321
		plugins/dvd/dvd_css.o
322

323
PLUGIN_ESD =	plugins/esd/esd.o \
324
		plugins/esd/aout_esd.o
325

326
PLUGIN_FB =	plugins/fb/fb.o \
327 328
		plugins/fb/vout_fb.o

329
PLUGIN_GGI =	plugins/ggi/ggi.o \
330 331
		plugins/ggi/vout_ggi.o

332
PLUGIN_GLIDE =	plugins/glide/glide.o \
333 334
		plugins/glide/vout_glide.o

335 336 337 338
PLUGIN_GTK =	plugins/gtk/gtk.o \
		plugins/gtk/intf_gtk.o \
		plugins/gtk/gtk_callbacks.o \
		plugins/gtk/gtk_interface.o \
Pierre Baillet's avatar
Pierre Baillet committed
339 340
		plugins/gtk/gtk_support.o \
		plugins/gtk/gtk_playlist.o
341

342
PLUGIN_GNOME =	plugins/gnome/gnome.o \
343
		plugins/gnome/intf_gnome.o \
344 345 346
		plugins/gnome/gnome_callbacks.o \
		plugins/gnome/gnome_interface.o \
		plugins/gnome/gnome_support.o
347

348 349 350
PLUGIN_QT =	plugins/qt/qt.o \
		plugins/qt/intf_qt.o

351
PLUGIN_KDE =	plugins/kde/kde.o \
352
		plugins/kde/intf_kde.o
353

354 355
PLUGIN_IDCT =	plugins/idct/idct.o \
		plugins/idct/idct_common.o
356

357 358
PLUGIN_IDCTCLASSIC =	plugins/idct/idctclassic.o \
			plugins/idct/idct_common.o
359

360 361
PLUGIN_IDCTMMX =	plugins/idct/idctmmx.o \
			plugins/idct/idct_common.o
362

363 364 365
PLUGIN_IDCTMMXEXT =	plugins/idct/idctmmxext.o \
			plugins/idct/idct_common.o

366 367 368 369
PLUGIN_MACOSX =	plugins/macosx/macosx.o \
		plugins/macosx/intf_macosx.o \
		plugins/macosx/vout_macosx.o

370 371
PLUGIN_MGA =	plugins/mga/mga.o \
		plugins/mga/vout_mga.o
372

373 374 375 376 377 378 379 380 381 382 383 384
PLUGIN_MOTION =	plugins/motion/motion.o \
		plugins/motion/vdec_motion_common.o \
		plugins/motion/vdec_motion_inner.o

PLUGIN_MOTIONMMX =	plugins/motion/motionmmx.o \
			plugins/motion/vdec_motion_common.o \
			plugins/motion/vdec_motion_inner_mmx.o

PLUGIN_MOTIONMMXEXT =	plugins/motion/motionmmxext.o \
			plugins/motion/vdec_motion_common.o \
			plugins/motion/vdec_motion_inner_mmxext.o

385 386 387
PLUGIN_NCURSES =	plugins/text/ncurses.o \
			plugins/text/intf_ncurses.o

388
PLUGIN_NULL =	plugins/null/null.o
389

390 391
PLUGIN_PS =	plugins/mpeg/ps.o \
		plugins/mpeg/input_ps.o
392

393 394 395
PLUGIN_SDL =	plugins/sdl/sdl.o \
		plugins/sdl/vout_sdl.o \
		plugins/sdl/aout_sdl.o 
396

397 398
PLUGIN_TS =	plugins/mpeg/ts.o \
		plugins/mpeg/input_ts.o
399

400 401
PLUGIN_X11=	plugins/x11/x11.o \
		plugins/x11/vout_x11.o
402

403 404 405 406 407 408 409 410 411 412
PLUGIN_YUV =	plugins/yuv/yuv.o \
		plugins/yuv/video_yuv.o \
		plugins/yuv/transforms_yuv.o

PLUGIN_YUVMMX =	plugins/yuv/yuvmmx.o \
		plugins/yuv/video_yuvmmx.o \
		plugins/yuv/transforms_yuvmmx.o

STD_PLUGIN_OBJ = \
		$(PLUGIN_ALSA) \
413
		$(PLUGIN_DARWIN) \
414 415
		$(PLUGIN_DSP) \
		$(PLUGIN_DUMMY) \
416
		$(PLUGIN_DVD) \
417 418 419
		$(PLUGIN_ESD) \
		$(PLUGIN_FB) \
		$(PLUGIN_GGI) \
420
		$(PLUGIN_IDCT) \
421
		$(PLUGIN_IDCTCLASSIC) \
422
		$(PLUGIN_IDCTMMX) \
423
		$(PLUGIN_IDCTMMXEXT) \
424
		$(PLUGIN_MACOSX) \
425 426 427 428
		$(PLUGIN_MGA) \
		$(PLUGIN_MOTION) \
		$(PLUGIN_MOTIONMMX) \
		$(PLUGIN_MOTIONMMXEXT) \
429
		$(PLUGIN_NCURSES) \
430 431
		$(PLUGIN_NULL) \
		$(PLUGIN_PS) \
432
		$(PLUGIN_SDL) \
433 434 435 436
		$(PLUGIN_TS) \
		$(PLUGIN_YUV) \
		$(PLUGIN_YUVMMX)

437
# list duplicates
438 439
STD_PLUGIN_COMMON =	plugins/idct/idct_common.o \
			plugins/motion/vdec_motion_common.o
440

441
# filter out duplicates from the plugin object lists
442
STD_PLUGIN_OBJ :=	$(filter-out $(STD_PLUGIN_COMMON), \
443
				 $(STD_PLUGIN_OBJ)) $(STD_PLUGIN_COMMON)
444

445
NONSTD_PLUGIN_OBJ = \
446
		$(PLUGIN_X11) \
447
		$(PLUGIN_GLIDE) \
448
		$(PLUGIN_GTK) \
449 450 451
		$(PLUGIN_GNOME)

NONSTD_CPP_PLUGIN_OBJ = \
452
		$(PLUGIN_BEOS) \
453
		$(PLUGIN_QT) \
454
		$(PLUGIN_KDE)
455

Michel Kaempf's avatar
Michel Kaempf committed
456 457 458
#
# Other lists of files
#
459 460 461 462
objects := $(C_OBJ) $(ASM_OBJ) $(STD_PLUGIN_OBJ) $(NONSTD_PLUGIN_OBJ)
cdependancies := $(objects:%.o=.dep/%.d)
cppobjects := $(CPP_OBJ) $(NONSTD_CPP_PLUGIN_OBJ)
cppdependancies := $(cppobjects:%.o=.dep/%.dpp)
Michel Kaempf's avatar
Michel Kaempf committed
463 464 465 466 467 468 469 470 471 472 473

# All symbols must be exported
export

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

#
# Virtual targets
#
474
all: vlc @ALIASES@ plugins
Michel Kaempf's avatar
Michel Kaempf committed
475 476

clean:
477
	rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(STD_PLUGIN_OBJ)
478
	rm -f plugins/*/*.o src/*/*.o lib/*.so
479
	rm -f vlc gvlc kvlc qvlc
Michel Kaempf's avatar
Michel Kaempf committed
480 481

distclean: clean
482
	rm -f src/*/*.o plugins/*/*.o **/*~ *.log
483 484
	rm -f Makefile include/defs.h include/config.h
	rm -f config.status config.cache config.log
485
	rm -f gmon.out core build-stamp
486
	rm -rf .dep
487 488

install:
489 490
	mkdir -p $(DESTDIR)$(bindir)
	$(INSTALL) vlc $(DESTDIR)$(bindir)
491
# ugly
492 493 494 495 496 497
	for alias in "" @ALIASES@ ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
	mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
	$(INSTALL) -m 644 $(PLUGINS:%=lib/%.so) $(DESTDIR)$(libdir)/videolan/vlc
	mkdir -p $(DESTDIR)$(datadir)/videolan
	$(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
	$(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
498
	$(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
Michel Kaempf's avatar
Michel Kaempf committed
499

Vincent Seguin's avatar
Vincent Seguin committed
500
show:
501
	@echo CC: $(CC)
502
	@echo CFLAGS: $(CFLAGS)
503
	@echo DCFLAGS: $(DCFLAGS)
504
	@echo LCFLAGS: $(LCFLAGS)
505 506
	@echo C_OBJ: $(C_OBJ)
	@echo CPP_OBJ: $(CPP_OBJ)
507
	@echo STD_PLUGIN_OBJ: $(STD_PLUGIN_OBJ)
508 509 510 511
	@echo NONSTD_PLUGIN_OBJ: $(NONSTD_PLUGIN_OBJ)
	@echo NONSTD_CPP_PLUGIN_OBJ: $(NONSTD_CPP_PLUGIN_OBJ)
	@echo objects: $(objects)
	@echo cppobjects: $(cppobjects)
Vincent Seguin's avatar
Vincent Seguin committed
512

Sam Hocevar's avatar
Sam Hocevar committed
513 514
# ugliest of all, but I have no time to do it -- sam
snapshot:
515
	rm -rf /tmp/vlc-@VLC_VERSION@* /tmp/vlc-@VLC_VERSION@nocss*
516
	# copy archive in /tmp
517
	find -type d | grep -v CVS | grep -v '\.dep' | while read i ; \
518 519
		do mkdir -p /tmp/vlc-@VLC_VERSION@/$$i ; \
	done
520
	find debian -mindepth 1 -maxdepth 1 -type d | \
521
		while read i ; do rm -rf /tmp/vlc-@VLC_VERSION@/$$i ; done
522 523 524 525
	# .c .h .in .cpp
	find include src plugins -type f -name '*.[chi]*' | while read i ; \
		do cp $$i /tmp/vlc-@VLC_VERSION@/$$i ; \
	done
526
	# copy misc files
527
	cp vlc.spec AUTHORS COPYING ChangeLog INSTALL README TODO \
528 529 530
		Makefile.in Makefile.dep configure configure.in install-sh \
		config.sub config.guess todo.pl \
			/tmp/vlc-@VLC_VERSION@/
531 532 533
	for file in control control-css vlc-gtk.menu vlc.copyright vlc.docs \
		changelog changelog-css rules rules-css vlc.1 vlc.dirs \
		vlc.menu ; do \
534
			cp debian/$$file /tmp/vlc-@VLC_VERSION@/debian/ ; done
535 536 537
	for file in default8x16.psf default8x9.psf gvlc.png vlc.png \
		gvlc.xpm vlc.xpm ; do \
			cp share/$$file /tmp/vlc-@VLC_VERSION@/share/ ; done
538 539

	# build css-enabled archives
540 541 542 543 544 545
	(cd /tmp ; tar cf vlc-@VLC_VERSION@.tar vlc-@VLC_VERSION@ ; \
		bzip2 -f -9 < vlc-@VLC_VERSION@.tar \
			> vlc-@VLC_VERSION@.tar.bz2 ; \
		gzip -f -9 vlc-@VLC_VERSION@.tar )
	mv /tmp/vlc-@VLC_VERSION@.tar.gz /tmp/vlc-@VLC_VERSION@.tar.bz2 ..

546
	# clean up
547
	rm -rf /tmp/vlc-@VLC_VERSION@*
Sam Hocevar's avatar
Sam Hocevar committed
548

549
plugins: $(PLUGINS:%=lib/%.so)
Michel Kaempf's avatar
Michel Kaempf committed
550

551
FORCE:
552

553
#
554
# GTK/Gnome and Framebuffer aliases - don't add new aliases which could bloat
555 556
# the namespace
#
557
gvlc kvlc qvlc: vlc
558 559
	rm -f $@ && ln -s vlc $@

Michel Kaempf's avatar
Michel Kaempf committed
560 561 562 563

#
# Generic rules (see below)
#
564 565 566 567
$(cdependancies): %.d: FORCE
	@$(MAKE) -s --no-print-directory -f Makefile.dep $@

$(cppdependancies): %.dpp: FORCE
568
	@$(MAKE) -s --no-print-directory -f Makefile.dep $@
Michel Kaempf's avatar
Michel Kaempf committed
569

570
$(C_OBJ): %.o: Makefile.dep
571
$(C_OBJ): %.o: .dep/%.d
572
$(C_OBJ): %.o: %.c
573
	$(CC) $(CFLAGS) -c -o $@ $<
Vincent Seguin's avatar
Vincent Seguin committed
574

575 576
$(CPP_OBJ): %.o: Makefile.dep
$(CPP_OBJ): %.o: .dep/%.dpp
577
$(CPP_OBJ): %.o: %.cpp
578
	$(CC) $(CFLAGS) -c -o $@ $<
579

580
$(ASM_OBJ): %.o: Makefile.dep
581
$(ASM_OBJ): %.o: %.S
582
	$(CC) $(CFLAGS) -c -o $@ $<
Michel Kaempf's avatar
Michel Kaempf committed
583

584 585 586 587 588
$(STD_PLUGIN_OBJ): %.o: Makefile.dep
$(STD_PLUGIN_OBJ): %.o: .dep/%.d
$(STD_PLUGIN_OBJ): %.o: %.c
	$(CC) $(CFLAGS) $(PCFLAGS) -c -o $@ $<

589 590 591 592 593
$(PLUGIN_X11): %.o: Makefile.dep
$(PLUGIN_X11): %.o: .dep/%.d
$(PLUGIN_X11): %.o: %.c
	$(CC) $(CFLAGS) $(PCFLAGS) -I/usr/X11R6/include -c -o $@ $<

594 595 596
$(PLUGIN_GTK): %.o: Makefile.dep
$(PLUGIN_GTK): %.o: .dep/%.d
$(PLUGIN_GTK): %.o: %.c
597
	$(CC) $(CFLAGS) $(PCFLAGS) `gtk-config --cflags gtk` -c -o $@ $<
598

599
$(PLUGIN_GNOME): %.o: Makefile.dep
600
$(PLUGIN_GNOME): %.o: .dep/%.d
601
$(PLUGIN_GNOME): %.o: %.c
602
	$(CC) $(CFLAGS) $(PCFLAGS) `gnome-config --cflags gtk gnomeui` -c -o $@ $<
603 604

$(PLUGIN_GLIDE): %.o: Makefile.dep
605
$(PLUGIN_GLIDE): %.o: .dep/%.d
606
$(PLUGIN_GLIDE): %.o: %.c
607
	$(CC) $(CFLAGS) $(PCFLAGS) -I/usr/include/glide -c -o $@ $<
608

609 610 611 612 613 614 615
$(PLUGIN_QT): %.o: Makefile.dep
$(PLUGIN_QT): %.o: .dep/%.dpp
$(PLUGIN_QT): %.o: %.moc
	$(CC) $(CFLAGS) $(PCFLAGS) -I/usr/include/qt -c -o $@ $(<:%.moc=%.cpp)
$(PLUGIN_QT:%.o=%.moc): %.moc: %.cpp
	moc -i $< -o $@

616 617
$(PLUGIN_KDE): %.o: Makefile.dep
$(PLUGIN_KDE): %.o: .dep/%.dpp
618 619
$(PLUGIN_KDE): %.o: %.cpp
	$(CC) $(CFLAGS) $(PCFLAGS) -I/usr/include/kde -I/usr/include/qt -fno-rtti -c -o $@ $<
620

621 622 623 624 625
$(PLUGIN_BEOS): %.o: Makefile.dep
$(PLUGIN_BEOS): %.o: .dep/%.dpp
$(PLUGIN_BEOS): %.o: %.cpp
	$(CC) $(CFLAGS) $(PCFLAGS) -c -o $@ $<

626
#
627
# Main application target
628
#
629

630 631 632 633 634
vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
ifeq ($(SYS),beos)
	$(CC) $(CFLAGS) $(LCFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
	rm -f ./plugins/_APP_
	ln -s ../vlc ./plugins/_APP_
635 636 637
else
ifeq ($(SYS),nto-qnx)
	$(CC) $(CFLAGS) $(LCFLAGS) -Xlinker -export-dynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
638
else
639
	$(CC) $(CFLAGS) $(LCFLAGS) --export-dynamic @DYNAMIC_FLAG@ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)	
640
endif
641
endif
642

643 644 645 646
#
# Plugin targets
#

647
lib/beos.so: $(PLUGIN_BEOS)
648
	$(CC) $(PCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_ -lbe -lgame -lroot -ltracker
649

650
lib/esd.so: $(PLUGIN_ESD)
651
ifneq (,$(findstring bsd,$(SYS)))
652
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^ -lesd
653
else
654
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^ -laudiofile -lesd
655
endif
656

657 658 659 660 661 662
lib/macosx.so: $(PLUGIN_MACOSX)
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^

lib/darwin.so: $(PLUGIN_DARWIN)
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^

663
lib/dsp.so: $(PLUGIN_DSP)
664
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
665

666
lib/qt.so: $(PLUGIN_QT)
667
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^ -lqt
668

669
lib/kde.so: $(PLUGIN_KDE)
670
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^ -lkdeui -lkdecore -lqt -ldl
671

Henri Fallon's avatar
Henri Fallon committed
672
lib/alsa.so: $(PLUGIN_ALSA)
673
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^ -lasound
Henri Fallon's avatar
Henri Fallon committed
674

675
lib/fb.so: $(PLUGIN_FB)
676
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
677

678 679 680 681
ifeq ($(SYS),nto-qnx)
lib/x11.so: $(PLUGIN_X11)
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^ -L/usr/X11R6/lib -lX11 -lXext -lsocket
else
682
lib/x11.so: $(PLUGIN_X11)
683
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^ -L/usr/X11R6/lib -lX11 -lXext
684
endif
685

686
lib/mga.so: $(PLUGIN_MGA)
687
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^ -L/usr/X11R6/lib -lX11 -lXext
688

689
lib/gtk.so: $(PLUGIN_GTK)
690
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^ `gtk-config --libs gtk | sed 's,-rdynamic,,'`
691

692
lib/gnome.so: $(PLUGIN_GNOME)
693
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^ `gnome-config --libs gnomeui | sed 's,-rdynamic,,'`
694

695
lib/glide.so: $(PLUGIN_GLIDE)
696
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^ $(LIB_GLIDE)
697

698
lib/ggi.so: $(PLUGIN_GGI)
699
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^ $(LIB_GGI)
700

Pierre Baillet's avatar
Pierre Baillet committed
701
lib/sdl.so: $(PLUGIN_SDL)
702
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^ $(LIB_SDL)
Pierre Baillet's avatar
Pierre Baillet committed
703

704
lib/ncurses.so: $(PLUGIN_NCURSES)
705
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^ -lncurses
706

707
ifeq ($(SYS),beos)
708 709 710
lib/null.so: $(PLUGIN_NULL)
	$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_

711 712 713 714 715 716 717 718 719
lib/ps.so: $(PLUGIN_PS)
	$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_

lib/ts.so: $(PLUGIN_TS)
	$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_

lib/dvd.so: $(PLUGIN_DVD)
	$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_

720 721 722
lib/dummy.so: $(PLUGIN_DUMMY)
	$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_

723
lib/yuv.so: $(PLUGIN_YUV)
724
	$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
725 726

lib/yuvmmx.so: $(PLUGIN_YUVMMX)
727 728
	$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_

729 730 731 732 733 734 735 736 737 738 739 740
lib/motion.so: $(PLUGIN_MOTION)
	$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_

lib/motionmmx.so: $(PLUGIN_MOTIONMMX)
	$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_

lib/motionmmxext.so: $(PLUGIN_MOTIONMMXEXT)
	$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_

lib/idct.so: $(PLUGIN_IDCT)
	$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_

741 742 743
lib/idctclassic.so: $(PLUGIN_IDCTCLASSIC)
	$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_

744
lib/idctmmx.so: $(PLUGIN_IDCTMMX)
745
	$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
746 747 748

lib/idctmmxext.so: $(PLUGIN_IDCTMMXEXT)
	$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
749
else
750
lib/null.so: $(PLUGIN_NULL)
751
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
752

753
lib/ps.so: $(PLUGIN_PS)
754
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
755 756

lib/ts.so: $(PLUGIN_TS)
757
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
758 759

lib/dvd.so: $(PLUGIN_DVD)
760
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
761

762
lib/dummy.so: $(PLUGIN_DUMMY)
763
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
764

765
lib/yuv.so: $(PLUGIN_YUV)
766
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
767 768

lib/yuvmmx.so: $(PLUGIN_YUVMMX)
769
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
770

771
lib/motion.so: $(PLUGIN_MOTION)
772
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
773 774

lib/motionmmx.so: $(PLUGIN_MOTIONMMX)
775
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
776 777

lib/motionmmxext.so: $(PLUGIN_MOTIONMMXEXT)
778
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
779

780
lib/idct.so: $(PLUGIN_IDCT)
781
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
782 783

lib/idctclassic.so: $(PLUGIN_IDCTCLASSIC)
784
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
785

786
lib/idctmmx.so: $(PLUGIN_IDCTMMX)
787
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
788 789

lib/idctmmxext.so: $(PLUGIN_IDCTMMXEXT)
790
	$(CC) $(PCFLAGS) $(PLCFLAGS) -o $@ $^
791
endif
792

Michel Kaempf's avatar
Michel Kaempf committed
793 794 795 796 797
################################################################################
# Note on generic rules and dependancies
################################################################################

# Note on dependancies: each .c file is associated with a .d file, which
798 799
# 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
800 801 802
# directory.
# The dep directory should be ignored by CVS.

803
# Note on inclusions: depending of the target, the dependancies files must
Michel Kaempf's avatar
Michel Kaempf committed
804
# or must not be included. The problem is that if we ask make to include a file,
805 806
# 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
807 808 809 810 811
# 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
812 813
# The object Makefile known how to make a .o from a .c, and includes
# dependancies for the target, but only those required.