XCOMM $XConsortium: sv4Lib.rules,v 1.8 91/07/19 15:38:53 rws Exp $

/*
 * SVR4 shared library rules
 */

#ifndef HasSharedLibraries
#define HasSharedLibraries YES
#endif
#ifndef SharedDataSeparation
#define SharedDataSeparation NO
#endif
#ifndef SharedCodeDef
#define SharedCodeDef /**/
#endif
#ifndef SharedLibraryDef
#define SharedLibraryDef /**/
#endif
#ifndef ShLibIncludeFile
#define ShLibIncludeFile <sv4Lib.tmpl>
#endif
#ifndef SharedLibraryLoadFlags
#define SharedLibraryLoadFlags -G -z text -M mapfile
#endif
#ifndef PositionIndependentCFlags
#ifdef HasGcc2
#define PositionIndependentCFlags -fpic
#else
#define PositionIndependentCFlags -K PIC
#endif
#endif

/*
 * InstallSharedLibrary - generate rules to install the shared library.
 */
#ifndef InstallSharedLibrary
#define	InstallSharedLibrary(libname,rev,dest)				@@\
install:: Concat($(DESTDIR)dest/lib,libname.so.rev)			@@\
Concat($(DESTDIR)dest/lib,libname.so.rev): Concat(lib,libname.so.rev)	@@\
	MakeDir($(DESTDIR)dest)						@@\
	$(INSTALL) -c $(INSTLIBFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\
	$(RM) Concat($(DESTDIR)dest/lib,libname.so)			@@\
	$(LN) Concat(lib,libname.so.rev) Concat($(DESTDIR)dest/lib,libname.so)

#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 we do not hose people by having
 * the library gone for long periods.
 * The mapfile has to be consistent with down.
 */
#ifndef SharedLibraryTarget
#define SharedLibraryTarget(libname,rev,solist,down,up)			@@\
AllTarget(Concat(lib,libname.so.rev))					@@\
									@@\
Concat(lib,libname.so.rev):  solist $(MAPFILE)				@@\
	$(RM) $@~							@@\
	(cd down; $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS))	@@\
	$(RM) $@ 							@@\
	$(MV) $@~ $@							@@\
	$(RM) Concat(lib,libname.so)					@@\
	$(LN) $@ Concat(lib,libname.so)					@@\
									@@\
$(MAPFILE)::								@@\
	-@sccs get $(MAPFILE) 2> /dev/null				@@\
	-@if [ ! -f $(MAPFILE) ] ; then touch $(MAPFILE); fi;		@@\
	-@$(MV) $(MAPFILE) down 2> /dev/null				@@\
									@@\
clean::									@@\
	$(RM) $(MAPFILE) Concat(lib,libname.so.rev) Concat(lib,libname.so)

#endif /* SharedLibraryTarget */

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


/*
 * SharedObjectTarget - generate rules to create a shared object;
 * build it into a different name so that we do not hose people by having
 * the object gone for long periods.
 * The mapfile has to be consistent with down.
 */
#ifndef SharedObjectTarget
#define SharedObjectTarget(objname,rev,solist,down,up)			@@\
AllTarget(objname.so.rev)						@@\
									@@\
objname.so.rev:  solist	$(MAPFILE)					@@\
	$(RM) $@~							@@\
	(cd down; $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS))	@@\
	$(RM) $@ 							@@\
	$(MV) $@~ $@							@@\
									@@\
$(MAPFILE)::								@@\
        -@sccs get MapfileName 2> /dev/null				@@\
        -@if [ ! -f MapfileName ] ; then touch MapfileName; fi;		@@\
	-@$(MV) MapfileName down 2> /dev/null				@@\
									@@\
clean::									@@\
	$(RM) $(MAPFILE) objname.so.rev 

#endif /* SharedObjectTarget */


/*
 * InstallSharedObject - generate rules to install the shared object.
 */
#ifndef InstallSharedObject
#define	InstallSharedObject(objname,rev,dest)				@@\
install:: Concat($(DESTDIR)dest/,objname.so.rev)			@@\
Concat($(DESTDIR)dest/,objname.so.rev): objname.so.rev			@@\
	MakeDir($(DESTDIR)dest)						@@\
	$(INSTALL) -c $(INSTLIBFLAGS) objname.so.rev $(DESTDIR)dest

#endif /* InstallSharedObject */

/*
 * ProfiledLibObjCompile - compile fragment for profiled objects
 * This definition overrides the one in Imake.rules.  Needed to use the
 * -xpg flag instead of -pg.
 */
#ifndef ProfiledLibObjCompile
#define ProfiledLibObjCompile(options) LibObjCompile(profiled,-xpg options)
#endif

/*
 * InstallDpsProfiledLibrary - generate rules to install the indicated
 * profiled library.
 */
#ifndef InstallDpsProfiledLibrary
#define InstallDpsProfiledLibrary(libname,dest)                         @@\
install:: Concat($(DESTDIR)dest/lib,libname.a)                          @@\
Concat($(DESTDIR)dest/lib,libname.a): Concat3(lib,libname,_p.a)         @@\
        MakeDir($(DESTDIR)dest)                                         @@\
	$(CP) Concat3(lib,libname,_p.a) profiled/Concat(lib,libname.a)  @@\
        $(INSTALL) -c $(INSTLIBFLAGS) Concat(profiled/lib,libname.a) $(DESTDIR)dest @@\
	$(RM) profiled/Concat(lib,libname.a)                            @@\
        RanLibrary($(RANLIBINSTFLAGS) Concat($(DESTDIR)dest/lib,libname.a))
#endif /* InstallLibrary */

