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

include ../../../Mkinclude

LIBNAME		= syslib
LIBFSRCS	= 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
LIBCSRCS	=
LIBSRCS		= $(LIBFSRCS) $(LIBCSRCS)
LIBFOBJS	= gliget.o gliqnp.o gllget.o gllqnp.o glrget.o glrqnp.o \
		  glcget.o glcqnp.o glpget.o glpqnp.o glqfnm.o rpnget.o \
		  rpnopt.o rpnenv.o rpnxfl.o lchreq.o iufopn.o cfsrch.o \
		  msgdmp.o mszdmp.o prcopn.o
LIBCOBJS	=
LIBOBJS		= $(LIBFOBJS) $(LIBCOBJS)


object: $(LIBOBJS)

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

library: archive ranlib

archive:
	@$(AR) $(ARFLAGS) $(LDCLLIBFILE) $(LIBOBJS)

ranlib:
	$(RANLIB) $(LDCLLIBFILE)

clean:
	$(RM) *.o *~ gliqnp.f glrqnp.f90 glcqnp.f
