Statistics
| Branch: | Revision:

ffmpeg / common.mak @ 25e4f8aa

History | View | Annotate | Download (2.43 KB)

1 8b2121e3 Måns Rullgård
#
2
# common bits used by all libraries
3
#
4
5 997baf01 Måns Rullgård
VPATH = $(SRC_PATH_BARE)/lib$(NAME)
6
SRC_DIR = "$(VPATH)"
7 8b2121e3 Måns Rullgård
8 722dabcc Diego Biurrun
CFLAGS   += $(CFLAGS-yes)
9
OBJS     += $(OBJS-yes)
10
ASM_OBJS += $(ASM_OBJS-yes)
11 2d93bcc7 Diego Biurrun
CPP_OBJS += $(CPP_OBJS-yes)
12 722dabcc Diego Biurrun
13 dadb850a Diego Biurrun
CFLAGS += -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
14
          -D_ISOC9X_SOURCE -I$(BUILD_ROOT) -I$(SRC_PATH) \
15
          -I$(SRC_PATH)/libavutil $(OPTFLAGS)
16 1540cfdc Måns Rullgård
SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
17 8b2121e3 Måns Rullgård
OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
18
STATIC_OBJS := $(OBJS) $(STATIC_OBJS)
19
SHARED_OBJS := $(OBJS) $(SHARED_OBJS)
20
21 06aa32ff Diego Biurrun
all: $(EXTRADEPS) $(LIB) $(SLIBNAME)
22 8b2121e3 Måns Rullgård
23
$(LIB): $(STATIC_OBJS)
24
	rm -f $@
25
	$(AR) rc $@ $^ $(EXTRAOBJS)
26
	$(RANLIB) $@
27
28 baa3a937 Måns Rullgård
$(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
29
	ln -sf $^ $@
30
31
$(SLIBNAME_WITH_MAJOR): $(SHARED_OBJS)
32 8b2121e3 Måns Rullgård
	$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
33 5cb854e1 Diego Biurrun
	$(SLIB_EXTRA_CMD)
34 8b2121e3 Måns Rullgård
35
%.o: %.c
36
	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
37
38
%.o: %.S
39
	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
40
41 c6c46511 Diego Biurrun
%: %.o $(LIB)
42
	$(CC) $(LDFLAGS) -o $@ $^ $(EXTRALIBS)
43
44 9d0199f4 Diego Biurrun
depend dep: $(SRCS)
45 8b2121e3 Måns Rullgård
	$(CC) -MM $(CFLAGS) $^ 1>.depend
46
47
clean::
48 b8635ec6 Diego Biurrun
	rm -f *.o *.d *~ *.a *.lib *.so *.so.* *.dylib *.dll \
49 009618ea Diego Biurrun
	      *.def *.dll.a *.exp
50 8b2121e3 Måns Rullgård
51
distclean: clean
52
	rm -f .depend
53
54
ifeq ($(BUILD_SHARED),yes)
55
INSTLIBTARGETS += install-lib-shared
56
endif
57
ifeq ($(BUILD_STATIC),yes)
58
INSTLIBTARGETS += install-lib-static
59
endif
60
61
install: install-libs install-headers
62
63
install-libs: $(INSTLIBTARGETS)
64
65
install-lib-shared: $(SLIBNAME)
66 b8e10478 Diego Biurrun
	install -d "$(shlibdir)"
67 ca3798dc Ramiro Polla
	install -m 755 $(SLIBNAME) "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
68
	$(STRIP) "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
69 e35a3b7d Diego Biurrun
	cd "$(shlibdir)" && \
70
		ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
71
	cd "$(shlibdir)" && \
72
		ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
73 8fbec4f4 Ramiro Polla
	$(SLIB_INSTALL_EXTRA_CMD)
74 8b2121e3 Måns Rullgård
75
install-lib-static: $(LIB)
76 c7bb67c4 Måns Rullgård
	install -d "$(libdir)"
77 8b2121e3 Måns Rullgård
	install -m 644 $(LIB) "$(libdir)"
78 d7e27559 Diego Biurrun
	$(LIB_INSTALL_EXTRA_CMD)
79 8b2121e3 Måns Rullgård
80
install-headers:
81 c7bb67c4 Måns Rullgård
	install -d "$(incdir)"
82
	install -d "$(libdir)/pkgconfig"
83 997baf01 Måns Rullgård
	install -m 644 $(addprefix $(SRC_DIR)/,$(HEADERS)) "$(incdir)"
84 8b2121e3 Måns Rullgård
	install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
85
86 f9edb717 Diego Biurrun
uninstall: uninstall-libs uninstall-headers
87
88
uninstall-libs:
89 afa61532 Diego Biurrun
	-rm -f "$(shlibdir)/$(SLIBNAME_WITH_MAJOR)" \
90
	       "$(shlibdir)/$(SLIBNAME)"            \
91
	       "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
92
	-rm -f "$(libdir)/$(LIB)"
93 f9edb717 Diego Biurrun
94
uninstall-headers:
95 76808d6e Víctor Paesa
	rm -f $(addprefix "$(incdir)/",$(HEADERS))
96 afa61532 Diego Biurrun
	rm -f "$(libdir)/pkgconfig/lib$(NAME).pc"
97 f9edb717 Diego Biurrun
98 3263626f Diego Biurrun
.PHONY: all depend dep clean distclean install* uninstall*
99
100 6ca0c110 Diego Biurrun
-include .depend