NewMakefile.gmk

Tue, 18 Sep 2012 11:29:16 -0700

author
ohair
date
Tue, 18 Sep 2012 11:29:16 -0700
changeset 478
2ba6f4da4bf3
child 494
e64f2cb57d05
permissions
-rw-r--r--

7197849: Update new build-infra makefiles
Reviewed-by: ihse, erikj, ohrstrom, tbell

     1 #
     2 # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 #
     5 # This code is free software; you can redistribute it and/or modify it
     6 # under the terms of the GNU General Public License version 2 only, as
     7 # published by the Free Software Foundation.  Oracle designates this
     8 # particular file as subject to the "Classpath" exception as provided
     9 # by Oracle in the LICENSE file that accompanied this code.
    10 #
    11 # This code is distributed in the hope that it will be useful, but WITHOUT
    12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14 # version 2 for more details (a copy is included in the LICENSE file that
    15 # accompanied this code).
    16 #
    17 # You should have received a copy of the GNU General Public License version
    18 # 2 along with this work; if not, write to the Free Software Foundation,
    19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20 #
    21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22 # or visit www.oracle.com if you need additional information or have any
    23 # questions.
    24 #
    26 # Utilities used in this Makefile
    27 BASENAME=basename
    28 CAT=cat
    29 CD=cd
    30 CMP=cmp
    31 CP=cp
    32 ECHO=echo
    33 MKDIR=mkdir
    34 PWD=pwd
    35 SH=sh
    36 ifeq ($(PLATFORM),windows)
    37   ZIP=zip
    38 else
    39   # store symbolic links as the link
    40   ZIP=zip -y
    41 endif
    42 # Insure we have a path that looks like it came from pwd
    43 #   (This is mostly for Windows sake and drive letters)
    44 define UnixPath # path
    45 $(shell (cd "$1" && $(PWD)))
    46 endef
    48 # Current root directory
    49 CURRENT_DIRECTORY := $(shell $(PWD))
    51 # Build directory root
    52 BUILD_DIR_ROOT = $(CURRENT_DIRECTORY)/build
    54 # All configured Makefiles to run
    55 ALL_MAKEFILES = $(wildcard $(BUILD_DIR_ROOT)/*-*/Makefile)
    57 # All bundles to create
    58 ALL_IMAGE_DIRS = $(wildcard $(BUILD_DIR_ROOT)/*-*/images/*-image)
    60 # Build all the standard 'all', 'images', and 'clean' targets
    61 all images clean: checks
    62 	@if [ "$(ALL_MAKEFILES)" = "" ] ; then \
    63 	  $(ECHO) "ERROR: No configurations to build"; exit 1; \
    64 	fi
    65 	@for bdir in $(dir $(ALL_MAKEFILES)) ; do \
    66 	  $(ECHO) "$(CD) $${bdir} && $(MAKE) $(EXTRA_MAKE_ARGS) $@" ; \
    67 	  $(CD) $${bdir} && $(MAKE) $(EXTRA_MAKE_ARGS) $@ ; \
    68 	done
    70 # Bundle creation
    71 bundles:
    72 	@if [ "$(ALL_IMAGE_DIRS)" = "" ] ; then \
    73 	  $(ECHO) "ERROR: No images to bundle"; exit 1; \
    74 	fi
    75 	@for i in $(ALL_IMAGE_DIRS) ; do \
    76           $(MKDIR) -p $${i}/../../bundles && \
    77           $(RM) $${i}/../../bundles/`$(BASENAME) $${i}`.zip && \
    78 	  $(ECHO) "$(CD) $${i} && $(ZIP) -q -r ../../bundles/`$(BASENAME) $${i}`.zip ."  && \
    79 	  $(CD) $${i} && $(ZIP) -q -r ../../bundles/`$(BASENAME) $${i}`.zip . ; \
    80 	done
    82 # Clobber all the built files
    83 clobber::
    84 	$(RM) -r $(BUILD_DIR_ROOT)
    86 # Make various checks to insure the build will be successful
    87 #   Possibilities:
    88 #     * Check that if any closed repo is provided, they all must be.
    89 #     * Check that all open repos exist, at least until we are ready for some
    90 #       kind of partial build.
    91 checks:
    92 	@$(ECHO) "No checks yet"
    94 # Keep track of phony targets
    95 PHONY_LIST += all images clean clobber checks
    97 ###########################################################################
    98 # To help in adoption of the new configure&&make build process, a bridge
    99 #   build will use the old settings to run configure and do the build.
   101 # Build with the configure bridge
   102 bridgeBuild: bridge2configure images
   104 # Bridge from old Makefile ALT settings to configure options
   105 bridge2configure: .bridge2configureOpts
   106 	$(CD) common/makefiles && sh ../autoconf/configure $(strip $(shell $(CAT) $<))
   108 # Create a file with configure options created from old Makefile mechanisms.
   109 .bridge2configureOpts: .bridge2configureOptsLatest
   110 	$(RM) $@
   111 	$(CP) $< $@
   113 # In case make was invoked from a specific path
   114 _MAKE_COMMAND_PATH:=$(firstword $(MAKE))
   115 ifneq ($(dir $(_MAKE_COMMAND_PATH)),./)
   116   # This could be removed someday if JPRT was fixed and we could assume that
   117   #    the path to make was always in PATH.
   118   MAKE_BINDIR:=$(call UnixPath,$(dir $(_MAKE_COMMAND_PATH)))
   119   NEWPATH:=$(MAKE_BINDIR):${PATH}
   120   PATH:=$(NEWPATH)
   121   export PATH
   122   MAKE_COMMAND=$(MAKE_BINDIR)/$(notdir $(_MAKE_COMMAND_PATH))
   123 else
   124   MAKE_COMMAND=$(_MAKE_COMMAND_PATH)
   125 endif
   127 # Use this file to only change when obvious things have changed
   128 .bridge2configureOptsLatest: FRC
   129 	$(RM) $@.tmp
   130 	@$(ECHO) " MAKE=$(MAKE_COMMAND) " >> $@.tmp
   131 	@$(ECHO) " --with-debug-level=$(if $(DEBUG_LEVEL),$(DEBUG_LEVEL),release) " >> $@.tmp
   132 ifdef ARCH_DATA_MODEL
   133 	@$(ECHO) " --with-target-bits=$(ARCH_DATA_MODEL) " >> $@.tmp
   134 endif
   135 ifdef ALT_PARALLEL_COMPILE_JOBS
   136 	@$(ECHO) " --with-num-cores=$(ALT_PARALLEL_COMPILE_JOBS) " >> $@.tmp
   137 endif
   138 ifdef ALT_BOOTDIR
   139 	@$(ECHO) " --with-boot-jdk=$(call UnixPath,$(ALT_BOOTDIR)) " >> $@.tmp
   140 endif
   141 ifdef ALT_CUPS_HEADERS_PATH
   142 	@$(ECHO) " --with-cups-include=$(call UnixPath,$(ALT_CUPS_HEADERS_PATH)) " >> $@.tmp
   143 endif
   144 ifdef ALT_FREETYPE_HEADERS_PATH
   145 	@$(ECHO) " --with-freetype=$(call UnixPath,$(ALT_FREETYPE_HEADERS_PATH)/..) " >> $@.tmp
   146 endif
   147 	@if [ -f $@ ] ; then \
   148           if ! $(CMP) $@ $@.tmp > /dev/null ; then \
   149             $(CP) $@.tmp $@ ; \
   150           fi ; \
   151         else \
   152           $(CP) $@.tmp $@ ; \
   153         fi
   154 	$(RM) $@.tmp
   156 # Clobber all the built files
   157 clobber:: bridge2clobber
   158 bridge2clobber::
   159 	$(RM) .bridge2*
   161 # Keep track of phony targets
   162 PHONY_LIST += bridge2configure bridgeBuild bridge2clobber
   164 ###########################################################################
   165 # Javadocs
   166 #
   168 javadocs:
   169 	cd common/makefiles && $(MAKE) -f MakefileJavadoc.gmk
   171 # Keep track of phony targets
   172 PHONY_LIST += javadocs
   174 ###########################################################################
   175 # JPRT targets
   177 ifndef JPRT_ARCHIVE_BUNDLE
   178   JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip
   179 endif
   181 jprt_build_product: DEBUG_LEVEL=release
   182 jprt_build_product: BUILD_DIRNAME=*-release
   183 jprt_build_product: jprt_build_generic
   185 jprt_build_fastdebug: DEBUG_LEVEL=fastdebug
   186 jprt_build_fastdebug: BUILD_DIRNAME=*-fastdebug
   187 jprt_build_fastdebug: jprt_build_generic
   189 jprt_build_debug: DEBUG_LEVEL=slowdebug
   190 jprt_build_debug: BUILD_DIRNAME=*-debug
   191 jprt_build_debug: jprt_build_generic
   193 jprt_build_generic: EXTRA_MAKE_ARGS=LOG=nofile,info
   194 jprt_build_generic: $(JPRT_ARCHIVE_BUNDLE)
   196 $(JPRT_ARCHIVE_BUNDLE): bridgeBuild bundles
   197 	$(MKDIR) -p $(@D)
   198 	$(RM) $@
   199 	$(CP) $(BUILD_DIR_ROOT)/$(BUILD_DIRNAME)/bundles/j2sdk-image.zip $@
   201 # Keep track of phony targets
   202 PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \
   203               jprt_build_generic
   205 ###########################################################################
   206 # Phony targets
   207 .PHONY: $(PHONY_LIST)
   209 # Force target
   210 FRC:

mercurial