sgiLib.rules revision 11d341ca
1XCOMM $Xorg: sgiLib.rules,v 1.3 2000/08/17 19:41:48 cpqbld Exp $ 2XCOMM $XFree86: xc/config/cf/sgiLib.rules,v 1.3 2000/06/15 20:49:56 dawes Exp $ 3 4#ifndef HasSharedLibraries 5#define HasSharedLibraries YES 6#endif 7#if OSMajorVersion < 5 8#ifndef SharedDataSeparation 9#define SharedDataSeparation YES 10#endif 11#define SharedCodeDef -DSHAREDCODE 12#define SharedLibraryDef -DATTSHAREDLIB 13#define PositionIndependentCFlags -G 0 14 15/* 16 * SharedLibraryTarget - generate rules to create a shared library; 17 * build it into a different name so that we don't hose people by having 18 * the library gone for long periods. 19 */ 20#define SharedLibraryTarget(libname,rev,solist,down,up) @@\ 21AllTarget(Concat3(lib,libname,_s)) @@\ 22 @@\ 23Concat3(lib,libname,_s): sharedlib.o solist Concat(lib,libname.spec) $(EXTRALIBRARYDEPS) @@\ 24 $(RM) $@ $@.a \ @@\ 25 && cd down \ @@\ 26 && mkshlib -s Concat(up/lib,libname.spec) -t up/$@ -h up/$@.a \ @@\ 27 && ar rs up/$@.a sharedlib.o @@\ 28 LinkBuildLibrary($@) @@\ 29 LinkBuildLibrary($@.a) @@\ 30 @@\ 31clean:: @@\ 32 $(RM) Concat3(lib,libname,_s) Concat3(lib,libname,_s.a) 33 34/* 35 * SharedDepLibraryTarget - generate rules to create a shared library. 36 */ 37#define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up) @@\ 38AllTarget(Concat3(lib,libname,_s)) @@\ 39 @@\ 40Concat3(lib,libname,_s): deplist sharedlib.o Concat(lib,libname.spec) $(EXTRALIBRARYDEPS) @@\ 41 $(RM) $@ $@.a \ @@\ 42 && cd down \ @@\ 43 && mkshlib -s Concat(up/lib,libname.spec) -t up/$@ -h up/$@.a \ @@\ 44 && ar rs up/$@.a sharedlib.o @@\ 45 LinkBuildLibrary($@) @@\ 46 LinkBuildLibrary($@.a) @@\ 47 @@\ 48clean:: @@\ 49 $(RM) Concat3(lib,libname,_s) Concat3(lib,libname,_s.a) 50 51#define SharedLibraryDataTarget(libname,rev,salist) 52 53/* 54 * InstallSharedLibrary - generate rules to install the shared library. 55 * NOTE: file must be executable, hence "INSTBINFLAGS" 56 */ 57#define InstallSharedLibrary(libname,rev,dest) @@\ 58install:: Concat3(lib,libname,_s) @@\ 59 MakeDir($(DESTDIR)dest) @@\ 60 $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) Concat3(lib,libname,_s.a) $(DESTDIR)dest @@\ 61 $(INSTALL) $(INSTALLFLAGS) $(INSTBINFLAGS) Concat3(lib,libname,_s) $(DESTDIR)dest 62 63 64/* 65 * InstallSharedLibraryData - generate rules to install the shared library data 66 */ 67#define InstallSharedLibraryData(libname,rev,dest) @@\ 68InstallTarget(install,Concat3(lib,libname,_s.a),$(INSTLIBFLAGS),dest) 69 70#else /* OSMajorVersion >= 5 */ 71 72#ifndef SharedDataSeparation 73#define SharedDataSeparation NO 74#endif 75#ifndef SharedCodeDef 76#define SharedCodeDef /**/ 77#endif 78#ifndef SharedLibraryDef 79#define SharedLibraryDef /**/ 80#endif 81#ifndef ShLibIncludeFile 82#define ShLibIncludeFile <sgiLib.tmpl> 83#endif 84#ifndef SharedLibraryLoadFlags 85#if OSMajorVersion < 6 86#define SharedLibraryLoadFlags -shared 87#else 88#ifndef Mips64Architecture 89#define SharedLibraryLoadFlags -shared 90#else 91#define SharedLibraryLoadFlags -shared -mips3 92#endif 93#endif 94#endif 95/* -KPIC is redundant, PIC is always used unless you specify -non_shared */ 96#ifndef PositionIndependentCFlags 97#define PositionIndependentCFlags -KPIC 98#endif 99#ifndef PositionIndependentCplusplusFlags 100#define PositionIndependentCplusplusFlags -KPIC 101#endif 102 103/* 104 * SGI's cc passes an undocumented flag to ld that causes it to look for 105 * -lX11 and force use of libX11.so.1. And it can't be turned off. Sigh. 106 * So we install one of those, too, in the shared library install target. 107 */ 108 109/* 110 * InstallSharedLibrary - generate rules to install the shared library. 111 */ 112#ifndef InstallSharedLibrary 113#define InstallSharedLibrary(libname,rev,dest) @@\ 114install:: Concat(lib,libname.so.rev) @@\ 115 MakeDir($(DESTDIR)dest) @@\ 116 $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\ 117 $(RM) Concat($(DESTDIR)dest/lib,libname.so) @@\ 118 cd $(DESTDIR)dest; $(LN) Concat(lib,libname.so.rev) Concat(lib,libname.so) @@\ 119 if [ "libname" = X11 ]; then \ @@\ 120 RemoveFile(Concat($(DESTDIR)dest/lib,libname.so.1)); \ @@\ 121 cd $(DESTDIR)dest; $(LN) Concat(lib,libname.so.rev) Concat(lib,libname.so.1);\ @@\ 122 fi 123 124#endif /* InstallSharedLibrary */ 125 126/* 127 * InstallSharedLibraryData - generate rules to install the shared library data 128 */ 129#ifndef InstallSharedLibraryData 130#define InstallSharedLibraryData(libname,rev,dest) 131#endif /* InstallSharedLibraryData */ 132 133 134/* 135 * SharedLibraryTarget - generate rules to create a shared library; 136 * build it into a different name so that we do not hose people by having 137 * the library gone for long periods. 138 */ 139 140/* 141 * SGI's cc passes an undocumented flag to ld that causes it to look for 142 * -lX11 and force use of libX11.so.1. Sigh. So we make one of those, too, 143 * in the shared library build target. 144 */ 145 146#ifndef sgiX11soHack 147#ifdef UseInstalled 148#define sgiX11soHack(libname) /**/ 149#else 150#define sgiX11soHack(libname) if [ "libname" = X11 ]; then \ @@\ 151 RemoveFile($(BUILDLIBDIR)/Concat(lib,libname.so.1)); \ @@\ 152 cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/$@ Concat(lib,libname.so.1); \ @@\ 153 fi 154#endif 155#endif /* sgiX11soHack */ 156 157#ifndef SharedLibraryTarget 158#define SharedLibraryTarget(libname,rev,solist,down,up) @@\ 159AllTarget(Concat(lib,libname.so.rev)) @@\ 160 @@\ 161Concat(lib,libname.so.rev): solist $(EXTRALIBRARYDEPS) @@\ 162 $(RM) $@~ @@\ 163 (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -soname $@ solist $(REQUIREDLIBS)) @@\ 164 $(RM) $@ @@\ 165 $(MV) $@~ $@ @@\ 166 $(RM) Concat(lib,libname.so) @@\ 167 $(LN) $@ Concat(lib,libname.so) @@\ 168 LinkBuildLibrary($@) @@\ 169 LinkBuildLibrary(Concat(lib,libname.so)) @@\ 170 sgiX11soHack(libname) @@\ 171 @@\ 172clean:: @@\ 173 $(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so) so_locations 174 175#endif /* SharedLibraryTarget */ 176 177/* 178 * SharedLibraryDataTarget - generate rules to create shlib data file; 179 */ 180#ifndef SharedLibraryDataTarget 181#define SharedLibraryDataTarget(libname,rev,salist) 182#endif /* SharedLibraryTarget */ 183 184#ifndef SharedDepLibraryTarget 185#define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up) @@\ 186AllTarget(Concat(lib,libname.so.rev)) @@\ 187 @@\ 188Concat(lib,libname.so.rev): deplist $(EXTRALIBRARYDEPS) @@\ 189 $(RM) $@~ @@\ 190 (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -soname $@ solist $(REQUIREDLIBS)) @@\ 191 $(RM) $@ @@\ 192 $(MV) $@~ $@ @@\ 193 $(RM) Concat(lib,libname.so) @@\ 194 $(LN) $@ Concat(lib,libname.so) @@\ 195 LinkBuildLibrary($@) @@\ 196 LinkBuildLibrary(Concat(lib,libname.so)) @@\ 197 sgiX11soHack(libname) @@\ 198 @@\ 199clean:: @@\ 200 $(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so) so_locations 201 202#endif /* SharedDepLibraryTarget */ 203 204#endif /* OsMajorVersion < 5 else */ 205