configure: simplify directory creation for out of tree builds
[libav.git] / common.mak
... / ...
CommitLineData
1#
2# common bits used by all libraries
3#
4
5all: # make "all" default target
6
7ifndef SUBDIR
8vpath %.c $(SRC_DIR)
9vpath %.h $(SRC_DIR)
10vpath %.S $(SRC_DIR)
11vpath %.asm $(SRC_DIR)
12
13ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
14BUILD_ROOT_REL = .
15else
16BUILD_ROOT_REL = ..
17endif
18
19ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
20
21CPPFLAGS := -DHAVE_AV_CONFIG_H -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(CPPFLAGS)
22
23%.o: %.c
24 $(CCDEP)
25 $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) $(LIBOBJFLAGS) -c $(CC_O) $<
26
27%.o: %.S
28 $(ASDEP)
29 $(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
30
31%.ho: %.h
32 $(CC) $(CPPFLAGS) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
33
34%$(EXESUF): %.c
35
36SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
37ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
38$(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
39endif
40
41$(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh config.mak
42 $< $(SRC_PATH) $@ $(EXTRA_VERSION)
43
44install: install-libs install-headers
45
46uninstall: uninstall-libs uninstall-headers
47
48.PHONY: all depend dep *clean install* uninstall* examples testprogs
49endif
50
51OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
52
53CFLAGS += $(CFLAGS-yes)
54OBJS += $(OBJS-yes)
55FFLIBS := $(FFLIBS-yes) $(FFLIBS)
56TESTPROGS += $(TESTPROGS-yes)
57
58FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
59FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
60
61EXAMPLES := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
62OBJS := $(addprefix $(SUBDIR),$(OBJS))
63TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
64
65DEP_LIBS := $(foreach NAME,$(FFLIBS),$(BUILD_ROOT_REL)/lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
66
67ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
68checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
69
70DEPS := $(OBJS:.o=.d)
71depend dep: $(DEPS)
72
73CLEANSUFFIXES = *.o *~ *.ho *.map
74DISTCLEANSUFFIXES = *.d *.pc
75LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
76
77-include $(wildcard $(DEPS))