ibmLib.rules   [plain text]


XCOMM $Xorg: ibmLib.rules,v 1.3 2000/08/17 19:41:47 cpqbld Exp $

/*
 * AIX shared library rules
 */

XCOMM $XFree86: xc/config/cf/ibmLib.rules,v 3.6 2001/01/17 16:22:31 dawes Exp $

#ifndef HasSharedLibraries
# define HasSharedLibraries YES
#endif
#ifndef ForceNormalLib
# define ForceNormalLib NO
#endif
#ifndef SharedDataSeparation
# define SharedDataSeparation NO
#endif
#ifndef SharedCodeDef
# define SharedCodeDef -DSHAREDCODE
#endif
#ifndef SharedLibraryDef
# define SharedLibraryDef -DAIXSHLIB
#endif
#ifndef ShLibIncludeFile
# define ShLibIncludeFile <ibmLib.tmpl>
#endif
#ifndef PositionIndependentCFlags
# define PositionIndependentCFlags -bM\:SRE
#endif
#ifndef ExtraLoadFlags
# define ExtraLoadFlags -bnodelcsect
#endif
#if !defined(LdPostLib) && !defined(UseInstalled) && OSMajorVersion > 3
# if ThreadedX
#  define LdPostLib -blibpath:$(USRLIBDIRPATH):/usr/lib/threads:/usr/lib:/lib
# else
#  define LdPostLib -blibpath:$(USRLIBDIRPATH):/usr/lib:/lib
# endif
# define SharedLibPostRef $(LDPOSTLIBS)
#endif
#ifndef SharedLibPostRef
# define SharedLibPostRef $(LDPOSTLIBS)
#endif
#if ThreadedX
# define BaseShLibReqs -lc_r -lm
#else
# define BaseShLibReqs -lc -lm
#endif
#ifndef UseExportLists
# define UseExportLists YES
#endif

/*
 * MakeExportList - generate an export list file for linking libraries.
 */
#ifndef MakeExportList
# if UseExportLists
#  define MakeExportList(libname,result) \
	@-RemoveFile(result)						@@\
	case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\	@@\
		echo "#! $@ ($${shr4obj:-shr.o})" > result		@@\
	if [ -f Concat(lib,libname.elist) ]; then \			@@\
	    $(CPP) $(ALLINCLUDES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(DEFINES) Concat(lib,libname.elist) | CppSedMagic > $@.list; \	@@\
	    $(EXPORTLISTGEN) $@~ $@.list >> result; \			@@\
	    RemoveFile($@.list); \					@@\
	else \								@@\
	    dump -g $@~ | sed -n -e 's/^[ 	]*[0-9][0-9]*[	 ]*\([^	 .][^	 ]*\)$$/\1/p' >> result; \	@@\
	fi;
# else
#  define MakeExportList(libname,result) \
	@-RemoveFile(result)						@@\
	case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\	@@\
		echo "#! $@ ($${shr4obj:-shr.o})" > result		@@\
	dump -g $@~ | sed -n -e 's/^[ 	]*[0-9][0-9]*[	 ]*\([^	 .][^	 ]*\)$$/\1/p' >> result;
# endif
#endif /* MakeExportList */


#if !defined(UseInstalled) && !defined(UseInstalledX11) \
    && !defined(UseImports) && !defined(ImportX11)
   /* we want this to be defined only when building X */

# if OSMajorVersion < 4
/*
 * SharedLibReferences - variables for shared libraries
 */

#  ifndef SharedLibReferences
#   define SharedLibReferences(varname,libname,libsource,revname,rev)	@@\
Concat3(DEP,varname,LIB) = /**/						@@\
Concat(varname,LIB) = _Use(Concat(-l,libname),Concat(libsource/lib,libname.a)) @@\
LintLibReferences(varname,libname,libsource)
#  endif

# endif

# if OSMajorVersion < 4
/*
 * SharedFontLibReferences - shared font libraries
 */

#  ifndef SharedLibReferences
#   define SharedLibReferences()					@@\
DEPFONTLIB = /**/							@@\
FONTLIB = -L$(FREETYPELIBDIR) _Use(-lXfont,$(FONTLIBSRC)/libXfont.a)	@@\
LintLibReferences(XFONT,Xfont,$(FONTLIBSRC))
#  endif

# else

#  ifndef SharedFontLibReferences
#   define SharedFontLibReferences()					@@\
DEPFONTLIB = /**/							@@\
FONTLIB = -L$(FREETYPELIBDIR) _Use(-lXfont,$(BUILDLIBDIR)/font.imp) $(BUILDLIBDI
)/libXfont.a)) @@\
LintLibReferences(XFONT,Xfont,$(FONTLIBSRC))
#  endif

