##!dmake -f

.SWAP :

# main goal of this Makefile:
# freeMCB, the utility to free any MCB block

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

#
#Project related settings
#
.IF $(NDEBUG)
PRG = freemcb.com
.ELSE
PRG = freemcb.exe
.ENDIF
SRC = freemcb.c
OBJ = freemcb.obj
HDR =
MYCFLAGS = # TEST=YES
MSGLIB !:= 
MSGDCL !:= yerror.h
LDLIBS = $(MSGLIB) $(FDLIB)\$(_MODEL)_$(LNG).lib $(FDLIB)\Suppl_$(_MODEL).lib $(FDLIB)\Fd_$(_MODEL).lib
.IF $(_COMPILER) == BC45
# Disable all the exception handling stuff
LDLIBS += noeh$(eq,$(_MODEL),t s $(_MODEL)).lib
.ENDIF

#
#First target
#
all : $(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-	\
-N \
-X-	\
-H	\
-I.;$(INCDIR)	\
-L.;$(LIBDIR)	\
-H=libber.csm	\
-f-	\
-ff-	\
-m$(_MODEL)

.IF $(_COMPILER) == BC45
CONFIGURATION += -RT- -lye -lyx
.ENDIF

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

.ENDIF


freemcb.com .SWAP : $(MSGLIB) $(OBJ) 
	@+if exist $@ del $@ >nul
.IF $(_COMPILER) == MC
	$(LD) $(LDCOMFLAG) $(LDFLAGS) $(MCDIR)\Pc86rl_t @$(mktmp $(OBJ:t" ") \n), $@, NUL,@$(mktmp $(LDLIBS:t" ") $(MCDIR)\Mclib\n)
.ELSE
	$(CC) $(CCLDCOMFLAGS) -e$@ @$(mktmp $(OBJ:t"\n") $(LDLIBS:t"\n")\n)
.ENDIF

freemcb.exe .SWAP : $(MSGLIB) $(OBJ) 
	@+if exist $@ del $@ >nul
.IF $(_COMPILER) == MC
	$(LD) $(LDFLAGS) $(MCDIR)\Pc86rl_s @$(mktmp $(OBJ:t" ") \n), $@, NUL,@$(mktmp $(LDLIBS:t" ") $(MCDIR)\Mclib\n)
.ELSE
	$(CC) $(CCLDFLAGS) -e$@ @$(mktmp $(OBJ:t"\n") $(LDLIBS:t"\n")\n)
.ENDIF

#MAKEDEP START
freemcb.obj : freemcb.c
#MAKEDEP STOP

clean ::
	$(RM) $(RMFLAGS) -s yerror.h__ q*.asm q*.cp q*.co $$*.asm $$*.cp $$*.co
	$(RM) /fs $(LNG).man $(LNG).tx

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