#  $Id: Makefile.in 0.38 2000/03/25 00:03:08 tom Exp $
###############################################################################
#
#  Generic Makefile to create the Gcal appointment/reminder files.
#
#  Copyright (c) 1994-1997, 2000  Thomas Esken          <esken@uni-muenster.de>
#                                 Im Hagenfeld 84
#                                 D-48147 M"unster
#                                 GERMANY
#
###############################################################################
#
#
#
#### Start of system configuration section. ####

PACKAGE = @PACKAGE@
VERSION = @VERSION@

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@

subdir = data

@SET_MAKE@

AWK = @AWK@
PERL = @PERL@

CP = @CP@

INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@

prefix = @prefix@
datadir = @datadir@
# Where to install the converted reminder/appointment and other example files.
packagedatadir = `echo $(datadir)/$(PACKAGE) | sed -e 's,//,/,g'`
# Where to install the `.gcalrc' file.
homedir = $(HOME)

thisgcal = ../src/$(PACKAGE)
datetime = `$(thisgcal) -f/dev/null -QUx --here='0 %:04*Y %:02*M %:02*D %:02*\_ %:02*?'`

#### End of system configuration section. ####



#### Start of package specific make variable definition section. ####

SHELL = /bin/sh

#
# File owner permissions used for installdata and installdates target.
#
BINPERMS = `echo $(INSTALL_PROGRAM) | sed -e 's,^.*/,,' -e 's/[^0-9]//g'`
SRCPERMS = `echo $(INSTALL_DATA) | sed -e 's,^.*/,,' -e 's/[^0-9]//g'`
#
# File owner permissions used for installdata and installdates target
# if the configure script doesn't set $(BINPERMS) or $(SRCPERMS).
#
BINPERMS2 = 0755
SRCPERMS2 = 0644

#
# Standard names.
#

dataREADMEFILE = \
  $(srcdir)/README
dataGCALRCFILE = \
  $(srcdir)/gcalrc
dataEXAMPLEFILES = \
  $(srcdir)/ansipic.rc \
  $(srcdir)/birthday.rc \
  $(srcdir)/bkk.rc \
  $(srcdir)/de-mdata.rc \
  $(srcdir)/de-sdata.rc \
  $(srcdir)/mdata.rc \
  $(srcdir)/meteoric.rc \
  $(srcdir)/ms.rc \
  $(srcdir)/sdata.rc \
  $(srcdir)/sun-moon.rc \
  $(srcdir)/textpic.rc \
  $(srcdir)/wloc.rc \
  $(srcdir)/wtt1.rc \
  $(srcdir)/wtt2.rc \
  $(srcdir)/wtt3.rc
dataMISCFILES = \
  $(srcdir)/Makefile.in \
  $(dataREADMEFILE) \
  $(dataGCALRCFILE) \
  $(dataEXAMPLEFILES)

datacalendarsDIR = calendars#
datacalendarsFILES = \
  $(srcdir)/$(datacalendarsDIR)/calendar.birth \
  $(srcdir)/$(datacalendarsDIR)/calendar.chris \
  $(srcdir)/$(datacalendarsDIR)/calendar.compu \
  $(srcdir)/$(datacalendarsDIR)/calendar.histo \
  $(srcdir)/$(datacalendarsDIR)/calendar.holid \
  $(srcdir)/$(datacalendarsDIR)/calendar.judai \
  $(srcdir)/$(datacalendarsDIR)/calendar.music \
  $(srcdir)/$(datacalendarsDIR)/calendar.ushol

