Matt Spinler | 12bdf05 | 2017-03-09 16:01:39 -0600 | [diff] [blame] | 1 | #!/bin/bash |
2 | |||||
3 | files=() | ||||
Matt Spinler | 88d7b4d | 2017-09-18 14:08:01 -0500 | [diff] [blame] | 4 | dir=$1 #Base directory |
Patrick Williams | 854d05a | 2021-04-14 10:18:33 -0500 | [diff] [blame] | 5 | # shellcheck disable=SC2206 # $2 is purposefully wordsplit. |
Matt Spinler | 88d7b4d | 2017-09-18 14:08:01 -0500 | [diff] [blame] | 6 | types=($2) #List of types (convert to array) |
Matt Spinler | cc2403c | 2017-03-17 11:07:06 -0500 | [diff] [blame] | 7 | |
Matt Spinler | 12bdf05 | 2017-03-09 16:01:39 -0600 | [diff] [blame] | 8 | echo "openpower_procedures_cpp_files = \\" |
Matt Spinler | 88d7b4d | 2017-09-18 14:08:01 -0500 | [diff] [blame] | 9 | for ((i=0; i<${#types[@]}; ++i)); |
Matt Spinler | 12bdf05 | 2017-03-09 16:01:39 -0600 | [diff] [blame] | 10 | do |
Matt Spinler | 88d7b4d | 2017-09-18 14:08:01 -0500 | [diff] [blame] | 11 | type=${types[$i]} |
Matt Spinler | 12bdf05 | 2017-03-09 16:01:39 -0600 | [diff] [blame] | 12 | type=${type// /} #remove spaces |
Patrick Williams | 854d05a | 2021-04-14 10:18:33 -0500 | [diff] [blame] | 13 | for file in "$dir"/procedures/"$type"/*.cpp; |
Matt Spinler | 12bdf05 | 2017-03-09 16:01:39 -0600 | [diff] [blame] | 14 | do |
Patrick Williams | 854d05a | 2021-04-14 10:18:33 -0500 | [diff] [blame] | 15 | files+=("$file") |
Matt Spinler | 12bdf05 | 2017-03-09 16:01:39 -0600 | [diff] [blame] | 16 | done |
17 | done | ||||
18 | |||||
Patrick Williams | 854d05a | 2021-04-14 10:18:33 -0500 | [diff] [blame] | 19 | for file in "${files[@]}"; |
Matt Spinler | 12bdf05 | 2017-03-09 16:01:39 -0600 | [diff] [blame] | 20 | do |
21 | echo " $file \\" | ||||
22 | done | ||||
23 | echo | ||||
24 | |||||
25 | cat << MAKEFILE | ||||
26 | openpower_procedures.cpp: \$(openpower_procedures_cpp_files) | ||||
27 | cat \$^ > \$@ | ||||
28 | |||||
29 | MAKEFILE |