Synchronise code with AAC decoder in SoC
[libav.git] / common.mak
CommitLineData
8b2121e3
MR
1#
2# common bits used by all libraries
3#
4
71c61f62 5all: # make "all" default target
0e32c8c6 6
8e255b8b 7ifndef SUBDIR
c415857d
MR
8vpath %.c $(SRC_DIR)
9vpath %.h $(SRC_DIR)
10vpath %.S $(SRC_DIR)
8b2121e3 11
9e6165b5
MR
12ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
13BUILD_ROOT_REL = .
14else
15BUILD_ROOT_REL = ..
16endif
17
5671fc14
MR
18ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
19
9e6165b5
MR
20CFLAGS := -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
21 -D_ISOC9X_SOURCE -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(OPTFLAGS)
8b2121e3
MR
22
23%.o: %.c
24 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
25
26%.o: %.S
27 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
28
e4d86a57
MR
29%.ho: %.h
30 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
31
caec74dd
MR
32%.d: %.c
33 $(DEPEND_CMD) > $@
34
35%.d: %.S
36 $(DEPEND_CMD) > $@
37
38%.d: %.cpp
39 $(DEPEND_CMD) > $@
40
18c64005
MR
41%.o: %.d
42
bf237413
MR
43%$(EXESUF): %.c
44
9e6165b5
MR
45SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
46ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
47$(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
48endif
49
50$(BUILD_ROOT_REL)/version.h:
51 $(SRC_PATH)/version.sh $(SRC_PATH) $@
52
71c61f62 53install: install-libs install-headers
7716f7ff 54
71c61f62 55uninstall: uninstall-libs uninstall-headers
8b2121e3 56
71c61f62
MR
57.PHONY: all depend dep clean distclean install* uninstall* tests
58endif
8b2121e3 59
71c61f62
MR
60CFLAGS += $(CFLAGS-yes)
61OBJS += $(OBJS-yes)
62ASM_OBJS += $(ASM_OBJS-yes)
63CPP_OBJS += $(CPP_OBJS-yes)
64FFLIBS := $(FFLIBS-yes) $(FFLIBS)
dbe6c6ff 65TESTS += $(TESTS-yes)
8b2121e3 66
71c61f62
MR
67FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
68FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(FFLIBS)) $(LDFLAGS)
8b2121e3 69
71c61f62
MR
70SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPP_OBJS:.o=.cpp)
71OBJS := $(OBJS) $(ASM_OBJS) $(CPP_OBJS)
8b2121e3 72
71c61f62
MR
73SRCS := $(addprefix $(SUBDIR),$(SRCS))
74OBJS := $(addprefix $(SUBDIR),$(OBJS))
75TESTS := $(addprefix $(SUBDIR),$(TESTS))
8b2121e3 76
76ca42a8
MR
77DEP_LIBS:=$(foreach NAME,$(FFLIBS),lib$(NAME)/$($(BUILD_SHARED:yes=S)LIBNAME))
78
71c61f62
MR
79ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h))
80checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
8b2121e3 81
caec74dd
MR
82DEPS := $(OBJS:.o=.d)
83depend dep: $(DEPS)
8b2121e3 84
0147b92e 85CLEANSUFFIXES = *.o *~ *.ho
d4210e2a 86LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp *.map
25cd5cb3 87DISTCLEANSUFFIXES = *.d *.pc
76a448ed 88
71c61f62 89define RULES
b153c68b
MR
90$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
91 $(CC) $(FFLDFLAGS) -o $$@ $$^ $(SUBDIR)$(LIBNAME) $(FFEXTRALIBS)
8b2121e3 92
b153c68b
MR
93$(SUBDIR)%-test.o: $(SUBDIR)%.c
94 $(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
95
96$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
97 $(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
f9edb717 98
71c61f62 99clean::
adc39350
DB
100 rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
101 $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
f9edb717 102
71c61f62 103distclean:: clean
95d2afec
DB
104 rm -f $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
105 $(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
71c61f62 106endef
bca9e0bc 107
71c61f62 108$(eval $(RULES))
bca9e0bc 109
71c61f62 110tests: $(TESTS)
3263626f 111
caec74dd 112-include $(DEPS)