#
#   COMPONENT_NAME: somx
#
#   ORIGINS: 27
#
#
#    25H7912  (C)  COPYRIGHT International Business Machines Corp. 1996
#   All Rights Reserved
#   Licensed Materials - Property of IBM
#   US Government Users Restricted Rights - Use, duplication or
#   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
#   @(#) 1.4 src/somples.nt/vacmake.hd, somples, som3.0 12/17/96 14:11:33 [12/23/96 08:40:24]
# 
# 
#  DISCLAIMER OF WARRANTIES.
#  The following [enclosed] code is sample code created by IBM
#  Corporation. This sample code is not part of any standard or IBM
#  product and is provided to you solely for the purpose of assisting
#  you in the development of your applications.  The code is provided
#  "AS IS". IBM MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT
#  NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
#  FOR A PARTICULAR PURPOSE, REGARDING THE FUNCTION OR PERFORMANCE OF
#  THIS CODE.  IBM shall not be liable for any damages arising out of
#  your use of the sample code, even if they have been advised of the
#  possibility of such damages.
# 
#  DISTRIBUTION.
#  This sample code can be freely distributed, copied, altered, and
#  incorporated into other software, provided that it bears the above
#  Copyright notice and DISCLAIMER intact.
# 
! IF "$(SMBINDINGS)"==""
SMBINDINGS=$(SOMBASE)\include
! ENDIF

CC = "C:\Progra~1\Borland\BCC55\Bin\bcc32.exe"
LD = "C:\Progra~1\Borland\BCC55\Bin\ilink32.exe"
LIBRARIAN = "C:\Progra~1\Borland\BCC55\Bin\implib.exe"
SC = sc
RC= irc
# VACBLD = vacbld

# VACBLD_C_TO_OBJ = $(SOMBASE)\samples\vacbld_c_to_obj.cmd
# VACBLD_CXX_TO_OBJ = $(SOMBASE)\samples\vacbld_cxx_to_obj.cmd
# VACBLD_OBJS_TO_EXE = $(SOMBASE)\samples\vacbld_objs_to_exe.cmd
# VACBLD_OBJS_TO_DLL = $(SOMBASE)\samples\vacbld_objs_to_dll.cmd

# command line settable for C and CPP FLAGS additions
P=
# command line settable for C and CPP DLL flags additions
PD=

# Borland shared library issues:
# When building dll's with borland, the run time dll c/c++ library from
# borland must be used.   This is specified with the -tWR compiler option.
# This flag must be present during compilation of c and c++ files and
# for the linking of exe and dll files.   But wait, there is more,
# the -tWR flag must come after the  -tWD and -tWM flags, but before the -tWC flag.
# Order counts, so be careful!

# Adding /y (line-level debug info) makes ilink32 crash

# CFLAGSCOMMON =         /Ti /O- /Os- /W1           /H128 /Q+ /c /Gd+ /Gm+
CFLAGSCOMMON =  /6 /d /N /v  /O- /O-S /w-par /w-aus       /q  /c
CFLAGSTAIL=/tWM /tWR
CFLAGS = $(P) $(CFLAGSCOMMON)
# CFLAGSDLL= $(PD) $(CFLAGSCOMMON) /Ge-
CFLAGSDLL=   $(PD) $(CFLAGSCOMMON)

# CPPFLAGSCOMMON = $(CFLAGSCOMMON)            /Tdp
CPPFLAGSCOMMON =   $(CFLAGSCOMMON) /x /xd /xp /P
CPPFLAGS = $(P) $(CPPFLAGSCOMMON)
CPPFLAGSTAIL=$(CFLAGSTAIL)
# CPPFLAGSDLL=$(PD) $(CPPFLAGSCOMMON) /Ge-
CPPFLAGSDLL=  $(PD) $(CPPFLAGSCOMMON)

# LDFLAGS=/DE /NOE /MAP /NOLogo
LDFLAGS=  /v       /s   /q
LDFLAGSTAIL=/tWM /tWR
# LDFLAGSDLL=/DLL $(LDFLAGS)
LDFLAGSDLL=  /tWD $(LDFLAGS)

EXELIBS=somtk.lib kernel32.lib user32.lib gdi32.lib
DLLLIBS=somtk.lib kernel32.lib user32.lib

# include path for sc
SMINCLPATH=-I. -I$(SOMBASE)\include 
SCFLAGS= -p 

# include path for CC
INCLPATH=/I. /I$(SOMBASE)\include 

# library path for LD
LIBPATH=/L$(SOMBASE)\libomf

SOMSTARS_DEPEND=$(SMBINDINGS)\somstars.bld
SOMCORBA_DEPEND=$(SMBINDINGS)\somcorba.bld
SOMXH_DEPEND=$(SMBINDINGS)\somxh.bld

# default deffile specifier
DEFSPEC=/DEF:$*.def

.suffixes: .dummy .cpp .c .idl .xih .xh .ih .h .rc .res .obj .exp .nge .def .ngd .od .lst .dll .lib .exe

.c.od:
	$(CC) $(CFLAGSDLL) $(PRIVCFLAGSDLL) $(CFLAGSTAIL) /o$*.obj $(INCLPATH) $<
	echo "x">$@

