Statistics
| Branch: | Revision:

ffmpeg / common.mak @ ed90d370

History | View | Annotate | Download (2.63 KB)

1 8b2121e3 Måns Rullgård
#
2
# common bits used by all libraries
3
#
4
5
SRC_DIR = $(SRC_PATH)/$(SUBDIR)
6
VPATH = $(SRC_DIR)
7
8
#FIXME: This should be in configure/config.mak
9
ifeq ($(CONFIG_WIN32),yes)
10
LDFLAGS = -Wl,--output-def,$(@:.dll=.def),--out-implib,lib$(SLIBNAME:$(SLIBSUF)=.dll.a)
11
endif
12
13
ifeq ($(TARGET_GPROF),yes)
14
CFLAGS+=-p
15
LDFLAGS+=-p
16
endif
17
18
ifeq ($(TARGET_ARCH_SPARC64),yes)
19
CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
20
endif
21
22 1540cfdc Måns Rullgård
SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
23 8b2121e3 Måns Rullgård
OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
24
STATIC_OBJS := $(OBJS) $(STATIC_OBJS)
25
SHARED_OBJS := $(OBJS) $(SHARED_OBJS)
26
27 06aa32ff Diego Biurrun
all: $(EXTRADEPS) $(LIB) $(SLIBNAME)
28 8b2121e3 Måns Rullgård
29
$(LIB): $(STATIC_OBJS)
30
	rm -f $@
31
	$(AR) rc $@ $^ $(EXTRAOBJS)
32
	$(RANLIB) $@
33
34 baa3a937 Måns Rullgård
$(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
35
	ln -sf $^ $@
36
37
$(SLIBNAME_WITH_MAJOR): $(SHARED_OBJS)
38 8b2121e3 Måns Rullgård
	$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
39
ifeq ($(CONFIG_WIN32),yes)
40
	-lib /machine:i386 /def:$(@:.dll=.def)
41
endif
42
43
%.o: %.c
44
	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
45
46
%.o: %.S
47
	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
48
49
# BeOS: remove -Wall to get rid of all the "multibyte constant" warnings
50
%.o: %.cpp
51
	g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
52
53
depend: $(SRCS)
54
	$(CC) -MM $(CFLAGS) $^ 1>.depend
55
56
dep:	depend
57
58
clean::
59
	rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll \
60
	      *.lib *.def *.dll.a *.exp
61
62
distclean: clean
63
	rm -f .depend
64
65
ifeq ($(BUILD_SHARED),yes)
66
INSTLIBTARGETS += install-lib-shared
67
endif
68
ifeq ($(BUILD_STATIC),yes)
69
INSTLIBTARGETS += install-lib-static
70
endif
71
72
install: install-libs install-headers
73
74
install-libs: $(INSTLIBTARGETS)
75
76
install-lib-shared: $(SLIBNAME)
77 c7bb67c4 Måns Rullgård
	install -d "$(libdir)"
78 8b2121e3 Måns Rullgård
ifeq ($(CONFIG_WIN32),yes)
79
	install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
80
else
81
	install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
82
		$(libdir)/$(SLIBNAME_WITH_VERSION)
83
	ln -sf $(SLIBNAME_WITH_VERSION) \
84
		$(libdir)/$(SLIBNAME_WITH_MAJOR)
85
	ln -sf $(SLIBNAME_WITH_VERSION) \
86
		$(libdir)/$(SLIBNAME)
87
endif
88
89
install-lib-static: $(LIB)
90 c7bb67c4 Måns Rullgård
	install -d "$(libdir)"
91 8b2121e3 Måns Rullgård
	install -m 644 $(LIB) "$(libdir)"
92
93
install-headers:
94 c7bb67c4 Måns Rullgård
	install -d "$(incdir)"
95
	install -d "$(libdir)/pkgconfig"
96 8b2121e3 Måns Rullgård
	install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(incdir)"
97
	install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
98
99 f9edb717 Diego Biurrun
uninstall: uninstall-libs uninstall-headers
100
101
uninstall-libs:
102
ifeq ($(CONFIG_WIN32),yes)
103
	-rm -f $(prefix)/$(SLIBNAME)
104
else
105
	-rm -f $(libdir)/$(SLIBNAME_WITH_MAJOR) \
106
	      $(libdir)/$(SLIBNAME)            \
107
	      $(libdir)/$(SLIBNAME_WITH_VERSION)
108
endif
109
	-rm -f $(libdir)/$(LIB)
110
111
uninstall-headers:
112
	rm -f $(addprefix $(incdir)/,$(HEADERS))
113
	rm -f $(libdir)/pkgconfig/lib$(NAME).pc
114
115 8b2121e3 Måns Rullgård
#
116
# include dependency files if they exist
117
#
118
ifneq ($(wildcard .depend),)
119
include .depend
120
endif