< prev index next >

make/common/TextFileProcessing.gmk

Print this page

        

@@ -1,7 +1,7 @@
 #
-# Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 only, as
 # published by the Free Software Foundation.  Oracle designates this

@@ -56,11 +56,11 @@
 #   SOURCE_DIRS one or more directory roots to search for files to process
 #   SOURCE_FILES complete paths to one or more files to process
 #   OUTPUT_DIR the directory where we store the processed files.
 #   OUTPUT_FILE the name of the resulting file. Only allowed if processing a
 #       single file.
-#   SOURCE_BASE_DIR a common root to all SOURCE_DIRS or SOURCE_FILES.
+#   SOURCE_BASE_DIR a common root to all SOURCE_DIRS.
 #       If specified, files will keep the path relative to the base in the
 #       OUTPUT_DIR. Otherwise, the hierarchy will be flattened into the OUTPUT_DIR.
 #   INCLUDE_FILES only include files matching these patterns (used only with
 #       SOURCE_DIRS)
 #   EXCLUDE_FILES exclude files matching these patterns (used only with

@@ -82,10 +82,13 @@
 
   ifneq ($$($1_SOURCE_FILES),)
     ifneq ($$($1_SOURCE_DIRS),)
       $$(error Cannot use both SOURCE_FILES and SOURCE_DIRS (in $1))
     endif
+    ifneq ($$($1_SOURCE_BASE_DIR),)
+      $$(error Cannot use SOURCE_BASE_DIR without SOURCE_DIRS (in $1))
+    endif
     ifneq ($$($1_EXCLUDE_FILES)$$($1_INCLUDE_FILES),)
       $$(error Cannot INCLUDE/EXCLUDE_FILES with SOURCE_FILES (in $1))
     endif
   else
     ifeq ($$($1_SOURCE_DIRS),)

@@ -98,11 +101,11 @@
       $$(foreach src, $$($1_SOURCE_DIRS), \
           $$(if $$(findstring $$($1_SOURCE_BASE_DIR), $$(src)), , \
           $$(error SOURCE_DIRS contains directory $$(src) outside \
               SOURCE_BASE_DIR $$($1_SOURCE_BASE_DIR) (in $1))))
     endif
-    $1_SOURCE_FILES := $$(sort $$(call FindFiles,$$($1_SOURCE_DIRS)))
+    $1_SOURCE_FILES := $$(sort $$(call CacheFind,$$($1_SOURCE_DIRS)))
     $1_EXCLUDE_FILES:=$$(foreach i,$$($1_SOURCE_DIRS),$$(addprefix $$i/,$$($1_EXCLUDE_FILES)))
     $1_INCLUDE_FILES:=$$(foreach i,$$($1_SOURCE_DIRS),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
     $1_SOURCE_FILES := $$(filter-out $$($1_EXCLUDE_FILES),$$($1_SOURCE_FILES))
     ifneq (,$$(strip $$($1_INCLUDE_FILES)))
       $1_SOURCE_FILES := $$(filter $$($1_INCLUDE_FILES),$$($1_SOURCE_FILES))

@@ -150,14 +153,13 @@
     endif
 
     # Convert the REPLACEMENTS syntax ( A => B ; C => D ; ...) to a sed command
     # line (-e "s/A/B/g" -e "s/C/D/g" ...), basically by replacing '=>' with '/'
     # and ';' with '/g" -e "s/', and adjusting for edge cases.
-    # '&' has special meaning in sed so needs to be escaped.
     $1_REPLACEMENTS_COMMAND_LINE := $(SED) -e 's$$($1_SEP)$$(subst $$(SPACE);$$(SPACE),$$($1_SEP)g' \
         -e 's$$($1_SEP),$$(subst $$(SPACE)=>$$(SPACE),$$($1_SEP),$$(subst $$(SPACE)=>$$(SPACE);$$(SPACE),$$($1_SEP)$$($1_SEP)g' \
-        -e 's$$($1_SEP),$$(subst &,\&,$$(strip $$($1_REPLACEMENTS))))))$$($1_SEP)g'
+        -e 's$$($1_SEP),$$(strip $$($1_REPLACEMENTS)))))$$($1_SEP)g'
   else
     # We don't have any replacements, just pipe the file through cat.
     $1_REPLACEMENTS_COMMAND_LINE := $(CAT)
   endif
 
< prev index next >