report if the service creation failed
[mplayer/greg.git] / Makefile
blob56a3b33d07ad592d296188a35c481d592730cddd
1 # LINUX Makefile made by A'rpi / Astral
2 # Some cleanup by LGB: * 'make -C dir' instead of 'cd dir;make;cd..'
3 # * for loops instead of linear sequence of make directories
4 # * some minor problems with make clean and distclean were corrected
5 # * DVD support
7 include config.mak
9 PRG = mplayer
10 PRG_CFG = codec-cfg
11 PRG_MENCODER = mencoder
13 # Do not strip the binaries at installation
14 ifeq ($(STRIPBINARIES),yes)
15 INSTALLSTRIP = -s
16 endif
18 # These subdirectories require installation due to binaries within them.
19 ifeq ($(VIDIX),yes)
20 SUBDIRS += libdha vidix
21 DO_MAKE = @ for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done
22 endif
24 SRCS_COMMON = cpudetect.c codec-cfg.c spudec.c playtree.c playtreeparser.c asxparser.c vobsub.c subreader.c sub_cc.c find_sub.c m_config.c m_option.c parser-cfg.c m_struct.c
25 SRCS_MENCODER = mencoder.c mp_msg-mencoder.c $(SRCS_COMMON) libao2/afmt.c divx4_vbr.c libvo/aclib.c libvo/osd.c libvo/sub.c libvo/font_load.c libvo/font_load_ft.c xvid_vbr.c parser-mecmd.c
26 SRCS_MPLAYER = mplayer.c mp_msg.c $(SRCS_COMMON) mixer.c parser-mpcmd.c
28 ifeq ($(UNRARLIB),yes)
29 SRCS_COMMON += unrarlib.c
30 endif
32 OBJS_MENCODER = $(SRCS_MENCODER:.c=.o)
33 OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o)
35 VO_LIBS = $(AA_LIB) $(X_LIB) $(SDL_LIB) $(GGI_LIB) $(MP1E_LIB) $(MLIB_LIB) $(SVGA_LIB) $(DIRECTFB_LIB) $(CACA_LIB)
36 AO_LIBS = $(ARTS_LIB) $(ESD_LIB) $(NAS_LIB) $(SGIAUDIO_LIB)
37 CODEC_LIBS = $(AV_LIB) $(FAME_LIB) $(MAD_LIB) $(VORBIS_LIB) $(THEORA_LIB) $(FAAD_LIB) $(LIBLZO_LIB) $(DECORE_LIB) $(XVID_LIB) $(PNG_LIB) $(Z_LIB) $(JPEG_LIB) $(ALSA_LIB) $(XMMS_LIB) $(MATROSKA_LIB)
38 COMMON_LIBS = libmpcodecs/libmpcodecs.a mp3lib/libMP3.a liba52/liba52.a libmpeg2/libmpeg2.a $(W32_LIB) $(DS_LIB) libaf/libaf.a libmpdemux/libmpdemux.a input/libinput.a postproc/libswscale.a osdep/libosdep.a $(DVDREAD_LIB) $(CODEC_LIBS) $(FREETYPE_LIB) $(TERMCAP_LIB) $(CDPARANOIA_LIB) $(MPLAYER_NETWORK_LIB) $(WIN32_LIB) $(GIF_LIB) $(MACOSX_FRAMEWORKS) $(SMBSUPPORT_LIB) $(FRIBIDI_LIB) $(FONTCONFIG_LIB) $(ENCA_LIB)
40 CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Iloader -Ilibvo $(FREETYPE_INC) $(EXTRA_INC) $(CDPARANOIA_INC) $(SDL_INC) $(X11_INC) $(FRIBIDI_INC) $(DVB_INC) $(XVID_INC) $(FONTCONFIG_INC) # -Wall
42 PARTS = libmpdemux libmpcodecs mp3lib liba52 libmpeg2 libavcodec libavformat libao2 drivers osdep postproc input libvo libaf
43 ifeq ($(INTERNAL_FAAD),yes)
44 COMMON_LIBS += libfaad2/libfaad2.a
45 PARTS += libfaad2
46 endif
47 ifeq ($(VIDIX),yes)
48 PARTS += libdha vidix
49 endif
50 ifeq ($(FAME),yes)
51 PARTS += libfame
52 endif
53 ifeq ($(DVDKIT2),yes)
54 PARTS += libmpdvdkit2
55 else
56 ifeq ($(DVDKIT),yes)
57 PARTS += libmpdvdkit
58 endif
59 endif
60 ifeq ($(GUI),yes)
61 PARTS += Gui
62 endif
63 ifneq ($(W32_LIB),)
64 PARTS += loader loader/dshow loader/dmo
65 endif
66 ifeq ($(LIBMENU),yes)
67 PARTS += libmenu
68 endif
70 ALL_PRG = $(PRG)
71 ifeq ($(MENCODER),yes)
72 ALL_PRG += $(PRG_MENCODER)
73 endif
75 COMMON_DEPS = $(W32_DEP) $(DS_DEP) $(MP1E_DEP) $(AV_DEP) libmpdemux/libmpdemux.a libmpcodecs/libmpcodecs.a libao2/libao2.a liba52/liba52.a mp3lib/libMP3.a libmpeg2/libmpeg2.a osdep/libosdep.a postproc/libswscale.a input/libinput.a libvo/libvo.a libaf/libaf.a
77 ifeq ($(INTERNAL_FAAD),yes)
78 COMMON_DEPS += libfaad2/libfaad2.a
79 endif
80 ifeq ($(VIDIX),yes)
81 COMMON_DEPS += libdha/libdha.so vidix/libvidix.a
82 endif
83 ifeq ($(FAME),yes)
84 COMMON_DEPS += libfame/libfame.a
85 endif
86 ifeq ($(DVDKIT2),yes)
87 ifeq ($(DVDKIT_SHARED),yes)
88 COMMON_DEPS += libmpdvdkit2/libmpdvdkit.so
89 else
90 COMMON_DEPS += libmpdvdkit2/libmpdvdkit.a
91 endif
92 endif
94 ifeq ($(SHARED_PP),yes)
95 COMMON_DEPS += libavcodec/libpostproc/libpostproc.so
96 COMMON_LIBS += libavcodec/libpostproc/libpostproc.so
97 endif
99 ifeq ($(GUI),yes)
100 COMMON_DEPS += Gui/libgui.a
101 GUI_LIBS = Gui/libgui.a
102 endif
104 .SUFFIXES: .cc .c .o
106 # .PHONY: $(COMMON_DEPS)
108 all: version.h $(ALL_PRG)
110 .c.o:
111 $(CC) -c $(CFLAGS) -o $@ $<
113 libaf/libaf.a:
114 $(MAKE) -C libaf
116 libmpdvdkit2/libmpdvdkit.a:
117 $(MAKE) -C libmpdvdkit2
119 libmpdvdkit2/libmpdvdkit.so:
120 $(MAKE) -C libmpdvdkit2 libmpdvdkit.so
122 loader/libloader.a:
123 $(MAKE) -C loader
125 libfame/libfame.a:
126 $(MAKE) -C libfame
128 libmpdemux/libmpdemux.a:
129 $(MAKE) -C libmpdemux
131 libmpcodecs/libmpcodecs.a:
132 $(MAKE) -C libmpcodecs
134 loader/dshow/libDS_Filter.a:
135 $(MAKE) -C loader/dshow
137 loader/dmo/libDMO_Filter.a:
138 $(MAKE) -C loader/dmo
140 libavcodec/libavcodec.a:
141 $(MAKE) -C libavcodec LIBPREF=lib LIBSUF=.a
143 libavformat/libavformat.a:
144 $(MAKE) -C libavformat LIBPREF=lib LIBSUF=.a
146 libmpeg2/libmpeg2.a:
147 $(MAKE) -C libmpeg2
149 libvo/libvo.a:
150 $(MAKE) -C libvo
152 libao2/libao2.a:
153 $(MAKE) -C libao2
155 liba52/liba52.a:
156 $(MAKE) -C liba52
158 libfaad2/libfaad2.a:
159 $(MAKE) -C libfaad2
161 mp3lib/libMP3.a:
162 $(MAKE) -C mp3lib
164 libdha/libdha.so:
165 $(MAKE) -C libdha
167 vidix/libvidix.a:
168 $(MAKE) -C vidix
170 Gui/libgui.a:
171 $(MAKE) -C Gui
173 osdep/libosdep.a:
174 $(MAKE) -C osdep
176 postproc/libswscale.a:
177 $(MAKE) -C postproc
179 input/libinput.a:
180 $(MAKE) -C input
182 libmenu/libmenu.a:
183 $(MAKE) -C libmenu
185 libavcodec/libpostproc/libpostproc.so:
186 $(MAKE) -C libavcodec/libpostproc
188 MPLAYER_DEP = $(OBJS_MPLAYER) $(COMMON_DEPS)
190 ifeq ($(LIBMENU),yes)
191 MPLAYER_DEP += libmenu/libmenu.a
192 MENU_LIBS = libmenu/libmenu.a
193 PARTS += libmenu
194 else
195 MENU_LIBS =
196 endif
198 MENCODER_DEP = $(OBJS_MENCODER) $(COMMON_DEPS)
200 ifeq ($(VIDIX),yes)
201 VIDIX_LIBS = vidix/libvidix.a
202 else
203 VIDIX_LIBS =
204 endif
206 ifeq ($(TARGET_WIN32),yes)
207 OBJS_MPLAYER += mplayer-rc.o
208 endif
210 $(PRG): $(MPLAYER_DEP)
211 ./darwinfixlib.sh $(MPLAYER_DEP)
212 ifeq ($(TARGET_WIN32),yes)
213 windres -o mplayer-rc.o mplayer.rc
214 endif
215 $(CC) $(CFLAGS) -o $(PRG) $(OBJS_MPLAYER) libvo/libvo.a libao2/libao2.a $(MENU_LIBS) $(VIDIX_LIBS) $(GUI_LIBS) $(COMMON_LIBS) $(GTK_LIBS) $(VO_LIBS) $(AO_LIBS) $(EXTRA_LIB) $(LIRC_LIB) $(LIRCC_LIB) $(STATIC_LIB) $(ARCH_LIB) $(I18NLIBS) -lm
217 mplayer.exe.spec.c: libmpcodecs/libmpcodecs.a
218 winebuild -fPIC -o mplayer.exe.spec.c -exe mplayer.exe -mcui \
219 libmpcodecs/ad_qtaudio.o libmpcodecs/vd_qtvideo.o \
220 -L/usr/local/lib/wine -lkernel32
222 mplayer.exe.so: $(MPLAYER_DEP) mplayer.exe.spec.c
223 $(CC) $(CFLAGS) -Wall -shared -Wl,-rpath,/usr/local/lib -Wl,-Bsymbolic -o mplayer.exe.so $(OBJS_MPLAYER) mplayer.exe.spec.c libvo/libvo.a libao2/libao2.a $(MENU_LIBS) $(VIDIX_LIBS) $(GUI_LIBS) $(COMMON_LIBS) $(GTK_LIBS) $(VO_LIBS) $(AO_LIBS) $(EXTRA_LIB) $(LIRC_LIB) $(LIRCC_LIB) $(STATIC_LIB) $(ARCH_LIB) -lwine -lm
225 mplayer_wine.so: $(MPLAYER_DEP)
226 ./darwinfixlib.sh $(MPLAYER_DEP)
227 $(CC) $(CFLAGS) -shared -Wl,-Bsymbolic -o mplayer_wine.so mplayer_wine.spec.c $(OBJS_MPLAYER) libvo/libvo.a libao2/libao2.a $(MENU_LIBS) $(VIDIX_LIBS) $(GUI_LIBS) $(COMMON_LIBS) $(GTK_LIBS) $(VO_LIBS) $(AO_LIBS) $(EXTRA_LIB) $(LIRC_LIB) $(LIRCC_LIB) $(STATIC_LIB) -lwine $(ARCH_LIB) -lm
229 ifeq ($(MENCODER),yes)
230 $(PRG_MENCODER): $(MENCODER_DEP)
231 ./darwinfixlib.sh $(MENCODER_DEP) libmpcodecs/libmpencoders.a
232 $(CC) $(CFLAGS) -o $(PRG_MENCODER) $(OBJS_MENCODER) libmpcodecs/libmpencoders.a $(ENCORE_LIB) $(COMMON_LIBS) $(EXTRA_LIB) $(MLIB_LIB) $(LIRC_LIB) $(LIRCC_LIB) $(ARCH_LIB) $(I18NLIBS) -lm
233 endif
235 codecs.conf.h: $(PRG_CFG) etc/codecs.conf
236 ./$(PRG_CFG) ./etc/codecs.conf > $@
238 codec-cfg.o: codecs.conf.h
240 # Every mplayer dependency depends on version.h, to force building version.h
241 # first (in serial mode) before any other of the dependencies for a parallel make
242 # run. This is necessary, because the make rule for version.h removes objects
243 # in a recursive "make distclean" and we must wait for this "make distclean" to
244 # finish before we can start building new object files.
245 $(MPLAYER_DEP): version.h
246 $(MENCODER_DEP): version.h
248 $(PRG_CFG): version.h codec-cfg.c codec-cfg.h
249 $(CC) $(CFLAGS) -g codec-cfg.c mp_msg.c -o $(PRG_CFG) -DCODECS2HTML $(EXTRA_LIB) $(I18NLIBS)
251 install: $(ALL_PRG)
252 ifeq ($(VIDIX),yes)
253 $(DO_MAKE)
254 endif
255 if test ! -d $(BINDIR) ; then mkdir -p $(BINDIR) ; fi
256 $(INSTALL) -m 755 $(INSTALLSTRIP) $(PRG) $(BINDIR)/$(PRG)
257 ifeq ($(GUI),yes)
258 -ln -sf $(PRG) $(BINDIR)/gmplayer
259 endif
260 if test ! -d $(MANDIR)/man1 ; then mkdir -p $(MANDIR)/man1; fi
261 for i in $(LANGUAGES); do \
262 if test "$$i" = en ; then \
263 $(INSTALL) -c -m 644 DOCS/man/en/mplayer.1 $(MANDIR)/man1/mplayer.1 ; \
264 else \
265 mkdir -p $(MANDIR)/$$i/man1 ; \
266 $(INSTALL) -c -m 644 DOCS/man/$$i/mplayer.1 $(MANDIR)/$$i/man1/mplayer.1 ; \
267 fi ; \
268 done
269 ifeq ($(MENCODER),yes)
270 $(INSTALL) -m 755 $(INSTALLSTRIP) $(PRG_MENCODER) $(BINDIR)/$(PRG_MENCODER)
271 for i in $(LANGUAGES); do \
272 if test "$$i" = en ; then \
273 ln -sf mplayer.1 $(MANDIR)/man1/mencoder.1 ; \
274 else \
275 ln -sf mplayer.1 $(MANDIR)/$$i/man1/mencoder.1 ; \
276 fi ; \
277 done
278 endif
279 @if test ! -d $(DATADIR) ; then mkdir -p $(DATADIR) ; fi
280 @if test ! -d $(DATADIR)/font ; then mkdir -p $(DATADIR)/font ; fi
281 @if test ! -f $(DATADIR)/font/font.desc ; then \
282 echo "*** Download font at http://www.mplayerhq.hu/homepage/dload.html" ; \
283 echo "*** for OSD/Subtitles support and extract to $(DATADIR)/font/" ; \
285 ifeq ($(GUI),yes)
286 @if test ! -d $(DATADIR)/Skin ; then mkdir -p $(DATADIR)/Skin ; fi
287 @echo "*** Download skin(s) at http://www.mplayerhq.hu/homepage/dload.html"
288 @echo "*** for GUI, and extract to $(DATADIR)/Skin/"
289 endif
290 @if test ! -d $(CONFDIR) ; then mkdir -p $(CONFDIR) ; fi
291 @if test -f $(CONFDIR)/codecs.conf ; then mv -f $(CONFDIR)/codecs.conf $(CONFDIR)/codecs.conf.old ; fi
292 ifeq ($(DVDKIT_SHARED),yes)
293 ifeq ($(DVDKIT2),yes)
294 if test ! -d $(LIBDIR) ; then mkdir -p $(LIBDIR) ; fi
295 $(INSTALL) -m 755 $(INSTALLSTRIP) libmpdvdkit2/libmpdvdkit.so $(LIBDIR)/libmpdvdkit.so
296 else
297 ifeq ($(DVDKIT),yes)
298 if test ! -d $(LIBDIR) ; then mkdir -p $(LIBDIR) ; fi
299 $(INSTALL) -m 755 $(INSTALLSTRIP) libmpdvdkit/libmpdvdkit.so $(LIBDIR)/libmpdvdkit.so
300 endif
301 endif
302 endif
304 uninstall:
305 -rm -f $(BINDIR)/$(PRG) $(BINDIR)/gmplayer $(MANDIR)/man1/mplayer.1
306 -rm -f $(BINDIR)/$(PRG_MENCODER) $(MANDIR)/man1/mencoder.1
307 @echo "Uninstall completed"
309 clean:
310 -rm -f *.o *~ $(OBJS) codecs.conf.h
312 distclean:
313 -rm -f *~ $(PRG) $(PRG_MENCODER) $(PRG_CFG) $(OBJS)
314 -rm -f *.o *.a .depend configure.log codecs.conf.h
315 @for a in $(PARTS); do $(MAKE) -C $$a distclean; done
316 -$(MAKE) -C libavcodec distclean LIBPREF=lib LIBSUF=.a
317 -$(MAKE) -C libavformat distclean LIBPREF=lib LIBSUF=.a
319 strip:
320 strip -s $(ALL_PRG)
322 dep: depend
324 depend:
325 ./version.sh `$(CC) -dumpversion`
326 $(CC) -MM $(CFLAGS) -DCODECS2HTML mplayer.c mencoder.c $(SRCS_MPLAYER) $(SRCS_MENCODER) 1>.depend
327 @for a in $(PARTS); do $(MAKE) -C $$a dep; done
329 # ./configure must be run if it changed in CVS
330 config.h: configure
331 @echo "############################################################"
332 @echo "####### Please run ./configure again - it's changed! #######"
333 @echo "############################################################"
334 ifeq ($(wildcard .developer),)
335 @exit 1
336 endif
338 # do not rebuild after cvs commits if .developer file is present!
340 # rebuild at every config.h/config.mak change:
341 version.h:
342 ./version.sh `$(CC) -dumpversion`
343 ifeq ($(wildcard .developer),)
344 $(MAKE) distclean
345 endif
346 $(MAKE) depend
348 # rebuild at every CVS update or config/makefile change:
349 ifeq ($(wildcard .developer),)
350 ifneq ($(wildcard CVS/Entries),)
351 version.h: CVS/Entries
352 endif
353 version.h: config.h config.mak Makefile
354 endif
357 # include dependencies to get make to recurse into lib dirs,
358 # if the user desires such behavior
360 ifneq ($(wildcard .libdeps),)
361 include .libdeps
362 endif
365 # include dependency files if they exist
367 ifneq ($(wildcard .depend),)
368 include .depend
369 endif