.c.obj:
	$(CC) $(CFLAGS) $(PRIVCFLAGS) $(CFLAGSTAIL) /o$*.obj $(INCLPATH) $<

.cpp.od:
	$(CC) $(CPPFLAGSDLL) $(PRIVCPPFLAGSDLL) $(CPPFLAGSTAIL) /o$*.obj $(INCLPATH) $<
	echo "x">$@

.cpp.obj:
	$(CC) $(CPPFLAGS) $(PRIVCPPFLAGS) $(CPPFLAGSTAIL) /o$*.obj $(INCLPATH) $<

.idl.ih:
	$(SC) -sih $(SCFLAGS) $(PRIVSCFLAGS) $(SMINCLPATH) $(SMPRIVINC) $*.idl

.idl.xh:
	$(SC) -sxh $(SCFLAGS) $(PRIVSCFLAGS) $(SMINCLPATH) $(SMPRIVINC) $*.idl

.idl.h:
	$(SC) -sh $(SCFLAGS) $(PRIVSCFLAGS) $(SMINCLPATH) $(SMPRIVINC) $*.idl

.idl.xih:
	$(SC) -sxih $(SCFLAGS) $(PRIVSCFLAGS) $(SMINCLPATH) $(SMPRIVINC) $*.idl

.idl.c:
	$(SC) -sc $(SCFLAGS) $(PRIVSCFLAGS) $(SMINCLPATH) $(SMPRIVINC) $*.idl

.idl.def:
	$(SC) -sdef $(SCFLAGS) $(PRIVSCFLAGS) $(SMINCLPATH) $(SMPRIVINC) $*.idl

.idl.exp:
	$(SC) -sexp $(SCFLAGS) $(PRIVSCFLAGS) $(SMINCLPATH) $(SMPRIVINC) $*.idl

.idl.ngd:
	$(SC) -sdef -mgnat $(SCFLAGS) $(PRIVSCFLAGS) $(SMINCLPATH) $(SMPRIVINC) $*.idl

.idl.nge:
	$(SC) -sexp -mgnat $(SCFLAGS) $(PRIVSCFLAGS) $(SMINCLPATH) $(SMPRIVINC) $*.idl

.c.lst:
	$(CC) /Pc+ /Pd+ /Pe- $(CFLAGS) $(PRIVCFLAGS) $(INCLPATH) $< > $*.lst

.cpp.lst:
	$(CC) /Pc+ /Pd+ /Pe- $(CFLAGS) $(INCLPATH) $< > $*.lst

.obj.exe:
	$(LD) $(LDFLAGS) $(PRIVLDFLAGS) $(LDFLAGSTAIL) $(LIBPATH) c0x32.obj $(EXEOBJS) , $*.exe , , $(PRIVEXELIBS) $(EXELIBS) cw32mti.lib

.dummy.exe:
	$(LD) $(LDFLAGS) $(PRIVLDFLAGS) $(LDFLAGSTAIL) $(LIBPATH) c0x32.obj $(EXEOBJS) , $*.exe , , $(PRIVEXELIBS) $(EXELIBS) cw32mti.lib

# note: you can override the DEFSPEC to use different DEF names
.exp.dll:
	$(LD) $(LDFLAGSDLL) $(PRIVLDFLAGSDLL) $(LDFLAGSTAIL) $(LIBPATH) c0d32.obj $(DLLOBJS:.od=.obj) , $@ , , $(PRIVDLLLIBS) $(DLLLIBS) cw32mti.lib , $<

# note: you can override the DEFSPEC to use different DEF names
# .od.dll:
# 	$(LD) $(LDFLAGSDLL) $(PRIVLDFLAGSDLL) $(LDFLAGSTAIL) $(LIBPATH) c0d32.obj $(DLLOBJS:.od=.obj) , $@ , , $(PRIVDLLLIBS) $(DLLLIBS) cw32mti.lib , $(DEFSPEC:/DEF:=)

# # note: you can override the DEFSPEC to use different DEF names
# .def.dll:
# 	$(LD) $(LDFLAGSDLL) $(PRIVLDFLAGSDLL) $(LDFLAGSTAIL) $(LIBPATH) c0d32.obj $(DLLOBJS:.od=.obj) , $@ , , $(PRIVDLLLIBS) $(DLLLIBS) cw32mti.lib , $(DEFSPEC:/DEF:=)

# # note: you can override the DEFSPEC to use different DEF names
# .ngd.dll:
# 	$(LD) $(LDFLAGSDLL) $(PRIVLDFLAGSDLL) $(LDFLAGSTAIL) $(LIBPATH) c0d32.obj $(DLLOBJS:.od=.obj) , $@ , , $(PRIVDLLLIBS) $(DLLLIBS) cw32mti.lib , $(DEFSPEC:/DEF:=)

.rc.res:
	$(RC) /r $<

.od.lib:
	$(LIBRARIAN) $*.lib $(DEFSPEC:/DEF:=)

.def.lib:
	$(LIBRARIAN) $*.lib $(DEFSPEC:/DEF:=)

.ngd.lib:
	$(LIBRARIAN) $*.lib $(DEFSPEC:/DEF:=)
