1 XCOMM $XConsortium: sv4Lib.rules /main/18 1996/09/28 16:13:29 rws $
2 XCOMM $XFree86: xc/config/cf/sv4Lib.rules,v 3.4 1996/12/23 05:50:34 dawes Exp $
5 * SVR4 shared library rules
8 #ifndef HasSharedLibraries
9 # define HasSharedLibraries YES
11 #ifndef SharedDataSeparation
12 # define SharedDataSeparation NO
15 # define SharedCodeDef /**/
17 #ifndef SharedLibraryDef
18 # define SharedLibraryDef /**/
20 #ifndef ShLibIncludeFile
21 # define ShLibIncludeFile <sv4Lib.tmpl>
23 #ifndef SharedLibraryLoadFlags
24 # define SharedLibraryLoadFlags -G -z text
26 #ifndef PositionIndependentCFlags
28 # define PositionIndependentCFlags -fpic
30 # define PositionIndependentCFlags -K PIC
33 #ifndef PositionIndependentCplusplusFlags
34 # if HasGcc2ForCplusplus
35 # define PositionIndependentCplusplusFlags -fpic
37 # define PositionIndependentCplusplusFlags -K PIC
40 #ifndef UseExportLists
41 # define UseExportLists NO
45 * InstallSharedLibrary - generate rules to install the shared library.
47 #ifndef InstallSharedLibrary
48 #if StripInstalledPrograms
49 # define InstallSharedLibrary(libname,rev,dest) @@\
50 install:: Concat(lib,libname.so.rev) @@\
51 MakeDir($(DESTDIR)dest) @@\
52 $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\
53 mcs -d Concat($(DESTDIR)dest/lib,libname.so.rev) @@\
54 $(RM) Concat($(DESTDIR)dest/lib,libname.so) @@\
55 cd $(DESTDIR)dest; $(LN) Concat(lib,libname.so.rev) Concat(lib,libname.so)
57 # define InstallSharedLibrary(libname,rev,dest) @@\
58 install:: Concat(lib,libname.so.rev) @@\
59 MakeDir($(DESTDIR)dest) @@\
60 $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\
61 $(RM) Concat($(DESTDIR)dest/lib,libname.so) @@\
62 cd $(DESTDIR)dest; $(LN) Concat(lib,libname.so.rev) Concat(lib,libname.so)
65 #endif /* InstallSharedLibrary */
68 * InstallSharedLibraryData - generate rules to install the shared library data
70 #ifndef InstallSharedLibraryData
71 # define InstallSharedLibraryData(libname,rev,dest)
72 #endif /* InstallSharedLibraryData */
74 #ifndef LinkWithExports
76 # define LinkWithExports(libname,rev,solist,down,up) \
77 (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS)) @@\
78 if [ -f Concat(lib,libname.elist) ]; then \ @@\
79 $(RM) down/$@.exports $@.list; \ @@\
80 $(CPP) $(ALLINCLUDES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(DEFINES) Concat(lib,libname.elist) | CppSedMagic >$@.list; \ @@\
81 $(EXPORTLISTGEN) $@~ $@.list > down/$@.exports; \ @@\
82 (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ ShlibExportListOpt($@.exports) solist $(REQUIREDLIBS)); \ @@\
83 $(RM) down/$@.exports $@.list; \ @@\
86 # define LinkWithExports(libname,rev,solist,down,up) \
87 (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS))
92 * SharedLibraryTarget - generate rules to create a shared library;
93 * build it into a different name so that we do not hose people by having
94 * the library gone for long periods.
96 #ifndef SharedLibraryTarget
97 # define SharedLibraryTarget(libname,rev,solist,down,up) @@\
98 AllTarget(Concat(lib,libname.so.rev)) @@\
100 Concat(lib,libname.so.rev): solist $(EXTRALIBRARYDEPS) @@\
102 LinkWithExports(libname,rev,solist,down,up) @@\
105 $(RM) Concat(lib,libname.so) @@\
106 $(LN) $@ Concat(lib,libname.so) @@\
107 LinkBuildLibrary($@) @@\
108 LinkBuildLibrary(Concat(lib,libname.so)) @@\
111 $(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so)
113 #endif /* SharedLibraryTarget */
116 #ifndef SharedDepModuleTarget
117 #define SharedDepModuleTarget(name,deps,solist) @@\
122 $(LD) -o $@~ $(SHLIBLDFLAGS) solist $(REQUIREDLIBS) @@\
129 #endif /* SharedDepModuleTarget */
133 * SharedLibraryDataTarget - generate rules to create shlib data file;
135 #ifndef SharedLibraryDataTarget
136 # define SharedLibraryDataTarget(libname,rev,salist)
137 #endif /* SharedLibraryTarget */