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
65 # define LinkWithExports(libname,rev,solist,down,up) \
66 (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS)) @@\
67 if [ -f Concat(lib,libname.elist) ]; then \ @@\
68 $(RM) down/$@.exports $@.list; \ @@\
69 $(CPP) $(ALLINCLUDES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(DEFINES) Concat(lib,libname.elist) | CppSedMagic >$@.list; \ @@\
70 $(EXPORTLISTGEN) $@~ $@.list > down/$@.exports; \ @@\
71 (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ ShlibExportListOpt($@.exports) solist $(REQUIREDLIBS)); \ @@\
72 $(RM) down/$@.exports $@.list; \ @@\
75 # define LinkWithExports(libname,rev,solist,down,up) \
76 (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS))
81 * SharedLibraryTarget - generate rules to create a shared library;
82 * build it into a different name so that we do not hose people by having
83 * the library gone for long periods.
85 #ifndef SharedLibraryTarget
86 # define SharedLibraryTarget(libname,rev,solist,down,up) @@\
87 AllTarget(Concat(lib,libname.so.rev)) @@\
89 Concat(lib,libname.so.rev): solist $(EXTRALIBRARYDEPS) @@\
91 LinkWithExports(libname,rev,solist,down,up) @@\
94 $(RM) Concat(lib,libname.so) @@\
95 $(LN) $@ Concat(lib,libname.so) @@\
96 LinkBuildLibrary($@) @@\
97 LinkBuildLibrary(Concat(lib,libname.so)) @@\
100 $(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so)
102 #endif /* SharedLibraryTarget */
105 * SharedLibraryDataTarget - generate rules to create shlib data file;
107 #ifndef SharedLibraryDataTarget
108 # define SharedLibraryDataTarget(libname,rev,salist)
109 #endif /* SharedLibraryTarget */