Statistics
| Branch: | Revision:

ffmpeg / common.mak @ a23c9c4a

History | View | Annotate | Download (2.7 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
20 24743a76 Diego Biurrun
all: $(LIBNAME) $(SLIBNAME)
21 8b2121e3 Måns Rullgård
22 582c1c47 Diego Biurrun
$(LIBNAME): $(OBJS)
23 8b2121e3 Måns Rullgård
	rm -f $@
24
	$(AR) rc $@ $^ $(EXTRAOBJS)
25
	$(RANLIB) $@
26
27 baa3a937 Måns Rullgård
$(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
28 20369773 Dave Yeo
	$(LN_S) $^ $@
29 baa3a937 Måns Rullgård
30 582c1c47 Diego Biurrun
$(SLIBNAME_WITH_MAJOR): $(OBJS)
31 d22e8442 Dave Yeo
	$(SLIB_CREATE_DEF_CMD)
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 24743a76 Diego Biurrun
%: %.o $(LIBNAME)
42 c6c46511 Diego Biurrun
	$(CC) $(LDFLAGS) -o $@ $^ $(EXTRALIBS)
43
44 e4d86a57 Måns Rullgård
%.ho: %.h
45
	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
46
47
ALLHEADERS = $(subst $(VPATH)/,,$(wildcard $(VPATH)/*.h))
48
checkheaders: $(filter-out %_template.ho,$(ALLHEADERS:.h=.ho))
49
50 9d0199f4 Diego Biurrun
depend dep: $(SRCS)
51 8b2121e3 Måns Rullgård
	$(CC) -MM $(CFLAGS) $^ 1>.depend
52
53
clean::
54 b8d40825 Diego Biurrun
	rm -f *.o *~ *.a *.lib *.so *.so.* *.dylib *.dll \
55 bca9e0bc Diego Biurrun
	      *.def *.dll.a *.exp *.ho *.map $(TESTS)
56 8b2121e3 Måns Rullgård
57
distclean: clean
58
	rm -f .depend
59
60 71fa13e8 Diego Biurrun
INSTALL_TARGETS-$(BUILD_SHARED) += install-lib-shared
61
INSTALL_TARGETS-$(BUILD_STATIC) += install-lib-static
62 8b2121e3 Måns Rullgård
63
install: install-libs install-headers
64
65 71fa13e8 Diego Biurrun
install-libs: $(INSTALL_TARGETS-yes)
66 8b2121e3 Måns Rullgård
67
install-lib-shared: $(SLIBNAME)
68 22a324da Diego Biurrun
	install -d "$(SHLIBDIR)"
69
	install -m 755 $(SLIBNAME) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
70
	$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
71
	cd "$(SHLIBDIR)" && \
72 20369773 Dave Yeo
		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
73 22a324da Diego Biurrun
	cd "$(SHLIBDIR)" && \
74 20369773 Dave Yeo
		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
75 8fbec4f4 Ramiro Polla
	$(SLIB_INSTALL_EXTRA_CMD)
76 8b2121e3 Måns Rullgård
77 24743a76 Diego Biurrun
install-lib-static: $(LIBNAME)
78 22a324da Diego Biurrun
	install -d "$(LIBDIR)"
79 24743a76 Diego Biurrun
	install -m 644 $(LIBNAME) "$(LIBDIR)"
80 d7e27559 Diego Biurrun
	$(LIB_INSTALL_EXTRA_CMD)
81 8b2121e3 Måns Rullgård
82
install-headers:
83 22a324da Diego Biurrun
	install -d "$(INCDIR)"
84
	install -d "$(LIBDIR)/pkgconfig"
85
	install -m 644 $(addprefix $(SRC_DIR)/,$(HEADERS)) "$(INCDIR)"
86
	install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(LIBDIR)/pkgconfig"
87 8b2121e3 Måns Rullgård
88 f9edb717 Diego Biurrun
uninstall: uninstall-libs uninstall-headers
89
90
uninstall-libs:
91 22a324da Diego Biurrun
	-rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
92
	       "$(SHLIBDIR)/$(SLIBNAME)"            \
93
	       "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
94 5b5d0491 Dave Yeo
	-$(SLIB_UNINSTALL_EXTRA_CMD)
95 24743a76 Diego Biurrun
	-rm -f "$(LIBDIR)/$(LIBNAME)"
96 f9edb717 Diego Biurrun
97 fa62bdb8 Diego Biurrun
uninstall-headers::
98 22a324da Diego Biurrun
	rm -f $(addprefix "$(INCDIR)/",$(HEADERS))
99
	rm -f "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
100 f9edb717 Diego Biurrun
101 bca9e0bc Diego Biurrun
tests: $(TESTS)
102
103
%-test$(EXESUF): %.c $(LIBNAME)
104
	$(CC) $(CFLAGS) $(LDFLAGS) -DTEST -o $@ $^ $(EXTRALIBS)
105
106
.PHONY: all depend dep clean distclean install* uninstall* tests
107 3263626f Diego Biurrun
108 6ca0c110 Diego Biurrun
-include .depend