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

include ../Mkinclude

LIBSRCS 	= $(DCLCONFVER) $(DCLFRT)
INSTSRC		= dcldate$(EXT) dclver$(EXT) dclexec$(EXT) dcltrf$(EXT) \
		  dclclr$(EXT)  dcldbs$(EXT) dclfont$(EXT) dclpara$(EXT) \
		  dcltone$(EXT) dclcmap$(EXT) repsl$(EXT) \
                  dclfontlist$(EXT) dclsysfont$(EXT) dclfontdialog$(EXT) \
                  dclsrv$(EXT) \

all: $(DCLCONFVER) $(DCLFRT)

$(DCLCONFVER): dclconfig.org
	@echo "Making shell script $(DCLCONFVER)"
	@$(SED) \
	     -e 's!@prefix@!$(prefix)!' \
	     -e 's!@DCLVERSION@!$(DCLVERSION)!' \
	     -e 's!@DCLVERNUM@!$(DCLVERNUM)!' \
	     -e 's!@DCLLANG@!$(DCLLANG)!' \
	     -e 's!@BINDIR@!$(BINDIR)!' \
	     -e 's!@LIBDIR@!$(LIBDIR)!' \
	     -e 's!@INCDIR@!$(INCDIR)!' \
	     -e 's!@DCLLIBNAME@!$(DCLLIBNAME)!' \
	     -e 's!@DCLLIBFILE@!$(DCLLIBFILE)!' \
	     -e 's!@DCLLIBOPT@!$(DCLLIBOPT)!' \
	     -e 's!@DCLLIBPATH@!$(DCLLIBPATH)!' \
	     -e 's!@DBASENAME@!$(DBASENAME)!' \
	     -e 's!@DBASEDIR@!$(DBASEDIR)!' \
	     -e 's!@XINCPATH@!$(XINCPATH)!' \
	     -e 's!@XLIBPATH@!$(XLIBPATH)!' \
	     -e 's!@XLIBOPT@!$(XLIBOPT)!' \
	     -e 's!@CC@!$(CC)!' \
	     -e 's!@CFLAGS@!$(CFLAGS)!' \
	     -e 's!@FC@!$(FC)!' \
	     -e 's!@FFLAGS@!$(FFLAGS)!' \
	     -e 's!@LDFLAGS@!$(LDFLAGS)!' \
	     -e 's!@LDLIBS@!$(LDLIBS)!' \
	     -e 's!@GTKVERSION@!$(GTKVERSION)!' \
	         dclconfig.org > $(DCLCONFVER)
	@chmod +x $(DCLCONFVER)

$(DCLFRT): dclfrt.org
	@echo "Making shell script $(DCLFRT)"
	@sed -e 's!@PATH@!$(BINDIR)!' dclfrt.org > $(DCLFRT)
	@chmod +x $(DCLFRT)

install:
	@-if (test $(BINDIR) != $(LBINDIR)) then \
	$(CP) $(LIBSRCS) $(BINDIR); fi
	@-if [ -e dcldate$(EXT) ] ; then \
	$(CP) $(INSTSRC) $(BINDIR) ; fi
	$(RM) $(BINDIR)/$(DCLCONFIG)
	ln -s $(DCLCONFVER) $(BINDIR)/$(DCLCONFIG)

clean:
	$(RM) *~ $(INSTSRC) $(DCLCONFIG) $(DCLCONFVER) $(DCLFRT) $(DCLCC)

distclean:
	$(RM) *~ $(INSTSRC) $(DCLCONFIG) $(DCLCONFVER) $(DCLFRT) $(DCLCC)
