# BEGIN COPYRIGHT BLOCK
# Copyright (C) 2001 Sun Microsystems, Inc.  Used by permission.
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#

# END COPYRIGHT BLOCK
# gmake		      to make L10N Package and Pseudo Package

# Override Options:
# gmake MMDD=mmdd
#       PKG_US=USServerProductDirectory  (input)
#       PKG_LANG=L10NPackageDirectory    (output)
#       PKG_XX=PseudoPackageDirectory    (output)

BUILD_ROOT = ../..

include $(BUILD_ROOT)/nsconfig.mk

ifndef MMDD
MMDD = $(shell date +%m.%d)
endif

ifeq ($(OS), Windows_NT)

PKG_US_T = $(BUILD_ROOT)/built/package/$(NSOBJDIR_NAME)
PKG_LANG_T = $(PKG_US_T)_lang
PKG_XX_T = $(PKG_US_T)_xx

else
# UNIX

PKG_US_T = $(BUILD_ROOT)/built/package/$(NSOBJDIR_NAME)
PKG_LANG_T = $(PKG_US_T)_lang
PKG_XX_T = $(PKG_US_T)_xx

endif
# end if(OS)

# use paths generated above unless overridden

ifndef PKG_US
PKG_US = $(PKG_US_T)
endif

ifndef PKG_LANG
PKG_LANG = $(PKG_LANG_T)
endif

ifndef PKG_XX
PKG_XX = $(PKG_XX_T)
endif

ifeq ($(OS), Windows_NT)
PATH_SEP=;
JRE=jre
else
PATH_SEP=:
JRE= $(COMPONENTS_DIR)/admin-jdk/$(NSCONFIG)/jdk1.1.6/bin/jre
endif
PSEUDOALL_CLASSPATH=$(OBJDIR)/pseudoall


MKDIR = mkdir -p

BuildNumDat = $(BUILD_ROOT)/$(BUILD_ARCH)/buildnum.dat
PumpkinDat  = $(BUILD_ROOT)/pumpkin.dat

all: report $(BuildNumDat) $(PumpkinDat) pseudoall
	@echo ==

report:
	@echo ""
	@echo "Make L10N Package and Pseudo Package for $(BUILD_MODULE)"
	@echo ""
	@echo "From US Server Product in"
	@echo "  $(PKG_US)"
	@echo "Make L10N Package in"
	@echo "  $(PKG_LANG)"
	@echo "Make Pseudo Package in"
	@echo "  $(PKG_XX)"
	@echo ""

$(PumpkinDat):
	cd ../../; $(PERL) pumpkin.pl $(PUMPKIN_AGE) pumpkin.dat

$(BuildNumDat):
	if test ! -d ../../$(BUILD_ARCH); then $(MKDIR) ../../$(BUILD_ARCH); fi;
	cd ../../dategen; $(MAKE) buildnum BUILD_MODULE=$(BUILD_MODULE) $(MAKEFLAGS)
	../../built/$(NSOBJDIR_NAME)/buildnum ../../$(BUILD_ARCH)

pseudoall:
	cd ../pseudoall; $(MAKE) $(MAKEFLAGS)
