mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-02 03:06:28 +02:00
7cb1d9e2db
Previously, all link-time dependencies were added for all libraries, resulting in bogus link-time dependencies since not all dependencies are shared across libraries. Also, in some cases like libavutil, not all dependencies were taken into account, resulting in some cases of underlinking. To address all this mess a machinery is added for tracking which dependency belongs to which library component and then leveraged to determine correct dependencies for all individual libraries.
64 lines
2.0 KiB
Makefile
64 lines
2.0 KiB
Makefile
#
|
|
# common bits used by all libraries
|
|
#
|
|
|
|
include $(SRC_PATH)/avbuild/arch.mak
|
|
|
|
OBJS += $(OBJS-yes)
|
|
FFLIBS := $($(NAME)_FFLIBS) $(FFLIBS-yes) $(FFLIBS)
|
|
TESTPROGS += $(TESTPROGS-yes)
|
|
|
|
FFEXTRALIBS := $(FFLIBS:%=$(LD_LIB)) $(foreach lib,EXTRALIBS-$(NAME) $(FFLIBS:%=EXTRALIBS-%),$($(lib))) $(EXTRALIBS)
|
|
|
|
OBJS := $(sort $(OBJS:%=$(SUBDIR)%))
|
|
TESTOBJS := $(TESTOBJS:%=$(SUBDIR)tests/%) $(TESTPROGS:%=$(SUBDIR)tests/%.o)
|
|
TESTPROGS := $(TESTPROGS:%=$(SUBDIR)tests/%$(EXESUF))
|
|
HOSTOBJS := $(HOSTPROGS:%=$(SUBDIR)%.o)
|
|
HOSTPROGS := $(HOSTPROGS:%=$(SUBDIR)%$(HOSTEXESUF))
|
|
TOOLS += $(TOOLS-yes)
|
|
TOOLOBJS := $(TOOLS:%=tools/%.o)
|
|
TOOLS := $(TOOLS:%=tools/%$(EXESUF))
|
|
HEADERS += $(HEADERS-yes)
|
|
|
|
PATH_LIBNAME = $(foreach NAME,$(1),lib$(NAME)/$($(2)LIBNAME))
|
|
DEP_LIBS := $(foreach lib,$(FFLIBS),$(call PATH_LIBNAME,$(lib),$(CONFIG_SHARED:yes=S)))
|
|
STATIC_DEP_LIBS := $(foreach lib,$(FFLIBS),$(call PATH_LIBNAME,$(lib)))
|
|
|
|
SRC_DIR := $(SRC_PATH)/lib$(NAME)
|
|
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
|
|
SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
|
|
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
|
|
HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
|
|
$(HOBJS): CCFLAGS += $(CFLAGS_HEADERS)
|
|
checkheaders: $(HOBJS)
|
|
.SECONDARY: $(HOBJS:.o=.c)
|
|
|
|
alltools: $(TOOLS)
|
|
|
|
$(HOSTOBJS): %.o: %.c
|
|
$(COMPILE_HOSTC)
|
|
|
|
$(HOSTPROGS): %$(HOSTEXESUF): %.o
|
|
$(HOSTLD) $(HOSTLDFLAGS) $(HOSTLD_O) $^ $(HOSTEXTRALIBS)
|
|
|
|
$(OBJS): | $(sort $(dir $(OBJS)))
|
|
$(HOBJS): | $(sort $(dir $(HOBJS)))
|
|
$(HOSTOBJS): | $(sort $(dir $(HOSTOBJS)))
|
|
$(TESTOBJS): | $(sort $(dir $(TESTOBJS)))
|
|
$(TOOLOBJS): | tools
|
|
|
|
OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(TESTOBJS))
|
|
|
|
CLEANSUFFIXES = *.d *.o *~ *.h.c *.gcda *.gcno *.map *.ver *.version
|
|
DISTCLEANSUFFIXES = *.pc
|
|
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
|
|
|
|
define RULES
|
|
clean::
|
|
$(RM) $(HOSTPROGS) $(TESTPROGS) $(TOOLS)
|
|
endef
|
|
|
|
$(eval $(RULES))
|
|
|
|
-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d))
|