#
#	Layers makefile (generated from 12/26/90 template)
#

#	Remove '#' from next line for "silent" operation
!CMDSWITCHES +s

#	Path to WGA Tools Project
W	= $(WGA)

#	Path to Layers Project Directory
L	= $(LAYERS)

#	Path to directory holding make stuff
M	= $L\makestuf

#	Path to directory holding forms preprocessor
FPP	= $L\bin\formpp.exe

#	Path to Local project
Z	= c:\bandit

#	Location of the Calendar Source Include directory
X	= $Z\inc

#	Location of the Laser Source Include directory
I	= $L\inc

#	Location of the Demilayr directory
D	= $L\src\demilayr

#	Location of resources directory
!IF "$(RESOURCE)" == ""
R	= $Z\src\usa
!ELSE
R	= $(RESOURCE)
!ENDIF

#	Sibling-invariant name of this directory
H	= \bandit\src\schdist\tools

#	Temporary files
T1	= $(TMP)\caz1.tmp
T2	= $(TMP)\caz2.tmp
T3	= $(TMP)\caz3.tmp


# tools are always ship version
VERSION	= WINDOWS

#	Ensure DLL is defined (default value 0)
!IF "$(DLL)" == ""
DLL	= 0
!ENDIF


goal: tools



#	List of all subsystem "external" files, which list all
#	the .OBJ files the subsystem uses.

ALLEXT=  schdist.ext  schd.ext  tools.ext 


#	Get list of OBJ files used in schdist

schdist.ext: version.txt \bandit\src\schdist\makefile
	echo +++++++++ 
	echo OBTAINING .OBJ LIST FROM schdist
		nmake -e -f \bandit\src\schdist\makefile -nologo objs.ext
		fixwhite -l < objs.ext > $@
		del objs.ext


#	Get list of OBJ files used in schd

schd.ext: version.txt \bandit\src\schdist\schd\makefile
	echo +++++++++ 
	echo OBTAINING .OBJ LIST FROM schd
		nmake -e -f \bandit\src\schdist\schd\makefile -nologo objs.ext
		fixwhite -l < objs.ext > $@
		del objs.ext


#	Get list of OBJ files used in tools

tools.ext: version.txt \bandit\src\schdist\tools\makefile
	echo +++++++++ 
	echo OBTAINING .OBJ LIST FROM tools
		nmake -e -f \bandit\src\schdist\tools\makefile -nologo objs.ext
		fixwhite -l < objs.ext > $@
		del objs.ext


#	Build list of all .OBJ files used in included subsystems.

allobjs.txt: $(ALLEXT)
	echo +++++++++
	echo BUILDING ALLOBJS.TXT
	-del $(T1)
	sed -n -f $M\allobj.sed $** >> $(T1)
	sed -e "s/\.obj//" $(T1) > $@
	del $(T1)



#	Produces a file named 'version.txt' as a side effect.

setdefs:
	set VERSION=WINDOWS_SHIP
	echo MAKING $(VERSION) VERSION
	chkvrs $(VERSION) version.txt makefile


#	Build strings.h and strings.sr

strings:
	set VERSION=$(VERSION)
	nmake -e -f ..\..\nonintl\makefile -nologo schd

#	Build layrport subsystem in this directory

layrport.sub: setdefs
	echo +++++++++
	echo BUILDING layrport
	nmake -e -f \bandit\src\layrport\makefile -nologo external


#	Build core subsystem in this directory

core.sub: setdefs
	echo +++++++++
	echo BUILDING core
	nmake -e -f \bandit\src\core\makefile -nologo external


#	Build schdist subsystem in this directory

schdist.sub: setdefs
	echo +++++++++
	echo BUILDING schdist
	nmake -e -f \bandit\src\schdist\makefile -nologo external


#	Build schd subsystem in this directory

schd.sub: setdefs
	echo +++++++++
	echo BUILDING schd
	nmake -e -f \bandit\src\schdist\schd\makefile -nologo external


#	Build tools subsystem in this directory

