delocate: replace "-as src1,src2,..." with "src1 src2 ...".

Not requiring the list of assembly sources to be comma-separated is
helpful to environments where the list would more naturally be
treated as a list.

Change-Id: I43b18cdbeed1dc7ad217ff61557ac55860f40733
Reviewed-on: https://boringssl-review.googlesource.com/15585
Reviewed-by: Matt Braithwaite <mab@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
diff --git a/crypto/fipsmodule/CMakeLists.txt b/crypto/fipsmodule/CMakeLists.txt
index 7250ccb..fcda1db 100644
--- a/crypto/fipsmodule/CMakeLists.txt
+++ b/crypto/fipsmodule/CMakeLists.txt
@@ -111,26 +111,22 @@
     bcm.c
   )
 
-  SET_TARGET_PROPERTIES(bcm_c_generated_asm PROPERTIES COMPILE_OPTIONS "-S")
-  SET_TARGET_PROPERTIES(bcm_c_generated_asm PROPERTIES POSITION_INDEPENDENT_CODE ON)
+  set_target_properties(bcm_c_generated_asm PROPERTIES COMPILE_OPTIONS "-S")
+  set_target_properties(bcm_c_generated_asm PROPERTIES POSITION_INDEPENDENT_CODE ON)
 
-  function(JOIN VALUES GLUE OUTPUT)
-    string (REPLACE ";" "${GLUE}" _TMP_STR "${VALUES}")
-    set (${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
+  function(prepend_path values prefix output)
+    set(result)
+    foreach(value ${values})
+      list(APPEND result "${prefix}/${value}")
+    endforeach(value)
+    set(${output} ${result} PARENT_SCOPE)
   endfunction()
 
-  set(DELOCATE_AS_FLAG)
-  set(DELOCATE_AS_ARG)
-
-  if(NOT "${BCM_ASM_SOURCES}" STREQUAL "")
-    set(DELOCATE_AS_FLAG "-as")
-    JOIN("${BCM_ASM_SOURCES}" ",${CMAKE_CURRENT_BINARY_DIR}/" BCM_ASM_SOURCES_COMMA_SEP)
-    SET(DELOCATE_AS_ARG "${CMAKE_CURRENT_BINARY_DIR}/${BCM_ASM_SOURCES_COMMA_SEP}")
-  endif()
+  prepend_path("${BCM_ASM_SOURCES}" "${CMAKE_CURRENT_BINARY_DIR}" DELOCATE_ASM_ARGS)
 
   add_custom_command(
     OUTPUT bcm-delocated.S
-    COMMAND ${GO_EXECUTABLE} run crypto/fipsmodule/delocate.go crypto/fipsmodule/ar.go crypto/fipsmodule/const.go -a $<TARGET_FILE:bcm_c_generated_asm> ${DELOCATE_AS_FLAG} ${DELOCATE_AS_ARG} -o ${CMAKE_CURRENT_BINARY_DIR}/bcm-delocated.S
+    COMMAND ${GO_EXECUTABLE} run crypto/fipsmodule/delocate.go crypto/fipsmodule/ar.go crypto/fipsmodule/const.go -a $<TARGET_FILE:bcm_c_generated_asm> -o ${CMAKE_CURRENT_BINARY_DIR}/bcm-delocated.S ${DELOCATE_ASM_ARGS}
     DEPENDS bcm_c_generated_asm ${BCM_ASM_SOURCES} delocate.go ar.go const.go
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
   )
diff --git a/crypto/fipsmodule/delocate.go b/crypto/fipsmodule/delocate.go
index 0549cf3..983f42f 100644
--- a/crypto/fipsmodule/delocate.go
+++ b/crypto/fipsmodule/delocate.go
@@ -36,7 +36,6 @@
 	arInput := flag.String("a", "", "Path to a .a file containing assembly sources")
 
 	outFile := flag.String("o", "", "Path to output assembly")
-	asmFiles := flag.String("as", "", "Comma separated list of assembly inputs")
 
 	flag.Parse()
 
@@ -48,8 +47,7 @@
 		}
 	}
 
-	asPaths := strings.Split(*asmFiles, ",")
-	for i, path := range asPaths {
+	for i, path := range flag.Args() {
 		if len(path) == 0 {
 			continue
 		}