Statistics
| Branch: | Revision:

ffmpeg / common.mak @ 42225a30

History | View | Annotate | Download (2.68 KB)

1
#
2
# common bits used by all libraries
3
#
4

    
5
SRC_DIR = $(SRC_PATH)/lib$(NAME)
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
#FIXME: This should be in configure/config.mak
19
ifeq ($(TARGET_ARCH_SPARC64),yes)
20
CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
21
endif
22

    
23
SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
24
OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
25
STATIC_OBJS := $(OBJS) $(STATIC_OBJS)
26
SHARED_OBJS := $(OBJS) $(SHARED_OBJS)
27

    
28
all: $(EXTRADEPS) $(LIB) $(SLIBNAME)
29

    
30
$(LIB): $(STATIC_OBJS)
31
	rm -f $@
32
	$(AR) rc $@ $^ $(EXTRAOBJS)
33
	$(RANLIB) $@
34

    
35
$(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
36
	ln -sf $^ $@
37

    
38
$(SLIBNAME_WITH_MAJOR): $(SHARED_OBJS)
39
	$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
40
ifeq ($(CONFIG_WIN32),yes)
41
	-lib /machine:i386 /def:$(@:.dll=.def)
42
endif
43

    
44
%.o: %.c
45
	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
46

    
47
%.o: %.S
48
	$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
49

    
50
# BeOS: remove -Wall to get rid of all the "multibyte constant" warnings
51
%.o: %.cpp
52
	g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
53

    
54
depend: $(SRCS)
55
	$(CC) -MM $(CFLAGS) $^ 1>.depend
56

    
57
dep:	depend
58

    
59
clean::
60
	rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll \
61
	      *.lib *.def *.dll.a *.exp
62

    
63
distclean: clean
64
	rm -f .depend
65

    
66
ifeq ($(BUILD_SHARED),yes)
67
INSTLIBTARGETS += install-lib-shared
68
endif
69
ifeq ($(BUILD_STATIC),yes)
70
INSTLIBTARGETS += install-lib-static
71
endif
72

    
73
install: install-libs install-headers
74

    
75
install-libs: $(INSTLIBTARGETS)
76

    
77
install-lib-shared: $(SLIBNAME)
78
	install -d "$(libdir)"
79
ifeq ($(CONFIG_WIN32),yes)
80
	install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
81
else
82
	install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
83
		$(libdir)/$(SLIBNAME_WITH_VERSION)
84
	ln -sf $(SLIBNAME_WITH_VERSION) \
85
		$(libdir)/$(SLIBNAME_WITH_MAJOR)
86
	ln -sf $(SLIBNAME_WITH_VERSION) \
87
		$(libdir)/$(SLIBNAME)
88
endif
89

    
90
install-lib-static: $(LIB)
91
	install -d "$(libdir)"
92
	install -m 644 $(LIB) "$(libdir)"
93

    
94
install-headers:
95
	install -d "$(incdir)"
96
	install -d "$(libdir)/pkgconfig"
97
	install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(incdir)"
98
	install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
99

    
100
uninstall: uninstall-libs uninstall-headers
101

    
102
uninstall-libs:
103
ifeq ($(CONFIG_WIN32),yes)
104
	-rm -f $(prefix)/$(SLIBNAME)
105
else
106
	-rm -f $(libdir)/$(SLIBNAME_WITH_MAJOR) \
107
	      $(libdir)/$(SLIBNAME)            \
108
	      $(libdir)/$(SLIBNAME_WITH_VERSION)
109
endif
110
	-rm -f $(libdir)/$(LIB)
111

    
112
uninstall-headers:
113
	rm -f $(addprefix $(incdir)/,$(HEADERS))
114
	rm -f $(libdir)/pkgconfig/lib$(NAME).pc
115

    
116
#
117
# include dependency files if they exist
118
#
119
ifneq ($(wildcard .depend),)
120
include .depend
121
endif