#
#               Copyright (c) 1999-2002 Georg Huettenegger
#

# common defines (like VERSION)
include src/common.mak

# used for the console binary packages
CPACKAGE=plextor-tool
CFROM=console-tgz
CFROMSTATIC=console-tgz-static
WINCFROM=console-win32
WINDIR=$(CPACKAGE)-$(VERSION)-x86-win32

# used for the gnome binary packages
GPACKAGE=plextor-tool-applet
GFROM=gnome-tgz
GFROMSTATIC=gnome-tgz-static

# used for the src tgz
PLEX_DIR=plextor-tool/
SRC_FILES=`find plextor-tool/src -name *.[ch]`
TBZ_DIRS=$(PLEX_DIR)console-* $(PLEX_DIR)gnome-* $(PLEX_DIR)doc
TBZ_FILES=$(PLEX_DIR)Makefile $(PLEX_DIR)src/Makefile*\
	$(PLEX_DIR)src/common.mak $(PLEX_DIR)src/.depend\
	$(PLEX_DIR)src/plextor-tool.* $(PLEX_DIR)src/plextor-tool-applet.*\
	$(PLEX_DIR)src/TODO $(PLEX_DIR)README $(SRC_FILES)

x86-linux:	console-x86-c6 gnome-x86-c6 gnome-x86-c6-static

x86-rpm:	console-x86-rpm gnome-x86-rpm-static gnome-x86-rpm

x86-rh62:	console-x86-rh62 gnome-x86-rh62 gnome-x86-static-rh62

x86-rpm-rh62:	console-x86-rpm-rh62 gnome-x86-rpm-rh62 gnome-x86-rpm-static-rh62

alpha:	console-alpha console-alpha-static

ppc:	console-ppc console-ppc-static gnome-ppc gnome-ppc-static

