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