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



XCOMM $XFree86: xc/config/cf/os2Lib.rules,v 3.12 2001/01/17 16:22:32 dawes Exp $

/*
 * OS2/EMX shared library rules (DLL version)
 */
#ifndef __EMX__
#error You must edit os2Lib.rules for your (non-EMX) OS/2 dev system
#endif

#ifndef HasSharedLibraries
#define HasSharedLibraries YES
#endif
#ifndef ForceNormalLib
#define ForceNormalLib NO
#endif

#define SharedOldX NO

#ifndef SharedDataSeparation
#define SharedDataSeparation NO
#endif
#ifndef SharedCodeDef
#define SharedCodeDef /**/
#endif
#ifndef SharedLibraryDef
#define SharedLibraryDef /**/
#endif
#ifndef ShLibIncludeFile
#define ShLibIncludeFile <os2Lib.tmpl>
#endif
#ifndef SharedLibraryLoadFlags
#define SharedLibraryLoadFlags /**/
#endif
#ifndef PositionIndependentCFlags
#define PositionIndependentCFlags -Zdll -Zomf -Zmtd
#endif

#ifndef NormalSharedLibObjCompile
#define NormalSharedLibObjCompile(options) RemoveFile($@)                       @@\
	$(CC) -c $(CFLAGS) options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS) $*.c @@\
	touch $*.o
#endif

#ifndef InstallSharedLibrary
#ifdef BuildImplibs
#define InstallSharedLibrary(libname,rev,dest)				@@\
install:: libname.dll libname.a	libname.lib				@@\
	MakeDir($(DESTDIR)dest)						@@\
	$(INSTALL) -c $(INSTLIBFLAGS) libname.dll $(DESTDIR)dest 	@@\
	$(INSTALL) -c $(INSTLIBFLAGS) libname.a $(DESTDIR)dest 		@@\
	$(INSTALL) -c $(INSTLIBFLAGS) libname.lib $(DESTDIR)dest
#else
#define InstallSharedLibrary(libname,rev,dest)				@@\
install:: libname.dll libname.a						@@\
	MakeDir($(DESTDIR)dest)						@@\
	$(INSTALL) -c $(INSTLIBFLAGS) libname.a $(DESTDIR)dest		@@\
	$(INSTALL) -c $(INSTLIBFLAGS) libname.dll $(DESTDIR)dest
#endif
#endif /* InstallSharedLibrary */

/*#ifdef UseInstalled
#define LinkBuildLibrary(lib) $(_NULLCMD_)
#else*/
#define LinkBuildLibrary(lib) MakeDir($(BUILDLIBDIR))			@@\
	RemoveFile($(BUILDLIBDIR)/lib)					@@\
	ImakeIndir $(BUILDLIBDIR) $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/lib .
/*#endif*/

        EMXIMP = emximp
        EMXOMF = emxomf
          SHLD = gcc -Zomf -Zdll -Zmtd
     SHADDLIBS = -lbsd -lsocket -lc_import
#ifndef BuildDllSupportLibs
/*#ifdef UseInstalled
#define BuildDllSupportLibs(slib) $(_NULLCMD_)
#else*/
#define BuildDllSupportLibs(slib)					@@\
	$(EMXIMP) -o slib.imp slib.def					@@\
	$(EMXIMP) -o slib.a slib.imp					@@\
	$(EMXOMF) -s -l slib.a 						@@\
	LinkBuildLibrary(slib.a)					@@\
	LinkBuildLibrary(slib.lib)
/*#endif*/
#endif

#ifndef BuildDllSupportLibs2
/*#ifdef UseInstalled
#define BuildDllSupportLibs2(slib) $(_NULLCMD_)
#else*/
#define BuildDllSupportLibs2(slib)					@@\
	$(EMXIMP) -o slib.imp Concat3(slib,os2,.def)			@@\
	$(EMXIMP) -o slib.a slib.imp					@@\
	$(EMXOMF) -s -l slib.a 						@@\
	LinkBuildLibrary(slib.a)					@@\
	LinkBuildLibrary(slib.lib)
/*#endif*/
#endif

#ifndef BuildLibSupportLibs
/*#ifdef UseInstalled
#define BuildLibSupportLibs(slib) $(_NULLCMD_)
#else*/
#define BuildLibSupportLibs(slib)					@@\
	$(EMXOMF) -s -l slib.a 						@@\
	LinkBuildLibrary(slib.a)					@@\
	LinkBuildLibrary(slib.lib)
/*#endif*/
#endif