# else

#  ifndef SharedLibReferences
#   define SharedLibReferences(varname,libname,libsource,revname,rev)	@@\
Concat3(DEP,varname,LIB) = /**/						@@\
Concat(varname,LIB) = _Use(Concat(-l,libname),Concat($(BUILDLIBDIR),/libname.imp) Concat3($(BUILDLIBDIR),/lib,libname.a)) @@\
LintLibReferences(varname,libname,libsource)
#  endif

# endif

/*
 * SharedDSLibReferences - variables for shared libraries
 */
# ifndef SharedDSLibReferences
#  define SharedDSLibReferences(varname,libname,libsource,revname,rev)	@@\
SharedLibReferences(varname,libname,libsource,revname,rev)
# endif

# if OSMajorVersion == 4
/*
 * UnsharedLibReferences - variables for unshared libraries
 */
#  ifndef UnsharedLibReferences
#   define UnsharedLibReferences(varname,libname,libsource)		@@\
Concat3(DEP,varname,LIB) = _UseCat($(USRLIBDIR)/lib,$(BUILDLIBDIR)/lib,libname.a)	@@\
Concat(varname,LIB) = _Use(Concat(-l,libname),Concat($(BUILDLIBDIR)/lib,libname.a))	@@\
LintLibReferences(varname,libname,libsource)
#  endif
# endif

#endif /* !defined(UseInstalled) && !defined(UseInstalledX11) ... */


/*
 * InstallSharedLibrary - generate rules to install the shared library.
 */
#ifndef InstallSharedLibrary
# define InstallSharedLibrary(libname,rev,dest)				@@\
InstallLibrary(libname,dest)
#endif /* InstallSharedLibrary */

/*
 * InstallSharedLibraryData - generate rules to install the shared library data
 */
#ifndef InstallSharedLibraryData
# define InstallSharedLibraryData(libname,rev,dest)
#endif /* InstallSharedLibraryData */

/*
 * SharedLibraryTarget - generate rules to create a shared library;
 * build it into a different name so that the we do not hose people by having
 * the library gone for long periods.
 *
 * IBM uses an unusual shared object file name (shr4.o) in some libraries. 
 * Duplicate this behavior to preserve compatibility with IBM's libraries.
 */
#if OSMajorVersion < 4

# ifndef SharedLibraryTarget
#  define SharedLibraryTarget(libname,rev,solist,down,up)		@@\
AllTarget(Concat(lib,libname.a))					@@\
									@@\
Concat(lib,libname.a):  solist $(UNSHAREDOBJS) $(EXTRALIBRARYDEPS)	@@\
	$(RM) $@~ shr.o shr4.o						@@\
	(cd down; $(AR) up/$@~ solist)					@@\
	dump -g $@~ | sed -n -e 's/^[ 	]*[0-9][0-9]*[	 ]*\([^	 .][^	 ]*\)$$/\1/p' > $@.syms	@@\
	$(LD) -o shr.o $@~ -H512 -T512 -bM\:SRE -bE\:$@.syms $(REQUIREDLIBS) BaseShLibReqs SharedLibPostRef	@@\
	$(LN) shr.o shr4.o						@@\
	$(RM) $@~							@@\
	case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\	@@\
		$(AR) $@~ $${shr4obj} shr.o $(UNSHAREDOBJS)		@@\
	$(RM) $@.syms $@ shr.o shr4.o					@@\
	$(MV) $@~ $@							@@\
	LinkBuildLibrary($@)						@@\
									@@\
clean::									@@\
	$(RM) Concat(lib,libname.a)
# endif /* SharedLibraryTarget */

#else /* OSMajorVersion >= 4 */

