Corrections of errors in aac_ac3_parser
[libav.git] / common.mak
CommitLineData
8b2121e3
MR
1#
2# common bits used by all libraries
3#
4
c415857d 5SRC_DIR = $(SRC_PATH_BARE)/lib$(NAME)
de2f77d8 6
0e32c8c6
MR
7LIBVERSION = $(lib$(NAME)_VERSION)
8LIBMAJOR = $(lib$(NAME)_VERSION_MAJOR)
9
c415857d
MR
10vpath %.c $(SRC_DIR)
11vpath %.h $(SRC_DIR)
12vpath %.S $(SRC_DIR)
8b2121e3 13
5671fc14
MR
14ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
15
722dabcc
DB
16CFLAGS += $(CFLAGS-yes)
17OBJS += $(OBJS-yes)
18ASM_OBJS += $(ASM_OBJS-yes)
2d93bcc7 19CPP_OBJS += $(CPP_OBJS-yes)
5671fc14 20FFLIBS += $(FFLIBS-yes)
722dabcc 21
dadb850a
DB
22CFLAGS += -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
23 -D_ISOC9X_SOURCE -I$(BUILD_ROOT) -I$(SRC_PATH) \
5671fc14
MR
24 $(addprefix -I$(SRC_PATH)/lib,$(ALLFFLIBS)) $(OPTFLAGS)
25
26EXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
27LDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(FFLIBS)) $(LDFLAGS)
1963f5e3 28
0d14ab27
FR
29SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPP_OBJS:.o=.cpp)
30OBJS := $(OBJS) $(ASM_OBJS) $(CPP_OBJS)
8b2121e3 31
24743a76 32all: $(LIBNAME) $(SLIBNAME)
8b2121e3 33
9bcc2883 34$(LIBNAME)$(DISABLE): $(OBJS)
8b2121e3
MR
35 rm -f $@
36 $(AR) rc $@ $^ $(EXTRAOBJS)
37 $(RANLIB) $@
38
9bcc2883 39$(SLIBNAME)$(DISABLE): $(SLIBNAME_WITH_MAJOR)
20369773 40 $(LN_S) $^ $@
baa3a937 41
582c1c47 42$(SLIBNAME_WITH_MAJOR): $(OBJS)
d22e8442 43 $(SLIB_CREATE_DEF_CMD)
8b2121e3 44 $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
5cb854e1 45 $(SLIB_EXTRA_CMD)
8b2121e3
MR
46
47%.o: %.c
48 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
49
50%.o: %.S
51 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
52
24743a76 53%: %.o $(LIBNAME)
c6c46511
DB
54 $(CC) $(LDFLAGS) -o $@ $^ $(EXTRALIBS)
55
e4d86a57
MR
56%.ho: %.h
57 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
58
c415857d 59ALLHEADERS = $(subst $(SRC_DIR)/,,$(wildcard $(SRC_DIR)/*.h))
e4d86a57
MR
60checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
61
7716f7ff
DB
62depend dep: .depend
63
64.depend: $(SRCS)
315c741d 65 $(DEPEND_CMD) > .depend
8b2121e3 66
8b2121e3 67clean::
b8d40825 68 rm -f *.o *~ *.a *.lib *.so *.so.* *.dylib *.dll \
bca9e0bc 69 *.def *.dll.a *.exp *.ho *.map $(TESTS)
8b2121e3 70
7716f7ff 71distclean:: clean
8b2121e3
MR
72 rm -f .depend
73
7b3ca33f
DB
74INSTALL_LIB_TARGETS-$(BUILD_SHARED) += install-lib-shared
75INSTALL_LIB_TARGETS-$(BUILD_STATIC) += install-lib-static
8b2121e3
MR
76
77install: install-libs install-headers
78
9bcc2883 79install-libs$(DISABLE): $(INSTALL_LIB_TARGETS-yes)
8b2121e3
MR
80
81install-lib-shared: $(SLIBNAME)
22a324da
DB
82 install -d "$(SHLIBDIR)"
83 install -m 755 $(SLIBNAME) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
84 $(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
85 cd "$(SHLIBDIR)" && \
20369773 86 $(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
22a324da 87 cd "$(SHLIBDIR)" && \
20369773 88 $(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
8fbec4f4 89 $(SLIB_INSTALL_EXTRA_CMD)
8b2121e3 90
24743a76 91install-lib-static: $(LIBNAME)
22a324da 92 install -d "$(LIBDIR)"
24743a76 93 install -m 644 $(LIBNAME) "$(LIBDIR)"
d7e27559 94 $(LIB_INSTALL_EXTRA_CMD)
8b2121e3 95
76a448ed
MR
96INCINSTDIR = $(INCDIR)/lib$(NAME)
97
9bcc2883 98install-headers$(DISABLE)::
76a448ed 99 install -d "$(INCINSTDIR)"
22a324da 100 install -d "$(LIBDIR)/pkgconfig"
c415857d 101 install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(INCINSTDIR)"
22a324da 102 install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(LIBDIR)/pkgconfig"
8b2121e3 103
f9edb717
DB
104uninstall: uninstall-libs uninstall-headers
105
7716f7ff 106uninstall-libs::
22a324da
DB
107 -rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
108 "$(SHLIBDIR)/$(SLIBNAME)" \
109 "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
5b5d0491 110 -$(SLIB_UNINSTALL_EXTRA_CMD)
24743a76 111 -rm -f "$(LIBDIR)/$(LIBNAME)"
f9edb717 112
fa62bdb8 113uninstall-headers::
76a448ed 114 rm -f $(addprefix "$(INCINSTDIR)/",$(HEADERS))
22a324da 115 rm -f "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
f9edb717 116
bca9e0bc
DB
117tests: $(TESTS)
118
119%-test$(EXESUF): %.c $(LIBNAME)
120 $(CC) $(CFLAGS) $(LDFLAGS) -DTEST -o $@ $^ $(EXTRALIBS)
121
122.PHONY: all depend dep clean distclean install* uninstall* tests
3263626f 123
6ca0c110 124-include .depend