common/makefiles/JavaCompilation.gmk

Print this page
rev 769 : 8024265: Enable new build on AIX
Reviewed-by: ihse


 146         $1_DEPS:=$$(filter $$(addprefix %,$$($1_SUFFIXES)),\
 147                     $$(call CacheFind,$$($1_SRCS)))
 148         ifneq (,$$($1_GREP_INCLUDE_PATTERNS))
 149             $1_DEPS:=$$(filter $$(addsuffix %,$$($1_GREP_INCLUDE_PATTERNS)),$$($1_DEPS))
 150         endif
 151         ifneq (,$$($1_GREP_EXCLUDE_PATTERNS))
 152             $1_DEPS:=$$(filter-out $$(addsuffix %,$$($1_GREP_EXCLUDE_PATTERNS)),$$($1_DEPS))
 153         endif
 154         # The subst of \ is needed because $ has to be escaped with \ in EXTRA_FILES for the command 
 155         # lines, but not here for use in make dependencies.
 156         $1_DEPS+=$$(subst \,,$$(foreach src,$$($1_SRCS),$$(addprefix $$(src)/,$$($1_EXTRA_FILES))))
 157         ifeq (,$$($1_SKIP_METAINF))
 158             $1_DEPS+=$$(call CacheFind,$$(wildcard $$(addsuffix /META-INF,$$($1_SRCS))))
 159         endif
 160     endif
 161 
 162     # Utility macros, to make the shell script receipt somewhat easier to dechipher.
 163 
 164     # The capture contents macro finds all files (matching the patterns, typically
 165     # .class and .prp) that are newer than the jar-file, ie the new content to be put into the jar.

 166     $1_CAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS),\
 167                    (($(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) -a -newer $$@ $$($1_GREP_INCLUDES) \
 168                        $$($1_GREP_EXCLUDES) | $(SED) 's|$$(src)/||g' &&\
 169                        $(ECHO) $$(subst $$(src)/,,$$($1_EXTRA_FILES))) > \
 170                        $$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE))
 171     # The capture metainf macro finds all files below the META-INF directory that are newer than the jar-file.
 172     ifeq (,$$($1_SKIP_METAINF))
 173         $1_CAPTURE_METAINF =$$(foreach src,$$($1_SRCS),($(FIND) $$(src)/META-INF -type f -a -newer $$@ 2> /dev/null | $(SED) 's|$$(src)/||g' >> $$(src)/_the.$$($1_JARNAME)_contents ) $$(NEWLINE))
 174     endif
 175     # The capture deletes macro finds all deleted files and concatenates them. The resulting file
 176     # tells us what to remove from the jar-file.
 177     $1_CAPTURE_DELETES=$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.deleted -newer $$@ -exec $(SED) 's|$$(src)||g' \{\} >> $$($1_DELETES_FILE) \;) $$(NEWLINE))
 178     # The update contents macro updates the jar file with the previously capture contents.
 179     # xargs is used to trim the whitespace from the contents file, to see if it is empty.
 180     $1_UPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\
 181                     (cd $$(src) && \
 182                      if [ -n "`$(CAT) _the.$$($1_JARNAME)_contents | $(XARGS)`" ]; then \
 183                          $(ECHO) "  updating" `$(WC) -l _the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \
 184                          $(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @_the.$$($1_JARNAME)_contents; \
 185                      fi) $$(NEWLINE))
 186     # The s-variants of the above macros are used when the jar is created from scratch.

 187     $1_SCAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS),\
 188                     (($(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \
 189                         $$($1_GREP_EXCLUDES) | $(SED) 's|$$(src)/||g' &&\
 190                         $$(subst $$(src)/,,$(ECHO) $$($1_EXTRA_FILES))) > \
 191                         $$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE))
 192 
 193     ifeq (,$$($1_SKIP_METAINF))
 194         $1_SCAPTURE_METAINF=$$(foreach src,$$($1_SRCS),\
 195                     ($(FIND) $$(src)/META-INF -type f 2> /dev/null | $(SED) 's|$$(src)/||g' >> \
 196                         $$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE))
 197     endif
 198     $1_SUPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\
 199                     (cd $$(src) && $(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE))
 200 
 201     # Use a slightly shorter name for logging, but with enough path to identify this jar.
 202     $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_JAR))
 203 
 204     ifneq (,$$($1_CHECK_COMPRESS_JAR))
 205         $1_JAR_CREATE_OPTIONS := c0fm
 206         $1_JAR_UPDATE_OPTIONS := u0f
 207         ifeq ($(COMPRESS_JARS), true)
 208             $1_JAR_CREATE_OPTIONS := cfm
 209             $1_JAR_UPDATE_OPTIONS := uf
 210         endif
 211     else




 146         $1_DEPS:=$$(filter $$(addprefix %,$$($1_SUFFIXES)),\
 147                     $$(call CacheFind,$$($1_SRCS)))
 148         ifneq (,$$($1_GREP_INCLUDE_PATTERNS))
 149             $1_DEPS:=$$(filter $$(addsuffix %,$$($1_GREP_INCLUDE_PATTERNS)),$$($1_DEPS))
 150         endif
 151         ifneq (,$$($1_GREP_EXCLUDE_PATTERNS))
 152             $1_DEPS:=$$(filter-out $$(addsuffix %,$$($1_GREP_EXCLUDE_PATTERNS)),$$($1_DEPS))
 153         endif
 154         # The subst of \ is needed because $ has to be escaped with \ in EXTRA_FILES for the command 
 155         # lines, but not here for use in make dependencies.
 156         $1_DEPS+=$$(subst \,,$$(foreach src,$$($1_SRCS),$$(addprefix $$(src)/,$$($1_EXTRA_FILES))))
 157         ifeq (,$$($1_SKIP_METAINF))
 158             $1_DEPS+=$$(call CacheFind,$$(wildcard $$(addsuffix /META-INF,$$($1_SRCS))))
 159         endif
 160     endif
 161 
 162     # Utility macros, to make the shell script receipt somewhat easier to dechipher.
 163 
 164     # The capture contents macro finds all files (matching the patterns, typically
 165     # .class and .prp) that are newer than the jar-file, ie the new content to be put into the jar.
 166     # NOTICE: please leave the parentheses space separated otherwise the AIX build will break!
 167     $1_CAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS),\
 168                    ( ( $(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) -a -newer $$@ $$($1_GREP_INCLUDES) \
 169                        $$($1_GREP_EXCLUDES) | $(SED) 's|$$(src)/||g' &&\
 170                        $(ECHO) $$(subst $$(src)/,,$$($1_EXTRA_FILES) ) ) > \
 171                        $$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE) )
 172     # The capture metainf macro finds all files below the META-INF directory that are newer than the jar-file.
 173     ifeq (,$$($1_SKIP_METAINF))
 174         $1_CAPTURE_METAINF =$$(foreach src,$$($1_SRCS),($(FIND) $$(src)/META-INF -type f -a -newer $$@ 2> /dev/null | $(SED) 's|$$(src)/||g' >> $$(src)/_the.$$($1_JARNAME)_contents ) $$(NEWLINE))
 175     endif
 176     # The capture deletes macro finds all deleted files and concatenates them. The resulting file
 177     # tells us what to remove from the jar-file.
 178     $1_CAPTURE_DELETES=$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.deleted -newer $$@ -exec $(SED) 's|$$(src)||g' \{\} >> $$($1_DELETES_FILE) \;) $$(NEWLINE))
 179     # The update contents macro updates the jar file with the previously capture contents.
 180     # Use 'wc -w' to see if the contents file is empty.
 181     $1_UPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\
 182                     (cd $$(src) && \
 183                      if [ "`$(WC) -w _the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'`" -gt "0" ]; then \
 184                          $(ECHO) "  updating" `$(WC) -l _the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \
 185                          $(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @_the.$$($1_JARNAME)_contents; \
 186                      fi) $$(NEWLINE))
 187     # The s-variants of the above macros are used when the jar is created from scratch.
 188     # NOTICE: please leave the parentheses space separated otherwise the AIX build will break!
 189     $1_SCAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS),\
 190                     ( ( $(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \
 191                         $$($1_GREP_EXCLUDES) | $(SED) 's|$$(src)/||g' &&\
 192                         $$(subst $$(src)/,,$(ECHO) $$($1_EXTRA_FILES) ) ) > \
 193                         $$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE) )
 194 
 195     ifeq (,$$($1_SKIP_METAINF))
 196         $1_SCAPTURE_METAINF=$$(foreach src,$$($1_SRCS),\
 197                     ($(FIND) $$(src)/META-INF -type f 2> /dev/null | $(SED) 's|$$(src)/||g' >> \
 198                         $$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE))
 199     endif
 200     $1_SUPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\
 201                     (cd $$(src) && $(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE))
 202 
 203     # Use a slightly shorter name for logging, but with enough path to identify this jar.
 204     $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_JAR))
 205 
 206     ifneq (,$$($1_CHECK_COMPRESS_JAR))
 207         $1_JAR_CREATE_OPTIONS := c0fm
 208         $1_JAR_UPDATE_OPTIONS := u0f
 209         ifeq ($(COMPRESS_JARS), true)
 210             $1_JAR_CREATE_OPTIONS := cfm
 211             $1_JAR_UPDATE_OPTIONS := uf
 212         endif
 213     else