Statistics
| Branch: | Revision:

ffmpeg / common.mak @ 47772399

History | View | Annotate | Download (2.61 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 1963f5e3 Diego Biurrun
17 1540cfdc Måns Rullgård
SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
18 8b2121e3 Måns Rullgård
OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
19
STATIC_OBJS := $(OBJS) $(STATIC_OBJS)
20
SHARED_OBJS := $(OBJS) $(SHARED_OBJS)
21
22 b8ef6423 Ramiro Polla
all: $(LIB) $(SLIBNAME)
23 8b2121e3 Måns Rullgård
24
$(LIB): $(STATIC_OBJS)
25
	rm -f $@
26
	$(AR) rc $@ $^ $(EXTRAOBJS)
27
	$(RANLIB) $@
28
29 baa3a937 Måns Rullgård
$(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
30
	ln -sf $^ $@
31
32
$(SLIBNAME_WITH_MAJOR): $(SHARED_OBJS)
33 8b2121e3 Måns Rullgård
	$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
34 5cb854e1 Diego Biurrun
	$(SLIB_EXTRA_CMD)
35 8b2121e3 Måns Rullgård
36
%.o: %.c
37
	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
38
39
%.o: %.S
40
	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
41
42 c6c46511 Diego Biurrun
%: %.o $(LIB)
43
	$(CC) $(LDFLAGS) -o $@ $^ $(EXTRALIBS)
44
45 e4d86a57 Måns Rullgård
%.ho: %.h
46
	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
47
48
ALLHEADERS = $(subst $(VPATH)/,,$(wildcard $(VPATH)/*.h))
49
checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
50
51 9d0199f4 Diego Biurrun
depend dep: $(SRCS)
52 8b2121e3 Måns Rullgård
	$(CC) -MM $(CFLAGS) $^ 1>.depend
53
54
clean::
55 b8d40825 Diego Biurrun
	rm -f *.o *~ *.a *.lib *.so *.so.* *.dylib *.dll \
56 e4d86a57 Måns Rullgård
	      *.def *.dll.a *.exp *.ho
57 8b2121e3 Måns Rullgård
58
distclean: clean
59
	rm -f .depend
60
61
ifeq ($(BUILD_SHARED),yes)
62
INSTLIBTARGETS += install-lib-shared
63
endif
64
ifeq ($(BUILD_STATIC),yes)
65
INSTLIBTARGETS += install-lib-static
66
endif
67
68
install: install-libs install-headers
69
70
install-libs: $(INSTLIBTARGETS)
71
72
install-lib-shared: $(SLIBNAME)
73 22a324da Diego Biurrun
	install -d "$(SHLIBDIR)"
74
	install -m 755 $(SLIBNAME) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
75
	$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
76
	cd "$(SHLIBDIR)" && \
77 e35a3b7d Diego Biurrun
		ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
78 22a324da Diego Biurrun
	cd "$(SHLIBDIR)" && \
79 e35a3b7d Diego Biurrun
		ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
80 8fbec4f4 Ramiro Polla
	$(SLIB_INSTALL_EXTRA_CMD)
81 8b2121e3 Måns Rullgård
82
install-lib-static: $(LIB)
83 22a324da Diego Biurrun
	install -d "$(LIBDIR)"
84
	install -m 644 $(LIB) "$(LIBDIR)"
85 d7e27559 Diego Biurrun
	$(LIB_INSTALL_EXTRA_CMD)
86 8b2121e3 Måns Rullgård
87
install-headers:
88 22a324da Diego Biurrun
	install -d "$(INCDIR)"
89
	install -d "$(LIBDIR)/pkgconfig"
90
	install -m 644 $(addprefix $(SRC_DIR)/,$(HEADERS)) "$(INCDIR)"
91
	install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(LIBDIR)/pkgconfig"
92 8b2121e3 Måns Rullgård
93 f9edb717 Diego Biurrun
uninstall: uninstall-libs uninstall-headers
94
95
uninstall-libs:
96 22a324da Diego Biurrun
	-rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
97
	       "$(SHLIBDIR)/$(SLIBNAME)"            \
98
	       "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
99
	-rm -f "$(LIBDIR)/$(LIB)"
100 f9edb717 Diego Biurrun
101 fa62bdb8 Diego Biurrun
uninstall-headers::
102 22a324da Diego Biurrun
	rm -f $(addprefix "$(INCDIR)/",$(HEADERS))
103
	rm -f "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
104 f9edb717 Diego Biurrun
105 3263626f Diego Biurrun
.PHONY: all depend dep clean distclean install* uninstall*
106
107 6ca0c110 Diego Biurrun
-include .depend