#$Id: Makefile,v 1.7 2006/08/20 21:03:03 jwrobel Exp $
include components/common.mk

FK_VERSION = 0.2.1
MIN_VERSION = 1.5.0.0
MAX_VERSION = 2.0b1
UPDATE_URL = http://firekeeper.mozdev.org/update-$(PLATFORM).rdf.php

INSTALL_FILE = firekeeper$(FK_VERSION)-$(PLATFORM).xpi
SRCDIR = ../downloads/firekeeper$(FK_VERSION)-src
ifeq ($(PLATFORM), windows)
	DYNAMIC_LIB = firekeeper.dll	
else
	DYNAMIC_LIB = firekeeper.so
endif

SUBDIRS = components

.PHONY: bin-release src-release clean $(SUBDIRS)

all: clean bin-release src-release
bin-release: $(SUBDIRS) 
	FK_VERSION=$(FK_VERSION) MIN_VERSION=$(MIN_VERSION) \
	MAX_VERSION=$(MAX_VERSION) UPDATE_URL=$(UPDATE_URL) \
	INSTALL_FILE=$(INSTALL_FILE) PLATFORM=$(PLATFORM) ./genrdfs.sh;
	mkdir -p release/components;
	mv components/*xpt components/$(DYNAMIC_LIB) release/components/;
	cp -r defaults chrome release/;
	cp chrome.manifest COPYING release/;	
	mv install.rdf release/;
	find release \( -name 'CVS' \) -type d|xargs rm -rf;		
	sh -c "cd release; zip -r $(INSTALL_FILE) *;"
	mv release/$(INSTALL_FILE) ../downloads;
	mv update\-$(PLATFORM).rdf.php ../www;
	rm -rf release;
src-release: 	
	rm -rf $(SRCDIR);
	$(MAKE) -C components clean
	mkdir $(SRCDIR);
	cp -r * $(SRCDIR);
	find $(SRCDIR) \( -name 'CVS' \) -type d|xargs rm -rf;
	sh -c "cd ../downloads; tar cvfz firekeeper$(FK_VERSION)-src.tar.gz firekeeper$(FK_VERSION)-src;"
	rm -rf $(SRCDIR);

$(SUBDIRS):
	$(MAKE) -C $@

clean:
	find . \( -name '*~' \) -type f|xargs rm -f;		
	rm -rf release;

