#
# Makefile for Borland C++ 4.5 on PC/DOS platforms
#
# compiler flags:  -mh         - use a huge memory model
#                  -w-pro      - suppress call to function without prototype warnings
#                  -w-par      - suppress unused parameter warnings
#                  -i64        - allow 64 character identifiers
#                  -N          - check for stack overflows

CC = bcc
CFLAGS = -mh -w-pro -w-par -i64 -N
CALOBS = cal_main.obj ecalmain.obj cal_tran.obj cal_eval.obj cal_util.obj matrix.obj
MINPACKOBS = dpmpar.obj enorm.obj fdjac2.obj lmdif.obj lmpar.obj qrfac.obj qrsolv.obj

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

ccal:		ccal.c $(CALOBS) $(MINPACKOBS)
	$(CC) $(CFLAGS) ccal.c @cal.rsp @minpack.rsp

ccal_fo:	ccal_fo.c $(CALOBS) $(MINPACKOBS)
	$(CC) $(CFLAGS) ccal_fo.c @cal.rsp @minpack.rsp

nccal:		nccal.c $(CALOBS) $(MINPACKOBS)
	$(CC) $(CFLAGS) nccal.c @cal.rsp @minpack.rsp

nccal_fo:	nccal_fo.c $(CALOBS) $(MINPACKOBS)
	$(CC) $(CFLAGS) nccal_fo.c @cal.rsp @minpack.rsp

ecal:		ecal.c $(CALOBS) $(MINPACKOBS)
	$(CC) $(CFLAGS) ecal.c @cal.rsp @minpack.rsp

xfd2xfu:	xfd2xfu.c $(CALOBS) $(MINPACKOBS)
	$(CC) $(CFLAGS) xfd2xfu.c @cal.rsp @minpack.rsp

wc2ic:		wc2ic.c $(CALOBS) $(MINPACKOBS)
	$(CC) $(CFLAGS) wc2ic.c @cal.rsp @minpack.rsp

ic2wc:		ic2wc.c $(CALOBS) $(MINPACKOBS)
	$(CC) $(CFLAGS) ic2wc.c @cal.rsp @minpack.rsp

csyn:		csyn.c gasdev.obj $(CALOBS) $(MINPACKOBS)
	$(CC) $(CFLAGS) csyn.c gasdev.obj @cal.rsp @minpack.rsp

ncsyn:		ncsyn.c gasdev.obj $(CALOBS) $(MINPACKOBS)
	$(CC) $(CFLAGS) ncsyn.c gasdev.obj @cal.rsp @minpack.rsp

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

cal_main.obj:	cal_main.h cal_main.c
	$(CC) $(CFLAGS) -c cal_main.c

ecalmain.obj:	cal_main.h ecalmain.c
	$(CC) $(CFLAGS) -c ecalmain.c

cal_tran.obj:	cal_main.h cal_tran.c
	$(CC) $(CFLAGS) -c cal_tran.c

cal_eval.obj:	cal_main.h cal_eval.c
	$(CC) $(CFLAGS) -c cal_eval.c

cal_util.obj:	cal_main.h cal_util.c
	$(CC) $(CFLAGS) -c cal_util.c

matrix.obj:	matrix/matrix.h matrix/matrix.c
	$(CC) $(CFLAGS) -Imatrix -c matrix/matrix.c

gasdev.obj:	gasdev.c
	$(CC) $(CFLAGS) -c gasdev.c

$(MINPACKOBS):   minpack/f2c.h \
                 minpack/dpmpar.c \
                 minpack/enorm.c \
                 minpack/fdjac2.c \
                 minpack/lmdif.c \
                 minpack/lmpar.c \
                 minpack/qrfac.c \
                 minpack/qrsolv.c
	$(CC) $(CFLAGS) -Iminpack -c minpack/*.c

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

all:	ccal \
	ccal_fo \
	nccal \
	nccal_fo \
	ecal \
	xfd2xfu \
	wc2ic \
	ic2wc \
	csyn \
	ncsyn

clean:
	del *.obj
	del *.exe

