CompileDemos.gmk 19.3 KB
Newer Older
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
#
# Copyright (c) 2011, 2012, 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.
#

default: all

include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include NativeCompilation.gmk

# Setup the java compilers for the JDK build.
include Setup.gmk

# Append demo goals to this variable.
BUILD_DEMOS=

# 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.

##################################################################################################

define SetupAppletDemo
     $$(eval $$(call SetupJavaCompilation,BUILD_DEMO_APPLET_$1,\
47
                SETUP:=GENERATE_USINGJDKBYTECODE,\
48
		SRC:=$(JDK_TOPDIR)/src/$3share/demo/applets/$1,\
49 50 51
		BIN:=$(JDK_OUTPUTDIR)/demo/applets/$1,\
		COPY:=.html .java .xyz .obj .au .gif,\
		DISABLE_SJAVAC:=$2))
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
     BUILD_DEMOS += $$(BUILD_DEMO_APPLET_$1)
endef

$(eval $(call SetupAppletDemo,ArcTest))
$(eval $(call SetupAppletDemo,BarChart))
$(eval $(call SetupAppletDemo,Blink))
$(eval $(call SetupAppletDemo,CardTest))
$(eval $(call SetupAppletDemo,Clock))
$(eval $(call SetupAppletDemo,DitherTest))
$(eval $(call SetupAppletDemo,DrawTest))
$(eval $(call SetupAppletDemo,Fractal))
$(eval $(call SetupAppletDemo,GraphicsTest))
$(eval $(call SetupAppletDemo,MoleculeViewer))
$(eval $(call SetupAppletDemo,NervousText))
$(eval $(call SetupAppletDemo,SimpleGraph))
$(eval $(call SetupAppletDemo,SortDemo))
$(eval $(call SetupAppletDemo,SpreadSheet))
# Build WireFrame without a server since it
# has a class Matrix3D that also exists in MoleculeViewer.
71
$(eval $(call SetupAppletDemo,WireFrame,true))
72 73 74

ifndef OPENJDK
    $(eval $(call SetupAppletDemo,Animator,,closed/))
75
    $(eval $(call SetupAppletDemo,GraphLayout,true,closed/))
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
    $(eval $(call SetupAppletDemo,JumpingBox,,closed/))
    $(eval $(call SetupAppletDemo,TicTacToe,,closed/))
endif

##################################################################################################

PATTERNS_TO_COPY=.html .txt .properties .js .gif .jpg .theme .data .opt README .c .h .png .ttf

define SetupDemo
    # Param 1 = Name of the demo
    # Param 2 = Subdirectory of the demo below the demo directory.
    # Param 3 = Additional javac flags.
    # Param 4 = The main class for the jar.
    # Param 5 = Additional source directory.
    # Param 6 = Extra dir below $(JDK_TOPDIR)/src (closed)
    # Param 7 = List of files to copy
    # Param 8 = Base name of jar file. Defaults to $1
    # Param 9 = Exclude list
    # Param 10 = Extra copy patterns
    # Param 11 = Extra manifest attribute
    # Param 12 = Suffix for compiler setup name

    # In some demos the source is found in a subdir called src.
    $1_MAIN_SRC:=$$(wildcard $(JDK_TOPDIR)/src/$6share/demo/$2/$1/src)
    ifeq ($$($1_MAIN_SRC),)
        $1_MAIN_SRC:=$(JDK_TOPDIR)/src/$6share/demo/$2/$1
    endif

    ifneq ($8,)
        $1_JARFILE := $8.jar
    else
        $1_JARFILE := $1.jar
    endif

    # Compile java classes if there are any.
    $1_JAVA_FILES_EXIST := $$(shell $$(FIND) $$($1_MAIN_SRC) -name "*.java")

    ifneq ($$($1_JAVA_FILES_EXIST),)
        $$(eval $$(call SetupJavaCompilation,BUILD_DEMO_$1,\
115
                SETUP:=GENERATE_USINGJDKBYTECODE,\
116 117
                ADD_JAVAC_FLAGS:=$3,\
		SRC:=$$($1_MAIN_SRC) $5,\
118
		BIN:=$(JDK_OUTPUTDIR)/democlasses/$2/$1,\
119
		COPY:=$(PATTERNS_TO_COPY) $(10),\
120
		JAR:=$(JDK_OUTPUTDIR)/demo/$2/$1/$$($1_JARFILE),\
121 122 123
		JARMAIN:=$4,\
		MANIFEST:=$(JDK_TOPDIR)/make/tools/manifest.mf,\
		EXTRA_MANIFEST_ATTR:=$(11),\
124 125 126
		SRCZIP:=$(JDK_OUTPUTDIR)/demo/$2/$1/src.zip,\
		EXCLUDE_FILES:=$9,\
		DISABLE_SJAVAC:=$(12)))
