build: simplify some conditional targets
[ffmpeg.git] / Makefile
index a155eea..7c7cdaf 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -41,15 +41,9 @@ FF_LDFLAGS   := $(FFLDFLAGS)
 FF_EXTRALIBS := $(FFEXTRALIBS)
 FF_DEP_LIBS  := $(DEP_LIBS)
 
-ALL_TARGETS-$(CONFIG_DOC)       += documentation
+all-$(CONFIG_DOC): documentation
 
-ifdef PROGS
-INSTALL_TARGETS-yes             += install-progs install-data
-INSTALL_TARGETS-$(CONFIG_DOC)   += install-man
-endif
-INSTALL_PROGS_TARGETS-$(CONFIG_SHARED) = install-libs
-
-all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
+all: $(FF_DEP_LIBS) $(PROGS)
 
 config.h: .config
 .config: $(wildcard $(FFLIBS:%=$(SRC_DIR)/lib%/all*.c))
@@ -74,12 +68,15 @@ endef
 
 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
 
+ffplay.o: CFLAGS += $(SDL_CFLAGS)
 ffplay$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
 ffserver$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
 
-%$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
+$(PROGS): %$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
        $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
 
+alltools: $(TOOLS)
+
 tools/%$(EXESUF): tools/%.o
        $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
 
@@ -89,8 +86,6 @@ tools/%.o: tools/%.c
 -include $(wildcard tools/*.d)
 -include $(wildcard tests/*.d)
 
-ffplay.o: CFLAGS += $(SDL_CFLAGS)
-
 VERSION_SH  = $(SRC_PATH_BARE)/version.sh
 GIT_LOG     = $(SRC_PATH_BARE)/.git/logs/HEAD
 
@@ -104,8 +99,6 @@ version.h .version:
 # force version.sh to run whenever version might have changed
 -include .version
 
-alltools: $(TOOLS)
-
 DOCS = $(addprefix doc/, developer.html faq.html general.html libavfilter.html) $(HTMLPAGES) $(MANPAGES) $(PODPAGES)
 
 documentation: $(DOCS)
@@ -117,7 +110,7 @@ TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d)
 doc/%.html: TAG = HTML
 doc/%.html: doc/%.texi $(SRC_PATH_BARE)/doc/t2h.init
        $(Q)$(TEXIDEP)
-       $(M)cd doc && texi2html -monolithic --init-file $(SRC_PATH_BARE)/doc/t2h.init $(<:doc/%=%)
+       $(M)texi2html -monolithic --init-file $(SRC_PATH_BARE)/doc/t2h.init --output $@ $<
 
 doc/%.pod: TAG = POD
 doc/%.pod: doc/%.texi
@@ -128,9 +121,18 @@ doc/%.1: TAG = MAN
 doc/%.1: doc/%.pod
        $(M)pod2man --section=1 --center=" " --release=" " $< > $@
 
-install: $(INSTALL_TARGETS-yes)
+ifdef PROGS
+install: install-progs install-data
+endif
+
+install: install-libs install-headers
+
+install-libs: install-libs-yes
 
-install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
+install-progs-$(CONFIG_DOC): install-man
+install-progs-$(CONFIG_SHARED): install-libs
+
+install-progs: install-progs-yes $(PROGS)
        $(Q)mkdir -p "$(BINDIR)"
        $(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
 
@@ -142,7 +144,7 @@ install-man: $(MANPAGES)
        $(Q)mkdir -p "$(MANDIR)/man1"
        $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
 
-uninstall: uninstall-progs uninstall-data uninstall-man
+uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data uninstall-man
 
 uninstall-progs:
        $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
@@ -168,7 +170,7 @@ clean:: testclean
 
 distclean::
        $(RM) $(DISTCLEANSUFFIXES)
-       $(RM) version.h config.* libavutil/avconfig.h
+       $(RM) config.* .version version.h libavutil/avconfig.h
 
 config:
        $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION)
@@ -180,7 +182,6 @@ check: test checkheaders
 fulltest test: codectest lavftest lavfitest seektest
 
 FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
-SEEK_REFFILE     = $(SRC_PATH)/tests/seek.regression.ref
 
 codectest: fate-codec
 lavftest:  fate-lavf
@@ -194,10 +195,6 @@ REFS = $(AREF) $(VREF)
 $(VREF): ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
 $(AREF): ffmpeg$(EXESUF) tests/data/asynth1.sw
 
-fate-acodec-aref:  CMD = codectest acodec
-fate-vsynth1-vref: CMD = codectest vsynth1
-fate-vsynth2-vref: CMD = codectest vsynth2
-
 ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
        @echo
        @echo "Unfortunately ffserver is broken and therefore its regression"
@@ -207,15 +204,15 @@ ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
 
 tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
        @mkdir -p tests/vsynth1
-       $(M)$(BUILD_ROOT)/$< 'tests/vsynth1/'
+       $(M)./$< 'tests/vsynth1/'
 
 tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
        @mkdir -p tests/vsynth2
-       $(M)$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
+       $(M)./$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
 
 tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
        @mkdir -p tests/data
-       $(M)$(BUILD_ROOT)/$< $@
+       $(M)./$< $@
 
 tests/data/asynth1.sw tests/vsynth%/00.pgm: TAG = GEN
 
@@ -250,8 +247,8 @@ FATE = $(FATE_ACODEC)                                                   \
        $(FATE_LAVFI)                                                    \
        $(FATE_SEEK)                                                     \
 
-$(FATE_ACODEC): $(AREF)
-$(FATE_VCODEC): $(VREF)
+$(filter-out %-aref,$(FATE_ACODEC)): $(AREF)
+$(filter-out %-vref,$(FATE_VCODEC)): $(VREF)
 $(FATE_LAVF):   $(REFS)
 $(FATE_LAVFI):  $(REFS) tools/lavfi-showfiltfmts$(EXESUF)
 $(FATE_SEEK):   fate-codec fate-lavf tests/seek_test$(EXESUF)
@@ -285,11 +282,12 @@ FATE_UTILS = base64 tiny_psnr
 
 fate: $(FATE)
 
-$(FATE) $(REFS): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
+$(FATE): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
        @echo "TEST    $(@:fate-%=%)"
        $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' '$(THREAD_TYPE)'
 
 fate-list:
        @printf '%s\n' $(sort $(FATE))
 
-.PHONY: documentation *test regtest-* alltools check config
+.PHONY: all alltools *clean check config documentation examples install*
+.PHONY: *test testprogs uninstall*