# makefile.bc
# This is the makefile for DOS/Windows
#
#########################################################################
#If you are using BORLAND C:
#
#	If you want to run the LTOOLS under DOS or Windows 9x, you need:
#            	Borland C 16bit Compiler (tested with BC 3.1, 4.52, 5.0)
#
#	If you want to run the LTOOLS under Windows NT/2000, you need:
# 		Borland C 32bit Compiler (tested with BC 4.52, 5.0, 5.5)
#
#If you are using Microsoft VISUAL C++:
#
#	Use Visual C++ only, when you want to run the LTOOLS under Windows NT/2000
#
#

#To use Microsoft VISUAL C++ remove the comment character '#' from the beginning 
#of the following line. Please note, that during compilation you will see a bundle
#of warning messages, which can be safely ignored:
#MICROSOFT=1;

#To use ldir unter NT as a DLL ldirNT.dll and a driver program, remove the comment
#character '#' from the beginning of the following line:
#USEDLL=1

##########################################################################

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

!ifdef MICROSOFT	#Microsoft C compiler settings (32bit only!)

CC32=cl
CC32FLAGS=/D__WIN32__  /D_Windows /O2
OD=-Fe

!ifdef USEDLL
DLL=/LD /DUSEDLL
!endif

!else			#Borland C compiler settings (16bit and 32bit)

CC16=bcc
CC32=bcc32
CCFLAGS=   -ml -C -3 -wall -N -DSTRICT -O2 -DNEWOUT
CC32FLAGS= -C -3 -wall -N -DSTRICT -O2 -DNEWOUT
OD=-e

!ifdef USEDLL
DLL=-tWD -DUSEDLL
!endif

!endif

ldir:           main.c readdisk.c dir.c super.c inode.c group.c ldir.h  proto.h  ext2.h  dosdisk.h ldirNT.c rfs.c makefile
		@if exist ..\bin\ldir.exe       del ..\bin\ldir.exe
!ifdef CC16
		@if exist ..\bin\ldirDOS.exe    del ..\bin\ldirDOS.exe
		$(CC16) $(CCFLAGS) $(OD)ldirDOS.exe main.c readdisk.c dir.c super.c inode.c group.c rfs.c
		@if exist ldirDOS.exe 		move ldirDOS.exe ..\bin
!endif
!ifdef CC32
		@if exist ..\bin\ldirNT.exe   	del ..\bin\ldirNT.exe
		@if exist ..\bin\ldirNT.dll 	del ..\bin\ldirNT.dll
!ifdef USEDLL
		$(CC32) $(CC32FLAGS) $(DLL) $(OD)ldirNT.dll main.c readdisk.c dir.c super.c inode.c group.c rfs.c
!ifndef MICROSOFT
		@if exist ldirNT.dll		implib ldirNT.lib ldirNT.dll
!endif
		@if exist ldirNT.dll   		move ldirNT.dll ..\bin
		$(CC32) $(CC32FLAGS) ldirNT.c ldirNT.lib
		@if exist ldirNT.exe		move ldirNT.exe ..\bin
		
!else
		$(CC32) $(CC32FLAGS) $(OD)ldirNT.exe main.c readdisk.c dir.c super.c inode.c group.c rfs.c
		@if exist ldirNT.exe   		move ldirNT.exe ..\bin
!endif		
!endif
                @copy *.bat    ..\bin
		@copy rfstool\rfstool.exe ..\bin
                @copy rfstool\raw*.dll ..\bin
clean:
		@if exist *.obj del *.obj
		@if exist *.sym del *.sym
		@if exist *.bak del *.bak
		@if exist *.exe del *.exe
                @if exist li*   del li*
                @if exist *.asm del *.asm
		@if exist *.lib del *.lib
		@if exist *.exp del *.exp