datadatesDIR = dates#
datadatesFILES = \
  $(srcdir)/$(datadatesDIR)/ancient \
  $(srcdir)/$(datadatesDIR)/can_holiday \
  $(srcdir)/$(datadatesDIR)/celtic \
  $(srcdir)/$(datadatesDIR)/computing \
  $(srcdir)/$(datadatesDIR)/events \
  $(srcdir)/$(datadatesDIR)/events1 \
  $(srcdir)/$(datadatesDIR)/events2 \
  $(srcdir)/$(datadatesDIR)/events3 \
  $(srcdir)/$(datadatesDIR)/events4 \
  $(srcdir)/$(datadatesDIR)/events5 \
  $(srcdir)/$(datadatesDIR)/events6 \
  $(srcdir)/$(datadatesDIR)/gdead \
  $(srcdir)/$(datadatesDIR)/hawaii \
  $(srcdir)/$(datadatesDIR)/literature \
  $(srcdir)/$(datadatesDIR)/lives \
  $(srcdir)/$(datadatesDIR)/lives1 \
  $(srcdir)/$(datadatesDIR)/lives2 \
  $(srcdir)/$(datadatesDIR)/lives3 \
  $(srcdir)/$(datadatesDIR)/lives4 \
  $(srcdir)/$(datadatesDIR)/lives5 \
  $(srcdir)/$(datadatesDIR)/lives6 \
  $(srcdir)/$(datadatesDIR)/lotr \
  $(srcdir)/$(datadatesDIR)/movies \
  $(srcdir)/$(datadatesDIR)/music \
  $(srcdir)/$(datadatesDIR)/radio \
  $(srcdir)/$(datadatesDIR)/sfo \
  $(srcdir)/$(datadatesDIR)/space \
  $(srcdir)/$(datadatesDIR)/sports \
  $(srcdir)/$(datadatesDIR)/television \
  $(srcdir)/$(datadatesDIR)/usa_holiday \
  $(srcdir)/$(datadatesDIR)/usa_other \
  $(srcdir)/$(datadatesDIR)/usa_states \
  $(srcdir)/$(datadatesDIR)/witchcraft \
  $(srcdir)/$(datadatesDIR)/world
datadatesMISCFILES = \
  $(srcdir)/$(datadatesDIR)/CREDITS \
  $(srcdir)/$(datadatesDIR)/README

datascriptsDIR = scripts#
datascriptsFILES = \
  $(srcdir)/$(datascriptsDIR)/cal2gcal.awk \
  $(srcdir)/$(datascriptsDIR)/cal2gcal.pl \
  $(srcdir)/$(datascriptsDIR)/ct2gcal.awk \
  $(srcdir)/$(datascriptsDIR)/ct2gcal.pl \
  $(srcdir)/$(datascriptsDIR)/old2v220.awk \
  $(srcdir)/$(datascriptsDIR)/old2v220.pl \
  $(srcdir)/$(datascriptsDIR)/v2x2v300.awk \
  $(srcdir)/$(datascriptsDIR)/v2x2v300.pl

DISTFILES = \
  $(dataMISCFILES) \
  $(datacalendarFILES) \
  $(datadatesFILES) \
  $(datadatesMISCFILES) \
  $(datascriptsFILES)

#### End of package specific make variable definition section. ####



#### Start of default targets section. ####

all: default

default check installbin install-strip id ID tags TAGS:
	@echo "Nothing to be done for \`$@'"

#### End of default targets section. ####



#### Start of install section. ####

install: installdirs installdates installdata
	@echo "All installs in $(subdir) done"

installdirs: $(top_srcdir)/mkinstalldirs
	$(NORMAL_INSTALL)
	$(SHELL) $(top_srcdir)/mkinstalldirs $(homedir)
	$(SHELL) $(top_srcdir)/mkinstalldirs $(packagedatadir)
	if test -n "$(AWK)" || test -n "$(PERL)"; \
	then \
	  $(SHELL) $(top_srcdir)/mkinstalldirs $(packagedatadir)/$(datascriptsDIR); \
	fi

