2006-02-13 13:53:25 +01:00
|
|
|
#
|
|
|
|
# common bits used by all libraries
|
|
|
|
#
|
|
|
|
|
2008-04-07 23:16:31 +02:00
|
|
|
all: # make "all" default target
|
2008-03-07 20:27:17 +01:00
|
|
|
|
2008-04-08 00:17:47 +02:00
|
|
|
ifndef SUBDIR
|
2009-03-25 19:14:28 +01:00
|
|
|
vpath %.c $(SRC_DIR)
|
|
|
|
vpath %.h $(SRC_DIR)
|
|
|
|
vpath %.S $(SRC_DIR)
|
2008-08-12 01:53:31 +02:00
|
|
|
vpath %.asm $(SRC_DIR)
|
2010-01-16 05:49:02 +01:00
|
|
|
vpath %.v $(SRC_DIR)
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2008-06-19 18:57:38 +02:00
|
|
|
ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
|
|
|
|
BUILD_ROOT_REL = .
|
|
|
|
else
|
|
|
|
BUILD_ROOT_REL = ..
|
|
|
|
endif
|
|
|
|
|
2010-03-06 18:14:19 +01:00
|
|
|
ifndef V
|
|
|
|
Q = @
|
|
|
|
ECHO = printf "$(1)\t%s\n" $(2)
|
|
|
|
BRIEF = CC AS YASM AR LD HOSTCC RANLIB STRIP CP
|
2010-03-06 20:29:29 +01:00
|
|
|
SILENT = DEPCC YASMDEP RM
|
2010-03-06 18:14:19 +01:00
|
|
|
MSG = $@
|
|
|
|
$(foreach VAR,$(BRIEF), \
|
|
|
|
$(eval $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
|
|
|
|
$(foreach VAR,$(SILENT),$(eval $(VAR) = @$($(VAR))))
|
|
|
|
$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
|
|
|
|
endif
|
|
|
|
|
2008-03-06 21:44:44 +01:00
|
|
|
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
|
|
|
|
|
2010-03-07 23:18:33 +01:00
|
|
|
CPPFLAGS := -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(CPPFLAGS)
|
2010-01-29 00:30:24 +01:00
|
|
|
CFLAGS += $(ECFLAGS)
|
2006-02-13 13:53:25 +01:00
|
|
|
|
|
|
|
%.o: %.c
|
2009-08-08 20:27:27 +02:00
|
|
|
$(CCDEP)
|
2009-08-23 15:46:07 +02:00
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) -c $(CC_O) $<
|
2006-02-13 13:53:25 +01:00
|
|
|
|
|
|
|
%.o: %.S
|
2009-08-08 20:27:27 +02:00
|
|
|
$(ASDEP)
|
2009-08-23 15:46:07 +02:00
|
|
|
$(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) -c -o $@ $<
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2007-06-17 02:05:39 +02:00
|
|
|
%.ho: %.h
|
2009-08-23 15:46:07 +02:00
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
|
2007-06-17 02:05:39 +02:00
|
|
|
|
2008-04-18 21:28:40 +02:00
|
|
|
%$(EXESUF): %.c
|
|
|
|
|
2010-01-16 05:49:02 +01:00
|
|
|
%.ver: %.v
|
2010-03-06 18:14:19 +01:00
|
|
|
$(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
|
2010-01-16 05:49:02 +01:00
|
|
|
|
2008-06-19 18:57:38 +02:00
|
|
|
SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
|
|
|
|
ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
|
|
|
|
$(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
|
|
|
|
endif
|
|
|
|
|
2009-03-02 10:33:57 +01:00
|
|
|
$(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh config.mak
|
2009-01-26 10:10:04 +01:00
|
|
|
$< $(SRC_PATH) $@ $(EXTRA_VERSION)
|
2008-06-19 18:57:38 +02:00
|
|
|
|
2008-04-07 23:16:31 +02:00
|
|
|
install: install-libs install-headers
|
2008-03-26 10:39:12 +01:00
|
|
|
|
2010-01-26 23:23:12 +01:00
|
|
|
uninstall: uninstall-libs uninstall-headers
|
|
|
|
|
|
|
|
.PHONY: all depend dep *clean install* uninstall* examples testprogs
|
2010-02-26 00:27:54 +01:00
|
|
|
|
|
|
|
# Disable suffix rules. Most of the builtin rules are suffix rules,
|
|
|
|
# so this saves some time on slow systems.
|
|
|
|
.SUFFIXES:
|
2010-02-27 16:25:28 +01:00
|
|
|
|
|
|
|
# Do not delete intermediate files from chains of implicit rules
|
|
|
|
.SECONDARY:
|
2008-04-07 23:16:31 +02:00
|
|
|
endif
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2009-04-13 00:48:44 +02:00
|
|
|
OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
|
|
|
|
|
2010-01-29 00:30:24 +01:00
|
|
|
CFLAGS += $(CFLAGS-yes)
|
2009-03-25 19:14:28 +01:00
|
|
|
OBJS += $(OBJS-yes)
|
|
|
|
FFLIBS := $(FFLIBS-yes) $(FFLIBS)
|
|
|
|
TESTPROGS += $(TESTPROGS-yes)
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2008-04-07 23:16:31 +02:00
|
|
|
FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
|
2009-04-01 02:53:25 +02:00
|
|
|
FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2009-03-29 16:35:20 +02:00
|
|
|
EXAMPLES := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
|
2009-03-25 19:14:28 +01:00
|
|
|
OBJS := $(addprefix $(SUBDIR),$(OBJS))
|
2010-03-08 19:43:44 +01:00
|
|
|
TESTOBJS := $(addprefix $(SUBDIR),$(TESTOBJS))
|
2009-03-25 19:19:20 +01:00
|
|
|
TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
|
2009-10-29 01:55:35 +01:00
|
|
|
HOSTOBJS := $(addprefix $(SUBDIR),$(addsuffix .o,$(HOSTPROGS)))
|
|
|
|
HOSTPROGS := $(addprefix $(SUBDIR),$(addsuffix $(HOSTEXESUF),$(HOSTPROGS)))
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2009-07-28 10:58:48 +02:00
|
|
|
DEP_LIBS := $(foreach NAME,$(FFLIBS),$(BUILD_ROOT_REL)/lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
|
2008-04-09 23:11:39 +02:00
|
|
|
|
2009-01-11 23:48:07 +01:00
|
|
|
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
|
2010-03-08 19:43:38 +01:00
|
|
|
SKIPHEADERS := $(addprefix $(SUBDIR),$(SKIPHEADERS-) $(SKIPHEADERS))
|
2009-08-23 13:02:37 +02:00
|
|
|
checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2009-10-29 01:55:35 +01:00
|
|
|
$(HOSTOBJS): %.o: %.c
|
|
|
|
$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
$(HOSTPROGS): %$(HOSTEXESUF): %.o
|
|
|
|
$(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
|
|
|
|
|
2008-04-09 22:48:17 +02:00
|
|
|
DEPS := $(OBJS:.o=.d)
|
|
|
|
depend dep: $(DEPS)
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2010-01-16 05:49:02 +01:00
|
|
|
CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver
|
2009-11-22 15:22:13 +01:00
|
|
|
DISTCLEANSUFFIXES = *.pc
|
2009-05-29 13:56:54 +02:00
|
|
|
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
|
2008-02-25 10:22:11 +01:00
|
|
|
|
2009-08-08 20:27:22 +02:00
|
|
|
-include $(wildcard $(DEPS))
|