Demo.gmk revision 2080
#
# Copyright 2004-2008 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Sun designates this
# particular file as subject to the "Classpath" exception as provided
# by Sun in the LICENSE file that accompanied this code.
#
# This code 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
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# JDK Demo building jar file.
# Some names are defined with LIBRARY inside the Defs.gmk file
# Input:
# DEMONAME - name of the demo
# DEMO_ROOT - path to root of all demo files
# DEMO_DESTDIR - path to final demo destination directory
#
# Optional Input:
# DEMO_SRCDIR - path to source if different from DEMO_ROOT
# DEMO_PSRCDIR - path to additional platform specific source
# DEMO_PKGDIR - sub directory of sources we want
# DEMO_TOPFILES - names of top-level files relative to DEMO_ROOT
# DEMO_MAINCLASS - name of the main class for the jar manifest
# DEMO_NATIVECLASS - name of the class with native methods
# DEMO_DESCRIPTOR - name of service file for jar (relative to DEMO_SRCDIR)
# DEMO_EXTRA_SRCDIR - path to directory that holds extra sources to add
# DEMO_EXTRA_FILES - extra sources relative to DEMO_EXTRA_SRCDIR
# DEMO_OBJECTS - extra native object files needed
# DEMO_MANIFEST_ATTR - extra line to add to the jar manifest file
# Assume the source directory is the root directory if not set
DEMO_SRCDIR = $(DEMO_ROOT)
DEMO_PKGDIR = .
# Some demos have special needs
DEMO_NEEDS_NPT = true
# Place to hold the build area (kind of a temp area)
# Destination "src" directory
# Place to hold the jar image we are creating
# The jar manifest file we will create and use
# The list of source files or options we will supply to javac
# Any name of javah file
# Get complete list of files for this demo
# Just the java sources
# Just the C and C++ sources
# All the native source files
# If we have java sources, then define the jar file we will create
# If we have native sources, define the native library we will create
# Path to native library we will create
DEMO_LIBRARY = \
# C and C++ compiler flags we need to add to standard flags
DEMO_CPPFLAGS += -I$(DEMO_BUILD_SRCDIR)
# If the npt library is used we need to find the npt.h file
# The npt library is delivered as part of the JRE
# Is the shared agent_util code needed
# Is the shared java_crw_demo code needed
# All the native object files we need to build the library
# Linking is special depending on whether we had C++ code or on windows
CPPFLAGS += $(DEMO_CPPFLAGS)
# bit between them.
else
LDLIBS.demo = $(LIBCXX)
LDLIBS.demo += -lc
else
LDLIBS.demo = $(LDLIBS)
# Files that are considered resources (need to be in the jar file)
# All destination files (top level readme files and all sources)
# Note: We exclude the topfiles from the src tree.
# Default rule
# Used to populate the destination directories
$(DEMO_DESTDIR)/%: $(DEMO_ROOT)/%
$(DEMO_DESTDIR)/%: $(DEMO_SRCDIR)/%
$(DEMO_BUILD_SRCDIR)/%: $(DEMO_SRCDIR)/%
$(DEMO_BUILD_SRCDIR)/%: $(DEMO_PSRCDIR)/%
$(DEMO_BUILD_SRCDIR)/%: $(DEMO_EXTRA_SRCDIR)/%
# Jar manifest file
$(DEMO_MANIFEST):
# Populating the jar image directory
$(DEMO_JAR_IMAGE)/%: $(DEMO_SRCDIR)/%
$(DEMO_JAR_IMAGE)/%: $(DEMO_PSRCDIR)/%
$(DEMO_JAR_IMAGE)/%: $(DEMO_EXTRA_SRCDIR)/%
$(DEMO_SRCDIR)/$(DEMO_DESCRIPTOR)
# If we are creating a jar file (we have java code)
# Input file for javac
@for i in $(DEMO_JAVA_SOURCES) ; do \
done
# Jar file creation
$(DEMO_JAR): \
$(DEMO_JAVAC_INPUT) \
$(DEMO_MANIFEST) \
$(MKDIR) -p $(DEMO_JAR_IMAGE)
@$(DEMO_JAVAC_INPUT)
-C $(DEMO_JAR_IMAGE) . \
# Create a src.zip file
# Install the destination src.zip file and create the src tree
$(DEMO_SOURCE_ZIP): $(DEMO_BUILD_SRCZIP)
# Native library building
# Full paths to object files
# Native compile rules
$(COMPILE.c) $(CC_OBJECT_OUTPUT_FLAG)$@ $<
$(COMPILE.cpp) $(CC_OBJECT_OUTPUT_FLAG)$@ $<
# Actual creation of the native shared library (C++ and C are different)
$(DEMO_LIBRARY): $(DEMO_FULL_OBJECTS)
$(DEMO_FULL_OBJECTS) $(LDLIBS.demo)
# Generation of any javah include file, make sure objects are dependent on it
$(DEMO_JAVAH_FILE): $(DEMO_JAR)
$(DEMO_FULL_OBJECTS): $(DEMO_JAVAH_FILE)
# Build involves populating the destination "src" tree, building the jar and
# native library, and creating a source bundle
@$(ECHO) "Created $@"
@$(ECHO) "Created $@"
# Why the nested make here? It only works this way, don't know why.
$(RM) -r $(DEMO_DESTDIR)
$(MKDIR) -p $(DEMO_DESTDIR)
# Applets are special, no jar file, no src.zip, everything expanded.
# Printing out a demo information line
# Print out the demo information
@$(ECHO) "========================================================="
@$(ECHO) "========================================================="
# Clean rule
$(RM) -r $(DEMO_BUILD_AREA)
$(RM) -r $(DEMO_DESTDIR)
# This should not be needed, but some versions of GNU amke have a bug that
# sometimes deleted these files for some strange and unknown reason
# (GNU make version 3.78.1 has the problem, GNU make version 3.80 doesn't?)
# List phony targets