# ------------------------------------------------------------------------------
#
#   Copyright (c) 1999-2000 by Klaus Reger <K.Reger@twc.de>
#
#   You may distribute under the terms of either the GNU General Public
#   License as specified in the Perl README file.
#
#   THIS IS BETA SOFTWARE!
#
#   THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
#   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
#   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
#   $Id: Makefile.PL,v 1.5 2002/02/28 15:49:37 k_reger Exp $
#
# ------------------------------------------------------------------------------
# Program-Data
# ------------------------------------------------------------------------------
# Project  : WWWdb
# System   : Perl
# Program  :
# Module   : $RCSfile: Makefile.PL,v $
# Version  : $Revision: 1.5 $
# Date     : $Date: 2002/02/28 15:49:37 $
# State    : $State: Exp $
#
# Description:
#   FIXME: DESCRIPTION
#
# --- Known Bugs ---------------------------------------------------------------
# - Currently none
# --- TODO -------------------
# - Make a correct rpm
# ------------------------------------------------------------------------------
# Change-log:
#
# $Log: Makefile.PL,v $
# Revision 1.5  2002/02/28 15:49:37  k_reger
# - Install modules in normal way
#
# Revision 1.4  2000/10/12 14:05:31  k_reger
# - snapshot
#
# ------------------------------------------------------------------------------

use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile
('NAME'	     => 'WWWdb',
 'VERSION_FROM' => 'WWWdb.cgi', # finds $VERSION
 'PMLIBDIRS'    => ['WWWdb/', 'WWWdb/DbSession/', 'Apache'],
# 'PM'           => 
# {'WWWdb_TransUri.pm' => '$(INST_LIBDIR)/Apache/WWWdb_TransUri.pm',
#  'WWWdb/Base.pm'     => '$(INST_LIBDIR)/WWWdb/Base.pm',
# }
);



sub MY::postamble {
'
translate: po-files trans

po-files:
	for i in `find . \( -name "*.cgi" -o \
                            -name "*.p[lm]" -o \
                            -name "*.rc" \) -follow -print | sort`; \
        do \
            echo "$${i}"; \
            ./tools/CreatePoFiles.pl -d en "$${i}"; \
            ./tools/CreatePoFiles.pl -d de "$${i}"; \
        done;


trans:
	rm -f ./locale/en; \
	for i in `find . \( -name "*_en.po" \)  -follow -print | sort`; \
        do \
            echo "$${i}"; \
	    tools/MsgFormat.pl ./locale en < $${i} >/dev/null; \
        done; \
	rm -f ./locale/de; \
	for i in `find . \( -name "*_de.po" \)  -follow -print | sort`; \
        do \
            echo "$${i}"; \
	    tools/MsgFormat.pl ./locale de < $${i} >/dev/null; \
        done;

reorg:
	tools/TestWWWdb.pl -b New "wwwdb_devel/ffffffffffffffff/Default/WWWdb:NavCatReorg"


# This code is from Loic Dachary <loic@gnu.org>
# ------------------------------------------------------------------------
# Build source and binary rpms. As of rpm-3.0, the ~/.rpmmacros
# must contain the following line:
# %_topdir /home/loic/local/rpm
# and that /home/loic/local/rpm contains the directory SOURCES, BUILD etc.
#
PACKAGE = $(NAME)

rpm:
	RPM_TOPDIR=`rpm --showrc | $(PERL) -n -e \'print if(s/.*_topdir\s+(.*)/$$1/)\'` ; \
	cp $(PACKAGE).spec $$RPM_TOPDIR/SPECS ; \
	cp $(PACKAGE)-$(VERSION).tar.gz $$RPM_TOPDIR/SOURCES ; \
	rpm -ba --clean --rmsource $$RPM_TOPDIR/SPECS/$(PACKAGE).spec ; \
	mv $$RPM_TOPDIR/RPMS/i386/$(PACKAGE)-$(VERSION)-1.i386.rpm . ; \
	mv $$RPM_TOPDIR/SRPMS/$(PACKAGE)-$(VERSION)-1.src.rpm .

#
# After this go to sourceforge.net/projects/unac, login, click file release
# and follow instructions.
#
distribute:
	ncftpput -V download.sourceforge.net /incoming $(PACKAGE)-$(VERSION)-1.i386.rpm
	ncftpput -V download.sourceforge.net /incoming $(PACKAGE)-$(VERSION)-1.src.rpm
	ncftpput -V download.sourceforge.net /incoming $(PACKAGE)-$(VERSION).tar.gz
';
}