#
# If an old-style `~/.gcalrc' is found, it is converted (`perl' preferred)
# preserving a copy of it by the name of `~/.gcalrc.DATETIME'.
# Otherwise, `gcalrc' is installed as `~/.gcalrc'.
#
installdata: $(dataGCALRCFILE) $(dataEXAMPLEFILES) $(dataREADMEFILE) installdirs
	$(NORMAL_INSTALL)
	@install_target=`echo "$(dataGCALRCFILE)" | sed -e 's,.*/,,'` ;\
	if test -f "$(homedir)/.$$install_target"; \
	then \
	  if test -n "$(CP)"; \
	  then \
	    $(CP) $(homedir)/.$$install_target $(homedir)/.$$install_target.$(datetime); \
	  else \
	    cat $(homedir)/.$$install_target > $(homedir)/.$$install_target.$(datetime); \
	  fi; \
	  echo "Saved original \`$(homedir)/.$$install_target' as \`$(homedir)/.$$install_target.$(datetime)'"; \
	  if test -n "$(PERL)"; \
	  then \
	    echo "$(PERL) updates possibly old-style \`$(homedir)/.$$install_target'"; \
	    $(PERL) $(srcdir)/$(datascriptsDIR)/old2v220.pl $(homedir)/.$$install_target > updated; \
	    $(INSTALL_DATA) updated $(homedir)/.$$install_target; \
	  else \
	    if test -n "$(AWK)"; \
	    then \
	      echo "$(AWK) updates possibly old-style \`$(homedir)/.$$install_target'"; \
	      $(AWK) -f $(srcdir)/$(datascriptsDIR)/old2v220.awk $(homedir)/.$$install_target > updated; \
	      $(INSTALL_DATA) updated $(homedir)/.$$install_target; \
	    else \
	      echo "Unable to update possibly old-style file \`$(homedir)/.$$install_target', missing \`awk' and \`perl'"; \
	      echo "Installing \`$(srcdir)/$$install_target' as \`$(homedir)/.$$install_target' instead"; \
	      $(INSTALL_DATA) $(srcdir)/$$install_target $(homedir)/.$$install_target; \
	    fi; \
	  fi; \
	  rm -f updated; \
	else \
	  echo "Installing \`$(dataGCALRCFILE)' as \`$(homedir)/.$$install_target'"; \
	  $(INSTALL_DATA) $(dataGCALRCFILE) $(homedir)/.$$install_target; \
	fi; \
	echo "Data file \`$(homedir)/.$$install_target' installed/updated"
	@for file in $(dataREADMEFILE) $(dataEXAMPLEFILES); \
	do \
	  install_target=$(packagedatadir)/`echo "$$file" | sed -e 's,.*/,,'`; \
	  echo "Installing \`$$file' as \`$$install_target'"; \
	  $(INSTALL_DATA) $$file $$install_target; \
	done; \
	if test -n "$(BINPERMS)"; \
	then \
	  chmod $(BINPERMS) $(packagedatadir); \
	else \
	  chmod $(BINPERMS2) $(packagedatadir); \
	fi
	@echo "Example data files installed"

#
# Only if a reminder/appointment file is NOT found in `$packagedatadir', it is
# installed, otherwise updated (`perl' preferred) because it could be old-style.
# Some documentation texts and all existing conversion scripts are also installed.
#
installdates: $(datacalendarsFILES) $(datadatesFILES) $(datadatesMISCFILES) installdirs
	$(NORMAL_INSTALL)
	@if test -n "$(AWK)" || test -n "$(PERL)"; \
	then \
	  for file in $(datacalendarsFILES); \
	  do \
	    install_target=$(packagedatadir)/`echo "$$file" | sed -e 's,.*/,,'`; \
	    if test -f "$$install_target"; \
	    then \
	      if test -n "$(CP)"; \
	      then \
	        $(CP) $$install_target updated; \
	      else \
	        cat $$install_target > updated; \
	      fi; \
	      if test -n "$(PERL)"; \
	      then \
	        echo "$(PERL) updates possibly old-style file \`$$install_target'"; \
	        $(PERL) $(srcdir)/$(datascriptsDIR)/old2v220.pl updated > $$install_target; \
	      else \
	        echo "$(AWK) updates possibly old-style file \`$$install_target'"; \
	        $(AWK) -f $(srcdir)/$(datascriptsDIR)/old2v220.awk updated > $$install_target; \
	      fi; \
	    else \
	      if test -n "$(PERL)"; \
	      then \
	        echo "$(PERL) installs \`$$file' as \`$$install_target'"; \
	        $(PERL) $(srcdir)/$(datascriptsDIR)/cal2gcal.pl $$file > $$install_target; \
	      else \
	        echo "$(AWK) installs \`$$file' as \`$$install_target'"; \
	        $(AWK) -f $(srcdir)/$(datascriptsDIR)/cal2gcal.awk $$file > $$install_target; \
	      fi; \
	    fi; \
	    if test -n "$(SRCPERMS)"; \
	    then \
	      chmod $(SRCPERMS) $$install_target; \
	    else \
	      chmod $(SRCPERMS2) $$install_target; \
	    fi; \
	  done; \
	  for file in $(datadatesFILES); \
	  do \
	    install_target=$(packagedatadir)/`echo "$$file" | sed -e 's,.*/,,'`; \
	    if test -f "$$install_target"; \
	    then \
	      if test -n "$(CP)"; \
	      then \
	        $(CP) $$install_target updated; \
	      else \
	        cat $$install_target > updated; \
	      fi; \
	      if test -n "$(PERL)"; \
	      then \
	        echo "$(PERL) updates possibly old-style file \`$$install_target'"; \
	        $(PERL) $(srcdir)/$(datascriptsDIR)/old2v220.pl updated > $$install_target; \
	      else \
	        echo "$(AWK) updates possibly old-style file \`$$install_target'"; \
	        $(AWK) -f $(srcdir)/$(datascriptsDIR)/old2v220.awk updated > $$install_target; \
	      fi; \
	    else \
	      if test -n "$(PERL)"; \
	      then \
	        echo "$(PERL) installs \`$$file' as \`$$install_target'"; \
	        $(PERL) $(srcdir)/$(datascriptsDIR)/ct2gcal.pl $$file > $$install_target; \
	      else \
	        echo "$(AWK) installs \`$$file' as \`$$install_target'"; \
	        $(AWK) -f $(srcdir)/$(datascriptsDIR)/ct2gcal.awk $$file > $$install_target; \
	      fi; \
	    fi; \
	    if test -n "$(SRCPERMS)"; \
	    then \
	      chmod $(SRCPERMS) $$install_target; \
	    else \
	      chmod $(SRCPERMS2) $$install_target; \
	    fi; \
	  done; \
	  rm -f updated; \
	  for file in $(datadatesMISCFILES); \
	  do \
	    install_target=$(packagedatadir)/`echo "$$file" | sed -e 's,.*/,,'`; \
	    echo "Installing \`$$file' as \`$$install_target.$(datadatesDIR)'"; \
	    $(INSTALL_DATA) $$file $$install_target.$(datadatesDIR); \
	  done; \
	  for file in $(datascriptsFILES); \
	  do \
	    install_target=$(packagedatadir)/`echo "$$file" | sed -e "s,^$(srcdir)/,,"`; \
	    echo "Installing \`$$file' as \`$$install_target'"; \
	    $(INSTALL_DATA) $$file $$install_target; \
	  done; \
	  if test -n "$(BINPERMS)"; \
	  then \
	    chmod $(BINPERMS) $(packagedatadir); \
	    chmod $(BINPERMS) $(packagedatadir)/$(datascriptsDIR); \
	  else \
	    chmod $(BINPERMS2) $(packagedatadir); \
	    chmod $(BINPERMS2) $(packagedatadir)/$(datascriptsDIR); \
	  fi; \
	  echo "Reminder/appointment files and conversion scripts installed/updated"; \
	else \
	  echo "Unable to install/update reminder/appointment files, missing \`awk' and \`perl'"; \
	fi

uninstall:
	$(NORMAL_UNINSTALL)
	-uninstall_target=`echo "$(dataGCALRCFILE)" | sed -e 's,.*/,,'`; \
	rm -f $(homedir)/.$$uninstall_target; \
	if test -n "$(AWK)" || test -n "$(PERL)"; \
	then \
	  for file in $(datacalendarsFILES) $(datadatesFILES); \
	  do \
	    uninstall_target=$(packagedatadir)/`echo "$$file" | sed -e 's,.*/,,'`; \
	    rm -f $$uninstall_target; \
	  done; \
	  for file in $(datadatesMISCFILES); \
	  do \
	    uninstall_target=$(packagedatadir)/`echo "$$file" | sed -e 's,.*/,,'`; \
	    rm -f $$uninstall_target.$(datadatesDIR); \
	  done; \
	  for file in $(dataREADMEFILE) $(dataEXAMPLEFILES); \
	  do \
	    uninstall_target=$(packagedatadir)/`echo "$$file" | sed -e 's,.*/,,'`; \
	    rm -f $$uninstall_target; \
	  done; \
	  for file in $(datascriptsFILES); \
	  do \
	    uninstall_target=$(packagedatadir)/`echo "$$file" | sed -e "s,^$(srcdir)/,,"`; \
	    rm -f $$uninstall_target; \
	  done; \
	  rmdir $(packagedatadir)/$(datascriptsDIR); \
	  rmdir $(packagedatadir) 2>/dev/null; \
	else \
	  : ; \
	fi
	@echo "Reminder/appointment/data files of distribution uninstalled"

#### End of install section. ####



#### Start of clean section. ####

clean:
	-rm -f updated

distclean: clean
	-rm -f Makefile

mostlyclean: distclean

realclean: distclean
	-rm -f id ID tags TAGS

maintainer-clean: realclean
	@echo "This command is intended for maintainers to use;"
	@echo "it deletes files that may require special tools to rebuild."

#### End of clean section. ####



dist dist-$(PACKAGE) distzip distzoo distlha distshar MANIFEST: Makefile $(DISTFILES)

Makefile: $(srcdir)/Makefile.in ../config.status
	cd .. \
	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \
	       $(SHELL) ./config.status



# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

# End of file
