#
#       Makefile for syslib
#
#       Copyright (C) 2000 GFD Dennou Club. All rights reserved.
#

ROOTDIR     = ..\..\..
OBJDIR      = ..

FSRC        = gliget.f gliqnp.f gllget.f gllqnp.f glrget.f glrqnp.f90 \
              glcget.f glcqnp.f glpget.f glpqnp.f glqfnm.f rpnget.f \
              rpnopt.f rpnenv.f rpnxfl.f lchreq.f iufopn.f cfsrch.f \
              msgdmp.f mszdmp.f prcopn.f

FOBJ = $(FSRC:.f=.obj)

!include $(ROOTDIR)\MkInclude.win

build:
    $(MAKE) /$(MAKEFLAGS) /NOLOGO /S /f makefile.win subdirs \
            SUBDIRS_PRETARGET=build-exec
build-exec: $(FSRC) $(FOBJ)

gliqnp.f: gliqnp.g
	@echo "Substituting system constants (gliqnp.g -> gliqnp.f)"
	@sed -e "s!@INTMAX!$(INTMAX)!" \
	     gliqnp.g > gliqnp.f

glrqnp.f90: glrqnp.g
	@echo "Substituting system constants (glrqnp.g -> glrqnp.f90)"
	@sed -e "s!@REALMAX!$(REALMAX)!" \
	     -e "s!@REALMIN!$(REALMIN)!" \
	     -e "s!@REPSL!$(REPSL)!" \
	     glrqnp.g > glrqnp.f90

glcqnp.f: glcqnp.g
	@echo "Substituting dcldbase path names (glcqnp.g -> glcqnp.f)"
	@sed -e "s!@DS_PATH!\'$(DBASEDIR)/\'!" \
	     glcqnp.g > glcqnp.f

install:
    $(MAKE) /$(MAKEFLAGS) /NOLOGO /S /f makefile.win subdirs \
            SUBDIRS_PRETARGET=install-exec
install-exec-unique:

clean:
    $(MAKE) /$(MAKEFLAGS) /NOLOGO /S /f makefile.win subdirs \
            SUBDIRS_PRETARGET=clean-exec
clean-exec-unique:
	IF EXIST gliqnp.f $(RM) gliqnp.f
	IF EXIST glrqnp.f90 $(RM) glrqnp.f90
	IF EXIST glcqnp.f $(RM) glcqnp.f
