# Makefile

# change these to the install prefix and exec-prefix values
prefix = @prefix@
exec_prefix = @exec_prefix@

# directories in which to run make
subdirs = tclutil astrotcl rtd cat skycat

# Note: add --enable-merge if you want to merge object files into the 
# skycat, rtd and cat shared libraries (for backward compatibility)
CONFIGURE = configure --prefix=$(prefix) --exec_prefix=$(exec_prefix)

all install clean: FORCE
	@set -x; for i in $(subdirs); do (cd $$i && $(MAKE) $@ || exit 1) done

# Run "configure" and "make all install" in the subdirectories
All: $(subdirs)

release: FORCE
	(cd skycat; $(MAKE) release)

distclean: FORCE
	@set -x; for i in $(subdirs) ; do (cd $$i && $(MAKE) distclean) ; done
	rm -rf autom4te.cache config.status config.log configure */configure Makefile

# run configure and make in individual dirs
tclutil: tclutil/configure FORCE
	(cd tclutil && $(CONFIGURE) && $(MAKE) && $(MAKE) install)

astrotcl: astrotcl/configure FORCE
	(cd astrotcl && $(CONFIGURE) && $(MAKE) && $(MAKE) install)

cat: cat/configure FORCE
	(cd cat && $(CONFIGURE) && $(MAKE) && $(MAKE) install)

rtd: rtd/configure FORCE
	(cd rtd && $(CONFIGURE) && $(MAKE) && $(MAKE) install)

skycat: skycat/configure FORCE
	(cd skycat && $(CONFIGURE) && $(MAKE) && $(MAKE) install)

# run autoconf
autoconf: configure tclutil/configure astrotcl/configure rtd/configure cat/configure skycat/configure

# run autoconf and configure
config: configure tclutil/configure astrotcl/configure rtd/configure cat/configure skycat/configure
	$(CONFIGURE)

configure: configure.in
	autoconf

tclutil/configure: tclutil/configure.in tclutil/aclocal.m4 tclconfig/tcl.m4
	(cd tclutil; autoconf)

astrotcl/configure: astrotcl/configure.in astrotcl/aclocal.m4 tclconfig/tcl.m4
	(cd astrotcl; autoconf)

rtd/configure: rtd/configure.in rtd/aclocal.m4 tclconfig/tcl.m4
	(cd rtd; autoconf)

cat/configure: cat/configure.in cat/aclocal.m4 tclconfig/tcl.m4 
	(cd cat; autoconf)

skycat/configure: skycat/configure.in skycat/aclocal.m4 tclconfig/tcl.m4
	(cd skycat; autoconf)

FORCE:
