checkpoint before running clean
[feisty_meow.git] / scripts / clam / clean_subdirs.sh
1 #!/bin/bash
2
3 # travels down each subdirectory and cleans using make.
4 function clean_subdirectories()
5 {
6   # keep the variable local to avoid contaminating
7   # other runs.
8   local smoot87
9
10   # find all the subdirectories.
11   for smoot87 in $(find . -mindepth 1 -maxdepth 1 -type f); do
12 echo name is $i
13
14 #    # skip if not a directory.
15 #    if [ ! -d "$smoot87" ]; then continue; fi
16 #echo "inside first check of it being dir: $smoot87"
17
18     # make sure there's a makefile there.
19     if [ -f "$smoot87/$MAKEFILE_NAME" ]; then
20 echo "inside barriers, with filename=$smoot87 and all conditions met."
21       pushd "$smoot87"
22       make --silent NOT_FIRST_MAKE=t -f $MAKEFILE_NAME clean
23     else
24       echo "Skipping makefile-less directory $smoot87..."
25     fi
26   done
27 }
28
29 # execute our function on current directory.
30 clean_subdirectories
31