NewMakefile.gmk

Fri, 12 Oct 2012 14:46:47 -0700

author
lana
date
Fri, 12 Oct 2012 14:46:47 -0700
changeset 491
ce2b111ee869
parent 478
2ba6f4da4bf3
child 494
e64f2cb57d05
permissions
-rw-r--r--

Merge

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

mercurial