Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 125 lines (89 sloc) 3.218 kB
490373d move common parts of makefiles into common.mak
mru authored
1 #
2 # common bits used by all libraries
3 #
4
e03cfee allow vpath search only for source files
mru authored
5 LIBSRC = $(SRC_PATH_BARE)/lib$(NAME)
6
14edbf1 simplify library version handling
mru authored
7 LIBVERSION = $(lib$(NAME)_VERSION)
8 LIBMAJOR = $(lib$(NAME)_VERSION_MAJOR)
9
e03cfee allow vpath search only for source files
mru authored
10 vpath %.c $(LIBSRC)
11 vpath %.h $(LIBSRC)
12 vpath %.S $(LIBSRC)
13
14 SRC_DIR = "$(LIBSRC)"
490373d move common parts of makefiles into common.mak
mru authored
15
0b76aa0 consolidate CFLAGS, LDFLAGS, EXTRALIBS assignment
mru authored
16 ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
17
96e7018 Move conditional CFLAGS and OBJS setting to common place.
diego authored
18 CFLAGS += $(CFLAGS-yes)
19 OBJS += $(OBJS-yes)
20 ASM_OBJS += $(ASM_OBJS-yes)
31e7961 Add CPP_OBJS-yes to CPP_OBJS, same as the other *_OBJS variables.
diego authored
21 CPP_OBJS += $(CPP_OBJS-yes)
0b76aa0 consolidate CFLAGS, LDFLAGS, EXTRALIBS assignment
mru authored
22 FFLIBS += $(FFLIBS-yes)
96e7018 Move conditional CFLAGS and OBJS setting to common place.
diego authored
23
5b25590 Move CFLAGS handling to common.mak.
diego authored
24 CFLAGS += -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
25 -D_ISOC9X_SOURCE -I$(BUILD_ROOT) -I$(SRC_PATH) \
0b76aa0 consolidate CFLAGS, LDFLAGS, EXTRALIBS assignment
mru authored
26 $(addprefix -I$(SRC_PATH)/lib,$(ALLFFLIBS)) $(OPTFLAGS)
27
28 EXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
29 LDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(FFLIBS)) $(LDFLAGS)
0a3cb7c readability cosmetics
diego authored
30
1e619e2 SRCS must be set using := or things break when ASM_OBJS is added to OBJS
mru authored
31 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
490373d move common parts of makefiles into common.mak
mru authored
32 OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
33
80aa377 Rename LIB to LIBNAME for consistency.
diego authored
34 all: $(LIBNAME) $(SLIBNAME)
490373d move common parts of makefiles into common.mak
mru authored
35
1dfb500 Declare libpostproc prerequisites directly instead of using a layer of
diego authored
36 $(LIBNAME): $(OBJS)
490373d move common parts of makefiles into common.mak
mru authored
37 rm -f $@
38 $(AR) rc $@ $^ $(EXTRAOBJS)
39 $(RANLIB) $@
40
eb6ec67 Create shared libraries using versioned filenames and add -rpath-link
mru authored
41 $(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
0242675 ln is not available on all platforms, so introduce a variable for it
diego authored
42 $(LN_S) $^ $@
eb6ec67 Create shared libraries using versioned filenames and add -rpath-link
mru authored
43
1dfb500 Declare libpostproc prerequisites directly instead of using a layer of
diego authored
44 $(SLIBNAME_WITH_MAJOR): $(OBJS)
c56c1f4 OS/2 support restored in cleaner form.
diego authored
45 $(SLIB_CREATE_DEF_CMD)
490373d move common parts of makefiles into common.mak
mru authored
46 $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
5d79ad3 Move MinGW special casing for shared lib creation to configure.
diego authored
47 $(SLIB_EXTRA_CMD)
490373d move common parts of makefiles into common.mak
mru authored
48
49 %.o: %.c
50 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
51
52 %.o: %.S
53 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
54
80aa377 Rename LIB to LIBNAME for consistency.
diego authored
55 %: %.o $(LIBNAME)
784b326 Simplify test program build.
diego authored
56 $(CC) $(LDFLAGS) -o $@ $^ $(EXTRALIBS)
57
b57cb50 add "checkheaders" target
mru authored
58 %.ho: %.h
59 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
60
e03cfee allow vpath search only for source files
mru authored
61 ALLHEADERS = $(subst $(LIBSRC)/,,$(wildcard $(LIBSRC)/*.h))
b57cb50 add "checkheaders" target
mru authored
62 checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
63
d4d2cb3 depend and dep are really the same target.
diego authored
64 depend dep: $(SRCS)
490373d move common parts of makefiles into common.mak
mru authored
65 $(CC) -MM $(CFLAGS) $^ 1>.depend
66
67 clean::
ed8b0f3 We do not create .d files, thus no need to remove them.
diego authored
68 rm -f *.o *~ *.a *.lib *.so *.so.* *.dylib *.dll \
59f7448 Move common test program infrastructure to common.mak.
diego authored
69 *.def *.dll.a *.exp *.ho *.map $(TESTS)
490373d move common parts of makefiles into common.mak
mru authored
70
71 distclean: clean
72 rm -f .depend
73
268a089 Simplify install-libs prerequisite generation.
diego authored
74 INSTALL_TARGETS-$(BUILD_SHARED) += install-lib-shared
75 INSTALL_TARGETS-$(BUILD_STATIC) += install-lib-static
490373d move common parts of makefiles into common.mak
mru authored
76
77 install: install-libs install-headers
78
268a089 Simplify install-libs prerequisite generation.
diego authored
79 install-libs: $(INSTALL_TARGETS-yes)
490373d move common parts of makefiles into common.mak
mru authored
80
81 install-lib-shared: $(SLIBNAME)
5c91762 cosmetics: Use uppercase names for installation directories in makefi…
diego authored
82 install -d "$(SHLIBDIR)"
83 install -m 755 $(SLIBNAME) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
84 $(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
85 cd "$(SHLIBDIR)" && \
0242675 ln is not available on all platforms, so introduce a variable for it
diego authored
86 $(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
5c91762 cosmetics: Use uppercase names for installation directories in makefi…
diego authored
87 cd "$(SHLIBDIR)" && \
0242675 ln is not available on all platforms, so introduce a variable for it
diego authored
88 $(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
3569c05 Install generated .lib files in shlibdir on MinGW.
diego authored
89 $(SLIB_INSTALL_EXTRA_CMD)
490373d move common parts of makefiles into common.mak
mru authored
90
80aa377 Rename LIB to LIBNAME for consistency.
diego authored
91 install-lib-static: $(LIBNAME)
5c91762 cosmetics: Use uppercase names for installation directories in makefi…
diego authored
92 install -d "$(LIBDIR)"
80aa377 Rename LIB to LIBNAME for consistency.
diego authored
93 install -m 644 $(LIBNAME) "$(LIBDIR)"
136342f Mac OS X requires running ranlib on static libraries after installation.
diego authored
94 $(LIB_INSTALL_EXTRA_CMD)
490373d move common parts of makefiles into common.mak
mru authored
95
37ddf94 Install headers in $prefix/include/$libname
mru authored
96 INCINSTDIR = $(INCDIR)/lib$(NAME)
97
490373d move common parts of makefiles into common.mak
mru authored
98 install-headers:
37ddf94 Install headers in $prefix/include/$libname
mru authored
99 install -d "$(INCINSTDIR)"
5c91762 cosmetics: Use uppercase names for installation directories in makefi…
diego authored
100 install -d "$(LIBDIR)/pkgconfig"
37ddf94 Install headers in $prefix/include/$libname
mru authored
101 install -m 644 $(addprefix $(SRC_DIR)/,$(HEADERS)) "$(INCINSTDIR)"
5c91762 cosmetics: Use uppercase names for installation directories in makefi…
diego authored
102 install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(LIBDIR)/pkgconfig"
490373d move common parts of makefiles into common.mak
mru authored
103
3a6b81d uninstallation support
diego authored
104 uninstall: uninstall-libs uninstall-headers
105
106 uninstall-libs:
5c91762 cosmetics: Use uppercase names for installation directories in makefi…
diego authored
107 -rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
108 "$(SHLIBDIR)/$(SLIBNAME)" \
109 "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
7711783 Add SLIB_UNINSTALL_EXTRA_COMMAND to uninstall the things installed via
diego authored
110 -$(SLIB_UNINSTALL_EXTRA_CMD)
80aa377 Rename LIB to LIBNAME for consistency.
diego authored
111 -rm -f "$(LIBDIR)/$(LIBNAME)"
3a6b81d uninstallation support
diego authored
112
9dba512 Move libpostproc-specific uninstallation command to the libpostproc M…
diego authored
113 uninstall-headers::
37ddf94 Install headers in $prefix/include/$libname
mru authored
114 rm -f $(addprefix "$(INCINSTDIR)/",$(HEADERS))
5c91762 cosmetics: Use uppercase names for installation directories in makefi…
diego authored
115 rm -f "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
3a6b81d uninstallation support
diego authored
116
59f7448 Move common test program infrastructure to common.mak.
diego authored
117 tests: $(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
e427693 Mark all phony targets as such.
diego authored
123
1a00599 Simplify .depend file inclusion.
diego authored
124 -include .depend
Something went wrong with that request. Please try again.