blob: d1aaf666cd6ac6e6ef9cebb4f68a49578659aa8b [file] [log] [blame]
Matt Spinler12bdf052017-03-09 16:01:39 -06001#!/bin/bash
2
3files=()
Matt Spinler88d7b4d2017-09-18 14:08:01 -05004dir=$1 #Base directory
Patrick Williams854d05a2021-04-14 10:18:33 -05005# shellcheck disable=SC2206 # $2 is purposefully wordsplit.
Matt Spinler88d7b4d2017-09-18 14:08:01 -05006types=($2) #List of types (convert to array)
Matt Spinlercc2403c2017-03-17 11:07:06 -05007
Matt Spinler12bdf052017-03-09 16:01:39 -06008echo "openpower_procedures_cpp_files = \\"
Matt Spinler88d7b4d2017-09-18 14:08:01 -05009for ((i=0; i<${#types[@]}; ++i));
Matt Spinler12bdf052017-03-09 16:01:39 -060010do
Matt Spinler88d7b4d2017-09-18 14:08:01 -050011 type=${types[$i]}
Matt Spinler12bdf052017-03-09 16:01:39 -060012 type=${type// /} #remove spaces
Patrick Williams854d05a2021-04-14 10:18:33 -050013 for file in "$dir"/procedures/"$type"/*.cpp;
Matt Spinler12bdf052017-03-09 16:01:39 -060014 do
Patrick Williams854d05a2021-04-14 10:18:33 -050015 files+=("$file")
Matt Spinler12bdf052017-03-09 16:01:39 -060016 done
17done
18
Patrick Williams854d05a2021-04-14 10:18:33 -050019for file in "${files[@]}";
Matt Spinler12bdf052017-03-09 16:01:39 -060020do
21 echo " $file \\"
22done
23echo
24
25cat << MAKEFILE
26openpower_procedures.cpp: \$(openpower_procedures_cpp_files)
27 cat \$^ > \$@
28
29MAKEFILE