2 # common bits used by all libraries
5 # first so "all" becomes default target
12 vpath %.asm $(SRC_DIR)
15 ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
23 ECHO = printf "$(1)\t%s\n" $(2)
24 BRIEF = CC AS YASM AR LD HOSTCC RANLIB STRIP CP
25 SILENT = DEPCC YASMDEP RM
27 M = @$(call ECHO,$(MSG),$@);
28 $(foreach VAR,$(BRIEF), \
29 $(eval $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
30 $(foreach VAR,$(SILENT),$(eval $(VAR) = @$($(VAR))))
31 $(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
34 ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
36 CPPFLAGS := -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(CPPFLAGS)
41 $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) -c $(CC_O) $<
45 $(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) -c -o $@ $<
48 $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
53 $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
57 install: install-libs install-headers
58 install-libs: install-libs-yes
60 uninstall: uninstall-libs uninstall-headers
62 .PHONY: all depend dep *clean install* uninstall* examples testprogs
64 # Disable suffix rules. Most of the builtin rules are suffix rules,
65 # so this saves some time on slow systems.
68 # Do not delete intermediate files from chains of implicit rules
72 OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
74 CFLAGS += $(CFLAGS-yes)
76 FFLIBS := $(FFLIBS-yes) $(FFLIBS)
77 TESTPROGS += $(TESTPROGS-yes)
79 FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
80 FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
82 EXAMPLES := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
83 OBJS := $(addprefix $(SUBDIR),$(sort $(OBJS)))
84 TESTOBJS := $(addprefix $(SUBDIR),$(TESTOBJS))
85 TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
86 HOSTOBJS := $(addprefix $(SUBDIR),$(addsuffix .o,$(HOSTPROGS)))
87 HOSTPROGS := $(addprefix $(SUBDIR),$(addsuffix $(HOSTEXESUF),$(HOSTPROGS)))
89 DEP_LIBS := $(foreach NAME,$(FFLIBS),$(BUILD_ROOT_REL)/lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
91 ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
92 SKIPHEADERS += $(addprefix $(ARCH)/,$(ARCH_HEADERS))
93 SKIPHEADERS := $(addprefix $(SUBDIR),$(SKIPHEADERS-) $(SKIPHEADERS))
94 checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
97 $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
99 $(HOSTPROGS): %$(HOSTEXESUF): %.o
100 $(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
102 DEPS := $(OBJS:.o=.d)
105 CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver
106 DISTCLEANSUFFIXES = *.pc
107 LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
109 -include $(wildcard $(DEPS))