# makefile.bc
# This is the makefile for Borland C
# (if you have Turbo_C, change variable CC below)
# 
# To compile, please set variables CC and CC32

#########################################################################
# Borland C 16bit Compiler (tested with BC 3.1, 4.52, 5.0)
#
# if bcc is not on your path, please insert the complete path for bcc
CC=bcc -mc
#
# Borland C 32bit Compiler (tested with BC 4.52, 5.0)
# uncomment the next line if you want to use ldir/lread under Windows NT
CC32=bcc32
#
##########################################################################

####no user configurable items below this line############################


LKFLAGS=-C -3 -wall -N -DSTRICT $(WIN) $(MODEL) -O2
CCFLAGS= -c $(LKFLAGS)

INCLUDES=ldir.h  proto.h  ext2.h  makefile

lread:          16bitObj  32bitObj
		$(CC) $(LKFLAGS) main.obj readdisk.obj dir.obj super.obj inode.obj group.obj	
		@if exist ..\bin\lread.exe     del ..\bin\lread.exe
		@if exist ..\bin\lwrite.exe    del ..\bin\lwrite.exe
		@if exist ..\bin\lreadNT.exe   del ..\bin\lreadNT.exe
		@if exist ..\bin\lwriteNT.exe  del ..\bin\lwriteNT.exe
		@if exist ..\bin\ldir.exe      del ..\bin\ldir.exe
		@move main.exe ..\bin\ldir.exe
		@copy *.bat ..\bin
!if $d(CC32)
		$(CC32) $(LKFLAGS) NTmain.obj NTreaddisk.obj NTdir.obj NTsuper.obj NTinode.obj NTgroup.obj
		@if exist ..\bin\ldirNT.exe   del ..\bin\ldirNT.exe
		@move NTmain.exe ..\bin\ldirNT.exe
!endif


16bitObj:	main.obj readdisk.obj dir.obj super.obj inode.obj group.obj

32bitObj:	NTmain.obj NTreaddisk.obj NTdir.obj NTsuper.obj NTinode.obj NTgroup.obj


# #################DOS / Windows 9x 16bit binaries#################################
main.obj:       $(INCLUDES) main.c
		$(CC)   $(CCFLAGS) main.c

readdisk.obj:   $(INCLUDES) readdisk.c
		$(CC) $(CCFLAGS) readdisk.c
		 
dir.obj:        $(INCLUDES) dir.c
		$(CC) $(CCFLAGS) dir.c

super.obj:      $(INCLUDES) super.c
		$(CC) $(CCFLAGS) super.c

inode.obj:      $(INCLUDES) inode.c
		$(CC) $(CCFLAGS) inode.c

group.obj:      $(INCLUDES) group.c
		$(CC) $(CCFLAGS) group.c


# #################Windows NT 32bit binaries#######################################
NTmain.obj:	$(INCLUDES) main.c
!if $d(CC32)
		$(CC32) $(CCFLAGS) -oNTmain.obj main.c
!endif		

NTreaddisk.obj:	$(INCLUDES) readdisk.c
!if $d(CC32)
		$(CC32) $(CCFLAGS) -oNTreaddisk.obj readdisk.c
!endif		

NTdir.obj:	$(INCLUDES) dir.c
!if $d(CC32)
		$(CC32) $(CCFLAGS) -oNTdir.obj dir.c
!endif		

NTsuper.obj:	$(INCLUDES) super.c
!if $d(CC32)
		$(CC32) $(CCFLAGS) -oNTsuper.obj super.c
!endif		

NTinode.obj:	$(INCLUDES) inode.c
!if $d(CC32)
		$(CC32) $(CCFLAGS) -oNTinode.obj inode.c
!endif		

NTgroup.obj:	$(INCLUDES) group.c
!if $d(CC32)
		$(CC32) $(CCFLAGS) -oNTgroup.obj group.c
!endif		


clean:
		@if exist *.obj del *.obj
		@if exist *.sym del *.sym
		@if exist *.bak del *.bak
		@if exist *.exe del *.exe
