2006-02-13 12:53:25 +00:00
|
|
|
#
|
|
|
|
# common bits used by all libraries
|
|
|
|
#
|
|
|
|
|
2010-03-09 14:58:18 +00:00
|
|
|
# first so "all" becomes default target
|
|
|
|
all: all-yes
|
2008-03-07 19:27:17 +00:00
|
|
|
|
2011-06-24 07:02:57 +00:00
|
|
|
ifndef SUBDIR
|
|
|
|
|
|
|
|
ifndef V
|
|
|
|
Q = @
|
|
|
|
ECHO = printf "$(1)\t%s\n" $(2)
|
2011-09-13 23:23:16 +00:00
|
|
|
BRIEF = CC CXX AS YASM AR LD HOSTCC STRIP CP
|
2012-07-28 23:56:31 +00:00
|
|
|
SILENT = DEPCC DEPAS DEPHOSTCC DEPYASM RM RANLIB
|
2011-06-24 07:02:57 +00:00
|
|
|
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
|
|
|
|
|
2012-04-25 20:01:59 +00:00
|
|
|
ALLFFLIBS = avcodec avdevice avfilter avformat avresample avutil postproc swscale swresample
|
2011-07-21 14:27:55 +00:00
|
|
|
|
2011-06-24 08:04:22 +00:00
|
|
|
# NASM requires -I path terminated with /
|
2011-06-27 01:32:45 +00:00
|
|
|
IFLAGS := -I. -I$(SRC_PATH)/
|
|
|
|
CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
|
|
|
|
CFLAGS += $(ECFLAGS)
|
2012-07-27 21:42:19 +00:00
|
|
|
CCFLAGS = $(CPPFLAGS) $(CFLAGS)
|
|
|
|
ASFLAGS := $(CPPFLAGS) $(ASFLAGS)
|
2012-07-30 15:44:56 +00:00
|
|
|
CXXFLAGS += $(CPPFLAGS) $(CFLAGS)
|
2012-08-07 21:04:55 +00:00
|
|
|
YASMFLAGS += $(IFLAGS:%=%/) -I$(SRC_PATH)/libavutil/x86/ -Pconfig.asm
|
|
|
|
|
2012-07-27 21:42:19 +00:00
|
|
|
HOSTCCFLAGS = $(IFLAGS) $(HOSTCFLAGS)
|
2011-07-21 14:27:55 +00:00
|
|
|
LDFLAGS := $(ALLFFLIBS:%=-Llib%) $(LDFLAGS)
|
2011-06-24 07:02:57 +00:00
|
|
|
|
2011-06-27 01:32:45 +00:00
|
|
|
define COMPILE
|
2012-07-27 21:42:19 +00:00
|
|
|
$(call $(1)DEP,$(1))
|
2012-07-28 23:56:31 +00:00
|
|
|
$($(1)) $($(1)FLAGS) $($(1)_DEPFLAGS) $($(1)_C) $($(1)_O) $<
|
2011-06-27 01:32:45 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
COMPILE_C = $(call COMPILE,CC)
|
2011-09-13 23:23:16 +00:00
|
|
|
COMPILE_CXX = $(call COMPILE,CXX)
|
2011-06-27 01:32:45 +00:00
|
|
|
COMPILE_S = $(call COMPILE,AS)
|
|
|
|
|
2011-06-24 07:02:57 +00:00
|
|
|
%.o: %.c
|
2011-06-27 01:32:45 +00:00
|
|
|
$(COMPILE_C)
|
2011-06-24 07:02:57 +00:00
|
|
|
|
2011-09-13 23:23:16 +00:00
|
|
|
%.o: %.cpp
|
|
|
|
$(COMPILE_CXX)
|
|
|
|
|
2011-03-04 19:41:33 +00:00
|
|
|
%.s: %.c
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -S -o $@ $<
|
|
|
|
|
2011-06-24 07:02:57 +00:00
|
|
|
%.o: %.S
|
2011-06-27 01:32:45 +00:00
|
|
|
$(COMPILE_S)
|
2011-06-24 07:02:57 +00:00
|
|
|
|
|
|
|
%.ho: %.h
|
2012-07-28 23:56:31 +00:00
|
|
|
$(CC) $(CCFLAGS) -c $(CC_O) -x c $<
|
2011-06-24 07:02:57 +00:00
|
|
|
|
|
|
|
%.ver: %.v
|
|
|
|
$(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
|
|
|
|
|
|
|
|
%.c %.h: TAG = GEN
|
|
|
|
|
2011-06-24 17:53:28 +00: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 07:02:57 +00:00
|
|
|
endif
|
|
|
|
|
2012-03-27 21:10:02 +00:00
|
|
|
include $(SRC_PATH)/arch.mak
|
2009-04-12 22:48:44 +00:00
|
|
|
|
2009-03-25 18:14:28 +00:00
|
|
|
OBJS += $(OBJS-yes)
|
|
|
|
FFLIBS := $(FFLIBS-yes) $(FFLIBS)
|
|
|
|
TESTPROGS += $(TESTPROGS-yes)
|
2006-02-13 12:53:25 +00:00
|
|
|
|
2011-06-28 13:45:57 +00:00
|
|
|
FFEXTRALIBS := $(FFLIBS:%=-l%$(BUILDSUF)) $(EXTRALIBS)
|
2006-02-13 12:53:25 +00:00
|
|
|
|
2011-06-28 13:45:57 +00: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 19:26:25 +00:00
|
|
|
TOOLS += $(TOOLS-yes)
|
|
|
|
TOOLOBJS := $(TOOLS:%=tools/%.o)
|
|
|
|
TOOLS := $(TOOLS:%=tools/%$(EXESUF))
|
2006-02-13 12:53:25 +00:00
|
|
|
|
2011-05-28 12:10:01 +00:00
|
|
|
DEP_LIBS := $(foreach NAME,$(FFLIBS),lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
|
2008-04-09 21:11:39 +00:00
|
|
|
|
2009-01-11 22:48:07 +00:00
|
|
|
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
|
2011-06-28 13:45:57 +00:00
|
|
|
SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
|
|
|
|
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
|
2012-07-15 20:30:40 +00:00
|
|
|
HEADEROBJS := $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
|
|
|
|
checkheaders: $(HEADEROBJS)
|
2006-02-13 12:53:25 +00:00
|
|
|
|
2011-07-10 19:26:25 +00:00
|
|
|
alltools: $(TOOLS)
|
|
|
|
|
2009-10-29 00:55:35 +00:00
|
|
|
$(HOSTOBJS): %.o: %.c
|
2012-07-20 10:01:19 +00:00
|
|
|
$(call COMPILE,HOSTCC)
|
2009-10-29 00:55:35 +00:00
|
|
|
|
|
|
|
$(HOSTPROGS): %$(HOSTEXESUF): %.o
|
|
|
|
$(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
|
|
|
|
|
2012-07-15 20:30:40 +00:00
|
|
|
$(OBJS): | $(sort $(dir $(OBJS)))
|
|
|
|
$(HOSTOBJS): | $(sort $(dir $(HOSTOBJS)))
|
|
|
|
$(TESTOBJS): | $(sort $(dir $(TESTOBJS)))
|
|
|
|
$(HEADEROBJS): | $(sort $(dir $(HEADEROBJS)))
|
|
|
|
$(TOOLOBJS): | tools
|
2011-06-28 17:45:13 +00:00
|
|
|
|
2012-07-15 20:30:40 +00:00
|
|
|
OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOSTOBJS) $(TESTOBJS) $(HEADEROBJS))
|
2011-06-28 17:45:13 +00:00
|
|
|
|
2011-11-29 19:35:48 +00:00
|
|
|
CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver *.gcno *.gcda
|
2009-11-22 14:22:13 +00:00
|
|
|
DISTCLEANSUFFIXES = *.pc
|
2012-04-30 08:33:49 +00:00
|
|
|
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
|
2008-02-25 09:22:11 +00:00
|
|
|
|
2012-07-20 10:01:19 +00:00
|
|
|
-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d))
|