gnome-x86-rh62:
	/bin/mkdir $(GPACKAGE)-$(VERSION)-x86-glibc-rh62
	/bin/cp $(GFROM)/* $(GPACKAGE)-$(VERSION)-x86-glibc-rh62
	/bin/tar cjvf $(GPACKAGE)-$(VERSION)-x86-glibc-rh62.tar.bz2 $(GPACKAGE)-$(VERSION)-x86-glibc-rh62
	rm -rf $(GPACKAGE)-$(VERSION)-x86-glibc-rh62

gnome-x86-static-rh62:
	/bin/mkdir $(GPACKAGE)-$(VERSION)-x86-glibc-static-rh62
	/bin/cp $(GFROMSTATIC)/* $(GPACKAGE)-$(VERSION)-x86-glibc-static-rh62
	/bin/tar cjvf $(GPACKAGE)-$(VERSION)-x86-glibc-static-rh62.tar.bz2 $(GPACKAGE)-$(VERSION)-x86-glibc-static-rh62
	rm -rf $(GPACKAGE)-$(VERSION)-x86-glibc-static-rh62

gnome-x86-c6:
	/bin/mkdir $(GPACKAGE)-$(VERSION)-x86-glibc
	/bin/cp $(GFROM)/* $(GPACKAGE)-$(VERSION)-x86-glibc
	/bin/tar cjvf $(GPACKAGE)-$(VERSION)-x86-glibc.tar.bz2 $(GPACKAGE)-$(VERSION)-x86-glibc
	rm -rf $(GPACKAGE)-$(VERSION)-x86-glibc

gnome-x86-c6-static:
	/bin/mkdir $(GPACKAGE)-$(VERSION)-x86-glibc-static
	/bin/cp $(GFROMSTATIC)/* $(GPACKAGE)-$(VERSION)-x86-glibc-static
	/bin/tar cjvf $(GPACKAGE)-$(VERSION)-x86-glibc-static.tar.bz2 $(GPACKAGE)-$(VERSION)-x86-glibc-static
	rm -rf $(GPACKAGE)-$(VERSION)-x86-glibc-static

gnome-x86-rpm:
	$(MAKE) -C gnome-rpm

gnome-x86-rpm-static:
	$(MAKE) -C gnome-rpm-static
	mv $(GPACKAGE)-$(VERSION)-1.$(HOSTTYPE).rpm $(GPACKAGE)-static-$(VERSION)-1.$(HOSTTYPE).rpm 

gnome-x86-rpm-rh62:
	$(MAKE) -C gnome-rpm
	mv $(GPACKAGE)-$(VERSION)-1.$(HOSTTYPE).rpm $(GPACKAGE)-rh62-$(VERSION)-1.$(HOSTTYPE).rpm 

gnome-x86-rpm-static-rh62:
	$(MAKE) -C gnome-rpm-static
	mv $(GPACKAGE)-$(VERSION)-1.$(HOSTTYPE).rpm $(GPACKAGE)-static-rh62-$(VERSION)-1.$(HOSTTYPE).rpm 

gnome-ppc:
	/bin/mkdir $(GPACKAGE)-$(VERSION)-ppc-glibc
	/bin/cp $(GFROM)/* $(GPACKAGE)-$(VERSION)-ppc-glibc
	/bin/tar czvf $(GPACKAGE)-$(VERSION)-ppc-glibc.tar.gz $(GPACKAGE)-$(VERSION)-ppc-glibc
	rm -rf $(GPACKAGE)-$(VERSION)-ppc-glibc

gnome-ppc-static:
	/bin/mkdir $(GPACKAGE)-$(VERSION)-ppc-glibc-static
	/bin/cp $(GFROMSTATIC)/* $(GPACKAGE)-$(VERSION)-ppc-glibc-static
	/bin/tar czvf $(GPACKAGE)-$(VERSION)-ppc-glibc-static.tar.gz $(GPACKAGE)-$(VERSION)-ppc-glibc-static
	rm -rf $(GPACKAGE)-$(VERSION)-ppc-glibc-static

console-x86-rh52:
	/bin/mkdir $(CPACKAGE)-$(VERSION)-x86-glibc-rh52
	/bin/cp $(CFROM)/* $(CPACKAGE)-$(VERSION)-x86-glibc-rh52
	/bin/tar czvf $(CPACKAGE)-$(VERSION)-x86-glibc-rh52.tar.gz $(CPACKAGE)-$(VERSION)-x86-glibc-rh52
	rm -rf $(CPACKAGE)-$(VERSION)-x86-glibc-rh52

console-x86-rh62:
	/bin/mkdir $(CPACKAGE)-$(VERSION)-x86-glibc-rh62
	/bin/cp $(CFROM)/* $(CPACKAGE)-$(VERSION)-x86-glibc-rh62
	/bin/tar cjvf $(CPACKAGE)-$(VERSION)-x86-glibc-rh62.tar.bz2 $(CPACKAGE)-$(VERSION)-x86-glibc-rh62
	rm -rf $(CPACKAGE)-$(VERSION)-x86-glibc-rh62

console-x86-c6:
	/bin/mkdir $(CPACKAGE)-$(VERSION)-x86-glibc
	/bin/cp $(CFROM)/* $(CPACKAGE)-$(VERSION)-x86-glibc
	/bin/tar cjvf $(CPACKAGE)-$(VERSION)-x86-glibc.tar.bz2 $(CPACKAGE)-$(VERSION)-x86-glibc
	rm -rf $(CPACKAGE)-$(VERSION)-x86-glibc

console-x86-rpm-rh52:
	rm -f console-rpm/plextor-tool.spec
	ln -s ../doc/plextor-tool.spec.old console-rpm/plextor-tool.spec
	$(MAKE) -C console-rpm
	mv $(CPACKAGE)-$(VERSION)-1.$(HOSTTYPE).rpm $(CPACKAGE)-rh52-$(VERSION)-1.$(HOSTTYPE).rpm
	rm -f console-rpm/plextor-tool.spec
	ln -s ../doc/plextor-tool.spec console-rpm/plextor-tool.spec

console-x86-rpm-rh62:
	$(MAKE) -C console-rpm
	mv $(CPACKAGE)-$(VERSION)-1.$(HOSTTYPE).rpm $(CPACKAGE)-rh62-$(VERSION)-1.$(HOSTTYPE).rpm

console-x86-rpm:
	$(MAKE) -C console-rpm

console-alpha:
	/bin/mkdir $(CPACKAGE)-$(VERSION)-alpha-glibc
	/bin/cp $(CFROM)/* $(CPACKAGE)-$(VERSION)-alpha-glibc
	/bin/tar czvf $(CPACKAGE)-$(VERSION)-alpha-glibc.tar.gz $(CPACKAGE)-$(VERSION)-alpha-glibc
	rm -rf $(CPACKAGE)-$(VERSION)-alpha-glibc

console-alpha-static:
	/bin/mkdir $(CPACKAGE)-$(VERSION)-alpha-glibc-static
	/bin/cp $(CFROMSTATIC)/* $(CPACKAGE)-$(VERSION)-alpha-glibc-static
	/bin/tar czvf $(CPACKAGE)-$(VERSION)-alpha-static.tar.gz $(CPACKAGE)-$(VERSION)-alpha-glibc-static
	rm -rf $(CPACKAGE)-$(VERSION)-alpha-glibc-static

console-ppc:
	/bin/mkdir $(CPACKAGE)-$(VERSION)-ppc-glibc
	/bin/cp $(CFROM)/* $(CPACKAGE)-$(VERSION)-ppc-glibc
	/bin/tar czvf $(CPACKAGE)-$(VERSION)-ppc-glibc.tar.gz $(CPACKAGE)-$(VERSION)-ppc-glibc
	rm -rf $(CPACKAGE)-$(VERSION)-ppc-glibc

console-ppc-static:
	/bin/mkdir $(CPACKAGE)-$(VERSION)-ppc-glibc-static
	/bin/cp $(CFROMSTATIC)/* $(CPACKAGE)-$(VERSION)-ppc-glibc-static
	/bin/tar czvf $(CPACKAGE)-$(VERSION)-ppc-static.tar.gz $(CPACKAGE)-$(VERSION)-ppc-glibc-static
	rm -rf $(CPACKAGE)-$(VERSION)-ppc-glibc-static

console-x86-win32:
	/bin/mkdir $(WINDIR)
	/bin/cp $(WINCFROM)/* $(CPACKAGE)-$(VERSION)-x86-win32
	unix2dos $(WINDIR)/README
	unix2dos $(WINDIR)/INSTALL
	unix2dos $(WINDIR)/COPYING
	unix2dos $(WINDIR)/NEWS
	gunzip $(WINDIR)/plextor-tool.8.gz
	unix2dos $(WINDIR)/plextor-tool.8
	/usr/bin/zip -r9 $(CPACKAGE)-$(VERSION)-x86-win32.zip $(WINDIR)
	rm -rf $(WINDIR)


tbz:
	cd .. ; tar cjvf $(PLEX_DIR)$(CPACKAGE)-$(VERSION).src.tar.bz2 $(TBZ_DIRS) $(TBZ_FILES)
