Make dhasetup more verbose based on code by
[mplayer/greg.git] / common.mak
blob0274a5a72575da58ad6cb298c1e6fada815423bc
2 # common bits used by all libraries
5 VPATH = $(SRC_PATH_BARE)/lib$(NAME)
6 SRC_DIR = "$(VPATH)"
8 CFLAGS += $(CFLAGS-yes)
9 OBJS += $(OBJS-yes)
10 ASM_OBJS += $(ASM_OBJS-yes)
11 CPP_OBJS += $(CPP_OBJS-yes)
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)
17 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S) $(CPPOBJS:.o=.cpp)
18 OBJS := $(OBJS) $(ASM_OBJS) $(CPPOBJS)
19 STATIC_OBJS := $(OBJS) $(STATIC_OBJS)
20 SHARED_OBJS := $(OBJS) $(SHARED_OBJS)
22 all: $(EXTRADEPS) $(LIB) $(SLIBNAME)
24 $(LIB): $(STATIC_OBJS)
25 rm -f $@
26 $(AR) rc $@ $^ $(EXTRAOBJS)
27 $(RANLIB) $@
29 $(SLIBNAME): $(SLIBNAME_WITH_MAJOR)
30 ln -sf $^ $@
32 $(SLIBNAME_WITH_MAJOR): $(SHARED_OBJS)
33 $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $^ $(EXTRALIBS) $(EXTRAOBJS)
34 $(SLIB_EXTRA_CMD)
36 %.o: %.c
37 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
39 %.o: %.S
40 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
42 %: %.o $(LIB)
43 $(CC) $(LDFLAGS) -o $@ $^ $(EXTRALIBS)
45 depend dep: $(SRCS)
46 $(CC) -MM $(CFLAGS) $^ 1>.depend
48 clean::
49 rm -f *.o *~ *.a *.lib *.so *.so.* *.dylib *.dll \
50 *.def *.dll.a *.exp
52 distclean: clean
53 rm -f .depend
55 ifeq ($(BUILD_SHARED),yes)
56 INSTLIBTARGETS += install-lib-shared
57 endif
58 ifeq ($(BUILD_STATIC),yes)
59 INSTLIBTARGETS += install-lib-static
60 endif
62 install: install-libs install-headers
64 install-libs: $(INSTLIBTARGETS)
66 install-lib-shared: $(SLIBNAME)
67 install -d "$(shlibdir)"
68 install -m 755 $(SLIBNAME) "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
69 $(STRIP) "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
70 cd "$(shlibdir)" && \
71 ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
72 cd "$(shlibdir)" && \
73 ln -sf $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
74 $(SLIB_INSTALL_EXTRA_CMD)
76 install-lib-static: $(LIB)
77 install -d "$(libdir)"
78 install -m 644 $(LIB) "$(libdir)"
79 $(LIB_INSTALL_EXTRA_CMD)
81 install-headers:
82 install -d "$(incdir)"
83 install -d "$(libdir)/pkgconfig"
84 install -m 644 $(addprefix $(SRC_DIR)/,$(HEADERS)) "$(incdir)"
85 install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
87 uninstall: uninstall-libs uninstall-headers
89 uninstall-libs:
90 -rm -f "$(shlibdir)/$(SLIBNAME_WITH_MAJOR)" \
91 "$(shlibdir)/$(SLIBNAME)" \
92 "$(shlibdir)/$(SLIBNAME_WITH_VERSION)"
93 -rm -f "$(libdir)/$(LIB)"
95 uninstall-headers::
96 rm -f $(addprefix "$(incdir)/",$(HEADERS))
97 rm -f "$(libdir)/pkgconfig/lib$(NAME).pc"
99 .PHONY: all depend dep clean distclean install* uninstall*
101 -include .depend