From 6b5e7d0c7b8646858be7bf2979b1141178dfb8d5 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Mon, 3 Oct 2016 16:52:33 -0400 Subject: [PATCH] looking good with scripted cleanup cleaning was working, so used same logic in the building process with make_subdirs. --- scripts/clam/clean_subdirs.sh | 15 +++++-------- scripts/clam/make_subdirs.sh | 26 ++++++++++++++++++++++ scripts/clam/rules.def | 41 ++++++----------------------------- 3 files changed, 38 insertions(+), 44 deletions(-) create mode 100644 scripts/clam/make_subdirs.sh diff --git a/scripts/clam/clean_subdirs.sh b/scripts/clam/clean_subdirs.sh index dd06d0c9..00ba783c 100644 --- a/scripts/clam/clean_subdirs.sh +++ b/scripts/clam/clean_subdirs.sh @@ -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 index 00000000..ac950559 --- /dev/null +++ b/scripts/clam/make_subdirs.sh @@ -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 $* + diff --git a/scripts/clam/rules.def b/scripts/clam/rules.def index c4851ca8..13279c2c 100644 --- a/scripts/clam/rules.def +++ b/scripts/clam/rules.def @@ -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' -- 2.34.1