usr/src/cmd/tomcat/Makefile.sfw
author Jon Tibble <meths@btinternet.com>
Fri, 10 Feb 2012 16:19:42 +0000
branchoi_151a
changeset 114 b6d40d0a7b17
parent 19 2551d5e2ae4a
child 74 fd34810c2c84
permissions -rw-r--r--
Added tag oi_151a_prestable1 for changeset b1282e88c680

#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
#
#ident	"@(#)Makefile.sfw	1.25	10/07/12 SMI"
#

include ../Makefile.cmd

# this is the source tarball that gives you what you need to
# actually download and build all the *real* source.

VER = 		apache-tomcat-$(COMPONENT_VERSION:sh)-src
TARBALL =	$(VER).tar.gz
PATCHES:sh =	echo Patches/*.patch
COMMON_DBCP =	commons-dbcp-1.2.2-src

GPATCH_FLAGS =	-p1 --no-backup-if-mismatch
UNPACKARCHIVE=	TAR=/usr/bin/gtar $(SRC)/tools/unpack-archive

TCLIB_DIR=$(COMPONENT_TOP)/libs

# No, not ANT_HOME since user builds might have ANT_HOME
# set in the environment.
ANTHOME=$(SRC)/lib/ant/jakarta-ant
ANTCMD=$(ANTHOME)/bin/ant	# invoke this to run 'ant' within the makefile

BUILD_PROPERTIES=build.properties

CLEANDIRS=$(VER) $(TCLIB_DIR)
CLEANFILES=$(BUILD_PROPERTIES)

all: $(VER)

JDK=$(JAVA_ROOT)
SFW_PATH="$(SPRO_VROOT)/bin:$(ANTHOME)/bin:$(JDK)/bin:$(PATH)"

install: all
	TOMCATSRC=$(VER) $(SHELL) ./install-tomcat

$(VER): lib
	 (cd $(VER); unset ANT_HOME || true; env \
	  JAVA_HOME=$(JDK) \
	  PATH=$(SFW_PATH) \
	  "ANT_HOME=$(ANTHOME)" \
	   $(ANTCMD) )

lib: $(BUILD_PROPERTIES) $(TCLIB_DIR)
	cp $(BUILD_PROPERTIES) $(VER)
	(cd $(VER); unset ANT_HOME || true; env \
	    JAVA_HOME=$(JDK) \
	    PATH=$(SFW_PATH) \
	    "ANT_HOME=$(ANTHOME)" \
	    $(ANTCMD) download)

# we create build.properties for use by the $(VER) target, but we can't
# directly create the file where the build wants it, since the $(VER)
# directory possibly won't yet exist when this target runs.  So, we let
# the $(VER) target copy the file later.  build.properties.in is a
# copy of the build.properties file under the tomcat distribution
# 'build' directory, which we modify slightly so sed can fix it up
# for each individual workspace
#
# The "regular" build process for tomcat is interesting, in that
# if you just run 'ant', the default is to go and try to download
# all the components from the net first.  Since we don't want
# to do that every time we build, they have already been downloaded,
# we just need also to modify build.properties (using sed script
# build.properties.sed) to make it use local copies.
#
# If you want to let tomcat download all needed libraries itself, you need
# just to comment out sed command using build.properties.sed. Please note
# you can then grep output for "download" keyword and use captured list of
# URLs for syncing already downloaded libraries.
 
$(BUILD_PROPERTIES): $(VER)/.patched
	cat $(VER)/build.properties.default | \
	sed -f Solaris/build.properties.sed | \
	sed -e 's;/usr/share/java;\$(TCLIB_DIR);' > $@

$(TCLIB_DIR):
	-mkdir -p $(TCLIB_DIR)

clean:
	-rm -rf $(CLEANDIRS) $(CLEANFILES)

include ../Makefile.targ