initial load of upstream version 1.06.32
[xmlrpc-c] / unix-common.make
1 # -*-makefile-*-    <-- an Emacs control
2
3 # The including make file must define these make variables:
4 #
5 # SHARED_LIBS_TO_INSTALL: List of the shared libraries that need to be
6 #   installed -- just the basic library names.  E.g. "libfoo libbar"
7 #
8 # SHLIB_SUFFIX: Shared library filename suffix, e.g. "so".
9 #
10 # MAJ: Library major version number, e.g. "3" in file name "libfoo.3.1"
11 #
12 # MIN: Library minor version number, e.g. "1" in file name "libfoo.3.1"
13 #
14 # LDFLAGS_SHLIB: linker (Ld) flags needed to link object files together into
15 #   a shared library.  May use $(SONAME) for the soname of the library.
16 #   Include -lc if appropriate.
17 #
18 # LADD: Additional linker flags (normally set on the make command line).
19 #
20 # INSTALL_DATA: beginning of shell command to install a library file.
21 #
22 # DESTDIR: main installation directory
23 #
24 # LIBINST_DIR: directory in which to install libraries, relative to DESTDIR.
25 #
26 # LN_S: beginning of shell command to make symbolic link (e.g. "ln -s").
27 #
28 # CXXLD: beginning of shell command to link, e.g. "g++".
29
30 # This make file defines these make variables that the including make file
31 # can use:
32 #
33 # ALL_SHARED_LIBRARIES: list of targets to be dependencies of all: .
34
35 # Including make file must contain a rule to build each library file
36 # (e.g. libfoo.3.1)
37
38 # This make file provides these rules:
39 #
40 # install-shared-libraries: install all shared libraries and the necessary
41 # symbolic links.
42
43 ALL_SHARED_LIBRARIES = \
44   $(SHARED_LIBS_TO_BUILD:%=%.$(SHLIB_SUFFIX).$(MAJ).$(MIN))
45
46 # SONAME is to be referenced by $(LDSHLIB) in $(SHLIB_RULE)
47 # SONAME is the name of the library file being built, with the minor
48 #   version number cut off.  E.g. if we're building libfoo.so.1.2, SONAME
49 #   is libfoo.so.1 .
50 SONAME = $(@:%.$(MIN)=%)
51
52 SHLIB_RULE = $(CXXLD) $(LDFLAGS_SHLIB) -o $@ $^ $(LADD)
53
54 SHLIB_INSTALL_TARGETS = $(SHARED_LIBS_TO_INSTALL:%=%/install)
55
56 #SHLIB_INSTALL_TARGETS is like "install/libfoo install/libbar"
57
58 .PHONY: $(SHLIB_INSTALL_TARGETS)
59 .PHONY: install-shared-libraries
60
61 install-shared-libraries: $(SHLIB_INSTALL_TARGETS)
62
63 $(SHLIB_INSTALL_TARGETS) X/install:%/install:%.$(SHLIB_SUFFIX).$(MAJ).$(MIN)
64 # $< is a library file name, e.g. libfoo.3.1 .
65         $(INSTALL_SHLIB) $< $(DESTDIR)$(LIBINST_DIR)/$<
66         cd $(DESTDIR)$(LIBINST_DIR); \
67           rm -f $(<:%.$(MIN)=%); \
68           $(LN_S) $< $(<:%.$(MIN)=%)
69         cd $(DESTDIR)$(LIBINST_DIR); \
70           rm -f $(<:%.$(MAJ).$(MIN)=%); \
71           $(LN_S) $(<:%.$(MIN)=%) $(<:%.$(MAJ).$(MIN)=%)