#ifndef SharedLibraryTarget
#define SharedLibraryTarget(libname,rev,solist,down,up)			@@\
AllTarget(Concat3(libname,rev,.dll))					@@\
.SUFFIXES: .obj .rsp .def						@@\
        LBRPATH = $(subst /,\,$(LIBRARY_PATH))				@@\
        LBRDEF = Concat4(libname,rev,os2,.def)				@@\
	LBRCPPDEF = Concat4(libname,rev,os2,-def.cpp)			@@\
	LBRRSP = Concat4(libname,rev,os2,.rsp)				@@\
									@@\
link.rsp: $(LBRRSP) $(LBRDEF)						@@\
	@echo $(LBRPATH)\\dll0.obj+ >link.rsp				@@\
	@cat $(LBRRSP) >>link.rsp					@@\
	@echo $(LBRPATH)\\mt\\ $(LBRPATH)\\ $(REQUIREDLIBS) bsd socket c_alias c_static c_import os2 emx2 end >>link.rsp	@@\
	@echo $(LBRDEF) >>link.rsp					@@\
									@@\
Concat3(libname,rev,.dll):  $(OBJS) link.rsp				@@\
	link386 @link.rsp >nul						@@\
	BuildDllSupportLibs2(Concat(libname,rev))			@@\
	LinkBuildLibrary(Concat3(libname,rev,.dll))			@@\
									@@\
clean::									@@\
	RemoveFiles(Concat3(libname,rev,.lib) Concat3(libname,rev,.imp) *.obj link.rsp)
#endif /* SharedLibraryTarget */

#ifndef NormalLibraryTarget
#define	NormalLibraryTarget(libname,objlist)				@@\
AllTarget(LibraryTargetName(libname))					@@\
									@@\
LibraryTargetName(libname): objlist					@@\
	RemoveFile($@)							@@\
	MakeLibrary($@,objlist)						@@\
	RanLibrary($@)							@@\
	BuildLibSupportLibs($*)
#endif /* NormalLibraryTarget */

#ifndef NormalDepLibraryTarget
#define	NormalDepLibraryTarget(libname,deplist,objlist)			@@\
AllTarget(Concat(libname,_baselibtarget) LibraryTargetName(libname))	@@\
									@@\
Concat(libname,_baselibtarget):: deplist				@@\
	rm -rf baseobjs/?*						@@\
	ImakeHelper 11 baseobjs						@@\
	$(CP) objlist baseobjs						@@\
									@@\
LibraryTargetName(libname): 						@@\
	RemoveFile($@)							@@\
	MakeLibrary($@,baseobjs/?*.o)					@@\
	RanLibrary($@)							@@\
	BuildLibSupportLibs($*)
#endif /* NormalDepLibraryTarget */

/*
 * SharedDepLibraryTarget - generate rules to create a shared library.
 */
#ifndef SharedDepLibraryTarget
#ifdef UseInstalled
#ifndef LinkBuildSonameLibrary
#define LinkBuildSonameLibrary(lib)
#endif
#else
#ifndef LinkBuildSonameLibrary
#define LinkBuildSonameLibrary(lib) (RemoveFile($(BUILDLIBDIR)/lib); \
	cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/lib .)
#endif
#endif

#define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up)	@@\
SharedLibraryTarget(libname,rev,solist,down,up)
#endif /* SharedDepLibraryTarget */

#ifndef SharedDepModuleTarget
#define SharedDepModuleTarget(name,deps,solist)				@@\
AllTarget(name)								@@\
									@@\
name: deps								@@\
	$(CC) -o $@ $(SHLIBLDFLAGS) solist $(REQUIREDLIBS) BaseShLibReqs @@\
									@@\
clean::									@@\
	RemoveFile(name)
#endif /* SharedDepModuleTarget */

#ifndef SharedLibraryDataTarget
#define SharedLibraryDataTarget(libname,rev,salist)
#endif /* SharedLibraryDataTarget */

#ifndef InstallSharedLibraryData
#define InstallSharedLibraryData(libname,rev,dest)
#endif /* InstallSharedLibraryData */

#ifndef InstallLibrary
#define	InstallLibrary(libname,dest)					@@\
install:: LibraryTargetName(libname)					@@\
	MakeDir($(DESTDIR)dest)						@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) LibraryTargetName(libname) $(DESTDIR)dest @@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) Concat(libname,.lib) $(DESTDIR)dest @@\
	RanLibrary($(RANLIBINSTFLAGS) $(DESTDIR)dest/LibraryTargetName(libname))
#endif /* InstallLibrary */

#ifndef LibMkdir
#define LibMkdir(dir) ImakeHelper 11 dir
#endif

