# $Id: Makefile,v 1.1.2.18 2001/03/12 19:21:48 oliver Exp $
# 
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
# 
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
# 
# The Original Code is Freedom code.
# 
# The Initial Developer of the Original Code is Zero-Knowledge Systems,
# Inc.  Portions created by Zero-Knowledge are Copyright (C) 2000
# Zero-Knowledge Systems, Inc.  All Rights Reserved.
# 
# Contributor(s):

# 
# Default target
#

default::
	@echo "Will only build the package target"

# Get the variables definition
include $(ZK_ROOT)/freedom/client/makefiles/Makefile.vars

# Get the target rules
include $(ZK_ROOT)/freedom/makefiles/Makefile.targs

SPECFILE := freedomclient$(ZK_RPM_CONFIG).spec
SPECTMPL := freedomclient.spec.tmpl


PKG_HTML := \
	$(notdir $(wildcard userdocs/html/*.htm)) \
	$(END_OF_LIST)

PKG_GIF := \
	$(notdir $(wildcard userdocs/images/*.gif)) \
	$(END_OF_LIST)

PKG_DOC := \
	LICENSE \
	RELEASE \
	INSTALL.DRIVER\
	$(END_OF_LIST)


package:: exes
	@$(ZK_SCRIPTDIR)/promoteFiles.pl userdocs/html   $(ZK_PKG_CLIENT_ROOT)/usr/share/freedom/doc/html $(PKG_HTML)
	@$(ZK_SCRIPTDIR)/promoteFiles.pl userdocs/images $(ZK_PKG_CLIENT_ROOT)/usr/share/freedom/doc/images $(PKG_GIF)
	@$(ZK_SCRIPTDIR)/promoteFiles.pl userdocs	 $(ZK_PKG_CLIENT_ROOT)/usr/share/freedom/doc $(PKG_DOC)
	@$(ZK_SCRIPTDIR)/promoteFiles.pl .        $(ZK_PKG_CLIENT_ROOT)/usr/share/freedom/ ping
	@$(ZK_SCRIPTDIR)/promoteFiles.pl .        $(ZK_PKG_CLIENT_ROOT)/usr/share/freedom/ diags.sh
	@$(ZK_SCRIPTDIR)/promoteFiles.pl .        $(ZK_PKG_CLIENT_ROOT)/usr/share/gnome/apps/Internet/ freedom.desktop
	@$(ZK_SCRIPTDIR)/promoteFiles.pl .        $(ZK_PKG_CLIENT_ROOT)/usr/share/pixmaps/ freedom_icon.png



# Add new targets or complement default target using :: rules
package::
	@if [ ! -d "$(ZK_BUILDDIR_RPMS)/RPMS/i386" ]; then mkdir -p "$(ZK_BUILDDIR_RPMS)/RPMS/i386"; fi
	@-rm -f $(SPECFILE)
	sed -e "s/%BUILDDATE%/`date +%Y.%m%d`/" -e "s/%CONFIG%/$(ZK_RPM_CONFIG)/" -e "s/%BUILDNUMBER%/$(ZK_BUILDNO)/" -e "s/%RPMCONFIG%/$(ZK_CONFIG)/" -e "s/%ZK_VERMAJOR%/$(ZK_VERMAJOR)/" -e "s/%ZK_VERMINOR%/$(ZK_VERMINOR)/" < $(SPECTMPL) > $(SPECFILE)
	unset ENV; rpm --define "_topdir $(ZK_BUILDDIR_RPMS)" --buildroot="$(ZK_PKG_CLIENT_ROOT)" -bb $(SPECFILE)

clean::
	-rm -f $(ZK_BUILDDIR_RPMS)/RPMS/i386/*.rpm $(SPECFILE)
