Commit de4070b5 authored by Måns Rullgård's avatar Måns Rullgård

Add generic rules for building helpers with HOSTCC

Originally committed as revision 20412 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 7a41027c
......@@ -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)
......
......@@ -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)
......
......@@ -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)
./$< > $@
......
......@@ -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)) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment