1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
|
#
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
################################################################################
# Build demos for the JDK into $(SUPPORT_OUTPUTDIR)/demos/image.
################################################################################
default: all
include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include NativeCompilation.gmk
include SetupJavaCompilers.gmk
include TextFileProcessing.gmk
include ZipArchive.gmk
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, CompileDemos-pre.gmk))
# Prepare the find cache.
DEMO_SRC_DIRS += $(TOPDIR)/src/demo
$(call FillFindCache, $(DEMO_SRC_DIRS))
# Append demo goals to this variable.
TARGETS =
# The demo structure and contents should really be cleaned up.
# Now every other demo has its own quirks where to put the
# READMEs and other files.
DEMO_SHARE_SRC := $(TOPDIR)/src/demo/share
GLOBAL_VERSION_INFO_RESOURCE := $(TOPDIR)/src/java.base/windows/native/common/version.rc
DEMO_MANIFEST := $(SUPPORT_OUTPUTDIR)/demos/java-main-manifest.mf
# This rule will be depended on due to the MANIFEST line in SetupBuildDemo
# and SetupBuildJvmtiDemo.
$(eval $(call SetupTextFileProcessing, BUILD_JAVA_MANIFEST, \
SOURCE_FILES := $(TOPDIR)/make/data/mainmanifest/manifest.mf, \
OUTPUT_FILE := $(DEMO_MANIFEST), \
REPLACEMENTS := \
@@VERSION_SPECIFICATION@@ => $(VERSION_SPECIFICATION) ; \
@@VERSION_SHORT@@ => $(VERSION_SHORT) ; \
@@COMPANY_NAME@@ => $(COMPANY_NAME) , \
))
################################################################################
# Build normal demos.
COPY_TO_JAR := .html .txt .properties .js .gif .jpg .theme .data .opt .c .h \
.png .ttf .xyz .obj README COPYRIGHT
COPY_TO_IMAGE := *.html *.txt *.png *.xml README*
# Setup make rules for building a demo.
#
# Parameter 1 is the name of the rule. This name is used as variable prefix,
# and the targets generated are listed in a variable by that name.
#
# Remaining parameters are named arguments. These include:
# DEMO_SUBDIR The name of the subdir of the demo, below the demo top dir.
# EXTRA_SRC_DIR Additional source directory.
# SRC_SUB_DIR Optional subdir to locate source code in
# SRC_DIR Alternative source directory to use for the demos.
# EXCLUDE_FILES Exclude file list
# JAR_NAME Base name of jar file. Defaults to $1.
# MAIN_CLASS The main class for the jar. Defaults to $1.
# EXTRA_COPY_TO_JAR Additional files to copy to jar (as patterns)
# EXTRA_COPY_TO_IMAGE Additional files to copy to images (as wildcards)
# EXTRA_MANIFEST_ATTR Extra manifest attribute
# SKIP_COMPILATION Skip Java compilation iff true
# DISABLE_SJAVAC Passed to SetupJavaCompilation
SetupBuildDemo = $(NamedParamsMacroTemplate)
define SetupBuildDemoBody
ifeq ($$($1_SRC_DIR), )
$1_SRC_DIR := $(DEMO_SHARE_SRC)
endif
$1_SRC_BASE := $$($1_SRC_DIR)/$$($1_DEMO_SUBDIR)/$1
# In some demos the source is found in a subdir
ifneq ($$($1_SRC_SUB_DIR), )
$1_MAIN_SRC := $$($1_SRC_BASE)/$$($1_SRC_SUB_DIR)
else
# for allmost all
$1_MAIN_SRC := $$($1_SRC_BASE)
endif
# Default is to use demo name as jar file name.
ifeq ($$($1_JAR_NAME), )
$1_JAR_NAME := $1
endif
# Default is to use demo name as jar main class.
ifeq ($$($1_MAIN_CLASS), )
$1_MAIN_CLASS := $1
else ifeq ($$($1_MAIN_CLASS), NONE)
$1_MAIN_CLASS :=
$1_EXTRA_MANIFEST_ATTR += Main-Class: \n
endif
ifneq ($$($1_SKIP_COMPILATION), true)
$$(eval $$(call SetupJavaCompilation, BUILD_DEMO_$1, \
SETUP := GENERATE_USINGJDKBYTECODE, \
SRC := $$($1_MAIN_SRC) $$($1_EXTRA_SRC_DIR), \
BIN := $(SUPPORT_OUTPUTDIR)/demos/classes/$$($1_DEMO_SUBDIR)/$1, \
COPY := $(COPY_TO_JAR) $$($1_EXTRA_COPY_TO_JAR), \
JAR := $(SUPPORT_OUTPUTDIR)/demos/image/$$($1_DEMO_SUBDIR)/$1/$$($1_JAR_NAME).jar, \
JARMAIN := $$($1_MAIN_CLASS), \
MANIFEST := $(DEMO_MANIFEST), \
EXTRA_MANIFEST_ATTR := $$($1_EXTRA_MANIFEST_ATTR), \
SRCZIP := $(SUPPORT_OUTPUTDIR)/demos/image/$$($1_DEMO_SUBDIR)/$1/src.zip, \
EXCLUDE_FILES := $$($1_EXCLUDE_FILES), \
DISABLE_SJAVAC := $$($1_DISABLE_SJAVAC), \
))
$1 += $$(BUILD_DEMO_$1)
endif
# Copy files. Sort is needed to remove duplicates.
$1_COPY_FILES := $$(sort $$(wildcard $$(addprefix $$($1_SRC_BASE)/, \
$(COPY_TO_IMAGE) $$($1_EXTRA_COPY_TO_IMAGE))))
$$(eval $$(call SetupCopyFiles, COPY_DEMO_$1, \
SRC := $$($1_SRC_BASE), \
DEST := $(SUPPORT_OUTPUTDIR)/demos/image/$$($1_DEMO_SUBDIR)/$1, \
FILES := $$($1_COPY_FILES), \
))
$1 += $$(COPY_DEMO_$1)
TARGETS += $$($1)
endef
CODEPOINT_SERVICE := java.awt.im.spi.InputMethodDescriptor
CODEPOINT_METAINF_SERVICE_FILE := \
$(SUPPORT_OUTPUTDIR)/demos/classes/jfc/CodePointIM/META-INF/services/$(CODEPOINT_SERVICE)
$(eval $(call SetupBuildDemo, CodePointIM, \
DEMO_SUBDIR := jfc, \
EXTRA_COPY_TO_JAR := $(CODEPOINT_SERVICE), \
))
# We also need to copy the CODEPOINT_SERVICE file to the META-INF/services
# location, and make sure the jar depends on that file to get it included.
$(CODEPOINT_METAINF_SERVICE_FILE): $(DEMO_SHARE_SRC)/jfc/CodePointIM/$(CODEPOINT_SERVICE)
$(call install-file)
$(BUILD_DEMO_CodePointIM_JAR): $(CODEPOINT_METAINF_SERVICE_FILE)
$(eval $(call SetupBuildDemo, FileChooserDemo, \
DEMO_SUBDIR := jfc, \
))
$(eval $(call SetupBuildDemo, SwingSet2, \
DEMO_SUBDIR := jfc, \
EXTRA_COPY_TO_JAR := .java, \
EXTRA_MANIFEST_ATTR := SplashScreen-Image: resources/images/splash.png, \
DISABLE_SJAVAC := true, \
))
$(eval $(call SetupBuildDemo, Font2DTest, \
DEMO_SUBDIR := jfc, \
))
$(eval $(call SetupBuildDemo, J2Ddemo, \
DEMO_SUBDIR := jfc, \
MAIN_CLASS := java2d.J2Ddemo, \
JAR_NAME := J2Ddemo, \
))
$(eval $(call SetupBuildDemo, Metalworks, \
DEMO_SUBDIR := jfc, \
))
$(eval $(call SetupBuildDemo, Notepad, \
DEMO_SUBDIR := jfc, \
))
$(eval $(call SetupBuildDemo, Stylepad, \
DEMO_SUBDIR := jfc, \
EXTRA_SRC_DIR := $(DEMO_SHARE_SRC)/jfc/Notepad, \
EXCLUDE_FILES := $(DEMO_SHARE_SRC)/jfc/Notepad/README.txt, \
))
$(eval $(call SetupBuildDemo, SampleTree, \
DEMO_SUBDIR := jfc, \
))
$(eval $(call SetupBuildDemo, TableExample, \
DEMO_SUBDIR := jfc, \
))
$(eval $(call SetupBuildDemo, TransparentRuler, \
DEMO_SUBDIR := jfc, \
MAIN_CLASS := transparentruler.Ruler, \
))
################################################################################
# Copy html and README files.
$(SUPPORT_OUTPUTDIR)/demos/image/README: $(DEMO_SHARE_SRC)/README
$(call install-file)
TARGETS += $(SUPPORT_OUTPUTDIR)/demos/image/README
################################################################################
# Copy netbeans project files.
$(SUPPORT_OUTPUTDIR)/demos/image/nbproject/%: $(DEMO_SHARE_SRC)/nbproject/%
$(call install-file)
$(CHMOD) -f ug+w $@
ifeq ($(call isTargetOs, solaris), true)
TARGETS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \
$(SUPPORT_OUTPUTDIR)/demos/image/nbproject/%, \
$(call FindFiles, $(DEMO_SHARE_SRC)/nbproject))
else
TARGETS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \
$(SUPPORT_OUTPUTDIR)/demos/image/nbproject/%, \
$(call FindFiles, $(DEMO_SHARE_SRC)/nbproject))
endif
################################################################################
ifneq ($(filter images, $(MAKECMDGOALS)), )
$(eval $(call SetupCopyFiles, COPY_TO_TEST_IMAGE, \
SRC := $(SUPPORT_OUTPUTDIR)/demos/image, \
DEST := $(TEST_IMAGE_DIR)/jdk/demos, \
FILES := $(call FindFiles, $(SUPPORT_OUTPUTDIR)/demos/image), \
))
IMAGES_TARGETS := $(COPY_TO_TEST_IMAGE)
endif
################################################################################
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, CompileDemos-post.gmk))
all: $(TARGETS)
images: $(IMAGES_TARGETS)
.PHONY: all
|