127 128

        BUILD_DEMOS +=  $$(BUILD_DEMO_$1) \
129 130
			$(JDK_OUTPUTDIR)/demo/$2/$1/$$($1_JARFILE) \
			$(JDK_OUTPUTDIR)/demo/$2/$1/src.zip 
131 132 133 134
    endif

    # Copy files.
    $1_COPY_TARGETS :=  $$(patsubst $(JDK_TOPDIR)/src/$6share/demo/$2/$1/%,\
135
			$(JDK_OUTPUTDIR)/demo/$2/$1/%,\
136 137
			$$(wildcard $$(addprefix $(JDK_TOPDIR)/src/$6share/demo/$2/$1/,$7)))
    ifneq ($7,)
138
        $(JDK_OUTPUTDIR)/demo/$2/$1/% : $(JDK_TOPDIR)/src/$6share/demo/$2/$1/%
139 140 141
		$(MKDIR) -p $$(@D)
		$(CP) $$< $$@
		$(CHMOD) -f ug+w $$@
142 143 144 145 146 147 148

        BUILD_DEMOS += $$($1_COPY_TARGETS)
    endif

endef

$(eval $(call SetupDemo,CodePointIM,jfc,,CodePointIM,,,*.html))
149 150
$(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.services : \
			$(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/CodePointIM.jar \
151
			$(JDK_TOPDIR)/src/share/demo/jfc/CodePointIM/java.awt.im.spi.InputMethodDescriptor
152
	(cd $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM && \
153 154 155
		$(MKDIR) -p _the.tmp/META-INF/services && \
		$(CP) $(JDK_TOPDIR)/src/share/demo/jfc/CodePointIM/java.awt.im.spi.InputMethodDescriptor _the.tmp/META-INF/services && \
		cd _the.tmp && \
156
		$(JAR) uf $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/CodePointIM.jar META-INF/services/java.awt.im.spi.InputMethodDescriptor && \
157
		cd META-INF/services && \
158 159
		$(JAR) uf $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/CodePointIM.jar java.awt.im.spi.InputMethodDescriptor)
	$(RM) -r $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.tmp
160
	$(TOUCH) $@
161

162
BUILD_DEMOS+=$(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.services
163 164 165 166 167 168 169 170 171

$(eval $(call SetupDemo,FileChooserDemo,jfc,,FileChooserDemo,,,README*))
$(eval $(call SetupDemo,Font2DTest,jfc,,Font2DTest,,,*.html *.txt))
$(eval $(call SetupDemo,Metalworks,jfc,,Metalworks,,,README*))
$(eval $(call SetupDemo,Notepad,jfc,,Notepad,,,README*))
$(eval $(call SetupDemo,SampleTree,jfc,,SampleTree,,,README*))
$(eval $(call SetupDemo,SwingApplet,jfc,,SwingApplet,,,README* *.html))
$(eval $(call SetupDemo,TableExample,jfc,,TableExample,,,README*))
$(eval $(call SetupDemo,TransparentRuler,jfc,,transparentruler.Ruler,,,README*))
172
$(eval $(call SetupDemo,jconsole-plugin,scripting,-cp $(JDK_OUTPUTDIR)/lib/jconsole.jar,,,,*.xml *.txt,,,,Main-Class: \n))
173 174 175 176
$(eval $(call SetupDemo,FullThreadDump,management,,FullThreadDump,,,README*))
$(eval $(call SetupDemo,JTop,management,-cp $(JDK_OUTPUTDIR)/lib/jconsole.jar,JTop,,,README*))
$(eval $(call SetupDemo,MemoryMonitor,management,,MemoryMonitor,,,README*))
$(eval $(call SetupDemo,VerboseGC,management,,VerboseGC,,,README*))
177
$(eval $(call SetupDemo,zipfs,nio,,,,,README* *.java,,,,Main-Class: \n))
178 179 180 181 182 183 184 185 186

ifndef OPENJDK
    $(eval $(call SetupDemo,Laffy,jfc,,,,closed/,*))
    $(eval $(call SetupDemo,SwingSet3,jfc,,,,closed/,*))

    $(eval $(call SetupDemo,Java2D,jfc,,java2d.Java2Demo,,closed/,*.html README*,Java2Demo))
    $(eval $(call SetupDemo,Stylepad,jfc,,Stylepad,\
		$(JDK_TOPDIR)/src/share/demo/jfc/Notepad,closed/,*.txt,,$(JDK_TOPDIR)/src/share/demo/jfc/Notepad/README.txt))
    $(eval $(call SetupDemo,SwingSet2,jfc,,SwingSet2,,closed/,README* *.html,,,.java COPYRIGHT,\
187
		SplashScreen-Image: resources/images/splash.png,true))
188 189

    BUILD_DEMOS += $(patsubst $(JDK_TOPDIR)/src/closed/share/demo/nbproject/%,\
190
			$(JDK_OUTPUTDIR)/demo/nbproject/%,\
191
			$(shell $(FIND) $(JDK_TOPDIR)/src/closed/share/demo/nbproject/ -type f))
192
    $(JDK_OUTPUTDIR)/demo/nbproject/% : $(JDK_TOPDIR)/src/closed/share/demo/nbproject/%
193 194 195
		$(MKDIR) -p $(@D)
		$(CP) $< $@
		$(CHMOD) -f ug+w $@
196 197 198 199 200
endif

##################################################################################################

# Why do we install a demo jar into the main jre/lib/ext????????????????
201
$(JDK_OUTPUTDIR)/lib/ext/zipfs.jar : $(JDK_OUTPUTDIR)/demo/nio/zipfs/zipfs.jar
202 203 204 205 206 207 208 209 210 211
		$(MKDIR) -p $(@D)
		$(CP) $< $@

BUILD_DEMOS += $(JDK_OUTPUTDIR)/lib/ext/zipfs.jar

##################################################################################################

# In the old makefiles, j2dbench was not compiled. 
#$(eval $(call SetupDemo,J2DBench,java2d,/src,,j2dbench/J2DBench))

212 213 214 215
# JVMTI demos are a bit strange and share some files, but be careful the
#    shared files are just the *.c and *.h files, not the README or sample
#    makefiles. So we always exclude the README.txt and sample.makefile.txt
#    from the extra sources.
216 217 218 219 220 221
define SetupJVMTIDemo
     # Param 1 = Name of the demo
     # Param 2 = add these directories to the includes, default is agent_util
     # Param 3 = extra CFLAGS
     # Param 4 = C or C++ (defaults to C)
     # Param 5 = libs for posix
222
     # Param 6 = libs for windows
223
     # Param 7 = libs for solaris
224 225 226 227 228 229
     BUILD_DEMO_JVMTI_$1_EXTRA_SRC:= \
        $$(wildcard $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/demo/jvmti/$1) \
	$$(wildcard $$(addprefix $(JDK_TOPDIR)/src/share/demo/jvmti/,$2))
     BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE:= \
	$$(wildcard $$(addprefix $(JDK_TOPDIR)/src/share/demo/jvmti/,$2)/README.txt) \
	$$(wildcard $$(addprefix $(JDK_TOPDIR)/src/share/demo/jvmti/,$2)/sample.makefile.txt)
230 231 232 233 234 235
     BUILD_DEMO_JVMTI_$1_EXTRA_INC:=$$(addprefix -I,$$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC))
     BUILD_DEMO_JVMTI_$1_LANG:=C
     ifneq (,$4)
         BUILD_DEMO_JVMTI_$1_LANG:=$4
     endif
     ifeq (C++,$4)
236
         $1_EXTRA_CXX:=$(LDFLAGS_CXX_JDK) $(LIBCXX)
237
     endif
238

239 240 241
     $1_CXXFLAGS:=$(CXXFLAGS_JDKLIB) -I$(JDK_TOPDIR)/src/share/demo/jvmti/$1 \
		  $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3 \
		  $(CXXFLAGS_DEBUG_SYMBOLS)
242
     ifeq ($1-$(OPENJDK_TARGET_CPU_ARCH),waiters-sparc)
243 244
         $1_FILTER:=-xregs=no%appl
         $1_CXXFLAGS:=$$(filter-out $$($1_FILTER),$$($1_CXXFLAGS))
245 246
     endif

247 248 249 250 251 252
     # Workaround for CFLAGS_JDKLIB containing ',' on solaris. If this is added as 'CFLAGS' to the
     # eval call below, the comma gets expanded too early.
     BUILD_DEMO_JVMTI_$1_CFLAGS:=$(CFLAGS_JDKLIB) $(CFLAGS_DEBUG_SYMBOLS) \
		-I$(JDK_TOPDIR)/src/share/demo/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3

     # Remove the -incremental:no setting to get .ilk-files like in the old build.
253 254 255
     $$(eval $$(call SetupNativeCompilation,BUILD_DEMO_JVMTI_$1,\
		SRC:=$(JDK_TOPDIR)/src/share/demo/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC),\
		LANG:=$$(BUILD_DEMO_JVMTI_$1_LANG),\
256
		OPTIMIZATION:=LOW,\
257
		CXXFLAGS:=$$($1_CXXFLAGS),\
258 259
		LDFLAGS:=$(filter-out -incremental:no -opt:ref,$(LDFLAGS_JDKLIB)),\
		LDFLAGS_macosx:=$(call SET_EXECUTABLE_ORIGIN),\
260 261
		LDFLAGS_SUFFIX:=$$($1_EXTRA_CXX),\
		LDFLAGS_SUFFIX_posix:=$5,\
262 263 264 265 266 267 268 269 270 271
		LDFLAGS_SUFFIX_windows:=$6,\
		LDFLAGS_SUFFIX_solaris:=$7 -lc,\
		LDFLAGS_SUFFIX_linux:=$8,\
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$$(RC_FLAGS) \
			  /D "JDK_FNAME=$1.dll" \
			  /D "JDK_INTERNAL_NAME=$1" \
			  /D "JDK_FTYPE=0x2L",\
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/demoobjs/jvmti/$1,\
		OUTPUT_DIR:=$(JDK_OUTPUTDIR)/demo/jvmti/$1/lib,\
272
		LIBRARY:=$1))
273 274 275

    $$(eval $$(call SetupZipArchive,BUILD_DEMO_JVMTI_SRC_$1,\
		SRC:=$(JDK_TOPDIR)/src/share/demo/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC),\
276 277
		EXCLUDE_FILES:=$$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE), \
		ZIP:=$(JDK_OUTPUTDIR)/demo/jvmti/$1/src.zip))
