1XCOMM $XFree86: xc/config/cf/darwinLib.rules,v 1.8 2003/10/09 22:43:18 herrb Exp $ 2/* 3 * Darwin/Mac OS X shared library rules 4 */ 5 6#ifndef UseElfFormat 7#define UseElfFormat NO 8#endif 9#ifndef HasSharedLibraries 10#define HasSharedLibraries YES 11#endif 12#ifndef ForceNormalLib 13#define ForceNormalLib YES 14#endif 15 16#ifndef SharedDataSeparation 17#define SharedDataSeparation NO 18#endif 19#ifndef SharedCodeDef 20#define SharedCodeDef /**/ 21#endif 22#ifndef SharedLibraryDef 23#define SharedLibraryDef /**/ 24#endif 25#ifndef ShLibIncludeFile 26#define ShLibIncludeFile <darwinLib.tmpl> 27#endif 28#ifndef SharedLibraryLoadFlags 29#define SharedLibraryLoadFlags -dynamiclib 30#endif 31#ifndef PositionIndependentCFlags 32#define PositionIndependentCFlags -dynamic 33#endif 34#ifndef ExtraLoadFlags 35#define ExtraLoadFlags /**/ 36#endif 37 38/* 39 * InstallSharedLibrary - generate rules to install the shared library. 40 */ 41#ifndef InstallSharedLibrary 42#define InstallSharedLibrary(libname,rev,dest) @@\ 43install:: Concat(lib,libname.rev.dylib) @@\ 44 MakeDir($(DESTDIR)dest) @@\ 45 $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) Concat(lib,libname.rev.dylib) $(DESTDIR)dest @@\ 46 @MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \ @@\ 47 set -x; $(RM) Concat($(DESTDIR)dest/lib,libname.$$MAJREV.dylib) && \ @@\ 48 $(LN) Concat(lib,libname.rev.dylib) Concat($(DESTDIR)dest/lib,libname.$$MAJREV.dylib) @@\ 49 @if $(SOSYMLINK); then (set -x; \ @@\ 50 $(RM) Concat($(DESTDIR)dest/lib,libname.dylib); \ @@\ 51 $(LN) Concat(lib,libname.rev.dylib) Concat($(DESTDIR)dest/lib,libname.dylib)); fi 52#endif /* InstallSharedLibrary */ 53 54/* 55 * SharedLibraryTarget - generate rules to create a shared library; 56 * build it into a different name so that we do not hose people by having 57 * the library gone for long periods. 58 */ 59#ifndef SharedLibraryTarget 60# define SharedLibraryTarget(libname,rev,solist,down,up) @@\ 61AllTarget(Concat(lib,libname.rev.dylib)) @@\ 62 @@\ 63Concat(lib,libname.rev.dylib): solist $(EXTRALIBRARYDEPS) @@\ 64 $(RM) $@~ @@\ 65 @MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \ @@\ 66 INSTALLNAME=Concat(lib,libname.$$MAJREV.dylib); \ @@\ 67 set -x; (cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) -install_name $(USRLIBDIR)/$$INSTALLNAME -current_version rev -compatibility_version rev solist $(REQUIREDLIBS)); \ @@\ 68 $(RM) $$INSTALLNAME; $(LN) $@ $$INSTALLNAME; \ @@\ 69 LinkBuildSonameLibrary($$INSTALLNAME) @@\ 70 $(RM) $@ @@\ 71 $(MV) $@~ $@ @@\ 72 @if $(SOSYMLINK); then (set -x; \ @@\ 73 $(RM) Concat(lib,libname.dylib); \ @@\ 74 $(LN) $@ Concat(lib,libname.dylib)); fi @@\ 75 LinkBuildLibrary($@) @@\ 76 LinkBuildLibraryMaybe(Concat(lib,libname.dylib),$(SOSYMLINK)) @@\ 77 @@\ 78clean:: @@\ 79 @MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \ @@\ 80 set -x; $(RM) Concat(lib,libname.$$MAJREV.dylib) @@\ 81 $(RM) Concat(lib,libname.rev.dylib) Concat(lib,libname.dylib) 82 83#endif /* SharedLibraryTarget */ 84 85/* 86 * SharedDepLibraryTarget - generate rules to create a shared library. 87 */ 88#ifndef SharedDepLibraryTarget 89# define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up) @@\ 90AllTarget(Concat(lib,libname.rev.dylib)) @@\ 91 @@\ 92Concat(lib,libname.rev.dylib): deplist $(EXTRALIBRARYDEPS) @@\ 93 $(RM) $@~ @@\ 94 @MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \ @@\ 95 INSTALLNAME=Concat(lib,libname.$$MAJREV.dylib); \ @@\ 96 set -x; (cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) -install_name $(USRLIBDIR)/$$INSTALLNAME -current_version rev -compatibility_version rev solist $(REQUIREDLIBS)); \ @@\ 97 $(RM) $$INSTALLNAME; $(LN) $@ $$INSTALLNAME; \ @@\ 98 LinkBuildSonameLibrary($$INSTALLNAME) @@\ 99 $(RM) $@ @@\ 100 $(MV) $@~ $@ @@\ 101 @if $(SOSYMLINK); then (set -x; \ @@\ 102 $(RM) Concat(lib,libname.dylib); \ @@\ 103 $(LN) $@ Concat(lib,libname.dylib)); fi @@\ 104 LinkBuildLibrary($@) @@\ 105 LinkBuildLibraryMaybe(Concat(lib,libname.dylib),$(SOSYMLINK)) @@\ 106 @@\ 107clean:: @@\ 108 @MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \ @@\ 109 set -x; $(RM) Concat(lib,libname.$$MAJREV.dylib) @@\ 110 $(RM) Concat(lib,libname.rev.dylib) Concat(lib,libname.dylib) 111 112#endif /* SharedDepLibraryTarget */ 113 114/* 115 * SharedDepCplusplusLibraryTarget - generate rules to create a shared library. 116 */ 117#ifndef SharedDepCplusplusLibraryTarget 118# define SharedDepCplusplusLibraryTarget(libname,rev,deplist,solist,down,up) @@\ 119AllTarget(Concat(lib,libname.rev.dylib)) @@\ 120 @@\ 121Concat(lib,libname.rev.dylib): deplist $(EXTRALIBRARYDEPS) @@\ 122 $(RM) $@~ @@\ 123 @MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \ @@\ 124 INSTALLNAME=Concat(lib,libname.$$MAJREV.dylib); \ @@\ 125 set -x; (cd down; $(CXX) -o up/$@~ $(SHLIBLDFLAGS) -install_name $(USRLIBDIR)/$$INSTALLNAME -current_version rev -compatibility_version rev solist $(REQUIREDLIBS)); \ @@\ 126 $(RM) $$INSTALLNAME; $(LN) $@ $$INSTALLNAME; \ @@\ 127 LinkBuildSonameLibrary($$INSTALLNAME) @@\ 128 $(RM) $@ @@\ 129 $(MV) $@~ $@ @@\ 130 @if $(SOSYMLINK); then (set -x; \ @@\ 131 $(RM) Concat(lib,libname.dylib); \ @@\ 132 $(LN) $@ Concat(lib,libname.dylib)); fi @@\ 133 LinkBuildLibrary($@) @@\ 134 LinkBuildLibraryMaybe(Concat(lib,libname.dylib),$(SOSYMLINK)) @@\ 135 @@\ 136clean:: @@\ 137 @MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \ @@\ 138 set -x; $(RM) Concat(lib,libname.$$MAJREV.dylib) @@\ 139 $(RM) Concat(lib,libname.rev.dylib) Concat(lib,libname.dylib) 140 141#endif /* SharedDepCplusplusLibraryTarget */ 142 143#ifndef SharedDepModuleTarget 144#define SharedDepModuleTarget(name,deps,solist) @@\ 145AllTarget(name) @@\ 146 @@\ 147name: deps @@\ 148 $(RM) $@~ @@\ 149 $(CC) -o $@~ $(SHLIBLDFLAGS) solist $(REQUIREDLIBS) @@\ 150 $(RM) $@ @@\ 151 $(MV) $@~ $@ @@\ 152 @@\ 153clean:: @@\ 154 $(RM) name 155 156#endif /* SharedDepModuleTarget */ 157 158/* 159 * SharedLibraryDataTarget - generate rules to create shlib data file; 160 */ 161#ifndef SharedLibraryDataTarget 162#define SharedLibraryDataTarget(libname,rev,salist) 163#endif /* SharedLibraryDataTarget */ 164 165#ifndef InstallSharedLibraryData 166#define InstallSharedLibraryData(libname,rev,dest) 167#endif /* InstallSharedLibraryData */ 168