#
#   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 = icc
LD = ilink
LIBRARIAN = ilib
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=

CFLAGSCOMMON = /Ti /O- /Os- /W1 /H128 /Q+ /c /Gd+ /Gm+
CFLAGS = $P $(CFLAGSCOMMON)
CFLAGSDLL= $(PD) $(CFLAGSCOMMON) /Ge-

CPPFLAGSCOMMON = $(CFLAGSCOMMON) /Tdp
CPPFLAGS = $P $(CPPFLAGSCOMMON)
CPPFLAGSDLL=$(PD) $(CPPFLAGSCOMMON) /Ge-

LDFLAGS=/DE /NOE /MAP /NOLogo
LDFLAGSDLL=/DLL $(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 

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

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

.SUFFIXES: .c .cpp .idl .xih .xh .ih .h .rc .res .obj .def .od .lst .dll .lib .exe .nid

.cpp.od:
	$(VACBLD_CXX_TO_OBJ) $*.obj.icc $*.obj $*.cpp
	$(VACBLD) $*.obj.icc
	echo "x">$@

#	$(CC) $(CPPFLAGSDLL) $(PRIVCPPFLAGSDLL) /Fo$*.obj $(INCLPATH) $<
#	echo "x">$@

.cpp.obj:
	$(VACBLD_CXX_TO_OBJ) $*.obj.icc $*.obj $*.cpp
	$(VACBLD) $*.obj.icc

#	$(CC) $(CPPFLAGS) $(PRIVCPPFLAGS) $(INCLPATH) $<

.c.od:
	$(VACBLD_C_TO_OBJ) $*.obj.icc $*.obj $*.c
	$(VACBLD) $*.obj.icc
	echo "x">$@

#	$(CC) $(CFLAGSDLL) $(PRIVCFLAGSDLL) /Fo$*.obj $(INCLPATH) $<
#	echo "x">$@

.c.obj:
	$(VACBLD_C_TO_OBJ) $*.obj.icc $*.obj $*.c
	$(VACBLD) $*.obj.icc

#	$(CC) $(CFLAGS) $(PRIVCFLAGS)  $(INCLPATH) /Fo$*.obj $<

.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.c:
	$(SC) -sc $(SCFLAGS) $(PRIVSCFLAGS) $(SMINCLPATH) $(SMPRIVINC) $*.idl

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

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

.idl.nid:
	$(SC) -sdef $(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:
	$(VACBLD_OBJS_TO_EXE) $@.icc $@ $** $(PRIVEXELIBS) $(EXELIBS)
	$(VACBLD) $@.icc
#	$(LD) $(PRIVLDFLAGS) $(LDFLAGS) $** $(PRIVEXELIBS) $(EXELIBS)

# note: you can override the DEFSPEC to use different DEF names
.od.dll:
	$(VACBLD_OBJS_TO_DLL) $@.icc $@ $(DEFSPEC:/DEF:=) $(DLLOBJS:.od=.obj) $*.exp $(PRIVDLLLIBS) $(DLLLIBS)
	$(VACBLD) $@.icc

#	$(LD) $(PRIVLDFLAGSDLL) $(LDFLAGSDLL) $(DEFSPEC) /OUT:$@ $(DLLOBJS:.od=.obj) $*.exp $(PRIVDLLLIBS) $(DLLLIBS)

# note: you can override the DEFSPEC to use different DEF names
.def.dll:
	$(LD) $(PRIVLDFLAGSDLL) $(LDFLAGSDLL) /OUT:$@ $(DLLOBJS:.od=.obj) $*.exp $(PRIVDLLLIBS) $(DLLLIBS)

.nid.dll:
	$(VACBLD_OBJS_TO_DLL) $@.icc $@ $(DEFSPEC:/DEF:=) $(DLLOBJS:.od=.obj) $*.exp $(PRIVDLLLIBS) $(DLLLIBS)
	$(VACBLD) $@.icc

#	$(LD) $(PRIVLDFLAGSDLL) $(LDFLAGSDLL) /OUT:$@ $(DLLOBJS:.od=.obj) $*.exp $(PRIVDLLLIBS) $(DLLLIBS)

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

.od.lib:
	$(LIBRARIAN) $(DEFSPEC)

.def.lib:
	$(LIBRARIAN) $(DEFSPEC) /geni:$* 

.nid.lib:
	$(LIBRARIAN) $(DEFSPEC) /geni:$* 
