]> git.sesse.net Git - vlc/blob - Makefile.old
* ./Makefile.old, ./modules/gui/win32/win32.bpr: fixed header location
[vlc] / Makefile.old
1 ###############################################################################
2 # vlc (VideoLAN Client) main Makefile - (c)1998 VideoLAN
3 ###############################################################################
4
5 ifeq ($(shell [ ! -r Makefile.opts ] && echo 1),)
6     include Makefile.opts
7 endif
8 ifeq ($(shell [ ! -r Makefile.config ] && echo 1),)
9     include Makefile.config
10 endif
11
12 ###############################################################################
13 # Objects and files
14 ###############################################################################
15
16 #
17 # C Objects
18
19 VLC := vlc
20 LIBVLC := libvlc
21 INTERFACE := interface intf_eject
22 PLAYLIST := playlist
23 INPUT := input input_ext-plugins input_ext-dec input_ext-intf input_dec input_programs input_clock input_info
24 VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
25 AUDIO_OUTPUT := audio_output filters input mixer output
26 STREAM_OUTPUT := stream_output
27 MISC := mtime modules threads cpu configuration netutils iso_lang messages objects extras
28
29 LIBVLC_OBJ :=   $(LIBVLC:%=src/%.o) \
30                 $(INTERFACE:%=src/interface/%.o) \
31                 $(PLAYLIST:%=src/playlist/%.o) \
32                 $(INPUT:%=src/input/%.o) \
33                 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
34                 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
35                 $(STREAM_OUTPUT:%=src/stream_output/%.o) \
36                 $(MISC:%=src/misc/%.o)
37
38 VLC_OBJ := $(VLC:%=src/%.o)
39
40 #
41 # Misc Objects
42
43 ifeq ($(NEED_GETOPT),1)
44 LIBVLC_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o 
45 endif
46
47 ifeq ($(NEED_SYMBOLS),1)
48 LIBVLC_OBJ += src/misc/symbols.o
49 endif
50
51 ifeq ($(SYS),beos)
52 CPP_OBJ :=      src/misc/beos_specific.o
53 endif
54
55 ifneq (,$(findstring darwin,$(SYS)))
56 LIBVLC_OBJ +=   src/misc/darwin_specific.o
57 endif
58
59 ifneq (,$(findstring mingw32,$(SYS)))
60 LIBVLC_OBJ +=   src/misc/win32_specific.o
61 RESOURCE_OBJ := share/vlc_win32_rc.o
62 endif
63
64 LIBVLC_OBJ += $(CPP_OBJ) $(M_OBJ) $(BUILTIN_OBJ)
65
66 C_OBJ := $(VLC_OBJ) $(LIBVLC_OBJ)
67
68 VLC_OBJ += $(RESOURCE_OBJ)
69
70 #
71 # Generated header
72 #
73 H_OBJ :=        src/misc/modules_builtin.h
74
75 #
76 # Other lists of files
77 #
78 C_DEP := $(C_OBJ:%.o=.dep/%.d)
79 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
80
81 #
82 # Translate plugin names
83 #
84 ifneq (,$(PLUGINS))
85 PLUGIN_OBJ := $(PLUGINS:%=modules/%.so)
86 endif
87 ifneq (,$(BUILTINS))
88 BUILTIN_OBJ := $(BUILTINS:%=modules/%.a)
89 endif
90
91 #
92 # Misc variables
93 #
94 VERSION := $(shell grep '^ *VERSION=' configure.in | head -1 | sed 's/"//g' | cut -f2 -d=)
95
96 # All symbols must be exported
97 export
98
99 ###############################################################################
100 # Targets
101 ###############################################################################
102
103 #
104 # Virtual targets
105 #
106 all: Makefile.opts vlc ${ALIASES} vlc.app plugins po mozilla/libvlcplugin.so
107
108 Makefile.opts:
109         @echo "**** No configuration found, please run ./configure"
110         @exit 1
111 #       ./configure
112 #       $(MAKE) $(MAKECMDGOALS)
113 #       exit    
114
115 show:
116         @echo CC: $(CC)
117         @echo CFLAGS: $(CFLAGS)
118         @echo LDFLAGS: $(LDFLAGS)
119         @echo plugins_CFLAGS: $(plugins_CFLAGS)
120         @echo plugins_LDFLAGS: $(plugins_LDFLAGS)
121         @echo builtins_CFLAGS: $(builtins_CFLAGS)
122         @echo builtins_LDFLAGS: $(builtins_LDFLAGS)
123         @echo C_OBJ: $(C_OBJ)
124         @echo CPP_OBJ: $(CPP_OBJ)
125         @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
126         @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
127
128 #
129 # Cleaning rules
130 #
131 clean: plugins-clean po-clean vlc-clean mozilla-clean
132         rm -f src/*/*.o extras/*/*.o
133         rm -f lib/*.so* lib/*.a
134         rm -f plugins/*.so plugins/*.a plugins/*.lib plugins/*.tds
135         rm -Rf extras/MacOSX/build
136
137 po-clean:
138         -cd po && $(MAKE) clean
139
140 plugins-clean:
141         for dir in $(shell echo $(PLUGIN_OBJ) $(BUILTIN_OBJ) | sed 's@\([^ ]*\)/[^ ]*@\1@g' ) ; do ( PARENT=`pwd` ; cd $${dir} && $(MAKE) -f $$PARENT/Makefile.modules clean PARENT=$$PARENT ) ; done
142
143 vlc-clean:
144         rm -f $(C_OBJ) $(CPP_OBJ)
145         rm -f vlc gnome-vlc gvlc kvlc qvlc vlc.exe
146         rm -Rf vlc.app
147
148 mozilla-clean:
149         -cd mozilla && $(MAKE) clean
150
151 distclean: clean
152         -cd po && $(MAKE) maintainer-clean
153         rm -f **/*.o **/*~ *.log
154         rm -f Makefile.opts Makefile.config vlc-config
155         rm -f include/defs.h include/modules_builtin.h
156         rm -f src/misc/modules_builtin.h
157         rm -f config*status config*cache config*log conftest*
158         rm -f gmon.out core build-stamp
159         rm -Rf .dep
160         rm -f .gdb_history
161
162 #
163 # Install/uninstall rules
164 #
165 install: vlc-install plugins-install builtins-install libvlc-install po-install mozilla-install
166
167 uninstall: vlc-uninstall plugins-uninstall builtins-uninstall libvlc-uninstall po-uninstall mozilla-uninstall
168
169 vlc-install:
170         mkdir -p $(DESTDIR)$(bindir)
171         $(INSTALL) vlc $(DESTDIR)$(bindir)
172 ifneq (,$(ALIASES))
173         for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
174 endif
175         mkdir -p $(DESTDIR)$(datadir)/vlc
176         $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/vlc
177         $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/vlc
178         $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/vlc
179
180 vlc-uninstall:
181         rm -f $(DESTDIR)$(bindir)/vlc
182 ifneq (,$(ALIASES))
183         for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias ; fi ; done
184 endif
185         rm -f $(DESTDIR)$(datadir)/vlc/*.psf
186         rm -f $(DESTDIR)$(datadir)/vlc/*.png
187         rm -f $(DESTDIR)$(datadir)/vlc/*.xpm
188         -rmdir $(DESTDIR)$(datadir)/vlc
189
190 plugins-install:
191         mkdir -p $(DESTDIR)$(libdir)/vlc
192 ifneq (,$(PLUGINS))
193         for plugin in $(PLUGINS) ; \
194                 do dir=`echo $$plugin | sed -e 's@/[^ ]*@@g'` ; \
195                 mkdir -p $(DESTDIR)$(libdir)/vlc/$$dir ; \
196                 cp modules/$${plugin}.so $(DESTDIR)$(libdir)/vlc/$$dir ; \
197         done
198 endif
199
200 plugins-uninstall:
201         rm -f $(DESTDIR)$(libdir)/vlc/*/*.so
202         -rmdir $(DESTDIR)$(libdir)/vlc/*
203         -rmdir $(DESTDIR)$(libdir)/vlc
204
205 builtins-install:
206         mkdir -p $(DESTDIR)$(libdir)/vlc
207 ifneq (,$(BUILTINS))
208         $(INSTALL) -m 644 $(BUILTINS:%=modules/%.a) $(DESTDIR)$(libdir)/vlc
209 endif
210
211 builtins-uninstall:
212         rm -f $(DESTDIR)$(libdir)/vlc/*.a
213         -rmdir $(DESTDIR)$(libdir)/vlc
214
215 libvlc-install:
216         mkdir -p $(DESTDIR)$(bindir)
217         $(INSTALL) vlc-config $(DESTDIR)$(bindir)
218         mkdir -p $(DESTDIR)$(includedir)/vlc
219         $(INSTALL) -m 644 include/vlc/*.h $(DESTDIR)$(includedir)/vlc
220         mkdir -p $(DESTDIR)$(libdir)
221         $(INSTALL) -m 644 lib/libvlc.a $(DESTDIR)$(libdir)
222
223 libvlc-uninstall:
224         rm -f $(DESTDIR)$(bindir)/vlc-config
225         rm -Rf $(DESTDIR)$(includedir)/vlc
226         rm -f $(DESTDIR)$(libdir)/libvlc.a
227
228 mozilla-install:
229 ifeq ($(MOZILLA),1)
230         -cd mozilla && $(MAKE) install
231 endif
232
233 mozilla-uninstall:
234 ifeq ($(MOZILLA),1)
235         -cd mozilla && $(MAKE) uninstall
236 endif
237
238 po-install:
239         -cd po && $(MAKE) install
240
241 po-uninstall:
242         -cd po && $(MAKE) uninstall
243
244 #
245 # Package generation rules
246 #
247 dist:
248         # Check that tmp isn't in the way
249         @if test -e tmp; then \
250                 echo "Error: please remove ./tmp, it is in the way"; false; \
251         else \
252                 echo "OK."; mkdir tmp; \
253         fi
254         # Copy directory structure in tmp
255         find -type d | grep -v '\(\.dep\|snapshot\|CVS\)' | while read i ; \
256                 do mkdir -p tmp/vlc/$$i ; \
257         done
258         rm -Rf tmp/vlc/tmp
259         find debian -mindepth 1 -maxdepth 1 -type d | \
260                 while read i ; do rm -Rf tmp/vlc/$$i ; done
261         # Copy .c .h .in .cpp .m and .glade files
262         find include src modules -type f -name '*.[bcdhigmrst]*' | while read i ; \
263                 do cp $$i tmp/vlc/$$i ; done
264         # Grmbl... special case...
265         for i in API BUGS DESIGN TODO ; \
266                 do cp modules/mad/$$i tmp/vlc/modules/mad ; done
267         # Copy plugin Makefiles
268         find modules -type f -name Makefile | while read i ; \
269                 do cp $$i tmp/vlc/$$i ; done
270         # Copy extra programs and documentation
271         cp -a extras/* tmp/vlc/extras
272         cp -a doc/* tmp/vlc/doc
273         find tmp/vlc/extras tmp/vlc/doc \
274                 -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
275                         while read i ; do rm -Rf $$i ; done
276         # Copy gettext stuff
277         cp po/ChangeLog po/vlc.pot po/*.po tmp/vlc/po
278         for i in Makefile.in.in POTFILES.in ; do cp po/$$i tmp/vlc/po ; done
279         # Copy misc files
280         cp FAQ AUTHORS COPYING TODO todo.pl ChangeLog* README* INSTALL* \
281                 ABOUT-NLS BUGS MODULES vlc.spec \
282                 Makefile Makefile.*.in Makefile.dep Makefile.modules \
283                 configure configure.in install-sh install-win32 macosx-dmg \
284                 config.sub config.guess aclocal.m4 mkinstalldirs \
285                         tmp/vlc/
286         # Copy Debian control files
287         for file in debian/*dirs debian/*docs debian/*menu debian/*desktop \
288                 debian/*copyright ; do cp $$file tmp/vlc/debian ; done
289         for file in control changelog rules ; do \
290                 cp debian/$$file tmp/vlc/debian/ ; done
291         # Copy ipkg control files
292         for file in control rules patch ; do \
293                 cp ipkg/$$file tmp/vlc/ipkg/ ; done
294         # Copy fonts and icons
295         for file in share/*vlc* share/*psf; do \
296                 cp $$file tmp/vlc/share ; done
297         # Build archives
298         F=vlc-${VERSION}; \
299         mv tmp/vlc tmp/$$F; (cd tmp ; \
300                 cd $$F && $(MAKE) distclean && cd .. ; \
301                 tar czf ../$$F.tar.gz $$F);
302         # Clean up
303         rm -Rf tmp
304
305 package-win32:
306         # XXX: this rule is probably only useful to you if you have exactly
307         # the same setup as me. Contact sam@zoy.org if you need to use it.
308         #
309         # Check that tmp isn't in the way
310         @if test -e tmp; then \
311                 echo "Error: please remove ./tmp, it is in the way"; false; \
312         else \
313                 echo "OK."; mkdir tmp; \
314         fi
315         # Create installation script
316         cp install-win32 tmp/nsi
317         # Copy relevant files
318         cp vlc.exe tmp/ 
319         $(STRIP) tmp/vlc.exe
320         cp INSTALL.win32 tmp/INSTALL.txt ; unix2dos tmp/INSTALL.txt
321         for file in AUTHORS COPYING ChangeLog README FAQ TODO ; \
322                         do cp $$file tmp/$${file}.txt ; \
323                         unix2dos tmp/$${file}.txt ; done
324         mkdir tmp/plugins
325 ifneq (,$(PLUGINS))
326         for i in $(PLUGINS) ; do \
327                 DIR=`echo $$i | cut -f1 -d/` ; \
328                 mkdir -p tmp/plugins/$$DIR ; \
329                 cp modules/$$i.so tmp/plugins/$$DIR ; \
330                 if test $$i != gui/win32/win32 ; then \
331                         $(STRIP) \
332                         tmp/plugins/$$DIR/`echo $$i | sed -e 's@.*/@@'`.so ; \
333                 fi ; \
334         done
335 endif
336         mkdir tmp/share
337         for file in default8x16.psf default8x9.psf ; \
338                 do cp share/$$file tmp/share/ ; done
339         # Create package 
340         wine ~/.wine/fake_windows/Program\ Files/NSIS/makensis.exe -- /DVERSION=${VERSION} /CD tmp/nsi
341         # Clean up
342         rm -Rf tmp
343
344 package-beos:
345         # Check that tmp isn't in the way
346         @if test -e tmp; then \
347                 echo "Error: please remove ./tmp, it is in the way"; false; \
348         else \
349                 echo "OK."; mkdir tmp; \
350         fi
351         
352         # Create dir
353         mkdir -p tmp/vlc/share
354         # Copy relevant files
355         cp vlc tmp/vlc/
356         strip tmp/vlc/vlc
357         xres -o tmp/vlc/vlc ./share/vlc_beos.rsrc
358         cp AUTHORS COPYING ChangeLog README FAQ TODO tmp/vlc/
359         for file in default8x16.psf default8x9.psf ; \
360                 do cp share/$$file tmp/vlc/share/ ; done
361         mkdir tmp/vlc/modules
362         cp $(PLUGINS:%=modules/%.so) tmp/vlc/modules/ 
363         strip $(PLUGINS:%=tmp/vlc/modules/%.so)
364         # Create package 
365         mv tmp/vlc tmp/vlc-${VERSION}
366         (cd tmp ; find vlc-${VERSION} | \
367         zip -9 -@ vlc-${VERSION}-BeOS-x86.zip )
368         mv tmp/vlc-${VERSION}-BeOS-x86.zip .
369         # Clean up
370         rm -Rf tmp
371
372 package-macosx:
373         # Check that tmp isn't in the way
374         @if test -e tmp; then \
375                 echo "Error: please remove ./tmp, it is in the way"; false; \
376         else \
377                 echo "OK."; mkdir tmp; \
378         fi
379
380         # Copy relevant files 
381         cp -R vlc.app tmp/
382         cp AUTHORS COPYING ChangeLog README README.MacOSX.rtf FAQ TODO tmp/
383
384         # Create disk image 
385         ./macosx-dmg 0 "vlc-${VERSION}" tmp/* 
386
387         # Clean up
388         rm -Rf tmp
389
390 #
391 # Gtk/Gnome/* aliases and OS X application
392 #
393 gnome-vlc gvlc kvlc qvlc: vlc
394         rm -f $@ && ln -s vlc $@
395
396 .PHONY: vlc.app
397 vlc.app: vlc plugins
398 ifneq (,$(findstring darwin,$(SYS)))
399         rm -Rf vlc.app
400         cd extras/MacOSX ; pbxbuild | grep -v '^ ' | grep -v '^\t' | grep -v "^$$"
401         cp -r extras/MacOSX/build/vlc.bundle ./vlc.app
402         $(INSTALL) -d vlc.app/Contents/MacOS/share
403         $(INSTALL) -d vlc.app/Contents/MacOS/modules
404         $(INSTALL) vlc vlc.app/Contents/MacOS/
405 ifneq (,$(PLUGINS))
406         $(INSTALL) $(PLUGINS:%=modules/%.so) vlc.app/Contents/MacOS/modules
407 endif
408         $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
409 endif
410
411 FORCE:
412
413 #
414 # Generic rules (see below)
415 #
416 src/misc/modules_builtin.h: Makefile.opts Makefile Makefile.config
417         @echo "make[$(MAKELEVEL)]: Creating \`$@'"
418         @rm -f $@ && cp $@.in $@
419 ifneq (,$(BUILTINS))
420         @for i in $(BUILTINS) ; do \
421                 echo "int vlc_entry__modules_"`echo $$i | sed -e 'y@/@_@' -e 's@\..*@@'`"( module_t* );" >>$@; \
422         done
423         @echo "" >> $@ ;
424 endif
425         @echo "#define ALLOCATE_ALL_BUILTINS() \\" >> $@ ;
426         @echo "    do \\" >> $@ ;
427         @echo "    { \\" >> $@ ;
428 ifneq (,$(BUILTINS))
429         @for i in $(BUILTINS) ; do \
430                 echo "        ALLOCATE_BUILTIN(modules_"`echo $$i | sed -e 'y@/@_@' -e 's@\..*@@'`"); \\" >> $@ ; \
431         done
432 endif
433         @echo "    } while( 0 );" >> $@ ;
434         @echo "" >> $@ ;
435
436 $(C_DEP): %.d: FORCE
437         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
438
439 $(CPP_DEP): %.dpp: FORCE
440         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
441
442 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
443 $(C_OBJ): %.o: $(H_OBJ)
444 $(C_OBJ): %.o: .dep/%.d
445 $(C_OBJ): %.o: %.c
446         $(CC) $(CFLAGS) $(vlc_CFLAGS) -c -o $@ $<
447
448 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
449 $(CPP_OBJ): %.o: $(H_OBJ)
450 $(CPP_OBJ): %.o: .dep/%.dpp
451 $(CPP_OBJ): %.o: %.cpp
452         $(CC) $(CFLAGS) $(vlc_CFLAGS) -c -o $@ $<
453
454 $(M_OBJ): %.o: Makefile.opts Makefile.dep Makefile
455 $(M_OBJ): %.o: $(H_OBJ)
456 $(M_OBJ): %.o: .dep/%.dm
457 $(M_OBJ): %.o: %.m
458         $(CC) $(CFLAGS) $(vlc_CFLAGS) -c -o $@ $<
459
460 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
461 ifneq (,(findstring mingw32,$(SYS)))
462 $(RESOURCE_OBJ): %.o: %.rc
463         $(WINDRES) -i $< -o $@
464 endif
465
466 #
467 # Main application target
468 #
469 vlc: Makefile.config Makefile.opts Makefile.dep Makefile $(VLC_OBJ) lib/libvlc.a $(BUILTIN_OBJ)
470         $(CC) $(CFLAGS) -o $@ $(VLC_OBJ) lib/libvlc.a $(LDFLAGS) $(vlc_LDFLAGS) $(BUILTIN_OBJ) $(builtins_LDFLAGS)
471 ifeq ($(SYS),beos)
472         xres -o $@ ./share/vlc_beos.rsrc
473         mimeset -f $@
474 endif
475
476 #
477 # Main library target
478 #
479 lib/libvlc.a: Makefile.opts Makefile.dep Makefile $(LIBVLC_OBJ)
480         rm -f $@
481         ar rc $@ $(LIBVLC_OBJ)
482         $(RANLIB) $@
483
484 #
485 # DO NOT DISTRIBUTE SHARED VERSIONS OF LIBVLC UNTIL THE ABI IS STABLE
486 # OR BURN IN HELL -- Sam
487 #
488 #lib/libvlc.so: Makefile.opts Makefile.dep Makefile $(LIBVLC_OBJ)
489 #       $(CC) -shared $(LIBVLC_OBJ) $(LDFLAGS) $(vlc_LDFLAGS) -o $@
490
491 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
492 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
493
494 modules/%.a modules/%.so: $(H_OBJ) FORCE
495         cd $(shell echo $@ | sed -e 's@\(.*\)/.*@\1@') && $(MAKE) -f $(shell echo $@ | sed -e 's@[^/]*/@../@g' -e 's@\(.*\)/.*@\1@')/Makefile.modules $(shell echo $@ | sed -e 's@.*/@@') PARENT=$(shell echo $@ | sed -e 's@[^/]*/@../@g' -e 's@\(.*\)/.*@\1@') MODULE_PATH=$(shell echo $@ | sed -e 'y@/@_@' -e 's@\..*@@')
496
497 #
498 # Mozilla plugin target
499 #
500 mozilla/libvlcplugin.so: FORCE
501 ifeq ($(MOZILLA),1)
502         @cd mozilla && $(MAKE) builtins_LDFLAGS="$(builtins_LDFLAGS)"
503 endif
504
505 #
506 # gettext target
507 #
508 po: FORCE
509         @cd po && $(MAKE)
510