1 XCOMM $XConsortium: sgiLib.rules /main/16 1996/09/28 18:11:04 rws $
3 #ifndef HasSharedLibraries
4 #define HasSharedLibraries YES
7 #ifndef SharedDataSeparation
8 #define SharedDataSeparation YES
10 #define SharedCodeDef -DSHAREDCODE
11 #define SharedLibraryDef -DATTSHAREDLIB
12 #define PositionIndependentCFlags -G 0
15 * SharedLibraryTarget - generate rules to create a shared library;
16 * build it into a different name so that we don't hose people by having
17 * the library gone for long periods.
19 #define SharedLibraryTarget(libname,rev,solist,down,up) @@\
20 AllTarget(Concat3(lib,libname,_s)) @@\
22 Concat3(lib,libname,_s): sharedlib.o solist Concat(lib,libname.spec) $(EXTRALIBRARYDEPS) @@\
25 && mkshlib -s Concat(up/lib,libname.spec) -t up/$@ -h up/$@.a \ @@\
26 && ar rs up/$@.a sharedlib.o @@\
27 LinkBuildLibrary($@) @@\
28 LinkBuildLibrary($@.a) @@\
31 $(RM) Concat3(lib,libname,_s) Concat3(lib,libname,_s.a)
33 #define SharedLibraryDataTarget(libname,rev,salist)
36 * InstallSharedLibrary - generate rules to install the shared library.
37 * NOTE: file must be executable, hence "INSTBINFLAGS"
39 #define InstallSharedLibrary(libname,rev,dest) @@\
40 install:: Concat3(lib,libname,_s) @@\
41 MakeDir($(DESTDIR)dest) @@\
42 $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) Concat3(lib,libname,_s.a) $(DESTDIR)dest @@\
43 $(INSTALL) $(INSTALLFLAGS) $(INSTBINFLAGS) Concat3(lib,libname,_s) $(DESTDIR)dest
47 * InstallSharedLibraryData - generate rules to install the shared library data
49 #define InstallSharedLibraryData(libname,rev,dest) @@\
50 InstallTarget(install,Concat3(lib,libname,_s.a),$(INSTLIBFLAGS),dest)
52 #else /* OSMajorVersion >= 5 */
54 #ifndef SharedDataSeparation
55 #define SharedDataSeparation NO
58 #define SharedCodeDef /**/
60 #ifndef SharedLibraryDef
61 #define SharedLibraryDef /**/
63 #ifndef ShLibIncludeFile
64 #define ShLibIncludeFile <sgiLib.tmpl>
66 #ifndef SharedLibraryLoadFlags
67 #if OSMajorVersion < 6
68 #define SharedLibraryLoadFlags -shared
70 #ifndef Mips64Architecture
71 #define SharedLibraryLoadFlags -shared
73 #define SharedLibraryLoadFlags -shared -mips3
77 /* -KPIC is redundant, PIC is always used unless you specify -non_shared */
78 #ifndef PositionIndependentCFlags
79 #define PositionIndependentCFlags -KPIC
81 #ifndef PositionIndependentCplusplusFlags
82 #define PositionIndependentCplusplusFlags -KPIC
86 * SGI's cc passes an undocumented flag to ld that causes it to look for
87 * -lX11 and force use of libX11.so.1. And it can't be turned off. Sigh.
88 * So we install one of those, too, in the shared library install target.
92 * InstallSharedLibrary - generate rules to install the shared library.
94 #ifndef InstallSharedLibrary
95 #define InstallSharedLibrary(libname,rev,dest) @@\
96 install:: Concat(lib,libname.so.rev) @@\
97 MakeDir($(DESTDIR)dest) @@\
98 $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\
99 $(RM) Concat($(DESTDIR)dest/lib,libname.so) @@\
100 cd $(DESTDIR)dest; $(LN) Concat(lib,libname.so.rev) Concat(lib,libname.so) @@\
101 if [ "libname" = X11 ]; then \ @@\
102 RemoveFile(Concat($(DESTDIR)dest/lib,libname.so.1)); \ @@\
103 cd $(DESTDIR)dest; $(LN) Concat(lib,libname.so.rev) Concat(lib,libname.so.1);\ @@\
106 #endif /* InstallSharedLibrary */
109 * InstallSharedLibraryData - generate rules to install the shared library data
111 #ifndef InstallSharedLibraryData
112 #define InstallSharedLibraryData(libname,rev,dest)
113 #endif /* InstallSharedLibraryData */
117 * SharedLibraryTarget - generate rules to create a shared library;
118 * build it into a different name so that we do not hose people by having
119 * the library gone for long periods.
123 * SGI's cc passes an undocumented flag to ld that causes it to look for
124 * -lX11 and force use of libX11.so.1. Sigh. So we make one of those, too,
125 * in the shared library build target.
130 #define sgiX11soHack(libname) /**/
132 #define sgiX11soHack(libname) if [ "libname" = X11 ]; then \ @@\
133 RemoveFile($(BUILDLIBDIR)/Concat(lib,libname.so.1)); \ @@\
134 cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/$@ Concat(lib,libname.so.1); \ @@\
137 #endif /* sgiX11soHack */
139 #ifndef SharedLibraryTarget
140 #define SharedLibraryTarget(libname,rev,solist,down,up) @@\
141 AllTarget(Concat(lib,libname.so.rev)) @@\
143 Concat(lib,libname.so.rev): solist $(EXTRALIBRARYDEPS) @@\
145 (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -soname $@ solist $(REQUIREDLIBS)) @@\
148 $(RM) Concat(lib,libname.so) @@\
149 $(LN) $@ Concat(lib,libname.so) @@\
150 LinkBuildLibrary($@) @@\
151 LinkBuildLibrary(Concat(lib,libname.so)) @@\
152 sgiX11soHack(libname) @@\
155 $(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so) so_locations
157 #endif /* SharedLibraryTarget */
160 * SharedLibraryDataTarget - generate rules to create shlib data file;
162 #ifndef SharedLibraryDataTarget
163 #define SharedLibraryDataTarget(libname,rev,salist)
164 #endif /* SharedLibraryTarget */
166 #endif /* OsMajorVersion < 5 else */