2006-02-13 13:53:25 +01:00
|
|
|
#
|
|
|
|
# common bits used by all libraries
|
|
|
|
#
|
|
|
|
|
2010-03-09 15:58:18 +01:00
|
|
|
# first so "all" becomes default target
|
|
|
|
all: all-yes
|
2008-03-07 20:27:17 +01:00
|
|
|
|
2011-06-24 09:02:57 +02:00
|
|
|
ifndef SUBDIR
|
|
|
|
|
|
|
|
ifndef V
|
|
|
|
Q = @
|
|
|
|
ECHO = printf "$(1)\t%s\n" $(2)
|
2011-09-14 01:23:16 +02:00
|
|
|
BRIEF = CC CXX AS YASM AR LD HOSTCC STRIP CP
|
2011-06-24 09:02:57 +02:00
|
|
|
SILENT = DEPCC YASMDEP RM RANLIB
|
|
|
|
MSG = $@
|
|
|
|
M = @$(call ECHO,$(TAG),$@);
|
|
|
|
$(foreach VAR,$(BRIEF), \
|
|
|
|
$(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
|
|
|
|
$(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
|
|
|
|
$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
|
|
|
|
endif
|
|
|
|
|
2011-09-19 06:13:30 +02:00
|
|
|
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale swresample
|
2011-07-21 16:27:55 +02:00
|
|
|
|
2011-06-24 10:04:22 +02:00
|
|
|
# NASM requires -I path terminated with /
|
2011-06-27 03:32:45 +02:00
|
|
|
IFLAGS := -I. -I$(SRC_PATH)/
|
|
|
|
CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
|
|
|
|
CFLAGS += $(ECFLAGS)
|
|
|
|
CCFLAGS = $(CFLAGS)
|
2011-09-14 01:23:16 +02:00
|
|
|
CXXFLAGS := $(CFLAGS) $(CXXFLAGS)
|
2011-08-15 23:35:53 +02:00
|
|
|
YASMFLAGS += $(IFLAGS) -I$(SRC_PATH)/libavutil/x86/ -Pconfig.asm
|
2011-06-24 09:02:57 +02:00
|
|
|
HOSTCFLAGS += $(IFLAGS)
|
2011-07-21 16:27:55 +02:00
|
|
|
LDFLAGS := $(ALLFFLIBS:%=-Llib%) $(LDFLAGS)
|
2011-06-24 09:02:57 +02:00
|
|
|
|
2011-06-27 03:32:45 +02:00
|
|
|
define COMPILE
|
|
|
|
$($(1)DEP)
|
|
|
|
$($(1)) $(CPPFLAGS) $($(1)FLAGS) $($(1)_DEPFLAGS) -c $($(1)_O) $<
|
|
|
|
endef
|
|
|
|
|
|
|
|
COMPILE_C = $(call COMPILE,CC)
|
2011-09-14 01:23:16 +02:00
|
|
|
COMPILE_CXX = $(call COMPILE,CXX)
|
2011-06-27 03:32:45 +02:00
|
|
|
COMPILE_S = $(call COMPILE,AS)
|
|
|
|
|
2011-06-24 09:02:57 +02:00
|
|
|
%.o: %.c
|
2011-06-27 03:32:45 +02:00
|
|
|
$(COMPILE_C)
|
2011-06-24 09:02:57 +02:00
|
|
|
|
2011-09-14 01:23:16 +02:00
|
|
|
%.o: %.cpp
|
|
|
|
$(COMPILE_CXX)
|
|
|
|
|
2011-03-04 20:41:33 +01:00
|
|
|
%.s: %.c
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -S -o $@ $<
|
|
|
|
|
2011-06-24 09:02:57 +02:00
|
|
|
%.o: %.S
|
2011-06-27 03:32:45 +02:00
|
|
|
$(COMPILE_S)
|
2011-06-24 09:02:57 +02:00
|
|
|
|
|
|
|
%.ho: %.h
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
|
|
|
|
|
|
|
|
%.ver: %.v
|
|
|
|
$(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
|
|
|
|
|
|
|
|
%.c %.h: TAG = GEN
|
|
|
|
|
2011-06-24 19:53:28 +02:00
|
|
|
# Dummy rule to stop make trying to rebuild removed or renamed headers
|
|
|
|
%.h:
|
|
|
|
@:
|
|
|
|
|
|
|
|
# Disable suffix rules. Most of the builtin rules are suffix rules,
|
|
|
|
# so this saves some time on slow systems.
|
|
|
|
.SUFFIXES:
|
|
|
|
|
|
|
|
# Do not delete intermediate files from chains of implicit rules
|
|
|
|
$(OBJS):
|
2011-06-24 09:02:57 +02:00
|
|
|
endif
|
|
|
|
|
2009-04-13 00:48:44 +02:00
|
|
|
OBJS-$(HAVE_MMX) += $(MMX-OBJS-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
|
|
|
|
2011-06-28 15:45:57 +02:00
|
|
|
FFEXTRALIBS := $(FFLIBS:%=-l%$(BUILDSUF)) $(EXTRALIBS)
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2011-06-28 15:45:57 +02:00
|
|
|
EXAMPLES := $(EXAMPLES:%=$(SUBDIR)%-example$(EXESUF))
|
|
|
|
OBJS := $(sort $(OBJS:%=$(SUBDIR)%))
|
|
|
|
TESTOBJS := $(TESTOBJS:%=$(SUBDIR)%) $(TESTPROGS:%=$(SUBDIR)%-test.o)
|
|
|
|
TESTPROGS := $(TESTPROGS:%=$(SUBDIR)%-test$(EXESUF))
|
|
|
|
HOSTOBJS := $(HOSTPROGS:%=$(SUBDIR)%.o)
|
|
|
|
HOSTPROGS := $(HOSTPROGS:%=$(SUBDIR)%$(HOSTEXESUF))
|
2011-07-10 21:26:25 +02:00
|
|
|
TOOLS += $(TOOLS-yes)
|
|
|
|
TOOLOBJS := $(TOOLS:%=tools/%.o)
|
|
|
|
TOOLS := $(TOOLS:%=tools/%$(EXESUF))
|
2006-02-13 13:53:25 +01:00
|
|
|
|
2011-05-28 14:10:01 +02:00
|
|
|
DEP_LIBS := $(foreach NAME,$(FFLIBS),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))
|
2011-06-28 15:45:57 +02:00
|
|
|
SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
|
|
|
|
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
|
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
|
|
|
|
2011-07-10 21:26:25 +02:00
|
|
|
alltools: $(TOOLS)
|
|
|
|
|
2009-10-29 01:55:35 +01:00
|
|
|
$(HOSTOBJS): %.o: %.c
|
|
|
|
$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
$(HOSTPROGS): %$(HOSTEXESUF): %.o
|
|
|
|
$(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
|
|
|
|
|
2011-07-10 21:05:45 +02:00
|
|
|
$(OBJS): | $(sort $(dir $(OBJS)))
|
|
|
|
$(HOSTOBJS): | $(sort $(dir $(HOSTOBJS)))
|
|
|
|
$(TESTOBJS): | $(sort $(dir $(TESTOBJS)))
|
2011-07-10 21:26:25 +02:00
|
|
|
$(TOOLOBJS): | tools
|
2011-06-28 19:45:13 +02:00
|
|
|
|
|
|
|
OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOSTOBJS) $(TESTOBJS))
|
|
|
|
|
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
|
|
|
|
2011-03-30 22:23:04 +02:00
|
|
|
-include $(wildcard $(OBJS:.o=.d) $(TESTOBJS:.o=.d))
|