Correctly handle empty frames
[libav.git] / common.mak
CommitLineData
8b2121e3
MR
1#
2# common bits used by all libraries
3#
4
de2f77d8
MR
5LIBSRC = $(SRC_PATH_BARE)/lib$(NAME)
6
0e32c8c6
MR
7LIBVERSION = $(lib$(NAME)_VERSION)
8LIBMAJOR = $(lib$(NAME)_VERSION_MAJOR)
9
de2f77d8
MR
10vpath %.c $(LIBSRC)
11vpath %.h $(LIBSRC)
12vpath %.S $(LIBSRC)
13
14SRC_DIR = "$(LIBSRC)"
8b2121e3 15
5671fc14
MR
16ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
17
722dabcc
DB
18CFLAGS += $(CFLAGS-yes)
19OBJS += $(OBJS-yes)
20ASM_OBJS += $(ASM_OBJS-yes)
2d93bcc7 21CPP_OBJS += $(CPP_OBJS-yes)
5671fc14 22FFLIBS += $(FFLIBS-yes)
722dabcc 23
dadb850a
DB
24CFLAGS += -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
25 -D_ISOC9X_SOURCE -I$(BUILD_ROOT) -I$(SRC_PATH) \
5671fc14
MR
26 $(addprefix -I$(SRC_PATH)/lib,$(ALLFFLIBS)) $(OPTFLAGS)
27
28EXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
29LDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(FFLIBS)) $(LDFLAGS)
1963f5e3 30
1540cfdc 31SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
8b2121e3 32OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
8b2121e3 33
24743a76 34all: $(LIBNAME) $(SLIBNAME)
8b2121e3 35
582c1c47 36$(LIBNAME): $(OBJS)
8b2121e3
MR
37 rm -f $@
38 $(AR) rc $@ $^ $(EXTRAOBJS)
39 $(RANLIB) $@
40
baa3a937 41$(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
20369773 42 $(LN_S) $^ $@
baa3a937 43
582c1c47 44$(SLIBNAME_WITH_MAJOR): $(OBJS)
d22e8442 45 $(SLIB_CREATE_DEF_CMD)
8b2121e3 46 $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
5cb854e1 47 $(SLIB_EXTRA_CMD)
8b2121e3
MR
48
49%.o: %.c
50 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
51
52%.o: %.S
53 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
54
24743a76 55%: %.o $(LIBNAME)
c6c46511
DB
56 $(CC) $(LDFLAGS) -o $@ $^ $(EXTRALIBS)
57
e4d86a57
MR
58%.ho: %.h
59 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
60
de2f77d8 61ALLHEADERS = $(subst $(LIBSRC)/,,$(wildcard $(LIBSRC)/*.h))
e4d86a57
MR
62checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
63
9d0199f4 64depend dep: $(SRCS)
8b2121e3
MR
65 $(CC) -MM $(CFLAGS) $^ 1>.depend
66
8b2121e3 67clean::
b8d40825 68 rm -f *.o *~ *.a *.lib *.so *.so.* *.dylib *.dll \
bca9e0bc 69 *.def *.dll.a *.exp *.ho *.map $(TESTS)
8b2121e3
MR
70
71distclean: clean
72 rm -f .depend
73
71fa13e8
DB
74INSTALL_TARGETS-$(BUILD_SHARED) += install-lib-shared
75INSTALL_TARGETS-$(BUILD_STATIC) += install-lib-static
8b2121e3
MR
76
77install: install-libs install-headers
78
71fa13e8 79install-libs: $(INSTALL_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
8b2121e3 98install-headers:
76a448ed 99 install -d "$(INCINSTDIR)"
22a324da 100 install -d "$(LIBDIR)/pkgconfig"
76a448ed 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
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