jdk/make/CompileDemos.gmk

Print this page




  27 
  28 include $(SPEC)
  29 include MakeBase.gmk
  30 include JavaCompilation.gmk
  31 include NativeCompilation.gmk
  32 include SetupJavaCompilers.gmk
  33 
  34 # Prepare the find cache.
  35 $(eval $(call FillCacheFind, $(JDK_TOPDIR)/src))
  36 
  37 # Append demo goals to this variable.
  38 BUILD_DEMOS =
  39 
  40 # The demo structure and contents should really be cleaned up.
  41 # Now every other demo has its own quirks where to put the
  42 # READMEs and other files.
  43 
  44 DEMO_SHARE_SRC := $(JDK_TOPDIR)/src/demo/share
  45 DEMO_CLOSED_SHARE_SRC := $(JDK_TOPDIR)/src/closed/demo/share
  46 DEMO_SOLARIS_SRC := $(JDK_TOPDIR)/src/demo/solaris
  47 DEMO_OS_API_SRC := $(JDK_TOPDIR)/src/demo/$(OPENJDK_TARGET_OS_API_DIR)
  48 VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
  49 
  50 ##################################################################################################
  51 
  52 define SetupAppletDemo
  53   $$(eval $$(call SetupJavaCompilation,BUILD_DEMO_APPLET_$1, \
  54       SETUP := GENERATE_USINGJDKBYTECODE, \
  55       SRC := $(JDK_TOPDIR)/src/$3demo/share/applets/$1, \
  56       BIN := $(JDK_OUTPUTDIR)/demo/applets/$1, \
  57       COPY := .html .java .xyz .obj .au .gif, \
  58       DISABLE_SJAVAC := $2))
  59       BUILD_DEMOS += $$(BUILD_DEMO_APPLET_$1)
  60 endef
  61 
  62 ifneq ($(OPENJDK_TARGET_OS), solaris)
  63   $(eval $(call SetupAppletDemo,ArcTest))
  64   $(eval $(call SetupAppletDemo,BarChart))
  65   $(eval $(call SetupAppletDemo,Blink))
  66   $(eval $(call SetupAppletDemo,CardTest))
  67   $(eval $(call SetupAppletDemo,Clock))


 197 
 198   $(JDK_OUTPUTDIR)/demo/nbproject/%: $(DEMO_CLOSED_SHARE_SRC)/nbproject/%
 199         $(call install-file)
 200         $(CHMOD) -f ug+w $@
 201 endif
 202 
 203 ##################################################################################################
 204 
 205 # In the old makefiles, j2dbench was not compiled.
 206 #$(eval $(call SetupDemo,J2DBench, java2d, /src, , j2dbench/J2DBench))
 207 
 208 # JVMTI demos are a bit strange and share some files, but be careful the
 209 # shared files are just the *.c and *.h files, not the README or sample
 210 # makefiles. So we always exclude the README.txt and sample.makefile.txt
 211 # from the extra sources.
 212 define SetupJVMTIDemo
 213   # Param 1 = Name of the demo
 214   # Param 2 = add these directories to the includes, default is agent_util
 215   # Param 3 = extra CFLAGS
 216   # Param 4 = C or C++ (defaults to C)
 217   # Param 5 = libs for posix
 218   # Param 6 = libs for windows
 219   # Param 7 = libs for solaris
 220   # Param 8 = libs for linux
 221   # Param 9 = extra directories with required sources
 222   BUILD_DEMO_JVMTI_$1_EXTRA_SRC := \
 223       $$(wildcard $(DEMO_OS_API_SRC)/jvmti/$1) \
 224       $$(wildcard $$(addprefix $(DEMO_SHARE_SRC)/jvmti/, $2)) \
 225       $9
 226   BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE := \
 227       $$(wildcard $$(patsubst %, $(DEMO_SHARE_SRC)/jvmti/%/README.txt, $2)) \
 228       $$(wildcard $$(patsubst %, $(DEMO_SHARE_SRC)/jvmti/%/sample.makefile.txt, $2))
 229   BUILD_DEMO_JVMTI_$1_EXTRA_INC := $$(addprefix -I, $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC))
 230   BUILD_DEMO_JVMTI_$1_LANG := C
 231   ifneq (, $4)
 232     BUILD_DEMO_JVMTI_$1_LANG := $4
 233   endif
 234   ifeq (C++, $4)
 235     $1_EXTRA_CXX := $(LDFLAGS_CXX_JDK) $(LIBCXX)
 236   endif
 237 
 238   $1_CXXFLAGS := $(CXXFLAGS_JDKLIB) -I$(DEMO_SHARE_SRC)/jvmti/$1 \
 239       $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3 \
 240       $(CXXFLAGS_DEBUG_SYMBOLS)
 241   ifeq ($1-$(OPENJDK_TARGET_CPU_ARCH), waiters-sparc)
 242     $1_FILTER := -xregs=no%appl
 243     $1_CXXFLAGS := $$(filter-out $$($1_FILTER), $$($1_CXXFLAGS))
 244   endif
 245 
 246   # Workaround for CFLAGS_JDKLIB containing ',' on solaris. If this is added as 'CFLAGS' to the
 247   # eval call below, the comma gets expanded too early.
 248   BUILD_DEMO_JVMTI_$1_CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_DEBUG_SYMBOLS) \
 249       -I$(DEMO_SHARE_SRC)/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3
 250 
 251   # Remove the -incremental:no setting to get .ilk-files like in the old build.
 252   $$(eval $$(call SetupNativeCompilation,BUILD_DEMO_JVMTI_$1, \
 253       SRC := $(DEMO_SHARE_SRC)/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC), \
 254       LANG := $$(BUILD_DEMO_JVMTI_$1_LANG), \
 255       OPTIMIZATION := LOW, \
 256       CXXFLAGS := $$($1_CXXFLAGS), \
 257       LDFLAGS := $(filter-out -incremental:no -opt:ref, $(LDFLAGS_JDKLIB)), \
 258       LDFLAGS_macosx := $(call SET_EXECUTABLE_ORIGIN), \
 259       LDFLAGS_SUFFIX := $$($1_EXTRA_CXX), \
 260       LDFLAGS_SUFFIX_posix := $5, \
 261       LDFLAGS_SUFFIX_windows := $6, \
 262       LDFLAGS_SUFFIX_solaris := $7 -lc, \
 263       LDFLAGS_SUFFIX_linux := $8, \
 264       VERSIONINFO_RESOURCE := $(VERSION_INFO_RESOURCE), \
 265       RC_FLAGS := $$(RC_FLAGS) \
 266           -D "JDK_FNAME=$1.dll" \
 267           -D "JDK_INTERNAL_NAME=$1" \
 268           -D "JDK_FTYPE=0x2L", \
 269       OBJECT_DIR := $(JDK_OUTPUTDIR)/demoobjs/jvmti/$1, \
 270       OUTPUT_DIR := $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib, \
 271       LIBRARY := $1))
 272 
 273   $$(eval $$(call SetupZipArchive,BUILD_DEMO_JVMTI_SRC_$1, \
 274       SRC := $(DEMO_SHARE_SRC)/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC), \
 275       EXCLUDE_FILES := $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE), \
 276       ZIP := $(JDK_OUTPUTDIR)/demo/jvmti/$1/src.zip))
 277 
 278   $(JDK_OUTPUTDIR)/demo/jvmti/$1/README.txt: $(DEMO_SHARE_SRC)/jvmti/$1/README.txt
 279         $$(call install-file)
 280         $(CHMOD) -f ug+w $$@




  27 
  28 include $(SPEC)
  29 include MakeBase.gmk
  30 include JavaCompilation.gmk
  31 include NativeCompilation.gmk
  32 include SetupJavaCompilers.gmk
  33 
  34 # Prepare the find cache.
  35 $(eval $(call FillCacheFind, $(JDK_TOPDIR)/src))
  36 
  37 # Append demo goals to this variable.
  38 BUILD_DEMOS =
  39 
  40 # The demo structure and contents should really be cleaned up.
  41 # Now every other demo has its own quirks where to put the
  42 # READMEs and other files.
  43 
  44 DEMO_SHARE_SRC := $(JDK_TOPDIR)/src/demo/share
  45 DEMO_CLOSED_SHARE_SRC := $(JDK_TOPDIR)/src/closed/demo/share
  46 DEMO_SOLARIS_SRC := $(JDK_TOPDIR)/src/demo/solaris
  47 DEMO_OS_TYPE_SRC := $(JDK_TOPDIR)/src/demo/$(OPENJDK_TARGET_OS_TYPE)
  48 VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
  49 
  50 ##################################################################################################
  51 
  52 define SetupAppletDemo
  53   $$(eval $$(call SetupJavaCompilation,BUILD_DEMO_APPLET_$1, \
  54       SETUP := GENERATE_USINGJDKBYTECODE, \
  55       SRC := $(JDK_TOPDIR)/src/$3demo/share/applets/$1, \
  56       BIN := $(JDK_OUTPUTDIR)/demo/applets/$1, \
  57       COPY := .html .java .xyz .obj .au .gif, \
  58       DISABLE_SJAVAC := $2))
  59       BUILD_DEMOS += $$(BUILD_DEMO_APPLET_$1)
  60 endef
  61 
  62 ifneq ($(OPENJDK_TARGET_OS), solaris)
  63   $(eval $(call SetupAppletDemo,ArcTest))
  64   $(eval $(call SetupAppletDemo,BarChart))
  65   $(eval $(call SetupAppletDemo,Blink))
  66   $(eval $(call SetupAppletDemo,CardTest))
  67   $(eval $(call SetupAppletDemo,Clock))


 197 
 198   $(JDK_OUTPUTDIR)/demo/nbproject/%: $(DEMO_CLOSED_SHARE_SRC)/nbproject/%
 199         $(call install-file)
 200         $(CHMOD) -f ug+w $@
 201 endif
 202 
 203 ##################################################################################################
 204 
 205 # In the old makefiles, j2dbench was not compiled.
 206 #$(eval $(call SetupDemo,J2DBench, java2d, /src, , j2dbench/J2DBench))
 207 
 208 # JVMTI demos are a bit strange and share some files, but be careful the
 209 # shared files are just the *.c and *.h files, not the README or sample
 210 # makefiles. So we always exclude the README.txt and sample.makefile.txt
 211 # from the extra sources.
 212 define SetupJVMTIDemo
 213   # Param 1 = Name of the demo
 214   # Param 2 = add these directories to the includes, default is agent_util
 215   # Param 3 = extra CFLAGS
 216   # Param 4 = C or C++ (defaults to C)
 217   # Param 5 = libs for unix
 218   # Param 6 = libs for windows
 219   # Param 7 = libs for solaris
 220   # Param 8 = libs for linux
 221   # Param 9 = extra directories with required sources
 222   BUILD_DEMO_JVMTI_$1_EXTRA_SRC := \
 223       $$(wildcard $(DEMO_OS_TYPE_SRC)/jvmti/$1) \
 224       $$(wildcard $$(addprefix $(DEMO_SHARE_SRC)/jvmti/, $2)) \
 225       $9
 226   BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE := \
 227       $$(wildcard $$(patsubst %, $(DEMO_SHARE_SRC)/jvmti/%/README.txt, $2)) \
 228       $$(wildcard $$(patsubst %, $(DEMO_SHARE_SRC)/jvmti/%/sample.makefile.txt, $2))
 229   BUILD_DEMO_JVMTI_$1_EXTRA_INC := $$(addprefix -I, $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC))
 230   BUILD_DEMO_JVMTI_$1_LANG := C
 231   ifneq (, $4)
 232     BUILD_DEMO_JVMTI_$1_LANG := $4
 233   endif
 234   ifeq (C++, $4)
 235     $1_EXTRA_CXX := $(LDFLAGS_CXX_JDK) $(LIBCXX)
 236   endif
 237 
 238   $1_CXXFLAGS := $(CXXFLAGS_JDKLIB) -I$(DEMO_SHARE_SRC)/jvmti/$1 \
 239       $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3 \
 240       $(CXXFLAGS_DEBUG_SYMBOLS)
 241   ifeq ($1-$(OPENJDK_TARGET_CPU_ARCH), waiters-sparc)
 242     $1_FILTER := -xregs=no%appl
 243     $1_CXXFLAGS := $$(filter-out $$($1_FILTER), $$($1_CXXFLAGS))
 244   endif
 245 
 246   # Workaround for CFLAGS_JDKLIB containing ',' on solaris. If this is added as 'CFLAGS' to the
 247   # eval call below, the comma gets expanded too early.
 248   BUILD_DEMO_JVMTI_$1_CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_DEBUG_SYMBOLS) \
 249       -I$(DEMO_SHARE_SRC)/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3
 250 
 251   # Remove the -incremental:no setting to get .ilk-files like in the old build.
 252   $$(eval $$(call SetupNativeCompilation,BUILD_DEMO_JVMTI_$1, \
 253       SRC := $(DEMO_SHARE_SRC)/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC), \
 254       LANG := $$(BUILD_DEMO_JVMTI_$1_LANG), \
 255       OPTIMIZATION := LOW, \
 256       CXXFLAGS := $$($1_CXXFLAGS), \
 257       LDFLAGS := $(filter-out -incremental:no -opt:ref, $(LDFLAGS_JDKLIB)), \
 258       LDFLAGS_macosx := $(call SET_EXECUTABLE_ORIGIN), \
 259       LDFLAGS_SUFFIX := $$($1_EXTRA_CXX), \
 260       LDFLAGS_SUFFIX_unix := $5, \
 261       LDFLAGS_SUFFIX_windows := $6, \
 262       LDFLAGS_SUFFIX_solaris := $7 -lc, \
 263       LDFLAGS_SUFFIX_linux := $8, \
 264       VERSIONINFO_RESOURCE := $(VERSION_INFO_RESOURCE), \
 265       RC_FLAGS := $$(RC_FLAGS) \
 266           -D "JDK_FNAME=$1.dll" \
 267           -D "JDK_INTERNAL_NAME=$1" \
 268           -D "JDK_FTYPE=0x2L", \
 269       OBJECT_DIR := $(JDK_OUTPUTDIR)/demoobjs/jvmti/$1, \
 270       OUTPUT_DIR := $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib, \
 271       LIBRARY := $1))
 272 
 273   $$(eval $$(call SetupZipArchive,BUILD_DEMO_JVMTI_SRC_$1, \
 274       SRC := $(DEMO_SHARE_SRC)/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC), \
 275       EXCLUDE_FILES := $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE), \
 276       ZIP := $(JDK_OUTPUTDIR)/demo/jvmti/$1/src.zip))
 277 
 278   $(JDK_OUTPUTDIR)/demo/jvmti/$1/README.txt: $(DEMO_SHARE_SRC)/jvmti/$1/README.txt
 279         $$(call install-file)
 280         $(CHMOD) -f ug+w $$@