build: simplify some conditional targets
[ffmpeg.git] / Makefile
index 73ada9a..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-$(CONFIG_DOC): install-man
+install-progs-$(CONFIG_SHARED): install-libs
 
-install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
+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))
@@ -202,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
 
@@ -287,4 +289,5 @@ $(FATE): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
 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*