1 # -*-makefile-*- <-- an Emacs control
3 # The including make file must define these make variables:
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"
8 # SHLIB_SUFFIX: Shared library filename suffix, e.g. "so".
10 # MAJ: Library major version number, e.g. "3" in file name "libfoo.3.1"
12 # MIN: Library minor version number, e.g. "1" in file name "libfoo.3.1"
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.
18 # LADD: Additional linker flags (normally set on the make command line).
20 # INSTALL_DATA: beginning of shell command to install a library file.
22 # DESTDIR: main installation directory
24 # LIBINST_DIR: directory in which to install libraries, relative to DESTDIR.
26 # LN_S: beginning of shell command to make symbolic link (e.g. "ln -s").
28 # CXXLD: beginning of shell command to link, e.g. "g++".
30 # This make file defines these make variables that the including make file
33 # ALL_SHARED_LIBRARIES: list of targets to be dependencies of all: .
35 # Including make file must contain a rule to build each library file
38 # This make file provides these rules:
40 # install-shared-libraries: install all shared libraries and the necessary
43 ALL_SHARED_LIBRARIES = \
44 $(SHARED_LIBS_TO_BUILD:%=%.$(SHLIB_SUFFIX).$(MAJ).$(MIN))
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
50 SONAME = $(@:%.$(MIN)=%)
52 SHLIB_RULE = $(CXXLD) $(LDFLAGS_SHLIB) -o $@ $^ $(LADD)
54 SHLIB_INSTALL_TARGETS = $(SHARED_LIBS_TO_INSTALL:%=%/install)
56 #SHLIB_INSTALL_TARGETS is like "install/libfoo install/libbar"
58 .PHONY: $(SHLIB_INSTALL_TARGETS)
59 .PHONY: install-shared-libraries
61 install-shared-libraries: $(SHLIB_INSTALL_TARGETS)
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)=%)