avformat/output-example: Declare link dependency on libswscale in the Makefile
[libav.git] / common.mak
CommitLineData
8b2121e3
MR
1#
2# common bits used by all libraries
3#
4
451db983
MR
5# first so "all" becomes default target
6all: all-yes
0e32c8c6 7
7bb3a302 8include $(SRC_PATH)/arch.mak
c5662879 9
6ccf540f
DB
10OBJS += $(OBJS-yes)
11FFLIBS := $(FFLIBS-yes) $(FFLIBS)
12TESTPROGS += $(TESTPROGS-yes)
8b2121e3 13
8db73c61
MR
14LDLIBS = $(FFLIBS:%=%$(BUILDSUF))
15FFEXTRALIBS := $(LDLIBS:%=$(LD_LIB)) $(EXTRALIBS)
8b2121e3 16
deb3ed01
MR
17EXAMPLES := $(EXAMPLES:%=$(SUBDIR)%-example$(EXESUF))
18OBJS := $(sort $(OBJS:%=$(SUBDIR)%))
19TESTOBJS := $(TESTOBJS:%=$(SUBDIR)%) $(TESTPROGS:%=$(SUBDIR)%-test.o)
20TESTPROGS := $(TESTPROGS:%=$(SUBDIR)%-test$(EXESUF))
21HOSTOBJS := $(HOSTPROGS:%=$(SUBDIR)%.o)
22HOSTPROGS := $(HOSTPROGS:%=$(SUBDIR)%$(HOSTEXESUF))
28e1c979
MR
23TOOLS += $(TOOLS-yes)
24TOOLOBJS := $(TOOLS:%=tools/%.o)
25TOOLS := $(TOOLS:%=tools/%$(EXESUF))
121604b0 26HEADERS += $(HEADERS-yes)
8b2121e3 27
b5cacdb3
DB
28PATH_LIBNAME = $(foreach NAME,$(1),lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
29DEP_LIBS := $(foreach lib,$(FFLIBS),$(call PATH_LIBNAME,$(lib)))
76ca42a8 30
7b5e8a27 31ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
deb3ed01
MR
32SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
33SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
dfd9159f
MR
34HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
35checkheaders: $(HOBJS)
36.SECONDARY: $(HOBJS:.o=.c)
8b2121e3 37
28e1c979
MR
38alltools: $(TOOLS)
39
de4070b5 40$(HOSTOBJS): %.o: %.c
b9d3c378 41 $(call COMPILE,HOSTCC)
de4070b5
MR
42
43$(HOSTPROGS): %$(HOSTEXESUF): %.o
095792f2 44 $(HOSTLD) $(HOSTLDFLAGS) $(HOSTLD_O) $< $(HOSTLIBS)
de4070b5 45
3e5cce81
DB
46$(OBJS): | $(sort $(dir $(OBJS)))
47$(HOSTOBJS): | $(sort $(dir $(HOSTOBJS)))
48$(TESTOBJS): | $(sort $(dir $(TESTOBJS)))
28e1c979 49$(TOOLOBJS): | tools
5e27ec28
MR
50
51OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOSTOBJS) $(TESTOBJS))
52
dfd9159f 53CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver
79de9c83 54DISTCLEANSUFFIXES = *.pc
b5a3c603 55LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
76a448ed 56
395c3feb 57define RULES
1c9d54b4
MR
58clean::
59 $(RM) $(OBJS) $(OBJS:.o=.d)
395c3feb
MR
60 $(RM) $(HOSTPROGS)
61 $(RM) $(TOOLS)
62endef
63
64$(eval $(RULES))
1c9d54b4 65
dfd9159f 66-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d))