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

include ../../../Mkinclude

LIBNAME		= swpack
LIBFSRCS	= swcget.f swcmll.f swcqnp.f swiget.f swiqnp.f swlget.f \
		  swlqnp.f swpack.f swpget.f swpqnp.f swqfnm.f swrget.f \
		  swrqnp.f
LIBCSRCS	= cfnchr.c z1pack.c zgpack.c ztpack.c zxpack.c
LIBSRCS		= $(LIBFSRCS) $(LIBCSRCS)
LIBFOBJS	= swcget.o swcmll.o swcqnp.o swiget.o swiqnp.o swlget.o \
		  swlqnp.o swpack.o swpget.o swpqnp.o swqfnm.o swrget.o \
		  swrqnp.o
LIBCOBJS	= cfnchr.o zgpack.o
LIBOBJS		= $(LIBFOBJS) $(LIBCOBJS)


object: $(LIBOBJS)

zgpack.c: zgpack.$(DRV_EXT).c
	@$(CP) zgpack.$(DRV_EXT).c zgpack.c

swiqnp.f: swiqnp.g
	@echo "Substituting system constants (swiqnp.g -> swiqnp.f)"
	@sed -e "s!@DCLNWS!$(DCLNWS)!" \
	     -e "s!@IWIDTH!$(IWIDTH)!" \
	     -e "s!@IHEIGHT!$(IHEIGHT)!" \
	     swiqnp.g > swiqnp.f

library: archive ranlib

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

ranlib:
	$(RANLIB) $(LDCLLIBFILE)

clean:
	$(RM) *.o *~ swiqnp.f zgpack.c
