< prev index next >

make/common/NativeCompilation.gmk

Print this page

        

*** 51,69 **** --- 51,81 ---- UNIX_PATH_PREFIX := /cygdrive else ifeq ($(OPENJDK_BUILD_OS_ENV), windows.msys) UNIX_PATH_PREFIX := endif + # This pattern is used to transform the output of the microsoft CL compiler + # into a make syntax dependency file (.d) WINDOWS_SHOWINCLUDE_SED_PATTERN := \ -e '/^Note: including file:/!d' \ -e 's|Note: including file: *||' \ -e 's|\\|/|g' \ -e 's|^\([a-zA-Z]\):|$(UNIX_PATH_PREFIX)/\1|g' \ -e '/$(subst /,\/,$(TOPDIR))/!d' \ -e 's|$$$$| \\|g' \ # + # This pattern is used to transform a dependency file (.d) to a list + # of make targets for dependent files (.d.targets) + DEPENDENCY_TARGET_SED_PATTERN := \ + -e 's/\#.*//' \ + -e 's/^[^:]*: *//' \ + -e 's/ *\\$$$$//' \ + -e '/^$$$$/ d' \ + -e 's/$$$$/ :/' \ + # + define add_native_source # param 1 = BUILD_MYPACKAGE # parma 2 = the source file name (..../alfa.c or .../beta.cpp) # param 3 = the bin dir that stores all .o (.obj) and .d files. # param 4 = the c flags to the compiler
*** 103,114 **** --- 115,131 ---- ifeq (,$$(findstring $$($1_$2_OBJ),$$($1_ALL_OBJS))) $1_ALL_OBJS+=$$($1_$2_OBJ) ifeq (,$$(filter %.s,$2)) # And this is the dependency file for this obj file. $1_$2_DEP:=$$(patsubst %$(OBJ_SUFFIX),%.d,$$($1_$2_OBJ)) + # The dependency target file lists all dependencies as empty targets + # to avoid make error "No rule to make target" for removed files + $1_$2_DEP_TARGETS:=$$(patsubst %$(OBJ_SUFFIX),%.d.targets,$$($1_$2_OBJ)) + # Include previously generated dependency information. (if it exists) -include $$($1_$2_DEP) + -include $$($1_$2_DEP_TARGETS) ifeq ($(TOOLCHAIN_TYPE), microsoft) $1_$2_DEBUG_OUT_FLAGS:=-Fd$$(patsubst %$(OBJ_SUFFIX),%.pdb,$$($1_$2_OBJ)) \ -Fm$$(patsubst %$(OBJ_SUFFIX),%.map,$$($1_$2_OBJ)) endif
*** 137,146 **** --- 154,168 ---- exit `cat $$($1_$2_DEP).exitvalue` $(RM) $$($1_$2_DEP).exitvalue ($(ECHO) $$@: \\ \ && $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_$2_DEP).raw) > $$($1_$2_DEP) endif + # Create a dependency target file from the dependency file. + # Solution suggested by http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/ + ifneq ($$($1_$2_DEP),) + $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_$2_DEP) > $$($1_$2_DEP_TARGETS) + endif endif endef # Setup make rules for creating a native binary (a shared library or an # executable).
*** 450,469 **** # This is a rough heuristic and may not always print accurate information. $$($1_BUILD_INFO): $$($1_SRCS) $$($1_COMPILE_VARDEPS_FILE) ifeq ($$(wildcard $$($1_TARGET)),) $(ECHO) 'Creating $$($1_BASENAME) from $$(words $$(filter-out %.vardeps, $$?)) file(s)' else ! $(ECHO) 'Updating $$($1_BASENAME) from $$(words $$(filter-out %.vardeps, $$?)) file(s)' endif $(TOUCH) $$@ # On windows we need to create a resource file ifeq ($(OPENJDK_TARGET_OS), windows) ifneq (,$$($1_VERSIONINFO_RESOURCE)) $1_RES:=$$($1_OBJECT_DIR)/$$($1_BASENAME).res $1_RES_DEP:=$$($1_RES).d -include $$($1_RES_DEP) $1_RES_VARDEPS := $(RC) $$($1_RC_FLAGS) $1_RES_VARDEPS_FILE := $$(call DependOnVariable, $1_RES_VARDEPS, \ $$($1_RES).vardeps) --- 472,496 ---- # This is a rough heuristic and may not always print accurate information. $$($1_BUILD_INFO): $$($1_SRCS) $$($1_COMPILE_VARDEPS_FILE) ifeq ($$(wildcard $$($1_TARGET)),) $(ECHO) 'Creating $$($1_BASENAME) from $$(words $$(filter-out %.vardeps, $$?)) file(s)' else ! $(ECHO) $$(strip 'Updating $$($1_BASENAME)' \ ! $$(if $$(filter-out %.vardeps, $$?), \ ! 'from $$(words $$(filter-out %.vardeps, $$?)) file(s)') \ ! $$(if $$(filter %.vardeps, $$?), 'due to makefile changes')) endif $(TOUCH) $$@ # On windows we need to create a resource file ifeq ($(OPENJDK_TARGET_OS), windows) ifneq (,$$($1_VERSIONINFO_RESOURCE)) $1_RES:=$$($1_OBJECT_DIR)/$$($1_BASENAME).res $1_RES_DEP:=$$($1_RES).d + $1_RES_DEP_TARGETS:=$$($1_RES).d.targets -include $$($1_RES_DEP) + -include $$($1_RES_DEP_TARGETS) $1_RES_VARDEPS := $(RC) $$($1_RC_FLAGS) $1_RES_VARDEPS_FILE := $$(call DependOnVariable, $1_RES_VARDEPS, \ $$($1_RES).vardeps)
*** 473,482 **** --- 500,510 ---- # Windows RC compiler does not support -showIncludes, so we mis-use CL for this. $(CC) $$($1_RC_FLAGS) -showIncludes -nologo -TC \ $(CC_OUT_OPTION)$$($1_RES_DEP).obj $$($1_VERSIONINFO_RESOURCE) > $$($1_RES_DEP).raw 2>&1 || exit 0 ($(ECHO) $$($1_RES): \\ \ && $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_RES_DEP).raw) > $$($1_RES_DEP) + $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_RES_DEP) > $$($1_RES_DEP_TARGETS) endif ifneq (,$$($1_MANIFEST)) $1_GEN_MANIFEST:=$$($1_OBJECT_DIR)/$$($1_PROGRAM).manifest IMVERSIONVALUE:=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VERSION).$(COOKED_BUILD_NUMBER) $1_MANIFEST_VARDEPS_FILE := $$(call DependOnVariable, IMVERSIONVALUE, \
< prev index next >