build: Add missing hevc_ps dependency for QSV HEVC encoder
[libav.git] / common.mak
1 #
2 # common bits used by all libraries
3 #
4
5 # first so "all" becomes default target
6 all: all-yes
7
8 include $(SRC_PATH)/arch.mak
9
10 OBJS += $(OBJS-yes)
11 FFLIBS := $($(NAME)_FFLIBS) $(FFLIBS-yes) $(FFLIBS)
12 TESTPROGS += $(TESTPROGS-yes)
13
14 FFEXTRALIBS := $(FFLIBS:%=$(LD_LIB)) $(EXTRALIBS)
15
16 OBJS := $(sort $(OBJS:%=$(SUBDIR)%))
17 TESTOBJS := $(TESTOBJS:%=$(SUBDIR)tests/%) $(TESTPROGS:%=$(SUBDIR)tests/%.o)
18 TESTPROGS := $(TESTPROGS:%=$(SUBDIR)tests/%$(EXESUF))
19 HOSTOBJS := $(HOSTPROGS:%=$(SUBDIR)%.o)
20 HOSTPROGS := $(HOSTPROGS:%=$(SUBDIR)%$(HOSTEXESUF))
21 TOOLS += $(TOOLS-yes)
22 TOOLOBJS := $(TOOLS:%=tools/%.o)
23 TOOLS := $(TOOLS:%=tools/%$(EXESUF))
24 HEADERS += $(HEADERS-yes)
25
26 PATH_LIBNAME = $(foreach NAME,$(1),lib$(NAME)/$($(2)LIBNAME))
27 DEP_LIBS := $(foreach lib,$(FFLIBS),$(call PATH_LIBNAME,$(lib),$(CONFIG_SHARED:yes=S)))
28 STATIC_DEP_LIBS := $(foreach lib,$(FFLIBS),$(call PATH_LIBNAME,$(lib)))
29
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 $(HOBJS): CCFLAGS += $(CFLAGS_HEADERS)
36 checkheaders: $(HOBJS)
37 .SECONDARY: $(HOBJS:.o=.c)
38
39 alltools: $(TOOLS)
40
41 $(HOSTOBJS): %.o: %.c
42 $(COMPILE_HOSTC)
43
44 $(HOSTPROGS): %$(HOSTEXESUF): %.o
45 $(HOSTLD) $(HOSTLDFLAGS) $(HOSTLD_O) $^ $(HOSTLIBS)
46
47 $(OBJS): | $(sort $(dir $(OBJS)))
48 $(HOBJS): | $(sort $(dir $(HOBJS)))
49 $(HOSTOBJS): | $(sort $(dir $(HOSTOBJS)))
50 $(TESTOBJS): | $(sort $(dir $(TESTOBJS)))
51 $(TOOLOBJS): | tools
52
53 OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(TESTOBJS))
54
55 CLEANSUFFIXES = *.d *.o *~ *.h.c *.gcda *.gcno *.map *.ver
56 DISTCLEANSUFFIXES = *.pc
57 LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
58
59 define RULES
60 clean::
61 $(RM) $(HOSTPROGS) $(TESTPROGS) $(TOOLS)
62 endef
63
64 $(eval $(RULES))
65
66 -include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d))