7074397: Build infrastructure changes (makefile re-write)
Summary: New makefiles transition, old and new living side by side for now.
Reviewed-by: ohair, jjg, dholmes, ohrstrom, erikj, ihse, tgranat, ykantser
Contributed-by: ohrstrom <fredrik.ohrstrom@oracle.com>, erikj <erik.joelsson@oracle.com>, ihse <magnus.ihse.bursie@oracle.com>, tgranat <torbjorn.granat@oracle.com>, ykantser <yekaterina.kantserova@oracle.com>
diff --git a/makefiles/CopyFiles.gmk b/makefiles/CopyFiles.gmk
new file mode 100644
index 0000000..63679cf
--- /dev/null
+++ b/makefiles/CopyFiles.gmk
@@ -0,0 +1,232 @@
+#
+# 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.
+#
+
+INCLUDEDIR = $(JDK_OUTPUTDIR)/include
+# TODO: Platform dir needs to be "win32" on windows /erikj
+PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM)
+
+#
+# Copy exported header files to outputdir.
+#
+H_TARGET_FILES =$(INCLUDEDIR)/jdwpTransport.h \
+ $(INCLUDEDIR)/jni.h \
+ $(INCLUDEDIR)/jvmti.h \
+ $(INCLUDEDIR)/jvmticmlr.h \
+ $(INCLUDEDIR)/classfile_constants.h \
+ $(INCLUDEDIR)/jawt.h \
+ $(PLATFORM_INCLUDE)/jni_md.h \
+ $(PLATFORM_INCLUDE)/jawt_md.h
+
+$(INCLUDEDIR)/%.h: $(JDK_TOPDIR)/src/share/javavm/export/%.h
+ $(MKDIR) -p $(@D)
+ rm -f $@
+ $(CP) $< $@
+
+$(PLATFORM_INCLUDE)/%.h: $(JDK_TOPDIR)/src/$(LEGACY_HOST_OS_API)/javavm/export/%.h
+ $(MKDIR) -p $(@D)
+ rm -f $@
+ $(CP) $< $@
+
+COPY_FILES = $(H_TARGET_FILES)
+
+##########################################################################################
+
+LIBDIR = $(JDK_OUTPUTDIR)/lib
+SERVICETAG_LIBDIR = $(LIBDIR)/servicetag
+
+$(SERVICETAG_LIBDIR)/jdk_header.png: $(JDK_TOPDIR)/src/share/classes/com/sun/servicetag/resources/jdk_header.png
+ $(MKDIR) -p $(@D)
+ rm -f $@
+ $(CP) $< $@
+ $(CHMOD) 444 $@
+
+COPY_FILES += $(SERVICETAG_LIBDIR)/jdk_header.png
+
+##########################################################################################
+
+MGMT_LIBDIR = $(LIBDIR)/management
+MGMT_LIB_SRC = $(JDK_TOPDIR)/src/share/lib/management
+MGMT_SRC_FILES = $(wildcard $(MGMT_LIB_SRC)/*)
+MGMT_TARGET_FILES = $(subst $(MGMT_LIB_SRC),$(MGMT_LIBDIR),$(MGMT_SRC_FILES))
+
+$(MGMT_LIBDIR)/management.properties: $(MGMT_LIB_SRC)/management.properties
+ $(MKDIR) -p $(@D)
+ rm -f $@
+ $(CP) $< $@
+ $(CHMOD) 644 $@
+
+$(MGMT_LIBDIR)/%: $(MGMT_LIB_SRC)/%
+ $(MKDIR) -p $(@D)
+ rm -f $@
+ $(CP) $< $@
+ $(CHMOD) 444 $@
+
+COPY_FILES += $(MGMT_TARGET_FILES)
+
+##########################################################################################
+
+LOGGING_LIB_SRC = $(JDK_TOPDIR)/src/share/lib
+
+$(LIBDIR)/logging.properties: $(LOGGING_LIB_SRC)/logging.properties
+ $(MKDIR) -p $(@D)
+ rm -f $@
+ $(CP) $< $@
+
+COPY_FILES += $(LIBDIR)/logging.properties
+
+##########################################################################################
+#
+# Copy property files from sun/print to LIBDIR
+#
+PSFONTPROPFILE_SRC_DIR = $(JDK_TOPDIR)/src/share/classes/sun/print
+PSFONTPROPFILE_SRCS = $(wildcard $(PSFONTPROPFILE_SRC_DIR)/*.properties*)
+PSFONTPROPFILE_TARGET_FILES = $(subst $(PSFONTPROPFILE_SRC_DIR),$(LIBDIR),$(PSFONTPROPFILE_SRCS))
+
+$(PSFONTPROPFILE_TARGET_FILES): $(PSFONTPROPFILE_SRCS)
+ $(MKDIR) -p $(@D)
+ rm -f $@
+ $(CP) $< $@
+
+COPY_FILES += $(PSFONTPROPFILE_TARGET_FILES)
+
+##########################################################################################
+#
+# Copy flavormap.properties, cursor.properties and cursors gif files to LIBDIR
+#
+PLATFORM_LIB_SRC = $(JDK_TOPDIR)/src/$(LEGACY_HOST_OS_API)/lib
+
+$(LIBDIR)/flavormap.properties: $(PLATFORM_LIB_SRC)/flavormap.properties
+ $(MKDIR) -p $(@D)
+ rm -f $@
+ $(CP) $< $@
+
+COPY_FILES += $(LIBDIR)/flavormap.properties
+
+CURSORS_DEST_DIR = $(LIBDIR)/images/cursors
+CURSORS_PLATFORM_LIB_SRC = $(PLATFORM_LIB_SRC)/images/cursors
+
+$(CURSORS_DEST_DIR)/cursors.properties: $(CURSORS_PLATFORM_LIB_SRC)/cursors.properties
+ $(MKDIR) -p $(@D)
+ rm -f $@
+ $(CP) $< $@
+
+COPY_FILES += $(CURSORS_DEST_DIR)/cursors.properties
+
+CURSORS_LIB_SRC = $(JDK_TOPDIR)/src/share/lib/images/cursors
+ifeq ($(PLATFORM), windows)
+CURSORS_SRC_FILES = $(CURSORS_LIB_SRC)/invalid32x32.gif $(wildcard $(CURSORS_LIB_SRC)/win32_*.gif)
+else # PLATFORM
+CURSORS_SRC_FILES = $(CURSORS_LIB_SRC)/invalid32x32.gif $(wildcard $(CURSORS_LIB_SRC)/motif_*.gif)
+endif # PLATFORM
+CURSORS_TARGET_FILES = $(subst $(CURSORS_LIB_SRC),$(CURSORS_DEST_DIR),$(CURSORS_SRC_FILES))
+
+$(CURSORS_TARGET_FILES): $(CURSORS_SRC_FILES)
+ $(MKDIR) -p $(@D)
+ rm -f $@
+ $(CP) $< $@
+
+COPY_FILES += $(CURSORS_TARGET_FILES)
+
+##########################################################################################
+
+CONTENT_TYPES_SRC=$(JDK_TOPDIR)/src/$(LEGACY_HOST_OS_API)/lib
+
+$(LIBDIR)/content-types.properties: $(CONTENT_TYPES_SRC)/content-types.properties
+ $(MKDIR) -p $(@D)
+ rm -f $@
+ $(CP) $< $@
+
+COPY_FILES += $(LIBDIR)/content-types.properties
+
+##########################################################################################
+
+ICCPROFILE_DEST_DIR := $(LIBDIR)/cmm
+
+ifdef OPENJDK
+ ICCPROFILE_SRC_DIR := $(JDK_TOPDIR)/src/share/lib/cmm/lcms
+else
+ ICCPROFILE_SRC_DIR := $(JDK_TOPDIR)/src/closed/share/lib/cmm/kcms
+endif
+
+ICCPROFILE_SRCS:=$(wildcard $(ICCPROFILE_SRC_DIR)/*.pf)
+ICCPROFILE_TARGET_FILES:=$(subst $(ICCPROFILE_SRC_DIR),$(ICCPROFILE_DEST_DIR),$(ICCPROFILE_SRCS))
+
+$(ICCPROFILE_DEST_DIR)%.pf: $(ICCPROFILE_SRC_DIR)%.pf
+ $(MKDIR) -p $(@D)
+ rm -f $@
+ $(CP) $< $@
+ $(CHMOD) 444 $@
+
+COPY_FILES += $(ICCPROFILE_TARGET_FILES)
+
+##########################################################################################
+
+#make sure freetype dll will be available at runtime as well as link time
+#
+#NB: Default freetype build system uses -h linker option and
+# result .so contains hardcoded library name that is later
+# used for adding dependencies to other objects
+# (e.g. libfontmanager.so).
+#
+# It is not obvious how to extract that hardcoded name (libfreetype.so.6)
+# without overcomplicating logic here.
+# To workaround this we hardcode .6 suffix for now.
+#
+# Note that .so.6 library will not be found by System.loadLibrary()
+# but fortunately we need to load FreeType library explicitly
+# on windows only
+#
+#TODO: rework this to avoid hardcoding library name in the makefile
+#
+ifdef OPENJDK
+ ifeq ($(PLATFORM), windows)
+ FREETYPE_LIB = $(JDK_OUTPUTDIR)/bin/$(call SHARED_LIBRARY,freetype)
+ else
+ ifeq ($(USING_SYSTEM_FT_LIB), false)
+ FREETYPE_LIB = $(JDK_OUTPUTDIR)/lib/$(LIBARCH)/$(call SHARED_LIBRARY,freetype).6
+ endif
+ endif
+
+ $(FREETYPE_LIB):
+ $(CP) $(FREETYPE2_LIB_PATH)/$(call SHARED_LIBRARY,freetype) $@
+
+ COPY_FILES += $(FREETYPE_LIB)
+endif
+
+##########################################################################################
+
+# Copy msvcr100.dll on windows
+
+ifeq ($(PLATFORM),windows)
+ MSVCRNN_TARGET := $(JDK_OUTPUTDIR)/bin/$(notdir $(MSVCRNN_DLL))
+ $(MSVCRNN_TARGET): $(MSVCRNN_DLL)
+ $(MKDIR) -p $(@D)
+ rm -f $@
+ $(CP) $< $@
+
+ COPY_FILES += $(MSVCRNN_TARGET)
+endif
+
+##########################################################################################