# ifndef SharedLibraryTarget
#  define SharedLibraryTarget(libname,rev,solist,down,up)		@@\
AllTarget(Concat(lib,libname.a))					@@\
									@@\
Concat(lib,libname.a):  solist $(UNSHAREDOBJS) $(EXTRALIBRARYDEPS)	@@\
	RemoveFiles($@~ shr.o shr4.o)					@@\
	(cd down; $(AR) up/$@~ solist)					@@\
	MakeExportList(libname,libname.imp)				@@\
	$(LD) -o shr.o $@~ -H512 -T512 -bM\:SRE -bE\:libname.imp -bnoentry $(REQUIREDLIBS) BaseShLibReqs $(LDPOSTLIBS)	@@\
	$(LN) shr.o shr4.o						@@\
	RemoveFile($@~)							@@\
	case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\	@@\
		$(AR) $@~ $${shr4obj} shr.o $(UNSHAREDOBJS)		@@\
	RemoveFile($@)							@@\
	$(MV) $@~ $@							@@\
	LinkBuildLibrary($@)						@@\
	LinkBuildLibrary(libname.imp)					@@\
									@@\
clean::									@@\
	$(RM) Concat(lib,libname.a)
# endif /* SharedLibraryTarget */

#endif

/*
 * SharedDepLibraryTarget - generate rules to create a shared library.
 */
#if OSMajorVersion < 4

# ifndef SharedDepLibraryTarget
#  define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up)	@@\
AllTarget(Concat(lib,libname.a))					@@\
									@@\
Concat(lib,libname.a):  deplist $(UNSHAREDOBJS) $(EXTRALIBRARYDEPS)	@@\
	$(RM) $@~ shr.o shr4.o						@@\
	(cd down; $(AR) up/$@~ solist)					@@\
	dump -g $@~ | sed -n -e 's/^[ 	]*[0-9][0-9]*[	 ]*\([^	 .][^	 ]*\)$$/\1/p' > $@.syms	@@\
	$(LD) -o shr.o $@~ -H512 -T512 -bM\:SRE -bE\:$@.syms $(REQUIREDLIBS) BaseShLibReqs SharedLibPostRef	@@\
	$(LN) shr.o shr4.o						@@\
	$(RM) $@~							@@\
	case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\	@@\
		$(AR) $@~ $${shr4obj} shr.o $(UNSHAREDOBJS)		@@\
	$(RM) $@.syms $@ shr.o shr4.o					@@\
	$(MV) $@~ $@							@@\
	LinkBuildLibrary($@)						@@\
									@@\
clean::									@@\
	$(RM) Concat(lib,libname.a)
# endif /* SharedDepLibraryTarget */

#else /* OSMajorVersion >= 4 */

# ifndef SharedDepLibraryTarget
#  define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up)	@@\
AllTarget(Concat(lib,libname.a))					@@\
									@@\
Concat(lib,libname.a):  deplist $(UNSHAREDOBJS) $(EXTRALIBRARYDEPS)	@@\
	RemoveFiles($@~ shr.o shr4.o)					@@\
	(cd down; $(AR) up/$@~ solist)					@@\
	MakeExportList(libname,libname.imp)				@@\
	$(LD) -o shr.o $@~ -H512 -T512 -bM\:SRE -bE\:libname.imp -bnoentry $(REQUIREDLIBS) BaseShLibReqs $(LDPOSTLIBS)	@@\
	$(LN) shr.o shr4.o						@@\
	RemoveFile($@~)							@@\
	case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\	@@\
		$(AR) $@~ $${shr4obj} shr.o $(UNSHAREDOBJS)		@@\
	RemoveFile($@)							@@\
	$(MV) $@~ $@							@@\
	LinkBuildLibrary($@)						@@\
	LinkBuildLibrary(libname.imp)					@@\
									@@\
clean::									@@\
	$(RM) Concat(lib,libname.a)
# endif /* SharedDepLibraryTarget */

#endif

/*
 * SharedLibraryDataTarget - generate rules to create shlib data file;
 */
#ifndef SharedLibraryDataTarget
# define SharedLibraryDataTarget(libname,rev,salist)
#endif /* SharedLibraryTarget */