Skip to content

Commit

Permalink
Finish the quieting of "./clean -a" (#789)
Browse files Browse the repository at this point in the history
TYPE: enhancement

KEYWORDS: clean script

SOURCE: internal

DESCRIPTION OF CHANGES: 

The purpose of the `clean` script is to run through multiple directories and either remove 
files directly or to issue some `make clean` or `make superclean` command. 

In the `clean` script itself, remove `set echo`, so the script does not report each command
contained within the script: cd here, cd there, this if test, that else branch, etc.

To stop the "Entering such and such dir" and "Leaving such and such dir"
paired messages as the Makefiles traverse the source code, add the `-s` option to all 
`make clean` and `make superclean` commands. This stops make from printing a rule
before executing it. We still get error messages if they should occur. With a much smaller
output from `clean -a`, we can actually notice the error messages. We have not added the
`-s` option to any other portion of the makefile system than the `make clean` or `make superclean` options.

Remove an outright echo statement from grib2 IO.

Add a small, new makefile for CRTM, expressly for the `clean` option. This is because the full 
Makefile assumes that the configure.wrf file exists, the Makefile cannot include it (if it does not exist), 
and immediately fails the clean step in that directory.

LIST OF MODIFIED FILES:
M   clean
M   external/Makefile
M   external/io_grib_share/build/library_rules.mk
M   var/Makefile
A   var/external/crtm_2.3.0/libsrc/makefile_clean
M   var/external/crtm_2.3.0/makefile

TESTS CONDUCTED: 
 - [x] Before mods, output from `clean -a` was 60 lines; now it is quiet.
 - [x] The small amount of output pointed out an obvious error that needed to be fixed.
 - [x] Before mods, CRTM directory was not actually cleaned
 - [x] `clean -a` still reports errors 
```
/bin/rm: cannot remove ‘foo_foo_fee_doo’: No such file or directory
```
 - [x] Build still works
  • Loading branch information
davegill committed Feb 26, 2019
1 parent 38c3cfc commit a0bdaa1
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 21 deletions.
1 change: 0 additions & 1 deletion clean
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ endif
( cd inc ; /bin/rm -f *.inc namelist.default )


set echo
set arg="$1"
if ( "$arg" == '-a' || "$arg" == '-aa' ) then
if ( -d var ) then
Expand Down
30 changes: 15 additions & 15 deletions external/Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@


superclean :
@( cd esmf_time_f90 ; make superclean )
@( cd io_pnetcdf ; make superclean )
@( cd io_pio ; make superclean )
@( cd io_int ; make superclean )
@( cd io_netcdf ; make superclean )
@( cd io_mcel ; make superclean )
@( cd io_phdf5 ; make superclean )
@( cd io_grib1 ; make superclean )
@( cd io_grib_share ; make superclean )
@( cd io_grib2 ; make superclean )
@( cd io_esmf ; make superclean )
@( cd ioapi_share ; make superclean )
@( cd RSL_LITE ; make superclean )
@( cd fftpack/fftpack5 ; make superclean )
@( cd atm_ocn ; make superclean )
@( cd esmf_time_f90 ; make -s superclean )
@( cd io_pnetcdf ; make -s superclean )
@( cd io_pio ; make -s superclean )
@( cd io_int ; make -s superclean )
@( cd io_netcdf ; make -s superclean )
@( cd io_mcel ; make -s superclean )
@( cd io_phdf5 ; make -s superclean )
@( cd io_grib1 ; make -s superclean )
@( cd io_grib_share ; make -s superclean )
@( cd io_grib2 ; make -s superclean )
@( cd io_esmf ; make -s superclean )
@( cd ioapi_share ; make -s superclean )
@( cd RSL_LITE ; make -s superclean )
@( cd fftpack/fftpack5 ; make -s superclean )
@( cd atm_ocn ; make -s superclean )


1 change: 0 additions & 1 deletion external/io_grib_share/build/library_rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ thisdir_clean: thisdir_clean_lib
@/bin/rm -f *.o *.obj *.mod *.f90 core so_locations Makefile.bak *~ #*#
@/bin/rm -fr ii_files
@if [ -d utest ] ; then \
echo " Doing make clean on utest subdirectory"; \
cd utest; \
make clean; \
cd ..; \
Expand Down
6 changes: 3 additions & 3 deletions var/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ superclean :
links README* landread.c.dist \
depend inc/*.inc inc/*.h preproc.sh )
@( cd da; /bin/rm -f *.exe )
@( cd external/bufr; make clean )
@( cd external/crtm_2.3.0; make clean )
@( cd external/wavelet ; make superclean )
@( cd external/bufr; make -s clean )
@( cd external/crtm_2.3.0; make -s clean )
@( cd external/wavelet ; make -s superclean )
@( cd da/makedepf90-2.8.8; /bin/rm -f makedepf90 config.log Makefile config.status )
@( cd gen_be; /bin/rm -f *.exe )
8 changes: 8 additions & 0 deletions var/external/crtm_2.3.0/libsrc/makefile_clean
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

package = CRTM

# The file definitions. This include must occur before targets.
include make.filelist

clean:
@$(RM) *.o *.mod *.a
5 changes: 4 additions & 1 deletion var/external/crtm_2.3.0/makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
MAKE = make -i -r

# Target specification
all clean:
all :
@cd libsrc && $(MAKE) $@

clean:
@cd libsrc && $(MAKE) -s -f makefile_clean $@

0 comments on commit a0bdaa1

Please sign in to comment.