1 XCOMM $XConsortium: hpLib.rules /main/16 1996/12/04 11:44:35 swick $
4 * HP 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 <hpLib.tmpl>
22 #ifndef SharedLibraryLoadFlags
23 # define SharedLibraryLoadFlags -b
25 #ifndef PositionIndependentCFlags
26 # define PositionIndependentCFlags +z
28 #ifndef LargePositionIndependentCFlags
29 # define LargePositionIndependentCFlags +Z
32 # define InstLibFlags -m 0555
35 /* assert: LdPostLib pulls in -L$(USRLIBDIR), so it doesn't need to be here */
36 # define ExtraLoadFlags -Wl,+s -Wl,+b$(USRLIBDIRPATH)
38 #ifndef UseExportLists
39 # define UseExportLists YES
42 /* Pre-linking shared libraries is supported in HP/UX 10. */
43 #if OSMajorVersion > 9
44 # define HPRequiredLibs $(LDPRELIBS) $(REQUIREDLIBS) +s +b $(USRLIBDIRPATH)
46 # define HPRequiredLibs $(REQUIREDLIBS)
49 #ifndef LinkWithExports
51 # define LinkWithExports(libname,rev,solist,down,up) \
52 (cd down; $(LD) -o up/$@~ $(SHLIBLDFLAGS) +h $@ solist HPRequiredLibs) @@\
53 if [ -f Concat(lib,libname.elist) ]; then \ @@\
54 RemoveFiles($@.exports $@.list); \ @@\
55 $(CPP) $(ALLINCLUDES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(DEFINES) Concat(lib,libname.elist) | CppSedMagic >$@.list; \ @@\
56 $(EXPORTLISTGEN) $@~ $@.list > $@.exports; \ @@\
57 (cd down; $(LD) -c up/$@.exports -o up/$@~ $(SHLIBLDFLAGS) +h $@ solist HPRequiredLibs); \ @@\
58 RemoveFiles($@.exports $@.list); \ @@\
61 # define LinkWithExports(libname,rev,solist,down,up) \
62 (cd down; $(LD) -o up/$@~ $(SHLIBLDFLAGS) +h $@ solist HPRequiredLibs)
67 * InstallSharedLibrary - generate rules to install the shared library.
69 #ifndef InstallSharedLibrary
70 # define InstallSharedLibrary(libname,rev,dest) @@\
71 install:: Concat(lib,libname.sl.rev) @@\
72 MakeDir($(DESTDIR)dest) @@\
73 RMoveToBakFile(Concat($(DESTDIR)dest/lib,libname.sl.rev)) @@\
74 $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) Concat(lib,libname.sl.rev) $(DESTDIR)dest @@\
75 $(RM) Concat($(DESTDIR)dest/lib,libname.sl) @@\
76 cd $(DESTDIR)dest; $(LN) Concat(lib,libname.sl.rev) Concat(lib,libname.sl) @@\
77 -RemoveFile(Concat(lib,libname.sl.rev.bak))
79 #endif /* InstallSharedLibrary */
82 * InstallSharedLibraryData - generate rules to install the shared library data
84 #ifndef InstallSharedLibraryData
85 # define InstallSharedLibraryData(libname,rev,dest)
86 #endif /* InstallSharedLibraryData */
90 * SharedLibraryTarget - generate rules to create a shared library;
91 * build it into a different name so that we do not hose people by having
92 * the library gone for long periods.
94 #ifndef SharedLibraryTarget
95 # define SharedLibraryTarget(libname,rev,solist,down,up) @@\
96 AllTarget(Concat(lib,libname.sl.rev)) @@\
98 Concat(lib,libname.sl.rev): solist $(EXTRALIBRARYDEPS) @@\
100 LinkWithExports(libname,rev,solist,down,up) @@\
101 -RemoveFiles($@ $@.bak) @@\
102 MoveToBakFile($@) @@\
104 $(RM) Concat(lib,libname.sl) @@\
105 $(LN) $@ Concat(lib,libname.sl) @@\
106 LinkBuildLibrary($@) @@\
107 LinkBuildLibrary(Concat(lib,libname.sl)) @@\
110 $(RM) Concat(lib,libname.sl.rev) Concat(lib,libname.sl)
112 #endif /* SharedLibraryTarget */
115 * SharedLibraryDataTarget - generate rules to create shlib data file;
117 #ifndef SharedLibraryDataTarget
118 # define SharedLibraryDataTarget(libname,rev,salist)
119 #endif /* SharedLibraryTarget */