common/makefiles/JavaCompilation.gmk

changeset 619
76808fb4194a
parent 611
d3d9ab8ee7b0
child 635
907a926d3c96
equal deleted inserted replaced
618:fdb1e09519ed 619:76808fb4194a
40 endif 40 endif
41 41
42 FALSE_FIND_PATTERN:=-name FILE_NAME_THAT_DOESNT_EXIST 42 FALSE_FIND_PATTERN:=-name FILE_NAME_THAT_DOESNT_EXIST
43 43
44 define SetupJavaCompiler 44 define SetupJavaCompiler
45 # param 1 is for example BOOT_JAVAC or NEW_JAVAC 45 # param 1 is for example GENERATE_OLD_BYTECODE or GENERATE_NEW_JDKBYTECODE
46 # This is the name later used to decide which java compiler to use. 46 # This is the name of the compiler setup.
47 # param 2-9 are named args. 47 # param 2-9 are named args.
48 # JVM:=The jvm used to run the javac/javah command 48 # JVM:=The jvm used to run the javac/javah command
49 # JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out 49 # JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out
50 # FLAGS:=Flags to be supplied to javac 50 # FLAGS:=Flags to be supplied to javac
51 # SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here 51 # SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here
141 # transfered in make variables. When the macro is run in a different makefile than the 141 # transfered in make variables. When the macro is run in a different makefile than the
142 # java compilation, the dependencies need to be found in the filesystem. 142 # java compilation, the dependencies need to be found in the filesystem.
143 ifneq (,$2) 143 ifneq (,$2)
144 $1_DEPS:=$2 144 $1_DEPS:=$2
145 else 145 else
146 $1_DEPS:=$$(filter $$(addprefix %,$$($1_FIND_PATTERNS)),\ 146 $1_DEPS:=$$(filter $$(addprefix %,$$($1_SUFFIXES)),\
147 $$(call CacheFind $$($1_SRCS))) 147 $$(call CacheFind,$$($1_SRCS)))
148 ifneq (,$$($1_GREP_INCLUDE_PATTERNS)) 148 ifneq (,$$($1_GREP_INCLUDE_PATTERNS))
149 $1_DEPS:=$$(filter $$(addsuffix %,$$($1_GREP_INCLUDE_PATTERNS)),$$($1_DEPS)) 149 $1_DEPS:=$$(filter $$(addsuffix %,$$($1_GREP_INCLUDE_PATTERNS)),$$($1_DEPS))
150 endif 150 endif
151 ifneq (,$$($1_GREP_EXCLUDE_PATTERNS)) 151 ifneq (,$$($1_GREP_EXCLUDE_PATTERNS))
152 $1_DEPS:=$$(filter-out $$(addsuffix %,$$($1_GREP_EXCLUDE_PATTERNS)),$$($1_DEPS)) 152 $1_DEPS:=$$(filter-out $$(addsuffix %,$$($1_GREP_EXCLUDE_PATTERNS)),$$($1_DEPS))
485 endif 485 endif
486 486
487 # Using sjavac to compile. 487 # Using sjavac to compile.
488 $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/javac_state 488 $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/javac_state
489 489
490 # Create SJAVAC variable, 490 # Create SJAVAC variable form JAVAC variable. Expects $1_JAVAC to be
491 # expects $1_JAVAC to be "bootclasspathprepend -jar ...javac.jar" 491 # "bootclasspathprepend -cp .../javac.jar com.sun.tools.javac.Main"
492 # and it is rewritten into "bootclasspathprepend com.sun.tools.sjavac.Main" 492 # and javac is simply replaced with sjavac.
493 $1_SJAVAC:=$$(word 1,$$($1_JAVAC)) -cp $$(word 3,$$($1_JAVAC)) com.sun.tools.sjavac.Main 493 $1_SJAVAC:=$$(subst com.sun.tools.javac.Main,com.sun.tools.sjavac.Main,$$($1_JAVAC))
494 494
495 # Set the $1_REMOTE to spawn a background javac server. 495 # Set the $1_REMOTE to spawn a background javac server.
496 $1_REMOTE:=--server:portfile=$$($1_SJAVAC_PORTFILE),id=$1,sjavac=$$(subst $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_SJAVAC)))) 496 $1_REMOTE:=--server:portfile=$$($1_SJAVAC_PORTFILE),id=$1,sjavac=$$(subst $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_SJAVAC))))
497 497
498 $$($1_BIN)/javac_state: $$($1_SRCS) $$($1_DEPENDS) 498 $$($1_BIN)/javac_state: $$($1_SRCS) $$($1_DEPENDS)

mercurial