#ifndef LibCleanDir
#define LibCleanDir(dir) 						@@\
	ImakeIndir dir call RemoveFiles(*.Osuf)
#endif

#define MakeStaticLibrary(libname) $(AR) libname *.o

#ifndef UnsharedLibraryTarget
#define	UnsharedLibraryTarget(libname,objlist,down,up)			@@\
AllTarget(LibraryTargetName(Concat(libname,_s)))			@@\
									@@\
LibraryTargetName(Concat(libname,_s)): objlist				@@\
	RemoveFile($@)							@@\
	ImakeIndir down MakeStaticLibrary(up/$@)			@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)						@@\
									@@\
install::	LibraryTargetName(Concat(libname,_s))			@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) LibraryTargetName(Concat(libname,_s)) $(DESTDIR)$(SHLIBDIR)
#endif

#ifndef UnsharedLibraryTarget3
#define	UnsharedLibraryTarget3(libname,objlist1,objlist2,objlist3,down,up) @@\
AllTarget(LibraryTargetName(Concat(libname,_s)))			@@\
									@@\
LibraryTargetName(Concat(libname,_s)): objlist1 objlist2 objlist3	@@\
	RemoveFile($@)							@@\
	ImakeIndir down MakeStaticLibrary(up/$@)			@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)						@@\
									@@\
install::	LibraryTargetName(Concat(libname,_s))			@@\
	$(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) LibraryTargetName(Concat(libname,_s)) $(DESTDIR)$(SHLIBDIR)
#endif /* UnsharedLibraryTarget3 */

/*
 * DebuggedLibraryTarget - generate rules to create a debuggable library.
 */
#ifndef DebuggedLibraryTarget
#define	DebuggedLibraryTarget(libname,objlist)				@@\
AllTarget(LibraryTargetNameSuffix(libname,_d))				@@\
									@@\
LibraryTargetNameSuffix(libname,_d): objlist $(EXTRALIBRARYDEPS)	@@\
	RemoveFile($@)							@@\
	ImakeIndir debugger MakeStaticLibrary(../$@)			@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)

#endif /* DebuggedLibraryTarget */

/*
 * DebuggedDepLibraryTarget - generate rules to create a debuggable library.
 */
#ifndef DebuggedDepLibraryTarget

#define	DebuggedDepLibraryTarget2(libname,deplist,objlist)		@@\
AllTarget(Concat(libname,_dbglibtarget) LibraryTargetNameSuffix(libname,_d))		@@\
									@@\
Concat(libname,_dbglibtarget):: deplist							@@\
	rm -rf debugged/?*						@@\
	ImakeHelper 11 debugged						@@\
	$(CP) objlist debugged						@@\
									@@\
LibraryTargetNameSuffix(libname,_d): $(EXTRALIBRARYDEPS)		@@\
	RemoveFile($@)							@@\
	ImakeIndir debugger MakeStaticLibrary(../$@)			@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)

#endif /* DebuggedDepLibraryTarget */

/*
 * ProfiledLibraryTarget - generate rules to create a profiled library.
 */
#ifndef ProfiledLibraryTarget
#define	ProfiledLibraryTarget(libname,objlist)				@@\
AllTarget(LibraryTargetNameSuffix(libname,_p))				@@\
									@@\
LibraryTargetNameSuffix(libname,_p): objlist $(EXTRALIBRARYDEPS)	@@\
	RemoveFile($@)							@@\
	ImakeIndir profiled MakeStaticLibrary(../$@)			@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)

#endif /* ProfiledLibraryTarget */

/*
 * ProfiledDepLibraryTarget - generate rules to create a profiled library.
 */
#ifndef ProfiledDepLibraryTarget
#define	ProfiledDepLibraryTarget(libname,deplist,objlist)		@@\
AllTarget(Concat(libname,_prflibtarget) LibraryTargetNameSuffix(libname,_p))		@@\
									@@\
Concat(libname,_prflibtarget):: deplist							@@\
	rm -rf profiled/?*						@@\
	ImakeHelper 11 profiled						@@\
	$(CP) objlist profiled						@@\
									@@\
LibraryTargetNameSuffix(libname,_p): $(EXTRALIBRARYDEPS)		@@\
	RemoveFile($@)							@@\
	ImakeIndir profiled MakeStaticLibrary(../$@)			@@\
	RanLibrary($@)							@@\
	_LinkBuildLibrary($@)

#endif /* ProfiledDepLibraryTarget */

/*
 * DepLibraryModuleTarget
 */
#ifndef DepLibraryModuleTarget
#define DepLibraryModuleTarget(module,deplist,objects)			@@\
NormalDepLibraryTarget(module, deplist, objects)
#endif
