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