build: Drop stray golomb dependencies
[libav.git] / common.mak
1 #
2 # common bits used by all libraries
3 #
4
5 include $(SRC_PATH)/arch.mak
6
7 OBJS += $(OBJS-yes)
8 FFLIBS := $($(NAME)_FFLIBS) $(FFLIBS-yes) $(FFLIBS)
9 TESTPROGS += $(TESTPROGS-yes)
10
11 FFEXTRALIBS := $(FFLIBS:%=$(LD_LIB)) $(EXTRALIBS)
12
13 OBJS := $(sort $(OBJS:%=$(SUBDIR)%))
14 TESTOBJS := $(TESTOBJS:%=$(SUBDIR)tests/%) $(TESTPROGS:%=$(SUBDIR)tests/%.o)
15 TESTPROGS := $(TESTPROGS:%=$(SUBDIR)tests/%$(EXESUF))
16 HOSTOBJS := $(HOSTPROGS:%=$(SUBDIR)%.o)
17 HOSTPROGS := $(HOSTPROGS:%=$(SUBDIR)%$(HOSTEXESUF))
18 TOOLS += $(TOOLS-yes)
19 TOOLOBJS := $(TOOLS:%=tools/%.o)
20 TOOLS := $(TOOLS:%=tools/%$(EXESUF))
21 HEADERS += $(HEADERS-yes)
22
23 PATH_LIBNAME = $(foreach NAME,$(1),lib$(NAME)/$($(2)LIBNAME))
24 DEP_LIBS := $(foreach lib,$(FFLIBS),$(call PATH_LIBNAME,$(lib),$(CONFIG_SHARED:yes=S)))
25 STATIC_DEP_LIBS := $(foreach lib,$(FFLIBS),$(call PATH_LIBNAME,$(lib)))
26
27 SRC_DIR := $(SRC_PATH)/lib$(NAME)
28 ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
29 SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
30 SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
31 HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
32 $(HOBJS): CCFLAGS += $(CFLAGS_HEADERS)
33 checkheaders: $(HOBJS)
34 .SECONDARY: $(HOBJS:.o=.c)
35
36 alltools: $(TOOLS)
37
38 $(HOSTOBJS): %.o: %.c
39 $(COMPILE_HOSTC)
40
41 $(HOSTPROGS): %$(HOSTEXESUF): %.o
42 $(HOSTLD) $(HOSTLDFLAGS) $(HOSTLD_O) $^ $(HOSTLIBS)
43
44 $(OBJS): | $(sort $(dir $(OBJS)))
45 $(HOBJS): | $(sort $(dir $(HOBJS)))
46 $(HOSTOBJS): | $(sort $(dir $(HOSTOBJS)))
47 $(TESTOBJS): | $(sort $(dir $(TESTOBJS)))
48 $(TOOLOBJS): | tools
49
50 OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(TESTOBJS))
51
52 CLEANSUFFIXES = *.d *.o *~ *.h.c *.gcda *.gcno *.map *.ver
53 DISTCLEANSUFFIXES = *.pc
54 LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
55
56 define RULES
57 clean::
58 $(RM) $(HOSTPROGS) $(TESTPROGS) $(TOOLS)
59 endef
60
61 $(eval $(RULES))
62
63 -include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d))