OS	= @OS@
ARCH	= @ARCH@
ROOT	= @ROOT@
EXEEXT	= @EXEEXT@
XPAFLAGS= @XPAFLAGS@
TKTABLEFLAGS = @TKTABLEFLAGS@
JOBS	= 1

include ./make.include

#--------------------------build

.PHONY	: saods9 tcl tk tkwin

saods9	: dirs tcl tk \
	tclxml xmlrpc xpa \
	tkblt tktable tkimg \
	tkmpeg tkhtml tkcon \
	tkwin \
	tksao ds9
# gcc- tclxml xpa tktable tkimg
# posix- tclcheckdns tcliis tclsignal

# no parallel
tcl	: $(TCLDIR)/win/Makefile
	@echo ""
	@echo "*** Install $(TCLDIR) ***"
	$(MAKE) -C $(TCLDIR)/win install

$(TCLDIR)/win/Makefile :
	@echo ""
	@echo "*** Configure $(TCLDIR) ***"
	cd $(TCLDIR)/win; \
	./configure \
	--prefix $(ROOT) -exec-prefix $(ROOT) \
	--disable-shared --enable-symbols

# no parallel
tk	: $(TKDIR)/win/Makefile
	@echo ""
	@echo "*** Install $(TKDIR) ***"
	$(MAKE) -C $(TKDIR)/win install

$(TKDIR)/win/Makefile :
	@echo ""
	@echo "*** Configure $(TKDIR) ***"
	cd $(TKDIR)/win; \
	./configure \
	$(TKFLAGS) \
	--prefix $(ROOT) -exec-prefix $(ROOT) \
	--disable-shared --enable-symbols

tkwin: $(TKWINDIR)/Makefile
	@echo ""
	@echo "*** Installing $(TKWINDIR) ***"
	$(MAKE) -C $(TKWINDIR) -j $(JOBS) install

$(TKWINDIR)/Makefile :
	@echo ""
	@echo "*** Configure $(TKWINDIR) ***"
	cd $(TKWINDIR); \
	./configure \
	$(WITHTK) \
	--prefix $(ROOT) --exec-prefix $(ROOT) \
	--disable-shared --enable-symbols

#--------------------------clean

.PHONY	: tkwinclean

tkwinclean :
	$(MAKE) -C $(TKWINDIR) clean

#--------------------------distclean

.PHONY	: tkwindistclean

tkwindistclean :
	$(MAKE) -C $(TKWINDIR) distclean

#--------------------------distribution

.PHONY	: dist

dist	: all
	cd bin; tar cvf - ds9$(EXEEXT) $(ZIPFILE) | gzip > dist/ds9.$(ARCH).$(DS9VERSION).tar.gz

