#Nornir makefile for Borland Free C Compiler.
# $Id: MAKEFILE,v 1.9 2001/05/27 13:57:40 Yoshi Exp $

# ALPHATEST
#ALPHASWITCH=-D_ALPHASWITCH

# DEBUG
DEBUGSW=-D_DEBUG

# project name & use copydll
# Sendbang.exe is required to execute "copydll::" in debugmode.
# If you don't have Sendbang.exe, get it or commentout COPYDLL.
!ifdef DEBUGSW
PRJ=NornirDebug.dll
COPYDLL=copydll
!else
PRJ=Nornir.dll
!endif

#others env
CPP=bcc32.exe
SOURCE=Nornir.cpp NornirSettings.cpp exports.cpp
OBJ=$(SOURCE:.cpp=.obj)

OUTDIR=.\OUTPUT

#######################################################
#If You donot have A2UNVLIB, uncomment follow lines.
A2UNVLIBSW =-D_A2UNVLIB
A2UNVLIB=A2UNV_BCC.LIB
A2UNVLIB_DIR=..\A2UNVLIB
A2UNVLIB_H_DIR = ..\A2UNVLIB
#######################################################

#lsapi.h & .lib name&place
LSAPI_H_DIR  =c:\litestep\dev
LSAPI_LIB_DIR=$(LSAPI_H_DIR)
LSLIB=lsapiBcc.lib

#cpp options
CPP_OPT=-w-8057- -5 -WD -O2 -Os -Oi -D_MBCS $(A2UNVLIBSW) $(DEBUGSWITCH)
DIR_SET= -n$(OUTDIR) -I$(A2UNVLIB_H_DIR) -I$(LSAPI_H_DIR) -L$(LSAPI_LIB_DIR) -L$(A2UNVLIB_DIR)

all: $(OUTDIR) $(A2UNVLIB) $(PRJ) $(COPYDLL)

$(PRJ):
	$(CPP) -e$@ $(CPP_OPT) $(DIR_SET) $(DEBUGSW) $(SOURCE) $(LSLIB) $(A2UNVLIB)

$(OUTDIR):
    if not exist $(OUTDIR) mkdir $(OUTDIR)

A2UNV_BCC.LIB::
	cd ..\A2UNVLIB
	make
	cd ..\Nornir

copydll::
	cd $(OUTDIR)
	sendbang !unloadmodule C:\temp\$(PRJ)
	copy $(PRJ) C:\temp
	sendbang !recycle
	cd ..

clean:
	-del $(OUTDIR)\*.obj
	-del $(OUTDIR)\*.dll
	-del $(OUTDIR)\*.tds
