##!dmake -f

# main goal of this Makefile:
# SWSUBST, the SUBST & JOIN replacement

# source in the Free-Dos initialization 
.INCLUDE .FIRST .IGNORE : fd_init.mk ../fd_init.mk ../../fd_init.mk

#
#Project related settings
#
PRG = swsubst.exe
SRC = cds.c drive.c flushdsk.c mkdir.c print.c remove.c set.c subst.c \
	swap.c swsubst.c yerror.c
OBJ = cds.obj drive.obj flushdsk.obj mkdir.obj print.obj remove.obj set.obj \
	subst.obj swap.obj swsubst.obj yerror.obj
HDR = cds.h yerror.h swsubst.h
MYCFLAGS = # TEST=YES
MSGLIB !:= msg.lib
MSGDCL !:= yerror.h
LDLIBS = $(MSGLIB) $(FDLIB)\$(_MODEL)_$(LNG).lib $(FDLIB)\SUPPL_$(_MODEL).lib

#
#First target
#
all : $(CFG) $(PRG)	# copy library into Free-Dos library dir

.INIT : $(CFG) tags refs errlist # Will make the utilizing files

#
#C initialization file
#
.IF $(CFG)
# Compiler configuration file, for Borland C only
# options: no Windows, no RTTI, use pre-compiled headers, no floating point

CONFIGURATION = -W-	\
-X-	\
-H	\
-I.;$(INCDIR)	\
-L.;$(LIBDIR)	\
-H=swsubst.csm	\
-f-	\
-ff-	\
-m$(_MODEL)

.IF $(USE31) == $(NULL)
CONFIGURATION += -RT-
.ENDIF

$(CFG) : $(MAKEFILE:s/-f//)
	Cat $(mktmp $(CONFIGURATION:t"\n")\n) >$@

.ENDIF


$(PRG) : $(MSGLIB) $(OBJ) 
	$(CC) $(CCLDFLAGS) -e$@ @$(mktmp $(OBJ:t"\n") $(LDLIBS:t"\n")\n)

#MAKEDEP START
cds.obj : cds.c \
	 cds.h
drive.obj : drive.c \
	 cds.h swsubst.h yerror.h
flushdsk.obj : flushdsk.c \
	 cds.h swsubst.h yerror.h
mkdir.obj : mkdir.c \
	 cds.h swsubst.h yerror.h
print.obj : print.c \
	 cds.h swsubst.h yerror.h
remove.obj : remove.c \
	 cds.h swsubst.h yerror.h
set.obj : set.c \
	 cds.h swsubst.h yerror.h
subst.obj : subst.c \
	 cds.h swsubst.h yerror.h
swap.obj : swap.c \
	 cds.h swsubst.h yerror.h
swsubst.obj : swsubst.c \
	 cds.h swsubst.h yerror.h
yerror.obj : yerror.c \
	 yerror.h
#MAKEDEP STOP

ci :: $(shell dir /b *.1 *.1g)

# source in the Free-Dos standard targets 
.INCLUDE .FIRST .IGNORE : fd_exit.mk ../fd_exit.mk ../../fd_exit.mk
