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

include ../../../Mkinclude

LIBNAME		= oslib
LIBFSRCS	= osgarg.f osqarn.f
LIBF90SRCS	= osgarg.f90 osqarn.f90
LIBCSRCS	= osexec.c osgenv.c osabrt.c
LIBSRCS		= $(LIBFSRCS) $(LIBCSRCS)
LIBFOBJS	= osgarg.o osqarn.o
LIBCOBJS	= osexec.o osgenv.o osabrt.o
LIBOBJS		= $(LIBFOBJS) $(LIBCOBJS)

object: $(LIBOBJS)

osqarn.o:
	@echo "Selecting system dependent code (osqarn.fxx.$(OSQARN))"
	$(CP) osqarn.$(OSQARN) osqarn.$(OSQARN_EXT)
	$(FC) $(FFLAGS) -c osqarn.$(OSQARN_EXT)

osgarg.o:
	@echo "Selecting system dependent code (osgarg.f.$(OSGARG))"
	$(CP) osgarg.$(OSGARG) osgarg.$(OSGARG_EXT)
	$(FC) $(FFLAGS) -c osgarg.$(OSGARG_EXT)

osexec.c: osexec.c.default
	$(CP) osexec.c.default osexec.c

osgenv.c: osgenv.c.default
	$(CP) osgenv.c.default osgenv.c

osabrt.c: osabrt.c.default
	$(CP) osabrt.c.default osabrt.c

library: archive ranlib

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

ranlib:
	$(RANLIB) $(LDCLLIBFILE)

clean:
	$(RM) *.o *~ osgarg.f osqarn.f *.c *.f90