tools.sub: setdefs
	echo +++++++++
	echo BUILDING tools
	nmake -e -f \bandit\src\schdist\tools\makefile -nologo external


#	Build the Windows resource file

tools.res: \bandit\src\schdist\tools\tools.rc
	echo +++++++++
!IF "$(VERSION)" == "WINDOWS"
	echo BUILDING DEBUG $@
	rc -dDEBUG -dMINTEST -fo $@ -r $**
!ENDIF
!IF "$(VERSION)" == "WINDOWS_SHIP"
	echo BUILDING SHIP $@
	rc -fo $@ -r $**
!ENDIF
!IF "$(VERSION)" == "WINDOWS_TEST"
	echo BUILDING TEST $@
	rc -dMINTEST -fo $@ -r $**
!ENDIF



##### Executable #####

TARGET	= tools

!IF "$(VERSION)" == "WINDOWS"
OTHERLIBS	= 
!ENDIF
!IF "$(VERSION)" == "WINDOWS_SHIP"
OTHERLIBS	= 
!ENDIF
!IF "$(VERSION)" == "WINDOWS_TEST"
OTHERLIBS	= 
!ENDIF

tools: setdefs strings \
	$(ALLEXT:.ext=.sub) allobjs.txt 
		echo +++++++++
		echo LINKING $@
		set TARGET=$(TARGET)
		set OTHERLIBS=$(OTHERLIBS)
		set DEFDIR=\bandit\src\schdist\tools
		link /ST:5000 /NOI /CO testapi.obj coreport.obj codepage.obj\
		poutils.obj extras.obj schpost.obj,dump_pof,NUL,dschdcor,NUL
		bind dump_pof.exe \lib\os2\doscalls.lib
#		link /NOI /NOF /CO dump_min.obj poutils.obj  \
#		extras.obj,dump_prf,NUL,dschdcor,NUL
#		bind dump_prf.exe \lib\os2\doscalls.lib

		bell 50 700 600 500 400


#	Remove all generated files in this directory.  Add to this list
#	if any other generated file types (like *.RES) or generated files
#	exist.

clean:
	echo +++++++++
	echo MAKING CLEAN
		-del *.obj
		-del *.ext
		-del *.lst
		-del *.cod
		-del *.exe
		-del *.lnk
		-del *.ilk
		-del *.res
		-del *.sym
		-del tools.map
		-del *.frm
		-del forms.map
		-del forms.ndx
		-del subclass.cxx
		-del allobjs.txt
		-del strings.*
		-del *.ir
		-del version.txt

#
#	Layers subsystem makefile (generated from 12/26/90 template)
#

#	Remove '#' from next line for "silent" operation
!CMDSWITCHES +s

#	Temporary files
T1	= $(TMP)\caz1.tmp
T2	= $(TMP)\caz2.tmp
T3	= $(TMP)\caz3.tmp

#	Path to WGA Tools Project
W	= $(WGA)

#	Path to Layers Project Directory
L	= $(LAYERS)

#	Path to directory holding make stuff
M	= $W\makestuf
F	= $W\tools\efilter

#	Path to directory holding forms preprocessor
FPP	= $L\bin\formpp.exe

#	Path to Local project
Z	= c:\bandit

#	Sibling-invariant name of this directory
H	= \bandit\src\schdist\tools


#	Location of the Layers Source Include directory
I	= $L\inc

#	Location of the Calendar Source Include directory
X	= $Z\inc

#	Location of the Demilayr directory
D	= $L\src\demilayr


#	Files on which every file of a given type depends.
#	Add others as appropriate, for instance, add $I\framewrk.hxx
#	if the Framework is used.
INCLS	= $I\slingsho.h $I\demilayr.h
AINCLS	= $I\slingsho.inc $I\debug.inc
INCLSXX	= $I\slingsho.h $I\demilayr.h
INCLSDES= forms.map $(FPP)

#	Pseudo target files for .hxx and .frm files.  Generated from .des
DES_XXX	=

goal:	external


#	Ensure version is defined
!IF "$(VERSION)" == ""
VERSION	= WINDOWS
!ENDIF