278

279
     $(JDK_OUTPUTDIR)/demo/jvmti/$1/README.txt : $(JDK_TOPDIR)/src/share/demo/jvmti/$1/README.txt
280 281 282 283 284 285 286 287
		$(MKDIR) -p $$(@D)
		$(CP) $$< $$@
		$(CHMOD) -f ug+w $$@

     ifneq (,$$(wildcard $(JDK_TOPDIR)/src/share/demo/jvmti/$1/*.java))
         $$(eval $$(call SetupJavaCompilation,BUILD_DEMO_JVMTI_$1_JAVA,\
                SETUP:=GENERATE_USINGJDKBYTECODE,\
		SRC:=$(JDK_TOPDIR)/src/share/demo/jvmti/$1,\
288
		BIN:=$(JDK_OUTPUTDIR)/democlasses/jvmti/$1,\
289
		COPY:=$(PATTERNS_TO_COPY),\
290
		JAR:=$(JDK_OUTPUTDIR)/demo/jvmti/$1/$1.jar,\
291
		EXTRA_MANIFEST_ATTR:=Main-Class: \n,\
292 293
		MANIFEST:=$(JDK_TOPDIR)/make/tools/manifest.mf))

294
         BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jvmti/$1/$1.jar
295 296
     endif

297
     BUILD_DEMOS += 	$$(BUILD_DEMO_JVMTI_$1) \
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
			$(JDK_OUTPUTDIR)/demo/jvmti/$1/src.zip \
			$(JDK_OUTPUTDIR)/demo/jvmti/$1/README.txt

     ifeq ($(OPENJDK_TARGET_OS),windows)
         # These files normally end up in OBJECT_DIR but for demos they
         # are supposed to be included in the distro.
         $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.lib: $$(BUILD_DEMO_JVMTI_$1)
		$(CP) $(JDK_OUTPUTDIR)/demoobjs/jvmti/$1/$1.lib $$@

         $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.exp: $$(BUILD_DEMO_JVMTI_$1)
		$(CP) $(JDK_OUTPUTDIR)/demoobjs/jvmti/$1/$1.exp $$@

         BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.lib \
			$(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.exp
     endif
313 314 315 316 317 318 319
endef

$(eval $(call SetupJVMTIDemo,compiledMethodLoad,	agent_util))
$(eval $(call SetupJVMTIDemo,gctest,			agent_util))
$(eval $(call SetupJVMTIDemo,heapTracker,		agent_util java_crw_demo))
$(eval $(call SetupJVMTIDemo,heapViewer,		agent_util))
$(eval $(call SetupJVMTIDemo,hprof,			java_crw_demo,\
320 321
		-I$(JDK_TOPDIR)/src/share/npt -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt,C,\
		-ldl,ws2_32.lib winmm.lib,-lsocket -lnsl,-lpthread))
322 323 324 325 326 327 328 329 330 331 332 333 334 335

$(eval $(call SetupJVMTIDemo,minst,			agent_util java_crw_demo))
$(eval $(call SetupJVMTIDemo,mtrace,			agent_util java_crw_demo))
$(eval $(call SetupJVMTIDemo,waiters,			agent_util,,C++))
$(eval $(call SetupJVMTIDemo,versionCheck,		agent_util))

##################################################################################################

# The jpda demo (com/sun/tools/example) is oddly enough stored in src/share/classes.
# At least, we do not need to compile the jpda demo, just jar/zip up the sources.
JPDA_SOURCES:=$(shell $(FIND) $(JDK_TOPDIR)/src/share/classes/com/sun/tools/example -type f)
# The number of files are few enough so that we can use echo safely below to list them.
JPDA_FILES:=$(subst $(JDK_TOPDIR)/src/share/classes/,,$(JPDA_SOURCES))

336
$(JDK_OUTPUTDIR)/demo/jpda/src.zip : $(JPDA_SOURCES)
337
		$(MKDIR) -p $(@D)
338 339
		(cd $(JDK_TOPDIR)/src/share/classes && $(ZIP) -qru $@ com -i "com/sun/tools/example/*")

340
$(JDK_OUTPUTDIR)/demo/jpda/examples.jar : $(JPDA_SOURCES)
341
		$(MKDIR) -p $(@D)
342 343 344 345 346 347 348 349
		$(RM) $(@D)/_the.sources
		$(call ListPathsSafely,JPDA_FILES,\n, >> $(@D)/_the.sources)
		$(SED) -e "s#@@RELEASE@@#$(RELEASE)#" 		\
		       -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" $(JDK_TOPDIR)/make/tools/manifest.mf > $(@D)/_the.manifest
		$(ECHO) "Main-Class: " >> $(@D)/_the.manifest
		(cd $(JDK_TOPDIR)/src/share/classes && $(JAR) cfm  $@ $(@D)/_the.manifest @$(@D)/_the.sources)
		(cd $(JDK_TOPDIR)/src/share/classes/com/sun/tools/example && $(JAR) uf $@ README)

350
$(JDK_OUTPUTDIR)/demo/jpda/com/sun/tools/example/README : $(JDK_TOPDIR)/src/share/classes/com/sun/tools/example/README
351
		$(MKDIR) -p $(@D)
352 353 354
		$(CP) $< $@
		$(CHMOD) -f ug+w $@

355 356
BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jpda/src.zip $(JDK_OUTPUTDIR)/demo/jpda/examples.jar \
		$(JDK_OUTPUTDIR)/demo/jpda/com/sun/tools/example/README
357 358 359

##################################################################################################

360
$(JDK_OUTPUTDIR)/demo/management/index.html : $(JDK_TOPDIR)/src/share/demo/management/index.html
361
		$(MKDIR) -p $(@D)
362 363 364
		$(CP) $< $@
		$(CHMOD) -f ug+w $@

365
$(JDK_OUTPUTDIR)/demo/jvmti/index.html : $(JDK_TOPDIR)/src/share/demo/jvmti/index.html
366
		$(MKDIR) -p $(@D)
367 368 369
		$(CP) $< $@
		$(CHMOD) -f ug+w $@

370 371
BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/management/index.html \
		$(JDK_OUTPUTDIR)/demo/jvmti/index.html
372 373 374 375

##################################################################################################

# The netbeans project files are copied into the demo directory.
376
BUILD_DEMOS += $(patsubst $(JDK_TOPDIR)/src/share/demo/nbproject/%,\
377
		$(JDK_OUTPUTDIR)/demo/nbproject/%,\
378 379
		$(shell $(FIND) $(JDK_TOPDIR)/src/share/demo/nbproject/ -type f))

380
$(JDK_OUTPUTDIR)/demo/nbproject/% : $(JDK_TOPDIR)/src/share/demo/nbproject/%
381 382 383 384 385 386
	$(MKDIR) -p $(@D)
	$(CP) $< $@
	$(CHMOD) -f ug+w $@

##################################################################################################

387
$(JDK_OUTPUTDIR)/demo/README: $(JDK_TOPDIR)/src/share/demo/README
388 389 390
	$(MKDIR) -p $(@D)
	$(CP) $< $@

391
BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/README
392 393 394

##################################################################################################

395
ifeq ($(OPENJDK_TARGET_OS), solaris)
396

397
$(JDK_OUTPUTDIR)/democlasses/jni/Poller/% : $(JDK_TOPDIR)/src/solaris/demo/jni/Poller/%
398 399 400 401
		$(MKDIR) -p $(@D)
		$(CP) $< $@
		$(CHMOD) -f ug+w $@

402
$(JDK_OUTPUTDIR)/demo/jni/Poller/README.txt : $(JDK_TOPDIR)/src/solaris/demo/jni/Poller/README.txt
403 404 405 406
		$(MKDIR) -p $(@D)
		$(CP) $< $@
		$(CHMOD) -f ug+w $@

407 408
$(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar : \
  $(JDK_OUTPUTDIR)/democlasses/jni/Poller/README.txt $(JDK_OUTPUTDIR)/democlasses/jni/Poller/Poller.c
409 410 411 412

$(eval $(call SetupJavaCompilation,BUILD_DEMO_POLLER_JAR,\
		SETUP:=GENERATE_USINGJDKBYTECODE, \
		SRC:=$(JDK_TOPDIR)/src/solaris/demo/jni/Poller, \
413 414 415
		BIN:=$(JDK_OUTPUTDIR)/democlasses/jni/Poller, \
		HEADERS:=$(JDK_OUTPUTDIR)/democlasses/jni/Poller, \
		JAR:=$(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar, \
416
		MANIFEST:=$(JDK_TOPDIR)/make/tools/manifest.mf, \
417 418 419
		SRCZIP:=$(JDK_OUTPUTDIR)/demo/jni/Poller/src.zip, \
		COPY:=README.txt Poller.c, \
		JARMAIN:=Client))
420

421 422


423 424
BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar $(JDK_OUTPUTDIR)/demo/jni/Poller/src.zip \
               $(JDK_OUTPUTDIR)/demo/jni/Poller/README.txt
425 426 427

$(eval $(call SetupNativeCompilation,BUILD_LIBPOLLER,\
		SRC:=$(JDK_TOPDIR)/src/solaris/demo/jni/Poller, \
428 429 430 431
		LANG:=C,\
		OPTIMIZATION:=LOW,\
		CFLAGS:=$(CFLAGS_JDKLIB) $(SHARED_LIBRARY_FLAGS) \
                        -I$(JDK_OUTPUTDIR)/democlasses/jni/Poller, \
432
		LDFLAGS:=$(LDFLAGS_JDKLIB), \
433 434
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/demoobjs/jni/Poller,\
                OUTPUT_DIR:=$(JDK_OUTPUTDIR)/demoobjs, \
435
		LIBRARY:=Poller))
436 437 438 439

#
# We can only compile native code after jar has been build (since we depend on generated .h files)
#
440
$(JDK_OUTPUTDIR)/demoobjs/jni/Poller/Poller.o : $(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar
441

442 443
$(JDK_OUTPUTDIR)/demo/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX) : \
  $(JDK_OUTPUTDIR)/demoobjs/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX)
444 445 446
	$(MKDIR) -p $(@D)
	$(CP) $< $@

447
BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX)
448 449

endif
450 451 452

##################################################################################################

453 454 455
ifndef OPENJDK
    DB_DEMO_ZIPFILE := $(shell $(FIND) $(JDK_TOPDIR)/src/closed/share/db -name "*demo*.zip")

456
    $(JDK_OUTPUTDIR)/demo/_the.db.unzipped: $(DB_DEMO_ZIPFILE)
457
	$(MKDIR) -p $(@D)
458 459 460
	$(RM) -r $(JDK_OUTPUTDIR)/demo/db $(JDK_OUTPUTDIR)/demo/demo
	$(CD) $(JDK_OUTPUTDIR)/demo && $(UNZIP) -o $<
	$(MV) $(JDK_OUTPUTDIR)/demo/demo $(JDK_OUTPUTDIR)/demo/db
461 462 463
	$(TOUCH) $@

#    Copy this after the unzip above to avoid race with directory creation and mv command.
464
     $(JDK_OUTPUTDIR)/demo/db/README-JDK-DEMOS.html: \
465
		$(JDK_TOPDIR)/src/closed/share/db/README-JDK-DEMOS.html \
466
		| $(JDK_OUTPUTDIR)/demo/_the.db.unzipped
467 468
	$(MKDIR) -p $(@D)
	$(CP) '$<' '$@'
469
     BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/_the.db.unzipped $(JDK_OUTPUTDIR)/demo/db/README-JDK-DEMOS.html
470
endif
471 472 473

##################################################################################################

474
all: $(BUILD_DEMOS)
475 476

.PHONY: all