Statistics
| Branch: | Revision:

ffmpeg / common.mak @ 45a09319

History | View | Annotate | Download (3.19 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 0d14ab27 François Revol
SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPP_OBJS:.o=.cpp)
30
OBJS := $(OBJS) $(ASM_OBJS) $(CPP_OBJS)
31 8b2121e3 Måns Rullgård
32 24743a76 Diego Biurrun
all: $(LIBNAME) $(SLIBNAME)
33 8b2121e3 Måns Rullgård
34 9bcc2883 Diego Biurrun
$(LIBNAME)$(DISABLE): $(OBJS)
35 8b2121e3 Måns Rullgård
	rm -f $@
36
	$(AR) rc $@ $^ $(EXTRAOBJS)
37
	$(RANLIB) $@
38
39 9bcc2883 Diego Biurrun
$(SLIBNAME)$(DISABLE): $(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 7716f7ff Diego Biurrun
depend dep: .depend
63
64
.depend: $(SRCS)
65 315c741d Diego Biurrun
	$(DEPEND_CMD) > .depend
66 8b2121e3 Måns Rullgård
67
clean::
68 b8d40825 Diego Biurrun
	rm -f *.o *~ *.a *.lib *.so *.so.* *.dylib *.dll \
69 bca9e0bc Diego Biurrun
	      *.def *.dll.a *.exp *.ho *.map $(TESTS)
70 8b2121e3 Måns Rullgård
71 7716f7ff Diego Biurrun
distclean:: clean
72 8b2121e3 Måns Rullgård
	rm -f .depend
73
74 7b3ca33f Diego Biurrun
INSTALL_LIB_TARGETS-$(BUILD_SHARED) += install-lib-shared
75
INSTALL_LIB_TARGETS-$(BUILD_STATIC) += install-lib-static
76 8b2121e3 Måns Rullgård
77
install: install-libs install-headers
78
79 9bcc2883 Diego Biurrun
install-libs$(DISABLE): $(INSTALL_LIB_TARGETS-yes)
80 8b2121e3 Måns Rullgård
81
install-lib-shared: $(SLIBNAME)
82 22a324da Diego Biurrun
	install -d "$(SHLIBDIR)"
83
	install -m 755 $(SLIBNAME) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
84
	$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
85
	cd "$(SHLIBDIR)" && \
86 20369773 Dave Yeo
		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
87 22a324da Diego Biurrun
	cd "$(SHLIBDIR)" && \
88 20369773 Dave Yeo
		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
89 8fbec4f4 Ramiro Polla
	$(SLIB_INSTALL_EXTRA_CMD)
90 8b2121e3 Måns Rullgård
91 24743a76 Diego Biurrun
install-lib-static: $(LIBNAME)
92 22a324da Diego Biurrun
	install -d "$(LIBDIR)"
93 24743a76 Diego Biurrun
	install -m 644 $(LIBNAME) "$(LIBDIR)"
94 d7e27559 Diego Biurrun
	$(LIB_INSTALL_EXTRA_CMD)
95 8b2121e3 Måns Rullgård
96 76a448ed Måns Rullgård
INCINSTDIR = $(INCDIR)/lib$(NAME)
97
98 9bcc2883 Diego Biurrun
install-headers$(DISABLE)::
99 76a448ed Måns Rullgård
	install -d "$(INCINSTDIR)"
100 22a324da Diego Biurrun
	install -d "$(LIBDIR)/pkgconfig"
101 c415857d Måns Rullgård
	install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(INCINSTDIR)"
102 22a324da Diego Biurrun
	install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(LIBDIR)/pkgconfig"
103 8b2121e3 Måns Rullgård
104 f9edb717 Diego Biurrun
uninstall: uninstall-libs uninstall-headers
105
106 7716f7ff Diego Biurrun
uninstall-libs::
107 22a324da Diego Biurrun
	-rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
108
	       "$(SHLIBDIR)/$(SLIBNAME)"            \
109
	       "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
110 5b5d0491 Dave Yeo
	-$(SLIB_UNINSTALL_EXTRA_CMD)
111 24743a76 Diego Biurrun
	-rm -f "$(LIBDIR)/$(LIBNAME)"
112 f9edb717 Diego Biurrun
113 fa62bdb8 Diego Biurrun
uninstall-headers::
114 76a448ed Måns Rullgård
	rm -f $(addprefix "$(INCINSTDIR)/",$(HEADERS))
115 22a324da Diego Biurrun
	rm -f "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
116 f9edb717 Diego Biurrun
117 bca9e0bc Diego Biurrun
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
123 3263626f Diego Biurrun
124 6ca0c110 Diego Biurrun
-include .depend