aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2009-10-29 00:55:35 +0000
committerMåns Rullgård <mans@mansr.com>2009-10-29 00:55:35 +0000
commitde4070b5204a97c555bcc32746fb7c60da971a6c (patch)
treee7693419df86057aa6b905668b19d63c0d869328
parent7a41027cc4c2249fcabd657f848dc8862033a2dd (diff)
downloadffmpeg-de4070b5204a97c555bcc32746fb7c60da971a6c.tar.gz
Add generic rules for building helpers with HOSTCC
Originally committed as revision 20412 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--Makefile7
-rw-r--r--common.mak8
-rw-r--r--libavcodec/Makefile7
-rw-r--r--subdir.mak3
4 files changed, 16 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 3a70a8f6f5..f011e51b4b 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,7 @@ PROGS_G = $(addsuffix _g$(EXESUF), $(PROGS-yes))
OBJS = $(addsuffix .o, $(PROGS-yes)) cmdutils.o
MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher))
+HOSTPROGS = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr)
BASENAMES = ffmpeg ffplay ffserver
ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES))
@@ -47,7 +48,8 @@ $(PROGS): %$(EXESUF): %_g$(EXESUF)
$(STRIP) $@
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
define RESET
$(1) :=
@@ -324,9 +326,6 @@ tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
mkdir -p tests/data
$(BUILD_ROOT)/$< $@
-tests/%$(HOSTEXESUF): tests/%.c
- $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
-
tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
$(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
diff --git a/common.mak b/common.mak
index 343ca749b5..396772bf64 100644
--- a/common.mak
+++ b/common.mak
@@ -61,6 +61,8 @@ FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
EXAMPLES := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
OBJS := $(addprefix $(SUBDIR),$(OBJS))
TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
+HOSTOBJS := $(addprefix $(SUBDIR),$(addsuffix .o,$(HOSTPROGS)))
+HOSTPROGS := $(addprefix $(SUBDIR),$(addsuffix $(HOSTEXESUF),$(HOSTPROGS)))
DEP_LIBS := $(foreach NAME,$(FFLIBS),$(BUILD_ROOT_REL)/lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
@@ -68,6 +70,12 @@ ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)
SKIPHEADERS = $(addprefix $(SUBDIR),$(SKIPHEADERS-))
checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
+$(HOSTOBJS): %.o: %.c
+ $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
+
+$(HOSTPROGS): %$(HOSTEXESUF): %.o
+ $(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
+
DEPS := $(OBJS:.o=.d)
depend dep: $(DEPS)
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 0938dd089d..21cba37b58 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -685,17 +685,16 @@ TESTPROGS = cabac dct eval fft h264 iirfilter rangecoder snow
TESTPROGS-$(ARCH_X86) += x86/cpuid
TESTPROGS-$(HAVE_MMX) += motion
+HOSTPROGS = costablegen
+
DIRS = alpha arm bfin mlib ppc ps2 sh4 sparc x86
-CLEANFILES = sin_tables.c cos_tables.c costablegen$(HOSTEXESUF) *_tables.h *_tablegen$(HOSTEXESUF)
+CLEANFILES = sin_tables.c cos_tables.c *_tables.h *_tablegen$(HOSTEXESUF)
include $(SUBDIR)../subdir.mak
$(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o
-$(SUBDIR)costablegen$(HOSTEXESUF): $(SUBDIR)costablegen.c
- $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
-
$(SUBDIR)cos_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
./$< > $@
diff --git a/subdir.mak b/subdir.mak
index eb9a70f97f..1a5158ac69 100644
--- a/subdir.mak
+++ b/subdir.mak
@@ -36,7 +36,8 @@ $(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
clean::
rm -f $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
- $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
+ $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS)))) \
+ $(HOSTOBJS) $(HOSTPROGS)
distclean:: clean
rm -f $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \