2 # common bits used by all libraries
5 # first so "all" becomes default target
8 include $(SRC_PATH)/arch.mak
11 FFLIBS := $($(NAME)_FFLIBS) $(FFLIBS-yes) $(FFLIBS)
12 TESTPROGS += $(TESTPROGS-yes)
14 LDLIBS = $(FFLIBS:%=%$(BUILDSUF))
15 FFEXTRALIBS := $(LDLIBS:%=$(LD_LIB)) $(EXTRALIBS)
17 OBJS := $(sort $(OBJS:%=$(SUBDIR)%))
18 TESTOBJS := $(TESTOBJS:%=$(SUBDIR)%) $(TESTPROGS:%=$(SUBDIR)%-test.o)
19 TESTPROGS := $(TESTPROGS:%=$(SUBDIR)%-test$(EXESUF))
20 HOSTOBJS := $(HOSTPROGS:%=$(SUBDIR)%.o)
21 HOSTPROGS := $(HOSTPROGS:%=$(SUBDIR)%$(HOSTEXESUF))
23 TOOLOBJS := $(TOOLS:%=tools/%.o)
24 TOOLS := $(TOOLS:%=tools/%$(EXESUF))
25 HEADERS += $(HEADERS-yes)
27 PATH_LIBNAME = $(foreach NAME,$(1),lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
28 DEP_LIBS := $(foreach lib,$(FFLIBS),$(call PATH_LIBNAME,$(lib)))
30 SRC_DIR := $(SRC_PATH)/lib$(NAME)
31 ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
32 SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
33 SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
34 HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
35 checkheaders: $(HOBJS)
36 .SECONDARY: $(HOBJS:.o=.c)
43 $(HOSTPROGS): %$(HOSTEXESUF): %.o
44 $(HOSTLD) $(HOSTLDFLAGS) $(HOSTLD_O) $^ $(HOSTLIBS)
46 $(OBJS): | $(sort $(dir $(OBJS)))
47 $(HOBJS): | $(sort $(dir $(HOBJS)))
48 $(HOSTOBJS): | $(sort $(dir $(HOSTOBJS)))
49 $(TESTOBJS): | $(sort $(dir $(TESTOBJS)))
52 OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(TESTOBJS))
54 CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver *.gcno *.gcda
55 DISTCLEANSUFFIXES = *.pc
56 LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
60 $(RM) $(OBJS) $(OBJS:.o=.d)
67 -include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d))