1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

Add generic rules for building helpers with HOSTCC

Originally committed as revision 20412 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Måns Rullgård 2009-10-29 00:55:35 +00:00
parent 7a41027cc4
commit de4070b520
4 changed files with 16 additions and 9 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)
./$< > $@

View File

@ -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)) \