1 XCOMM $TOG: sv4Lib.rules /main/19 1999/03/22 16:26:02 mgreess $
4 * SVR4 shared library rules
7 #ifndef HasSharedLibraries
8 # define HasSharedLibraries YES
10 #ifndef SharedDataSeparation
11 # define SharedDataSeparation NO
14 # define SharedCodeDef /**/
16 #ifndef SharedLibraryDef
17 # define SharedLibraryDef /**/
19 #ifndef ShLibIncludeFile
20 # define ShLibIncludeFile <sv4Lib.tmpl>
22 #ifndef SharedLibraryLoadFlags
23 # define SharedLibraryLoadFlags -G -z text
25 #ifndef PositionIndependentCFlags
27 # define PositionIndependentCFlags -fPIC
29 # define PositionIndependentCFlags -K PIC
32 #ifndef PositionIndependentCplusplusFlags
33 # if HasGcc2ForCplusplus
34 # define PositionIndependentCplusplusFlags -fpic
36 # define PositionIndependentCplusplusFlags -K PIC
39 #ifndef UseExportLists
40 # define UseExportLists NO
44 * InstallSharedLibrary - generate rules to install the shared library.
46 #ifndef InstallSharedLibrary
47 # define InstallSharedLibrary(libname,rev,dest) @@\
48 install:: Concat(lib,libname.so.rev) @@\
49 MakeDir($(DESTDIR)dest) @@\
50 $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\
51 $(RM) Concat($(DESTDIR)dest/lib,libname.so) @@\
52 cd $(DESTDIR)dest; $(LN) Concat(lib,libname.so.rev) Concat(lib,libname.so)
54 #endif /* InstallSharedLibrary */
57 * InstallSharedLibraryData - generate rules to install the shared library data
59 #ifndef InstallSharedLibraryData
60 # define InstallSharedLibraryData(libname,rev,dest)
61 #endif /* InstallSharedLibraryData */
63 #ifndef LinkWithExports
64 # if defined(SunArchitecture)
66 # define LinkWithExports(libname,rev,solist,down,up) \
67 (cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) -Wl,-soname,$@ solist $(REQUIREDLIBS))
69 # define LinkWithExports(libname,rev,solist,down,up) \
70 (cd down; $(CCENVSETUP) $(CXX) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS))
74 # define LinkWithExports(libname,rev,solist,down,up) \
75 (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS)) @@\
76 if [ -f Concat(lib,libname.elist) ]; then \ @@\
77 $(RM) down/$@.exports $@.list; \ @@\
78 $(CPP) $(ALLINCLUDES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(DEFINES) Concat(lib,libname.elist) | CppSedMagic >$@.list; \ @@\
79 $(EXPORTLISTGEN) $@~ $@.list > down/$@.exports; \ @@\
80 (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ ShlibExportListOpt($@.exports) solist $(REQUIREDLIBS)); \ @@\
81 $(RM) down/$@.exports $@.list; \ @@\
84 # define LinkWithExports(libname,rev,solist,down,up) \
85 (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS))
91 * SharedLibraryTarget - generate rules to create a shared library;
92 * build it into a different name so that we do not hose people by having
93 * the library gone for long periods.
95 #ifndef SharedLibraryTarget
96 # define SharedLibraryTarget(libname,rev,solist,down,up) @@\
97 AllTarget(Concat(lib,libname.so.rev)) @@\
99 Concat(lib,libname.so.rev): solist $(EXTRALIBRARYDEPS) @@\
101 LinkWithExports(libname,rev,solist,down,up) @@\
104 $(RM) Concat(lib,libname.so) @@\
105 $(LN) $@ Concat(lib,libname.so) @@\
106 LinkBuildLibrary($@) @@\
107 LinkBuildLibrary(Concat(lib,libname.so)) @@\
110 $(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so)
112 #endif /* SharedLibraryTarget */
115 * SharedLibraryDataTarget - generate rules to create shlib data file;
117 #ifndef SharedLibraryDataTarget
118 # define SharedLibraryDataTarget(libname,rev,salist)
119 #endif /* SharedLibraryTarget */