# VisualAge for Smalltalk V5
#
# OS/2 compile and link abt.exe, nodialog.exe, and esvio.exe
# (Assumes using VisualAge C++ 3.6.5)

PLATFORM   = OS2

BUILDDIR   = ..
ESINCLDIR  = $(BUILDDIR)\esincl
ESLIBDIR   = $(BUILDDIR)\eslib

CC         = icc
LINK       = icc
RC         = rc
RL         = rc
RM         = del
CP         = copy

# CPPFLAGS:            C preprocessor flags
#
#       /D$(PLATFORM)  Setup ES .h files for OS/2
#       /I$(ESINCLDIR) ES .h files
#
CPPFLAGS   = /D$(PLATFORM) /I$(ESINCLDIR)

# CFLAGS:              C compiler flags
#
#       /C             Compile only
#       /Fo$@          Name the object file
#       /Ge+           Build an EXE
#       /O+            Optimize
#       /qtune=blend   Optimize for Pentium-class machine
#       /Ti+           Keep executable debug information
#	/Q	       Compile quietly
#
CFLAGS     = /C /Fo$@ /Ge+ /O+ /qtune=blend /Q

# LFLAGS:              Linker flags
#
#       /B"/NOD"      Supress default library search
#       /B"/NOE"      Supress extended dictionary search
#       /B"/PMTYPE:PM" Make it a PM application
#       /B"/PMTYPE:VIO" Make it a VIO application
#       /B"/STACK:0x31000"  196K stack -- note that OS/2 seems
#                       to have occasional problems with a stack
#                       size evenly divisable by 64K.		
#       /Fe$@         Name the executable file
#       /Gm+          Link with the multithread libraries
#       /Ti+          Keep executable debug information
#
LFLAGS     = /B"/NOD /NOE /STACK:0x31000" /Fe$@ /Gm+
LFLAGSPM   = /B"/PMTYPE:PM"
LFLAGSVIO  = /B"/PMTYPE:VIO"

!IFDEF DEBUG
CPPFLAGS     = $(CPPFLAGS) /DDEBUG01
CFLAGS       = $(CFLAGS) /Ti+
LFLAGS       = $(LFLAGS) /Ti+
!ENDIF

# LIBS:
#
LIBS       = cpprms36.lib os2386.lib
ESLIBS     = $(ESLIBDIR)\esvmexe.lib $(ESLIBDIR)\esvm.lib

# Inference rules
.c.obj:
	$(CC) $(CPPFLAGS) $(CFLAGS) $<


all: abt.exe nodialog.exe esvio.exe

clean:
	- $(RM) *.obj
	- $(RM) *.res
	- $(RM) *.exe

abt.exe: main.obj parse.obj abt.res
	$(LINK) main.obj parse.obj $(ESLIBS) $(LIBS) $(LFLAGS) $(LFLAGSPM)
	$(RL) abt.res abt.exe

nodialog.exe: main.obj parse.obj nodialog.res
	$(LINK) main.obj parse.obj $(ESLIBS) $(LIBS) $(LFLAGS) $(LFLAGSPM)
	$(RL) nodialog.res nodialog.exe

esvio.exe: mainvio.obj esvio.res
	$(LINK) mainvio.obj parse.obj $(ESLIBS) $(LIBS) $(LFLAGS) $(LFLAGSVIO)
	$(RL) esvio.res esvio.exe

abt.res: abt.rc splash.bmp visage.ico
	$(RC) -r -dSplashFile=splash.bmp -dIconFile=visage.ico abt.rc

esvio.res: esvio.rc visage.ico
	$(RC) -r -dIconFile=visage.ico esvio.rc

nodialog.res: nodialog.rc visage.ico
	$(RC) -r -dIconFile=visage.ico nodialog.rc
