looking good with scripted cleanup
authorChris Koeritz <fred@gruntose.com>
Mon, 3 Oct 2016 20:52:33 +0000 (16:52 -0400)
committerChris Koeritz <fred@gruntose.com>
Mon, 3 Oct 2016 20:52:33 +0000 (16:52 -0400)
cleaning was working, so used same logic in the building process with make_subdirs.

scripts/clam/clean_subdirs.sh
scripts/clam/make_subdirs.sh [new file with mode: 0644]
scripts/clam/rules.def

index dd06d0c9600f33e2a9dae3183cdbf4c831ce61cc..00ba783c6d389a7f12d1a182b3b814872132298a 100644 (file)
@@ -8,18 +8,13 @@ function clean_subdirectories()
   local smoot87
 
   # find all the subdirectories.
-  for smoot87 in $(find . -mindepth 1 -maxdepth 1 -type f); do
-echo name is $i
-
-#    # skip if not a directory.
-#    if [ ! -d "$smoot87" ]; then continue; fi
-#echo "inside first check of it being dir: $smoot87"
-
+  for smoot87 in $(find . -mindepth 1 -maxdepth 1 -type d); do
     # make sure there's a makefile there.
-    if [ -f "$smoot87/$MAKEFILE_NAME" ]; then
-echo "inside barriers, with filename=$smoot87 and all conditions met."
+    if [ -f "$smoot87/makefile" ]; then
+#echo "inside barriers, with filename=$smoot87 and all conditions met."
       pushd "$smoot87"
-      make --silent NOT_FIRST_MAKE=t -f $MAKEFILE_NAME clean
+      make --silent -I "$CLAM_DIR" NOT_FIRST_MAKE=t clean
+      popd
     else
       echo "Skipping makefile-less directory $smoot87..."
     fi
diff --git a/scripts/clam/make_subdirs.sh b/scripts/clam/make_subdirs.sh
new file mode 100644 (file)
index 0000000..ac95055
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# travels down each subdirectory and builds using make.
+function make_subdirectories()
+{
+  # keep the variable local to avoid contaminating
+  # other runs.
+  local burlap51
+
+  # find all the subdirectories.
+  for burlap51 in $(find . -mindepth 1 -maxdepth 1 -type d); do
+    # make sure there's a makefile there.
+    if [ -f "$burlap51/makefile" ]; then
+#echo "inside barriers, with filename=$burlap51 and all conditions met."
+      pushd "$burlap51"
+      make --silent -I "$CLAM_DIR" NOT_FIRST_MAKE=t 
+      popd
+    else
+      echo "Skipping makefile-less directory $burlap51..."
+    fi
+  done
+}
+
+# executes our subdirectory make function.
+make_subdirectories $*
+
index c4851ca8487378e057c9bab6405baf6ca4a67718..13279c2c5410ecaf65e2e875455f7ff0e0b4113e 100644 (file)
@@ -88,23 +88,10 @@ endif
 # runs the programs specified in the RUN_TARGETS variable.
 run_targets:
        $(HIDESH)"$(CLAM_DIR)/target_runner.sh"
-#### "$(RUN_TARGETS)"
 
 # "make_subdirs" travels down each subdirectory and builds using make.
 make_subdirs:
-       $(HIDESH) -c '\
-for i in *; do \
-  if [ -d $$i ]; then \
-    if [ -f $$i/$(MAKEFILE_NAME) -a ! $$i -ef `pwd` ]; then \
-      echo; \
-      (cd $$i; $(MAKE) --silent NOT_FIRST_MAKE=t -f $(MAKEFILE_NAME) ); \
-    else \
-      echo Skipping makefile-less directory $$i...; \
-      echo; \
-    fi \
-  fi \
-done; \
-exit 0'
+       $(HIDESH)$(CLAM_DIR)/make_subdirs.sh
 
 # "clean" is a default target that removes object files, libs, executable
 # files and such that were created by the project.  it invokes the makefile
@@ -125,36 +112,22 @@ ready_to_clean:
 echo the other cleans were: $(OTHER_CLEANS); \
 echo the cleanup removal list is: $(CLEANUPS); \
 if [ ! -z "$(CLEANUPS)" ]; then \
-  for i in $(CLEANUPS) nonexistentishfileforlist; do \
-    rm -rf "$$i"; \
+  for spork19 in $(CLEANUPS) nonexistentishfileforlist; do \
+    rm -rf "$$spork19"; \
   done \
 fi'
 
 # "clean_subdirs" travels down each subdirectory and cleans using make.
 clean_subdirs:
-       $(HIDESH) -c '\
-for smoot87 in *; do \
-  if [ -d "$$smoot87" ]; then \
-echo "got inside first check of it being dir: $$smoot87"; \
-    if [ -f "$$smoot87/$(MAKEFILE_NAME)" -a ! "$$smoot87" -ef `pwd` ]; then \
-echo "got inside barriers, with filename=$$smoot87 and all conditions met."; \
-echo "the interesting one was: [$(test ! "$$smoot87" -ef `pwd` )]"; \
-      (cd "$$i"; $(MAKE) --silent NOT_FIRST_MAKE=t -f $(MAKEFILE_NAME) clean); \
-    else \
-      echo "Skipping makefile-less directory $$i..."; \
-    fi \
-  fi \
-done; \
-exit 0'
-###echo Cleaning "$$i" now...; 
+       $(HIDESH)$(CLAM_DIR)/clean_subdirs.sh
 
 # "rm_links" removes the files in the current directory that are links
 # to other files.  this is only useful in a unix environment.
 rm_links:
        $(HIDESH) -c '\
-for i in *; do \
-  if [ -h "$$i" ]; then \
-    /bin/rm -f "$$i"; \
+for gujira26 in *; do \
+  if [ -h "$$gujira26" ]; then \
+    /bin/rm -f "$$gujira26"; \
   fi \
 done; \
 exit 0'