Makefile 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. #
  2. # Main ffmpeg Makefile
  3. # (c) 2000-2004 Fabrice Bellard
  4. #
  5. include config.mak
  6. VPATH=$(SRC_PATH)
  7. CFLAGS=$(OPTFLAGS) -I$(BUILD_ROOT) -I$(SRC_PATH) -I$(SRC_PATH)/libavutil \
  8. -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat \
  9. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE
  10. LDFLAGS+= -g
  11. ifeq ($(CONFIG_SWSCALER),yes)
  12. CFLAGS := -I$(SRC_PATH)/libswscale $(CFLAGS)
  13. endif
  14. MANPAGES=doc/ffmpeg.1
  15. PROGS_G+=ffmpeg_g$(EXESUF)
  16. PROGS+=ffmpeg$(EXESUF)
  17. PROGTEST=output_example$(EXESUF)
  18. QTFASTSTART=qt-faststart$(EXESUF)
  19. ifeq ($(CONFIG_FFSERVER),yes)
  20. MANPAGES+=doc/ffserver.1
  21. PROGS+=ffserver$(EXESUF)
  22. endif
  23. ifeq ($(CONFIG_FFPLAY),yes)
  24. MANPAGES+=doc/ffplay.1
  25. PROGS_G+=ffplay_g$(EXESUF)
  26. PROGS+=ffplay$(EXESUF)
  27. endif
  28. BASENAMES=ffmpeg ffplay ffserver
  29. ALLPROGS=$(addsuffix $(EXESUF), $(BASENAMES))
  30. ALLPROGS_G=$(addsuffix _g$(EXESUF), $(BASENAMES))
  31. ALLMANPAGES=$(addsuffix .1, $(BASENAMES))
  32. ifeq ($(CONFIG_AUDIO_BEOS),yes)
  33. EXTRALIBS+=-lmedia -lbe
  34. endif
  35. ifeq ($(BUILD_SHARED),yes)
  36. DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
  37. else
  38. DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
  39. endif
  40. ifeq ($(BUILD_VHOOK),yes)
  41. VHOOK=videohook
  42. INSTALLVHOOK=install-vhook
  43. endif
  44. ifeq ($(BUILD_DOC),yes)
  45. DOC=documentation
  46. endif
  47. OBJS = ffmpeg.o ffserver.o cmdutils.o ffplay.o
  48. SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
  49. LDFLAGS := -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil $(LDFLAGS)
  50. EXTRALIBS := -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)
  51. ifeq ($(CONFIG_SWSCALER),yes)
  52. LDFLAGS+=-L./libswscale
  53. EXTRALIBS+=-lswscale$(BUILDSUF)
  54. endif
  55. all: lib $(PROGS_G) $(PROGS) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
  56. lib:
  57. $(MAKE) -C libavutil all
  58. $(MAKE) -C libavcodec all
  59. $(MAKE) -C libavformat all
  60. ifeq ($(CONFIG_PP),yes)
  61. $(MAKE) -C libpostproc all
  62. endif
  63. ifeq ($(CONFIG_SWSCALER),yes)
  64. $(MAKE) -C libswscale all
  65. endif
  66. ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
  67. $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS)
  68. ffserver$(EXESUF): ffserver.o .libs
  69. $(CC) $(LDFLAGS) $(FFSERVERLDFLAGS) -o $@ ffserver.o $(EXTRALIBS)
  70. ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
  71. $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(EXTRALIBS) $(SDL_LIBS)
  72. %$(EXESUF): %_g$(EXESUF)
  73. cp -p $< $@
  74. $(STRIP) $@
  75. version.h:
  76. $(SRC_PATH)/version.sh "$(SRC_PATH)"
  77. output_example$(EXESUF): output_example.o .libs
  78. $(CC) $(LDFLAGS) -o $@ output_example.o $(EXTRALIBS)
  79. qt-faststart$(EXESUF): qt-faststart.c
  80. $(CC) $(CFLAGS) $< -o $@
  81. cws2fws$(EXESUF): cws2fws.c
  82. $(CC) $< -o $@ -lz
  83. ffplay.o: ffplay.c
  84. $(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
  85. ffmpeg.o ffplay.o ffserver.o: version.h
  86. %.o: %.c
  87. $(CC) $(CFLAGS) -c -o $@ $<
  88. videohook: .libs
  89. $(MAKE) -C vhook all
  90. documentation:
  91. $(MAKE) -C doc all
  92. install: install-progs install-libs install-headers install-man $(INSTALLVHOOK)
  93. ifeq ($(BUILD_SHARED),yes)
  94. install-progs: $(PROGS) install-libs
  95. else
  96. install-progs: $(PROGS)
  97. endif
  98. install -d "$(bindir)"
  99. install -c $(INSTALLSTRIP) -m 755 $(PROGS) "$(bindir)"
  100. # create the window installer
  101. wininstaller: all install
  102. makensis ffinstall.nsi
  103. # install man from source dir if available
  104. install-man:
  105. ifneq ($(CONFIG_MINGW),yes)
  106. if [ -f doc/ffmpeg.1 ] ; then \
  107. install -d "$(mandir)/man1" ; \
  108. install -m 644 $(MANPAGES) "$(mandir)/man1" ; \
  109. fi
  110. endif
  111. install-vhook:
  112. $(MAKE) -C vhook install
  113. install-libs:
  114. $(MAKE) -C libavutil install-libs
  115. $(MAKE) -C libavcodec install-libs
  116. $(MAKE) -C libavformat install-libs
  117. ifeq ($(CONFIG_PP),yes)
  118. $(MAKE) -C libpostproc install-libs
  119. endif
  120. ifeq ($(CONFIG_SWSCALER),yes)
  121. $(MAKE) -C libswscale install-libs
  122. endif
  123. ifeq ($(BUILD_SHARED),yes)
  124. -$(LDCONFIG)
  125. endif
  126. install-headers:
  127. $(MAKE) -C libavutil install-headers
  128. $(MAKE) -C libavcodec install-headers
  129. $(MAKE) -C libavformat install-headers
  130. ifeq ($(CONFIG_PP),yes)
  131. $(MAKE) -C libpostproc install-headers
  132. endif
  133. ifeq ($(CONFIG_SWSCALER),yes)
  134. $(MAKE) -C libswscale install-headers
  135. endif
  136. uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
  137. uninstall-progs:
  138. rm -f $(addprefix $(bindir)/, $(ALLPROGS))
  139. uninstall-man:
  140. ifneq ($(CONFIG_MINGW),yes)
  141. rm -f $(addprefix $(mandir)/man1/,$(ALLMANPAGES))
  142. endif
  143. uninstall-vhook:
  144. $(MAKE) -C vhook uninstall
  145. uninstall-libs:
  146. $(MAKE) -C libavutil uninstall-libs
  147. $(MAKE) -C libavcodec uninstall-libs
  148. $(MAKE) -C libavformat uninstall-libs
  149. $(MAKE) -C libpostproc uninstall-libs
  150. uninstall-headers:
  151. $(MAKE) -C libavutil uninstall-headers
  152. $(MAKE) -C libavcodec uninstall-headers
  153. $(MAKE) -C libavformat uninstall-headers
  154. $(MAKE) -C libpostproc uninstall-headers
  155. -rmdir "$(incdir)"
  156. -rmdir "$(prefix)/include/postproc"
  157. dep: depend
  158. depend: .depend
  159. $(MAKE) -C libavutil depend
  160. $(MAKE) -C libavcodec depend
  161. $(MAKE) -C libavformat depend
  162. ifeq ($(CONFIG_PP),yes)
  163. $(MAKE) -C libpostproc depend
  164. endif
  165. ifeq ($(CONFIG_SWSCALER),yes)
  166. $(MAKE) -C libswscale depend
  167. endif
  168. ifeq ($(BUILD_VHOOK),yes)
  169. $(MAKE) -C vhook depend
  170. endif
  171. .depend: $(SRCS) version.h
  172. $(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $(SRCS) 1>.depend
  173. .libs: lib
  174. @test -f .libs || touch .libs
  175. @for i in $(DEP_LIBS) ; do if test $$i -nt .libs ; then touch .libs; fi ; done
  176. clean:
  177. $(MAKE) -C libavutil clean
  178. $(MAKE) -C libavcodec clean
  179. $(MAKE) -C libavformat clean
  180. $(MAKE) -C libpostproc clean
  181. $(MAKE) -C libswscale clean
  182. $(MAKE) -C tests clean
  183. $(MAKE) -C vhook clean
  184. $(MAKE) -C doc clean
  185. rm -f *.o *.d *~ .libs gmon.out TAGS \
  186. $(ALLPROGS) $(ALLPROGS_G) $(PROGTEST) $(QTFASTSTART)
  187. # Note well: config.log is NOT removed.
  188. distclean: clean
  189. $(MAKE) -C libavutil distclean
  190. $(MAKE) -C libavcodec distclean
  191. $(MAKE) -C libavformat distclean
  192. $(MAKE) -C libpostproc distclean
  193. $(MAKE) -C libswscale distclean
  194. $(MAKE) -C tests distclean
  195. $(MAKE) -C vhook distclean
  196. rm -f .depend version.h config.* *.pc
  197. TAGS:
  198. etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch]
  199. # regression tests
  200. codectest libavtest test-server fulltest test mpeg4 mpeg: $(PROGS)
  201. $(MAKE) -C tests $@
  202. # tar release (use 'make -k tar' on a checkouted tree)
  203. FILE=ffmpeg-$(shell grep "\#define FFMPEG_VERSION " version.h | \
  204. cut -d "\"" -f 2 )
  205. tar:
  206. rm -rf /tmp/$(FILE)
  207. cp -r . /tmp/$(FILE)
  208. ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude .svn )
  209. rm -rf /tmp/$(FILE)
  210. .PHONY: all lib videohook documentation install* wininstaller uninstall*
  211. .PHONY: dep depend clean distclean TAGS tar
  212. .PHONY: codectest libavtest test-server fulltest test mpeg4 mpeg
  213. ifneq ($(wildcard .depend),)
  214. include .depend
  215. endif