You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

265 lines
6.3KB

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