Statistics
| Branch: | Revision:

ffmpeg / common.mak @ 362b3bf7

History | View | Annotate | Download (3.12 KB)

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