build: rework rules for things in the tools dir

Declaring tools associated with each library in their respective
makefiles allows these tools to easily depend on the correct
prerequisites and link against the libs they need.

Signed-off-by: Mans Rullgard <mans@mansr.com>
pull/2/head
Mans Rullgard 14 years ago
parent b695256edd
commit 28e1c97916
  1. 21
      Makefile
  2. 6
      common.mak
  3. 2
      libavfilter/Makefile
  4. 1
      libavformat/Makefile
  5. 4
      subdir.mak
  6. 3
      tests/Makefile

@ -58,6 +58,8 @@ PROGS := $(PROGS-yes:%=%$(EXESUF))
OBJS = $(PROGS-yes:%=%.o) cmdutils.o OBJS = $(PROGS-yes:%=%.o) cmdutils.o
TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64 TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
HOSTPROGS := $(TESTTOOLS:%=tests/%) HOSTPROGS := $(TESTTOOLS:%=tests/%)
TOOLS = qt-faststart trasher
TOOLS-$(CONFIG_ZLIB) += cws2fws
BASENAMES = ffmpeg ffplay ffprobe ffserver BASENAMES = ffmpeg ffplay ffprobe ffserver
ALLPROGS = $(BASENAMES:%=%$(EXESUF)) ALLPROGS = $(BASENAMES:%=%$(EXESUF))
@ -86,6 +88,11 @@ FF_DEP_LIBS := $(DEP_LIBS)
all: $(FF_DEP_LIBS) $(PROGS) all: $(FF_DEP_LIBS) $(PROGS)
$(TOOLS): %$(EXESUF): %.o
$(LD) $(LDFLAGS) -o $@ $< $(ELIBS)
tools/cws2fws$(EXESUF): ELIBS = -lz
config.h: .config config.h: .config
.config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) .config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))
@-tput bold 2>/dev/null @-tput bold 2>/dev/null
@ -94,7 +101,7 @@ config.h: .config
SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \ SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \ ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS TOOLS
define RESET define RESET
$(1) := $(1) :=
@ -116,18 +123,6 @@ ffserver$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
$(PROGS): %$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS) $(PROGS): %$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
$(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS) $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
TOOLS = cws2fws graph2dot lavfi-showfiltfmts pktdumper probetest qt-faststart trasher
TOOLOBJS := $(TOOLS:%=tools/%.o)
TOOLS := $(TOOLS:%=tools/%$(EXESUF))
alltools: $(TOOLS)
tools/%$(EXESUF): tools/%.o
$(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
$(TOOLOBJS): %.o: %.c | tools
$(CC) $(CPPFLAGS) $(CFLAGS) -c $(CC_O) $<
OBJDIRS += tools OBJDIRS += tools
-include $(wildcard tools/*.d) -include $(wildcard tools/*.d)

@ -20,6 +20,9 @@ TESTOBJS := $(TESTOBJS:%=$(SUBDIR)%) $(TESTPROGS:%=$(SUBDIR)%-test.o)
TESTPROGS := $(TESTPROGS:%=$(SUBDIR)%-test$(EXESUF)) TESTPROGS := $(TESTPROGS:%=$(SUBDIR)%-test$(EXESUF))
HOSTOBJS := $(HOSTPROGS:%=$(SUBDIR)%.o) HOSTOBJS := $(HOSTPROGS:%=$(SUBDIR)%.o)
HOSTPROGS := $(HOSTPROGS:%=$(SUBDIR)%$(HOSTEXESUF)) HOSTPROGS := $(HOSTPROGS:%=$(SUBDIR)%$(HOSTEXESUF))
TOOLS += $(TOOLS-yes)
TOOLOBJS := $(TOOLS:%=tools/%.o)
TOOLS := $(TOOLS:%=tools/%$(EXESUF))
DEP_LIBS := $(foreach NAME,$(FFLIBS),lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME)) DEP_LIBS := $(foreach NAME,$(FFLIBS),lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
@ -28,6 +31,8 @@ SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%) SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho)) checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
alltools: $(TOOLS)
$(HOSTOBJS): %.o: %.c $(HOSTOBJS): %.o: %.c
$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $< $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
@ -37,6 +42,7 @@ $(HOSTPROGS): %$(HOSTEXESUF): %.o
$(OBJS): | $(dir $(OBJS)) $(OBJS): | $(dir $(OBJS))
$(HOSTOBJS): | $(dir $(HOSTOBJS)) $(HOSTOBJS): | $(dir $(HOSTOBJS))
$(TESTOBJS): | $(dir $(TESTOBJS)) $(TESTOBJS): | $(dir $(TESTOBJS))
$(TOOLOBJS): | tools
OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOSTOBJS) $(TESTOBJS)) OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOSTOBJS) $(TESTOBJS))

@ -62,4 +62,6 @@ OBJS-$(CONFIG_NULLSINK_FILTER) += vsink_nullsink.o
DIRS = x86 DIRS = x86
TOOLS = graph2dot lavfi-showfiltfmts
include $(SRC_PATH)/subdir.mak include $(SRC_PATH)/subdir.mak

@ -335,6 +335,7 @@ OBJS-$(CONFIG_JACK_INDEV) += timefilter.o
EXAMPLES = metadata output EXAMPLES = metadata output
TESTPROGS = timefilter TESTPROGS = timefilter
TOOLS = pktdumper probetest
include $(SRC_PATH)/subdir.mak include $(SRC_PATH)/subdir.mak

@ -34,7 +34,7 @@ install-libs-$(CONFIG_STATIC): install-lib$(NAME)-static
install-libs-$(CONFIG_SHARED): install-lib$(NAME)-shared install-libs-$(CONFIG_SHARED): install-lib$(NAME)-shared
define RULES define RULES
$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o
$$(LD) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS) $$(LD) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR) $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
@ -91,7 +91,7 @@ endef
$(eval $(RULES)) $(eval $(RULES))
$(EXAMPLES) $(TESTPROGS): $(THIS_LIB) $(DEP_LIBS) $(EXAMPLES) $(TESTPROGS) $(TOOLS): $(THIS_LIB) $(DEP_LIBS)
examples: $(EXAMPLES) examples: $(EXAMPLES)
testprogs: $(TESTPROGS) testprogs: $(TESTPROGS)

@ -31,9 +31,6 @@ tests/data/asynth1.sw tests/vsynth%/00.pgm: TAG = GEN
tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS) tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
$(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS) $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
tools/lavfi-showfiltfmts$(EXESUF): tools/lavfi-showfiltfmts.o $(FF_DEP_LIBS)
$(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
include $(SRC_PATH)/tests/fate.mak include $(SRC_PATH)/tests/fate.mak
include $(SRC_PATH)/tests/fate2.mak include $(SRC_PATH)/tests/fate2.mak

Loading…
Cancel
Save