jdk/make/common/Defs.gmk
changeset 4917 c98da2209f8c
parent 4681 7d382dfe6e55
child 5506 202f599c92aa
equal deleted inserted replaced
4916:de44744708a2 4917:c98da2209f8c
   574 
   574 
   575 # Simple install of $< file to $@
   575 # Simple install of $< file to $@
   576 define install-file
   576 define install-file
   577 $(prep-target)
   577 $(prep-target)
   578 $(CP) $< $@
   578 $(CP) $< $@
   579 $(install-module-file)
   579 @$(install-module-file)
   580 endef
   580 endef
   581 
   581 
   582 define chmod-file
   582 define chmod-file
   583 $(CHMOD) $1 $@
   583 $(CHMOD) $1 $@
   584 $(call chmod-module-file, $1)
   584 @$(call chmod-module-file, $1)
   585 endef
   585 endef
   586 
   586 
   587 define install-sym-link
   587 define install-sym-link
   588 $(LN) -s $1 $@
   588 $(LN) -s $1 $@
   589 $(call install-module-sym-link, $1)
   589 @$(call install-module-sym-link, $1)
   590 endef
   590 endef
   591 
   591 
   592 #
   592 #
   593 # Marcos for files not belonging to any module 
   593 # Marcos for files not belonging to any module 
   594 define install-non-module-file
   594 define install-non-module-file
   605 HOTSPOT_LOG_NAME = hotspot.log
   605 HOTSPOT_LOG_NAME = hotspot.log
   606 define java-vm-cleanup
   606 define java-vm-cleanup
   607 if [ -w $(HOTSPOT_LOG_NAME) ] ; then $(RM) $(HOTSPOT_LOG_NAME); fi
   607 if [ -w $(HOTSPOT_LOG_NAME) ] ; then $(RM) $(HOTSPOT_LOG_NAME); fi
   608 endef
   608 endef
   609 
   609 
   610 # Default make settings for processing SUBDIRS with clobber or clean names
       
   611 SUBDIRS_MAKEFLAGS-clobber = INCREMENTAL_BUILD=false
       
   612 SUBDIRS_MAKEFLAGS-clean   = INCREMENTAL_BUILD=false
       
   613 
       
   614 # Current directory
   610 # Current directory
   615 CURRENT_DIRECTORY := $(shell $(PWD))
   611 CURRENT_DIRECTORY := $(shell $(PWD))
   616 
       
   617 # If no timing wanted, we need to define these as empty
       
   618 ifdef NO_TIMING
       
   619 
       
   620 TIMING_ID:=NA
       
   621 
       
   622 define TIMING_start
       
   623 t=0:0:0:0
       
   624 endef
       
   625 
       
   626 define TIMING_end
       
   627 time_used=0
       
   628 endef
       
   629 
       
   630 else # NO_TIMING
       
   631 
       
   632 # Default timing id
       
   633 TIMING_ID:=$(shell $(BASENAME) $(CURRENT_DIRECTORY))
       
   634 
       
   635 # Timing start (must be used in same shell, e.g. same command line)
       
   636 #    Defines the shell variable $1 to have the start time.
       
   637 define TIMING_start
       
   638 $1=`$(DATE) +%j:%H:%M:%S`
       
   639 endef
       
   640 
       
   641 # Timing end (must be used in same shell, e.g. same command line)
       
   642 #    Expects shell variable $1 to have been defined as the start time.
       
   643 #    Expects shell variable $2 to have timing id string
       
   644 #    Sets total_seconds shell variable as the total seconds used.
       
   645 #    Sets time_used shell variable to contain format "%dh%dm%ds"
       
   646 define TIMING_end
       
   647 begTime="$${$1}"; \
       
   648 timing_id="$${$2}"; \
       
   649 endTime=`$(DATE) +%j:%H:%M:%S`; \
       
   650 d1=`$(ECHO) $${begTime} | $(CUT) -d':' -f1 | $(SED) -e 's@^0*@@'`; \
       
   651 if [ "$${d1}" = "" ] ; then d1=0; fi; \
       
   652 h1=`$(ECHO) $${begTime} | $(CUT) -d':' -f2 | $(SED) -e 's@^0*@@'`; \
       
   653 if [ "$${h1}" = "" ] ; then h1=0; fi; \
       
   654 m1=`$(ECHO) $${begTime} | $(CUT) -d':' -f3 | $(SED) -e 's@^0*@@'`; \
       
   655 if [ "$${m1}" = "" ] ; then m1=0; fi; \
       
   656 s1=`$(ECHO) $${begTime} | $(CUT) -d':' -f4 | $(SED) -e 's@^0*@@'`; \
       
   657 if [ "$${s1}" = "" ] ; then s1=0; fi; \
       
   658 d2=`$(ECHO) $${endTime} | $(CUT) -d':' -f1 | $(SED) -e 's@^0*@@'`; \
       
   659 if [ "$${d2}" = "" ] ; then d2=0; fi; \
       
   660 h2=`$(ECHO) $${endTime} | $(CUT) -d':' -f2 | $(SED) -e 's@^0*@@'`; \
       
   661 if [ "$${h2}" = "" ] ; then h2=0; fi; \
       
   662 m2=`$(ECHO) $${endTime} | $(CUT) -d':' -f3 | $(SED) -e 's@^0*@@'`; \
       
   663 if [ "$${m2}" = "" ] ; then m2=0; fi; \
       
   664 s2=`$(ECHO) $${endTime} | $(CUT) -d':' -f4 | $(SED) -e 's@^0*@@'`; \
       
   665 if [ "$${s2}" = "" ] ; then s2=0; fi; \
       
   666 t1_secs=`$(EXPR) $${d1} '*' 60 '*' 60 '*' 24 '+' $${h1} '*' 60 '*' 60 \
       
   667 		 '+' $${m1} '*' 60 '+' $${s1}`; \
       
   668 t2_secs=`$(EXPR) $${d2} '*' 60 '*' 60 '*' 24 '+' $${h2} '*' 60 '*' 60 \
       
   669 		 '+' $${m2} '*' 60 '+' $${s2}`; \
       
   670 total_seconds=`$(EXPR) $${t2_secs} '-' $${t1_secs}`; \
       
   671 if [ "$${total_seconds}" -lt 0 ] ; then total_seconds=0; fi; \
       
   672 t_hour=`$(EXPR) $${total_seconds} '/' '(' 60 '*' 60 ')'`h; \
       
   673 t_min=`$(EXPR) '(' $${total_seconds} '%' '(' 60 '*' 60 ')' ')' '/' 60`m; \
       
   674 t_sec=`$(EXPR) $${total_seconds} '%' 60`s; \
       
   675 time_used=$${t_sec}; \
       
   676 if [ "$${t_hour}" != "0h" ] ; then \
       
   677 time_used=$${t_hour}$${t_min}$${t_sec}; \
       
   678 elif [ "$${t_min}" != "0m" ] ; then \
       
   679 time_used=$${t_min}$${t_sec}; \
       
   680 else \
       
   681 time_used=$${t_sec}; \
       
   682 fi; \
       
   683 $(PRINTF) "  Timing: %05d seconds or %s for %s\n" \
       
   684     $${total_seconds} $${time_used} $${timing_id}
       
   685 endef
       
   686 
       
   687 endif # NO_TIMING
       
   688 
       
   689 # Given a SUBDIRS list, cd into them and make them
       
   690 #   SUBDIRS_MAKEFLAGS      Make settings for a subdir make
       
   691 #   SUBDIRS_MAKEFLAGS-$@   Make settings specific to this target
       
   692 define SUBDIRS-loop
       
   693 @$(ECHO) "Begin Processing SUBDIRS: $(SUBDIRS)"
       
   694 @for i in DUMMY $(SUBDIRS) ; do \
       
   695   if [ "$$i" != "DUMMY" ] ; then \
       
   696     $(ECHO) ">>>Recursively making "$$i" "$@" @ `$(DATE)` ..."; \
       
   697     timing_id="$(TIMING_ID)-`$(BASENAME) $${i}`"; \
       
   698     $(call TIMING_start,startTime); \
       
   699     curDir=$(CURRENT_DIRECTORY); \
       
   700     $(CD) $$i; $(MAKE) $@ TIMING_ID=$${timing_id} \
       
   701 			  $(SUBDIRS_MAKEFLAGS) \
       
   702 			  $(SUBDIRS_MAKEFLAGS-$@) \
       
   703 			  FULL_VERSION=$(FULL_VERSION) \
       
   704 			  RELEASE=$(RELEASE) || exit 1; \
       
   705 	       $(CD) $${curDir}; \
       
   706     $(call TIMING_end,startTime,timing_id); \
       
   707     $(ECHO) "<<<Finished Recursively making "$$i" "$@" @ `$(DATE)`." ; \
       
   708   fi ; \
       
   709 done
       
   710 @$(ECHO) "Done Processing SUBDIRS: $(SUBDIRS)"
       
   711 endef
       
   712 
       
   713 # Given a OTHERSUBDIRS list, cd into them and make them (extra loop define)
       
   714 #   OTHERSUBDIRS_MAKEFLAGS      Make settings for a subdir make
       
   715 define OTHERSUBDIRS-loop
       
   716 @$(ECHO) "Begin Processing OTHERSUBDIRS: $(OTHERSUBDIRS)"
       
   717 @for i in DUMMY $(OTHERSUBDIRS) ; do \
       
   718   if [ "$$i" != "DUMMY" ] ; then \
       
   719     $(ECHO) ">>>Recursively making "$$i" "$@" @ `$(DATE)` ..."; \
       
   720     timing_id="$(TIMING_ID)-`$(BASENAME) $${i}`"; \
       
   721     $(call TIMING_start,startTime); \
       
   722     curDir=$(CURRENT_DIRECTORY); \
       
   723     $(CD) $$i; $(MAKE) $@ TIMING_ID=$${timing_id} \
       
   724 		          $(OTHERSUBDIRS_MAKEFLAGS) \
       
   725 			  FULL_VERSION=$(FULL_VERSION) \
       
   726 			  RELEASE=$(RELEASE) || exit 1; \
       
   727 	       $(CD) $${curDir}; \
       
   728     $(call TIMING_end,startTime,timing_id); \
       
   729     $(ECHO) "<<<Finished Recursively making "$$i" "$@" @ `$(DATE)`." ; \
       
   730   fi ; \
       
   731 done
       
   732 @$(ECHO) "Done Processing OTHERSUBDIRS: $(OTHERSUBDIRS)"
       
   733 endef
       
   734 
   612 
   735 #
   613 #
   736 # Create BYFILE OPT and DBG settings, if CFLAGS_OPT/foobar.o is set then it is
   614 # Create BYFILE OPT and DBG settings, if CFLAGS_OPT/foobar.o is set then it is
   737 #    used for this file, otherwise the default settings are used.
   615 #    used for this file, otherwise the default settings are used.
   738 #
   616 #
   817 fi
   695 fi
   818 endef
   696 endef
   819 
   697 
   820 define install-import-file
   698 define install-import-file
   821 $(install-importonly-file)
   699 $(install-importonly-file)
   822 $(install-module-file)
   700 @$(install-module-file)
   823 endef
   701 endef
   824 
   702 
   825 .PHONY: all build clean clobber
   703 .PHONY: all build clean clobber