#	Ensure DLL is defined (default value 0)
!IF "$(DLL)" == ""
DLL	= 0
!ENDIF

#	Ensure DLLXDEFS is not defined if not a DLL
!IF "$(DLL)" == "0"
!IF	"$(DLLXDEFS)" != ""
DLLXDEFS=
!ENDIF
!ENDIF

#	Compiler and assembler flags

DEFS	= -DMINTEST -DSCHED_DIST_PROG -DDUMP_LOG -DCC -DDEBUG
CFLAGS  = -c -Alfu -Od -Z7p -G2sd -W3 -J -Gz -Zel -H64 -G4 -nologo -I..\bulinc -I. -I.. -I..\..\layrport
AFLAGS	= -Mx -Zi -t

CCPP_FLAGS = -E -DM_I88M -Dc_plusplus -DCC -I. -nologo
CFXX_FLAGS = +D12 +L +Gc +ML +MP +MW


OBJS0	= 
OBJS1	= testapi.obj 

!IF "$(DLL)" != "0"
OBJSDLL	= strings.obj
!ENDIF

#####

.SUFFIXES: .h .c .asm .obj .exe .cxx .res .rc .bas .des

{$H}.c.obj:
	echo +++++++++
	echo COMPILING $*.c
		cc $(CFLAGS) $(DEFS) $H\$*.c | efilter


{$H}.asm.obj:
   echo +++++++++
   echo ASSEMBLING $*.asm
		masm $(AFLAGS) $(DEFS) $H\$*.asm;


{$H}.cxx.obj:
	echo +++++++++
	echo PROCESSING $*.cxx
		cc $(CCPP_FLAGS) $(DEFS) $H\$*.cxx > $(T1)
		precxx $(DEFS) <$(T1) >$(T2)
		@rm $(T1)
		fixerror 217 "cfxx $(CFXX_FLAGS) +f$*.cxx +i$(T2) +o$(T3)"
		@rm $(T2)
		c6filter <$(T3) > $(TMP)\$*.c
		@rm $(T3)
	echo COMPILING $*.c
		cc $(CFLAGS) $(DEFS) $(TMP)\$*.c | efilter $F\filtcpp.txt
		@del $(TMP)\$*.*


#	.frm and .hxx generated together; only one rule is/need be called
#
#	NOTE:  The .hxx and .frm files are byproducts of the following rule.

{$H}.des.xxx:
	echo +++++++++
	echo PROCESSING $*.des
		touch $*.xxx
		formpp -dialog -f $(TMP)\$*.frm -h $(TMP)\$*.hxx $H\$*
		onerr diff $(TMP)\$*.frm $*.frm ! cp $(TMP)\$*.frm $*.frm >nul
		onerr diff $(TMP)\$*.hxx $*.hxx ! cp $(TMP)\$*.hxx $*.hxx >nul
	    -rm $(TMP)\$*.frm $(TMP)\$*.hxx


##### Put subsystem-specific make rules here #####

strings.obj: $D\strings.c strings.h strings.sr $(INCLS)
	echo +++++++++
	echo COMPILING $*.c
		cc $(CFLAGS) $(DEFS) $D\$*.c | efilter



##### EXTERNAL #####

objs.ext: $H\makefile
	echo ++++++++++
	echo BUILDING $@
		-del objs.ext
		echo $(OBJS0)					>> objs.ext
		echo $(OBJS1)					>> objs.ext
!IF "$(DLL)" != "0"
		echo $(OBJSDLL)					>> objs.ext
!ENDIF


external: \
		$(DES_XXX) $(OBJS0) \
		$(DES_XXX) $(OBJS1) \
!IF "$(DLL)" != "0"
		$(OBJSDLL) \
!ENDIF

			echo +++ MADE EXTERNAL $(VERSION) TOOLS



##### Dependencies #####

#	WARNING!!! These dependencies are obviously not complete.  
#	They need to filled in by the developer.

# dump_min.obj: $H\dump_min.c $(INCLS)
testapi.obj: $H\testapi.c $(INCLS)
