Home | History | Annotate | Line # | Download | only in dist
      1 /*
      2  * GNU/Hurd shared library rules
      3  *
      4  * $XFree86: xc/config/cf/gnuLib.rules,v 1.9 2003/10/11 09:40:13 herrb Exp $
      5  */
      6 
      7 /*
      8  * GNU/Hurd shared library rules
      9  * Cloned from Linux (ELF) shared library rules
     10  *
     11  */
     12 
     13 #ifndef HasSharedLibraries
     14 #define HasSharedLibraries YES
     15 #endif
     16 #ifndef ForceNormalLib
     17 #define ForceNormalLib NO
     18 #endif
     19 
     20 XCOMM XXX To rpath or not to rpath...
     21 #ifndef UseRpath
     22 #define UseRpath NO
     23 #endif
     24 
     25 #ifndef SharedOldX
     26 #define SharedOldX NO
     27 #endif
     28 
     29 #undef SpecialMalloc
     30 #define SpecialMalloc NO
     31 
     32 #define BaseShLibReqs   -lc
     33 
     34 #ifndef SharedDataSeparation
     35 #define SharedDataSeparation NO
     36 #endif
     37 #ifndef SharedCodeDef
     38 #define SharedCodeDef /**/
     39 #endif
     40 #ifndef SharedLibraryDef
     41 #define SharedLibraryDef /**/
     42 #endif
     43 #ifndef ShLibIncludeFile
     44 #define ShLibIncludeFile <gnuLib.tmpl>
     45 #endif
     46 #ifndef RpathLoadFlags
     47 #if UseRpath
     48 #define RpathLoadFlags -Wl,-rpath=$(USRLIBDIRPATH)
     49 #else
     50 #define RpathLoadFlags /**/
     51 #endif
     52 #endif
     53 #ifndef LibraryRpathLoadFlags
     54 #define LibraryRpathLoadFlags RpathLoadFlags
     55 #endif
     56 #ifndef SharedLibraryLoadFlags
     57 #define SharedLibraryLoadFlags -shared LibraryRpathLoadFlags
     58 #endif
     59 #ifndef PositionIndependentCFlags
     60 #define PositionIndependentCFlags -fPIC
     61 #endif
     62 #ifndef PositionIndependentCplusplusFlags
     63 #define PositionIndependentCplusplusFlags -fPIC
     64 #endif
     65 #ifndef ExtraLoadFlags
     66 #ifdef UseInstalled
     67 XCOMM XXX Maybe superfluous.
     68 #define ExtraLoadFlags RpathLoadFlags -Wl,-rpath-link=$(USRLIBDIRPATH)
     69 #else
     70 #define ExtraLoadFlags RpathLoadFlags -Wl,-rpath-link=$(BUILDLIBDIR)
     71 #endif
     72 #endif
     73 
     74 /*
     75  * InstallSharedLibrary - generate rules to install the shared library.
     76  * NOTE: file must be executable, hence "INSTBINFLAGS"
     77  */
     78 #ifndef InstallSharedLibrary
     79 #define InstallSharedLibrary(libname,rev,dest)				@@\
     80 install:: Concat(lib,libname.so.rev) 					@@\
     81 	MakeDir($(DESTDIR)dest)						@@\
     82 	$(INSTALL) $(INSTALLFLAGS) $(INSTBINFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\
     83 	@T=`echo Concat($(DESTDIR)dest/lib,libname.so.rev) | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`;\
     84 	  set -x; $(RM) $$T && $(LN) Concat(lib,libname.so.rev) $$T	@@\
     85 	@if $(SOSYMLINK); then (set -x; \
     86 	  $(RM) Concat($(DESTDIR)dest/lib,libname.so); \		@@\
     87 	  $(LN) Concat(lib,libname.so.rev) Concat($(DESTDIR)dest/lib,libname.so)); fi
     88 #endif /* InstallSharedLibrary */
     89 
     90 /*
     91  * InstallSharedLibraryData - generate rules to install the shared library data
     92  */
     93 #ifndef InstallSharedLibraryData
     94 #define InstallSharedLibraryData(libname,rev,dest)
     95 #endif /* InstallSharedLibraryData */
     96 
     97 
     98 /*
     99  * SharedLibraryTarget - generate rules to create a shared library;
    100  * build it into a different name so that we do not hose people by having
    101  * the library gone for long periods.
    102  */
    103 #ifndef SharedLibraryTarget
    104 #define SharedLibraryTarget(libname,rev,solist,down,up)			@@\
    105 AllTarget(Concat(lib,libname.so.rev))					@@\
    106 									@@\
    107 Concat(lib,libname.so.rev):  solist $(EXTRALIBRARYDEPS)			@@\
    108 	$(RM) $@~							@@\
    109 	@SONAME=`echo $@ | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; set -x; \		@@\
    110 		(cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) -Wl,-soname,$$SONAME solist $(REQUIREDLIBS) BaseShLibReqs); \ @@\
    111 		$(RM) $$SONAME; $(LN) $@ $$SONAME; \			@@\
    112 		LinkBuildSonameLibrary($$SONAME)			@@\
    113 	$(RM) $@							@@\
    114 	$(MV) $@~ $@							@@\
    115 	@if $(SOSYMLINK); then (set -x; \				@@\
    116 	  $(RM) Concat(lib,libname.so); \				@@\
    117 	  $(LN) $@ Concat(lib,libname.so)); fi				@@\
    118 	LinkBuildLibrary($@)						@@\
    119 	LinkBuildLibraryMaybe(Concat(lib,libname.so),$(SOSYMLINK))	@@\
    120 									@@\
    121 clean::									@@\
    122 	@MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \	@@\
    123 	set -x; $(RM) Concat(lib,libname.so.$$MAJREV)			@@\
    124 	$(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so)
    125 
    126 #endif /* SharedLibraryTarget */
    127 
    128 /*
    129  * SharedDepLibraryTarget - generate rules to create a shared library.
    130  */
    131 #ifndef SharedDepLibraryTarget
    132 #define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up)	@@\
    133 AllTarget(Concat(lib,libname.so.rev))					@@\
    134 									@@\
    135 Concat(lib,libname.so.rev):  deplist $(EXTRALIBRARYDEPS)		@@\
    136 	$(RM) $@~							@@\
    137 	@SONAME=`echo $@ | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; set -x; \		@@\
    138 		(cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) -Wl,-soname,$$SONAME solist $(REQUIREDLIBS) BaseShLibReqs); \ @@\
    139 		$(RM) $$SONAME; $(LN) $@ $$SONAME; \			@@\
    140 		LinkBuildSonameLibrary($$SONAME)			@@\
    141 	$(RM) $@ 							@@\
    142 	$(MV) $@~ $@							@@\
    143 	@if $(SOSYMLINK); then (set -x; \				@@\
    144 	  $(RM) Concat(lib,libname.so); \				@@\
    145 	  $(LN) $@ Concat(lib,libname.so)); fi				@@\
    146 	LinkBuildLibrary($@)						@@\
    147 	LinkBuildLibraryMaybe(Concat(lib,libname.so),$(SOSYMLINK))	@@\
    148 									@@\
    149 clean::									@@\
    150 	@MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \	@@\
    151 	set -x; $(RM) Concat(lib,libname.so.$$MAJREV)			@@\
    152 	$(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so)
    153 
    154 #endif /* SharedDepLibraryTarget */
    155 
    156 #ifndef SharedDepModuleTarget
    157 #define SharedDepModuleTarget(name,deps,solist)				@@\
    158 AllTarget(name)								@@\
    159 									@@\
    160 name: deps								@@\
    161 	$(RM) $@~							@@\
    162 	$(CC) -o $@~ $(SHLIBLDFLAGS) solist $(REQUIREDLIBS) BaseShLibReqs @@\
    163 	$(RM) $@							@@\
    164 	$(MV) $@~ $@							@@\
    165 									@@\
    166 clean::									@@\
    167 	$(RM) name
    168 
    169 #endif /* SharedDepModuleTarget */
    170 
    171 /*
    172  * SharedLibraryDataTarget - generate rules to create shlib data file;
    173  */
    174 #ifndef SharedLibraryDataTarget
    175 #define SharedLibraryDataTarget(libname,rev,salist)
    176 #endif /* SharedLibraryTarget */
    177