make/common/JavaCompilation.gmk

Print this page




 308   # Find all files in the source tree.
 309   $1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST)))
 310 
 311   # Filter on suffixes if set
 312   ifneq ($$($1_SUFFIXES),)
 313     $1_ALL_SRCS := $$(filter $$(addprefix %, $$($1_SUFFIXES)), $$($1_ALL_SRCS))
 314   endif
 315 
 316   ifneq ($$($1_INCLUDES),)
 317     ifneq ($$($1_SUFFIXES),)
 318       $1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES), \
 319           $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$$s$(DQUOTE),$$($1_INCLUDES))))
 320     else
 321       $1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES)))
 322     endif
 323   endif
 324   ifneq ($$($1_INCLUDE_FILES),)
 325     $1_ZIP_INCLUDES += $$(addprefix -i$(SPACE),$$($1_INCLUDE_FILES))
 326   endif
 327   ifneq ($$($1_EXCLUDES),)
 328     $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
 329     $1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES)))

 330     $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS))
 331   endif






 332 
 333   # Use a slightly shorter name for logging, but with enough path to identify this zip.
 334   $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP))
 335 
 336   # Now $1_ALL_SRCS should contain all sources that are going to be put into the zip.
 337   # I.e. the zip -i and -x options should match the filtering done in the makefile.
 338   # Explicitly excluded files can be given with absolute path. The patsubst solution
 339   # isn't perfect but the likelyhood of an absolute path to match something in a src
 340   # dir is very small.
 341   # If zip has nothing to do, it returns 12 and would fail the build. Check for 12
 342   # and only fail if it's not.
 343   $$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
 344         $(MKDIR) -p $$(@D)
 345         $(ECHO) Updating $$($1_NAME)
 346         $$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* $$(addprefix -x$(SPACE),$$(patsubst $$i/%,%,$$($1_EXCLUDE_FILES))) || test "$$$$?" = "12" )$$(NEWLINE)) true



 347         $(TOUCH) $$@
 348 
 349   # Add zip to target list
 350   $1 += $$($1_ZIP)
 351 endef
 352 
 353 define add_file_to_copy
 354   # param 1 = BUILD_MYPACKAGE
 355   # parma 2 = The source file to copy.
 356   $2_TARGET:=$2
 357   # Remove the source prefix.
 358   $$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$2_TARGET)))
 359   # To allow for automatic overrides, do not create a rule for a target file that
 360   # already has one
 361   ifeq ($$(findstring $$($2_TARGET), $$($1_COPY_LIST)), )
 362     $1_COPY_LIST += $$($2_TARGET)
 363     # Now we can setup the depency that will trigger the copying.
 364     $$($1_BIN)$$($2_TARGET) : $2
 365         $(MKDIR) -p $$(@D)
 366         $(CP) $$< $$@




 308   # Find all files in the source tree.
 309   $1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST)))
 310 
 311   # Filter on suffixes if set
 312   ifneq ($$($1_SUFFIXES),)
 313     $1_ALL_SRCS := $$(filter $$(addprefix %, $$($1_SUFFIXES)), $$($1_ALL_SRCS))
 314   endif
 315 
 316   ifneq ($$($1_INCLUDES),)
 317     ifneq ($$($1_SUFFIXES),)
 318       $1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES), \
 319           $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$$s$(DQUOTE),$$($1_INCLUDES))))
 320     else
 321       $1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES)))
 322     endif
 323   endif
 324   ifneq ($$($1_INCLUDE_FILES),)
 325     $1_ZIP_INCLUDES += $$(addprefix -i$(SPACE),$$($1_INCLUDE_FILES))
 326   endif
 327   ifneq ($$($1_EXCLUDES),)

 328     $1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES)))
 329     $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
 330     $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS))
 331   endif
 332   ifneq ($$($1_EXCLUDE_FILES),)
 333     # Cannot precompute ZIP_EXCLUDE_FILES as it is dependent on which src root is being
 334     # zipped at the moment.
 335     $1_SRC_EXCLUDE_FILES := $$(addprefix %, $$($1_EXCLUDE_FILES)) $$($1_EXCLUDE_FILES)
 336     $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDE_FILES), $$($1_ALL_SRCS))
 337   endif
 338 
 339   # Use a slightly shorter name for logging, but with enough path to identify this zip.
 340   $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP))
 341 
 342   # Now $1_ALL_SRCS should contain all sources that are going to be put into the zip.
 343   # I.e. the zip -i and -x options should match the filtering done in the makefile.
 344   # Explicitly excluded files can be given with absolute path. The patsubst solution
 345   # isn't perfect but the likelyhood of an absolute path to match something in a src
 346   # dir is very small.
 347   # If zip has nothing to do, it returns 12 and would fail the build. Check for 12
 348   # and only fail if it's not.
 349   $$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
 350         $(MKDIR) -p $$(@D)
 351         $(ECHO) Updating $$($1_NAME)
 352         $$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) \
 353             $$($1_ZIP_EXCLUDES) -x \*_the.\* \
 354             $$(addprefix -x$(SPACE), $$(patsubst $$i/%,%, $$($1_EXCLUDE_FILES))) \
 355             || test "$$$$?" = "12" )$$(NEWLINE)) true
 356         $(TOUCH) $$@
 357 
 358   # Add zip to target list
 359   $1 += $$($1_ZIP)
 360 endef
 361 
 362 define add_file_to_copy
 363   # param 1 = BUILD_MYPACKAGE
 364   # parma 2 = The source file to copy.
 365   $2_TARGET:=$2
 366   # Remove the source prefix.
 367   $$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$2_TARGET)))
 368   # To allow for automatic overrides, do not create a rule for a target file that
 369   # already has one
 370   ifeq ($$(findstring $$($2_TARGET), $$($1_COPY_LIST)), )
 371     $1_COPY_LIST += $$($2_TARGET)
 372     # Now we can setup the depency that will trigger the copying.
 373     $$($1_BIN)$$($2_TARGET) : $2
 374         $(MKDIR) -p $$(@D)
 375         $(CP) $$< $$@