# A makefile for constructing the .tar.gz and .zip files that
# make up an I-X release.

# Updated: Mon Mar 10 15:43:08 2008 by Jeff Dalton

# This file is normally used from the main I-X directory, which is
# two levels above the "development/etc" directory that contains this file.
# The archives are normally on ../test relative the the main I-X dir.

# The archive files have ix-${Version} as the top level of their
# contents.  That is, when unpacked they create an ix-${Version}
# directory and put everything in that.

# Usually, the user (in the main I-X dir) types 

#   make -f development/Makefile release-archives

# which uses the main Makefile to invoke this one.

# However, to manually make specific targets (rather than "all"),
# or to specify a version, do something like this, assuming that
# you are in the main I-X dir and that it is called ix-4.x:

# (cd ..; make -n Version=4.x -f ix-4.x/development/etc/release-makefile apps)

IX=ix-${Version}

TO=test

.PHONY: all full core source owl-s apps

all: full core source owl-s apps

full:
	tar -zc --exclude ${IX}/apps/co-opr2 \
		-f ${TO}/${IX}-`date +%d%h%y`.tar.gz ${IX}

core:
	zip -r ${TO}/${IX}-core.zip \
		${IX}/readme.html \
		${IX}/licence.html \
		${IX}/IX-Copyright.txt \
		${IX}/ix \
		${IX}/ix.exe \
		${IX}/IX-Mac.app \
		${IX}/ix.jar \
		${IX}/imports/*.{jar,txt,html} \
		${IX}/imports/jena2 \
		${IX}/scripts \
		${IX}/doc/*.{pdf,txt,html,gif,jpg} \
		${IX}/doc/{xml-syntax,plans,notes,images} \
		${IX}/wizard \
		${IX}/comms/jabber \
		${IX}/apps/idemo-basic \
		${IX}/apps/idemo-coop \
		${IX}/apps/isample \
		${IX}/apps/ime \
		${IX}/apps/addon \
		${IX}/apps/postix \
		${IX}/apps/idemo-sl

# /\/: Include test-related dirs in the "source" zip or in a separate "test"?

source:
	rm -f /tmp/ix-exclude
	echo "*.class" > /tmp/ix-exclude
	echo "*.jar" >> /tmp/ix-exclude
	zip -r ${TO}/${IX}-src.zip \
		${IX}/IX-Copyright.txt \
		${IX}/Makefile \
		${IX}/doc/javadoc \
		${IX}/development \
		${IX}/etc \
		-x@/tmp/ix-exclude

owl-s:
	zip -r ${TO}/${IX}-owl-s.zip \
		${IX}/IX-Copyright.txt \
		${IX}/doc/owl-s.html \
		${IX}/etc/ix-with-owl-s.jar \
		${IX}/etc/all-imports-for-owl-s.jar \
		${IX}/imports/owl-s

### Application .zip files

Apps = apps-cosarts apps-co-opr apps-co-opr2 apps-eresponse apps-kobe \
	apps-extras

.PHONY: ${Apps}

apps: ${Apps}

apps-cosarts:
	zip -r ${TO}/${IX}-apps-cosarts.zip \
		${IX}/IX-Copyright.txt \
		${IX}/doc/apps.html \
		${IX}/apps/cosarts

#               ${IX}/comms/grid \
#               ${IX}/comms/kaos

apps-co-opr:
	zip -r ${TO}/${IX}-apps-co-opr.zip \
		${IX}/IX-Copyright.txt \
		${IX}/doc/apps.html \
		${IX}/apps/co-opr

apps-co-opr2:
	zip -r ${TO}/${IX}-apps-co-opr2.zip \
		${IX}/IX-Copyright.txt \
		${IX}/doc/apps.html \
		${IX}/apps/co-opr2

apps-eresponse:
	zip -r ${TO}/${IX}-apps-eresponse.zip \
		${IX}/IX-Copyright.txt \
		${IX}/doc/apps.html \
		${IX}/apps/eresponse

apps-kobe:
	zip -r ${TO}/${IX}-apps-kobe.zip \
		${IX}/IX-Copyright.txt \
		${IX}/doc/apps.html \
		${IX}/apps/kobe

apps-extras:
	zip -r ${TO}/${IX}-apps-extras.zip \
		${IX}/IX-Copyright.txt \
		${IX}/doc/apps.html \
		${IX}/apps/aibo

#		${IX}/apps/mars \
#		${IX}/apps/irescue \
#		${IX}/apps/firegrid

# end
