include config

#version = $(shell date +"%d%m%y")
version = 1.05.00
osname=$(shell uname -s)
hardware=$(shell uname -m)
heptdir = heptagon-$(version)
heptbindir=$(heptdir)-$(osname)-$(hardware)

binary-distrib:
# main directory
	mkdir -p export/$(heptbindir)
# binaries
	mkdir -p export/$(heptbindir)/bin
	(cd compiler/; $(MAKE))
	cp compiler/$(COMPILER).$(TARGET) export/$(heptbindir)/bin/$(COMPILER)
	cp compiler/$(SIMULATOR).$(TARGET) export/$(heptbindir)/bin/$(SIMULATOR)
# libraries
	(cd lib; $(MAKE))
	cp -r lib export/$(heptbindir)
# examples
	cp -r examples export/$(heptbindir)
# tests
	mkdir -p export/$(heptbindir)/test
	cp -r test/bad test/good test/sdc test/image_filters test/scripts test/CTestTestfile.cmake export/$(heptbindir)/test
# manual
	mkdir -p export/$(heptbindir)/manual
	cp manual/heptagon-manual.pdf manual/heptreax-manual.pdf export/$(heptbindir)/manual
# Makefile, config, INSTALL
	cp config export/$(heptbindir)
	cp Makefile-bin export/$(heptbindir)/Makefile
	cp manual/INSTALL export/$(heptbindir)
	cd export; tar czf $(heptbindir).tar.gz $(heptbindir)


source-distrib:
# main directory
	mkdir -p export/$(heptdir)
# sources
	cp -r compiler export/$(heptdir)
# libraries
	cp -r lib export/$(heptdir)
# examples
	cp -r examples export/$(heptdir)
# tests
	mkdir -p export/$(heptdir)/test
	cp -r test/bad test/good test/image_filters test/scripts test/CTestTestfile.cmake export/$(heptdir)/test
# manual
	mkdir -p export/$(heptdir)/manual
	cp manual/heptagon-manual.pdf manual/heptreax-manual.pdf export/$(heptdir)/manual
# Makefile, config.in, configure, install-sh, INSTALL, COPYING
	cp config.in export/$(heptdir)
	cp configure export/$(heptdir)
	cp install-sh export/$(heptdir)
	cp Makefile export/$(heptdir)
	cp COPYING export/$(heptdir)
	cp manual/INSTALL export/$(heptdir)
	cd export; tar czf $(heptdir).tar.gz --exclude _build $(heptdir)