]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blob - common.mak
Remove lots of unused commented code. (Cleanup)
[frescor/ffmpeg.git] / common.mak
1 #
2 # common bits used by all libraries
3 #
4
5 VPATH = $(SRC_PATH_BARE)/lib$(NAME)
6 SRC_DIR = "$(VPATH)"
7
8 CFLAGS   += $(CFLAGS-yes)
9 OBJS     += $(OBJS-yes)
10 ASM_OBJS += $(ASM_OBJS-yes)
11 CPP_OBJS += $(CPP_OBJS-yes)
12
13 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 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
17 OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
18 STATIC_OBJS := $(OBJS) $(STATIC_OBJS)
19 SHARED_OBJS := $(OBJS) $(SHARED_OBJS)
20
21 all: $(EXTRADEPS) $(LIB) $(SLIBNAME)
22
23 $(LIB): $(STATIC_OBJS)
24         rm -f $@
25         $(AR) rc $@ $^ $(EXTRAOBJS)
26         $(RANLIB) $@
27
28 $(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
29         ln -sf $^ $@
30
31 $(SLIBNAME_WITH_MAJOR): $(SHARED_OBJS)
32         $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
33         $(SLIB_EXTRA_CMD)
34
35 %.o: %.c
36         $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
37
38 %.o: %.S
39         $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
40
41 %: %.o $(LIB)
42         $(CC) $(LDFLAGS) -o $@ $^ $(EXTRALIBS)
43
44 depend dep: $(SRCS)
45         $(CC) -MM $(CFLAGS) $^ 1>.depend
46
47 clean::
48         rm -f *.o *.d *~ *.a *.lib *.so *.so.* *.dylib *.dll \
49               *.def *.dll.a *.exp
50
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         install -d "$(shlibdir)"
67         install -m 755 $(SLIBNAME) "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
68         $(STRIP) "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
69         cd "$(shlibdir)" && \
70                 ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
71         cd "$(shlibdir)" && \
72                 ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
73         $(SLIB_INSTALL_EXTRA_CMD)
74
75 install-lib-static: $(LIB)
76         install -d "$(libdir)"
77         install -m 644 $(LIB) "$(libdir)"
78         $(LIB_INSTALL_EXTRA_CMD)
79
80 install-headers:
81         install -d "$(incdir)"
82         install -d "$(libdir)/pkgconfig"
83         install -m 644 $(addprefix $(SRC_DIR)/,$(HEADERS)) "$(incdir)"
84         install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
85
86 uninstall: uninstall-libs uninstall-headers
87
88 uninstall-libs:
89         -rm -f "$(shlibdir)/$(SLIBNAME_WITH_MAJOR)" \
90                "$(shlibdir)/$(SLIBNAME)"            \
91                "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
92         -rm -f "$(libdir)/$(LIB)"
93
94 uninstall-headers:
95         rm -f $(addprefix "$(incdir)/",$(HEADERS))
96         rm -f "$(libdir)/pkgconfig/lib$(NAME).pc"
97
98 .PHONY: all depend dep clean distclean install* uninstall*
99
100 -include .depend