NewMakefile.gmk
changeset 14111 2a82ecb35fc7
parent 13697 5262b00bc10c
child 15053 64278cb83950
equal deleted inserted replaced
14104:8d9d430b4244 14111:2a82ecb35fc7
    29 CD=cd
    29 CD=cd
    30 CMP=cmp
    30 CMP=cmp
    31 CP=cp
    31 CP=cp
    32 ECHO=echo
    32 ECHO=echo
    33 MKDIR=mkdir
    33 MKDIR=mkdir
       
    34 PRINTF=printf
    34 PWD=pwd
    35 PWD=pwd
    35 SH=sh
    36 TAR=tar
    36 ifeq ($(PLATFORM),windows)
    37 ifeq ($(PLATFORM),windows)
    37   ZIP=zip
    38   ZIP=zip
    38 else
    39 else
    39   # store symbolic links as the link
    40   # store symbolic links as the link
    40   ZIP=zip -y
    41   ZIP=zip -y
    61 all images clean: checks
    62 all images clean: checks
    62 	@if [ "$(ALL_MAKEFILES)" = "" ] ; then \
    63 	@if [ "$(ALL_MAKEFILES)" = "" ] ; then \
    63 	  $(ECHO) "ERROR: No configurations to build"; exit 1; \
    64 	  $(ECHO) "ERROR: No configurations to build"; exit 1; \
    64 	fi
    65 	fi
    65 	@for bdir in $(dir $(ALL_MAKEFILES)) ; do \
    66 	@for bdir in $(dir $(ALL_MAKEFILES)) ; do \
    66 	  $(ECHO) "$(CD) $${bdir} && $(MAKE) $(EXTRA_MAKE_ARGS) $@" ; \
    67 	  $(ECHO) "$(CD) $${bdir} && $(MAKE) $@" ; \
    67 	  $(CD) $${bdir} && $(MAKE) $(EXTRA_MAKE_ARGS) $@ ; \
    68 	  $(CD) $${bdir} && $(MAKE) $@ ; \
    68 	done
    69 	done
       
    70 
       
    71 # TBD: Deploy input
       
    72 $(BUILD_DIR_ROOT)/.deploy_input:
       
    73 	@if [ "$(ALL_MAKEFILES)" = "" ] ; then \
       
    74 	  $(ECHO) "ERROR: No configurations to build"; exit 1; \
       
    75 	fi
       
    76 	@for bdir in $(dir $(ALL_MAKEFILES)) ; do \
       
    77 	  if [ deploy/make/Makefile ] ; then \
       
    78 	    echo "Attempting deploy build." ; \
       
    79 	    ( \
       
    80 	      $(RM) -r $${bdir}/deploy_input ; \
       
    81 	      $(MKDIR) -p $${bdir}/deploy_input ; \
       
    82 	      ( $(CD) $${bdir}/images && $(TAR) -cf - j2sdk-image j2re-image ) \
       
    83 	        | ( $(CD) $${bdir}/deploy_input && $(TAR) -xf - ) ; \
       
    84 	    ) ; \
       
    85 	  fi; \
       
    86 	done
       
    87 	touch $@
       
    88 
       
    89 # TBD: Deploy images
       
    90 deploy: $(BUILD_DIR_ROOT)/.deploy_input
       
    91 	@if [ "$(ALL_MAKEFILES)" = "" ] ; then \
       
    92 	  $(ECHO) "ERROR: No configurations to build"; exit 1; \
       
    93 	fi
       
    94 	@for bdir in $(dir $(ALL_MAKEFILES)) ; do \
       
    95 	  if [ deploy/make/Makefile ] ; then \
       
    96 	    echo "Attempting deploy build." ; \
       
    97 	    ( \
       
    98 	      $(CD) deploy/make && \
       
    99 	      $(MAKE) \
       
   100 	        ABS_OUTPUTDIR=$${bdir}/deploy_input \
       
   101 	        OUTPUTDIR=$${bdir}/deploy_input \
       
   102 	    ) ; \
       
   103 	  fi; \
       
   104 	done
       
   105 
       
   106 # TBD: Install bundles
       
   107 install:
    69 
   108 
    70 # Bundle creation
   109 # Bundle creation
    71 bundles:
   110 bundles:
    72 	@if [ "$(ALL_IMAGE_DIRS)" = "" ] ; then \
   111 	@if [ "$(ALL_IMAGE_DIRS)" = "" ] ; then \
    73 	  $(ECHO) "ERROR: No images to bundle"; exit 1; \
   112 	  $(ECHO) "ERROR: No images to bundle"; exit 1; \
    89 #     * Check that all open repos exist, at least until we are ready for some
   128 #     * Check that all open repos exist, at least until we are ready for some
    90 #       kind of partial build.
   129 #       kind of partial build.
    91 checks:
   130 checks:
    92 	@$(ECHO) "No checks yet"
   131 	@$(ECHO) "No checks yet"
    93 
   132 
    94 # Keep track of phony targets
   133 # Keep track of user targets
    95 PHONY_LIST += all images clean clobber checks
   134 USER_TARGETS += all deploy install images clean clobber checks
    96 
   135 
    97 ###########################################################################
   136 ###########################################################################
    98 # To help in adoption of the new configure&&make build process, a bridge
   137 # 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.
   138 #   build will use the old settings to run configure and do the build.
   100 
   139 
   101 # Build with the configure bridge
   140 # Build with the configure bridge
   102 bridgeBuild: bridge2configure images
   141 bridgeBuild: bridge2configure images
   103 
   142 
   104 # Bridge from old Makefile ALT settings to configure options
   143 # Bridge from old Makefile ALT settings to configure options
   105 bridge2configure: .bridge2configureOpts
   144 bridge2configure: $(BUILD_DIR_ROOT)/.bridge2configureOpts
   106 	$(CD) common/makefiles && sh ../autoconf/configure $(strip $(shell $(CAT) $<))
   145 	bash ./configure $(strip $(shell $(CAT) $<))
   107 
   146 
   108 # Create a file with configure options created from old Makefile mechanisms.
   147 # Create a file with configure options created from old Makefile mechanisms.
   109 .bridge2configureOpts: .bridge2configureOptsLatest
   148 $(BUILD_DIR_ROOT)/.bridge2configureOpts: $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest
   110 	$(RM) $@
   149 	$(RM) $@
   111 	$(CP) $< $@
   150 	$(CP) $< $@
   112 
   151 
   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
       
   126 
       
   127 # Use this file to only change when obvious things have changed
   152 # Use this file to only change when obvious things have changed
   128 .bridge2configureOptsLatest: FRC
   153 $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest: FRC
   129 	$(RM) $@.tmp
   154 	$(RM) $@.tmp
   130 	@$(ECHO) " MAKE=$(MAKE_COMMAND) " >> $@.tmp
   155 	$(MKDIR) -p $(BUILD_DIR_ROOT)
   131 	@$(ECHO) " --with-debug-level=$(if $(DEBUG_LEVEL),$(DEBUG_LEVEL),release) " >> $@.tmp
   156 	@$(ECHO) " --with-debug-level=$(if $(DEBUG_LEVEL),$(DEBUG_LEVEL),release) " >> $@.tmp
   132 ifdef ARCH_DATA_MODEL
   157 ifdef ARCH_DATA_MODEL
   133 	@$(ECHO) " --with-target-bits=$(ARCH_DATA_MODEL) " >> $@.tmp
   158 	@$(ECHO) " --with-target-bits=$(ARCH_DATA_MODEL) " >> $@.tmp
   134 endif
   159 endif
   135 ifdef ALT_PARALLEL_COMPILE_JOBS
   160 ifdef ALT_PARALLEL_COMPILE_JOBS
   154 	$(RM) $@.tmp
   179 	$(RM) $@.tmp
   155 
   180 
   156 # Clobber all the built files
   181 # Clobber all the built files
   157 clobber:: bridge2clobber
   182 clobber:: bridge2clobber
   158 bridge2clobber::
   183 bridge2clobber::
   159 	$(RM) .bridge2*
   184 	$(RM) $(BUILD_DIR_ROOT)/.bridge2*
       
   185 	$(RM) $(BUILD_DIR_ROOT)/.deploy_input
   160 
   186 
   161 # Keep track of phony targets
   187 # Keep track of phony targets
   162 PHONY_LIST += bridge2configure bridgeBuild bridge2clobber
   188 PHONY_LIST += bridge2configure bridgeBuild bridge2clobber
   163 
   189 
   164 ###########################################################################
   190 ###########################################################################
       
   191 # Sanity checks (history target)
       
   192 #
       
   193 
       
   194 sanity: checks
       
   195 
       
   196 # Keep track of user targets
       
   197 USER_TARGETS += sanity
       
   198 
       
   199 ###########################################################################
   165 # Javadocs
   200 # Javadocs
   166 #
   201 #
   167 
   202 
   168 javadocs:
   203 javadocs:
   169 	cd common/makefiles && $(MAKE) -f MakefileJavadoc.gmk
   204 	cd common/makefiles && $(MAKE) -f MakefileJavadoc.gmk
   170 
   205 
   171 # Keep track of phony targets
   206 # Keep track of user targets
   172 PHONY_LIST += javadocs
   207 USER_TARGETS += javadocs
   173 
   208 
   174 ###########################################################################
   209 ###########################################################################
   175 # JPRT targets
   210 # JPRT targets
   176 
   211 
   177 ifndef JPRT_ARCHIVE_BUNDLE
   212 ifndef JPRT_ARCHIVE_BUNDLE
   188 
   223 
   189 jprt_build_debug: DEBUG_LEVEL=slowdebug
   224 jprt_build_debug: DEBUG_LEVEL=slowdebug
   190 jprt_build_debug: BUILD_DIRNAME=*-debug
   225 jprt_build_debug: BUILD_DIRNAME=*-debug
   191 jprt_build_debug: jprt_build_generic
   226 jprt_build_debug: jprt_build_generic
   192 
   227 
   193 jprt_build_generic: EXTRA_MAKE_ARGS=LOG=nofile,info
       
   194 jprt_build_generic: $(JPRT_ARCHIVE_BUNDLE)
   228 jprt_build_generic: $(JPRT_ARCHIVE_BUNDLE)
   195 
   229 
   196 $(JPRT_ARCHIVE_BUNDLE): bridgeBuild bundles
   230 $(JPRT_ARCHIVE_BUNDLE): bridgeBuild bundles
   197 	$(MKDIR) -p $(@D)
   231 	$(MKDIR) -p $(@D)
   198 	$(RM) $@
   232 	$(RM) $@
   201 # Keep track of phony targets
   235 # Keep track of phony targets
   202 PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \
   236 PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \
   203               jprt_build_generic
   237               jprt_build_generic
   204 
   238 
   205 ###########################################################################
   239 ###########################################################################
       
   240 # Help target
       
   241 
       
   242 HELP_FORMAT=%12s%s\n
       
   243 
       
   244 help:
       
   245 	@$(PRINTF) "# JDK Makefile\n"
       
   246 	@$(PRINTF) "#\n"
       
   247 	@$(PRINTF) "# Usage: make [Target]\n"
       
   248 	@$(PRINTF) "#\n"
       
   249 	@$(PRINTF) "#   $(HELP_FORMAT)" "Target   " "Description"
       
   250 	@$(PRINTF) "#   $(HELP_FORMAT)" "------   " "-----------"
       
   251 	@for i in $(USER_TARGETS) ; do \
       
   252 	  $(MAKE) help_$${i} ; \
       
   253 	done
       
   254 	@$(PRINTF) "#\n"
       
   255 
       
   256 help_all:
       
   257 	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
       
   258 	"Build the entire jdk but not the images"
       
   259 help_images:
       
   260 	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
       
   261 	"Create the jdk images for the builds"
       
   262 help_deploy:
       
   263 	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
       
   264 	"Create the jdk deploy images from the jdk images"
       
   265 help_install:
       
   266 	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
       
   267 	"Create the jdk install bundles from the deploy images"
       
   268 help_clean:
       
   269 	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
       
   270 	"Clean and prepare for a fresh build from scratch"
       
   271 help_clobber:
       
   272 	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
       
   273 	"Clean and also purge any hidden derived data"
       
   274 help_checks:
       
   275 	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
       
   276 	"Perform various checks to make sure we can build"
       
   277 help_sanity:
       
   278 	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
       
   279 	"Same as 'make checks'"
       
   280 help_javadocs:
       
   281 	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
       
   282 	"Build the javadocs"
       
   283 help_help:
       
   284 	@$(PRINTF) "#   $(HELP_FORMAT)" "$(subst help_,,$@) - " \
       
   285 	"Print out the help messages"
       
   286 
       
   287 # Keep track of user targets
       
   288 USER_TARGETS += help
       
   289 
       
   290 ###########################################################################
   206 # Phony targets
   291 # Phony targets
   207 .PHONY: $(PHONY_LIST)
   292 .PHONY: $(PHONY_LIST) $(USER_TARGETS)
   208 
   293 
   209 # Force target
   294 # Force target
   210 FRC:
   295 FRC:
   211