refactor the gathering of compile time settings after discussion with @sjplimp

- remove feature to record the compilation time and date
- remove 'echo -n' based "progress bar"
- update output format for "lmp_machine -h" to be consistent with help output
- move generation of lmpinstalledpkgs.h to be a separate target depending on
  all sources and headers in src folder. this way it is only regenerated
  when files are modified or packages installed
This commit is contained in:
Axel Kohlmeyer
2018-05-09 21:45:58 -04:00
parent 1f770a6a8f
commit 7f0c88c74b
4 changed files with 25 additions and 31 deletions

1
src/.gitignore vendored
View File

@ -5,7 +5,6 @@
/lmp_* /lmp_*
/style_*.h /style_*.h
/lmpcompiledate.h
/lmpinstalledpkgs.h /lmpinstalledpkgs.h
/*_gpu.h /*_gpu.h

View File

@ -1,7 +1,6 @@
# Make.sh = update Makefile.lib, Makefile.shlib, Makefile.list # Make.sh = update Makefile.lib, Makefile.shlib, Makefile.list
# or style_*.h files # or style_*.h files
# Syntax: sh Make.sh style # Syntax: sh Make.sh style
# sh Make.sh date
# sh Make.sh Makefile.lib # sh Make.sh Makefile.lib
# sh Make.sh Makefile.shlib # sh Make.sh Makefile.shlib
# sh Make.sh Makefile.list # sh Make.sh Makefile.list
@ -56,10 +55,6 @@ style () {
fi fi
} }
if (test $1 = "date") then
echo "static const char lammps_compile_date[] = \"`date`\";" > lmpcompiledate.h
fi
# create individual style files # create individual style files
# called by "make machine" # called by "make machine"
# col 1 = string to search for # col 1 = string to search for

View File

@ -18,7 +18,7 @@ OBJDIR = Obj_$@
OBJSHDIR = Obj_shared_$@ OBJSHDIR = Obj_shared_$@
SRC = $(wildcard *.cpp) SRC = $(wildcard *.cpp)
INC = $(wildcard *.h) INC = $(filter-out lmpinstalledpkgs.h,$(wildcard *.h))
OBJ = $(SRC:.cpp=.o) OBJ = $(SRC:.cpp=.o)
SRCLIB = $(filter-out main.cpp,$(SRC)) SRCLIB = $(filter-out main.cpp,$(SRC))
@ -150,6 +150,18 @@ help:
for file in $$files; do head -1 $$file; done for file in $$files; do head -1 $$file; done
@echo '' @echo ''
lmpinstalledpkgs.h: $(SRC) $(INC)
@echo 'Gathering installed package information (may take a little while)'
@echo 'static const char lammps_installed_packages[] = ' > lmpinstalledpkgs.tmp
@for p in $(PACKAGEUC) $(PACKUSERUC); do info=$$($(SHELL) Package.sh $$p installed); \
[ -n "$$info" ] && echo "\"$$info\"" | sed -e 's/".*package/"/' >> lmpinstalledpkgs.tmp || :; done
@echo ';' >> lmpinstalledpkgs.tmp
@if [ -f lmpinstalledpkgs.h ]; \
then test "`diff --brief lmpinstalledpkgs.tmp lmpinstalledpkgs.h`" != "" && \
mv lmpinstalledpkgs.tmp lmpinstalledpkgs.h || rm lmpinstalledpkgs.tmp ; \
else mv lmpinstalledpkgs.tmp lmpinstalledpkgs.h ; fi
# Build LAMMPS in one of 4 modes # Build LAMMPS in one of 4 modes
# exe = exe with static compile in Obj_machine (default) # exe = exe with static compile in Obj_machine (default)
# shexe = exe with shared compile in Obj_shared_machine # shexe = exe with shared compile in Obj_shared_machine
@ -163,17 +175,7 @@ help:
-f MAKE/MACHINES/Makefile.$@ -o -f MAKE/MINE/Makefile.$@ -f MAKE/MACHINES/Makefile.$@ -o -f MAKE/MINE/Makefile.$@
@if [ ! -d $(objdir) ]; then mkdir $(objdir); fi @if [ ! -d $(objdir) ]; then mkdir $(objdir); fi
@$(SHELL) Make.sh style @$(SHELL) Make.sh style
@$(SHELL) Make.sh date @$(MAKE) $(MFLAGS) lmpinstalledpkgs.h
@echo 'Gathering installed package information'
@echo 'static const char lammps_installed_packages[] = ' > lmpinstalledpkgs.tmp
@for p in $(PACKAGEUC) $(PACKUSERUC); do echo -n '.'; info=$$($(SHELL) Package.sh $$p installed); \
[ -n "$$info" ] && echo "\"$$info\"" | sed -e 's/".*package/"/' >> lmpinstalledpkgs.tmp || :; done
@echo ';' >> lmpinstalledpkgs.tmp
@echo
@if [ -f lmpinstalledpkgs.h ]; \
then test "`diff --brief lmpinstalledpkgs.tmp lmpinstalledpkgs.h`" != "" && \
mv lmpinstalledpkgs.tmp lmpinstalledpkgs.h || rm lmpinstalledpkgs.tmp ; \
else mv lmpinstalledpkgs.tmp lmpinstalledpkgs.h ; fi
@echo 'Compiling LAMMPS for machine $@' @echo 'Compiling LAMMPS for machine $@'
@if [ -f MAKE/MACHINES/Makefile.$@ ]; \ @if [ -f MAKE/MACHINES/Makefile.$@ ]; \
then cp MAKE/MACHINES/Makefile.$@ $(objdir)/Makefile; fi then cp MAKE/MACHINES/Makefile.$@ $(objdir)/Makefile; fi

View File

@ -983,7 +983,7 @@ void print_style(FILE *fp, const char *str, int &pos)
static const char lammps_config_options[] static const char lammps_config_options[]
= "LAMMPS compile time settings:\n\n" = "LAMMPS compile time settings:\n\n"
"MPI library setting: " "MPI library setting : "
#if defined(MPI_STUBS) #if defined(MPI_STUBS)
"Serial version using STUBS" "Serial version using STUBS"
#elif defined(MPICH_VERSION) #elif defined(MPICH_VERSION)
@ -996,31 +996,31 @@ static const char lammps_config_options[]
#else #else
"Parallel version using unknown MPI library" "Parallel version using unknown MPI library"
#endif #endif
"\nInteger sizes setting: " "\nInteger sizes setting : "
#if defined(LAMMPS_SMALLSMALL) #if defined(LAMMPS_SMALLSMALL)
" -DLAMMPS_SMALLSMALL" "-DLAMMPS_SMALLSMALL"
#elif defined(LAMMPS_SMALLBIG) #elif defined(LAMMPS_SMALLBIG)
" -DLAMMPS_SMALLBIG" "-DLAMMPS_SMALLBIG"
#elif defined(LAMMPS_BIGBIG) #elif defined(LAMMPS_BIGBIG)
" -DLAMMPS_BIGBIG" "-DLAMMPS_BIGBIG"
#else #else
" (unkown)" "(unkown)"
#endif #endif
"\nExternal commands support:" "\nExternal commands support :"
#if defined(LAMMPS_GZIP) #if defined(LAMMPS_GZIP)
" -DLAMMPS_GZIP" " -DLAMMPS_GZIP"
#endif #endif
#if defined(LAMMPS_FFMPEG) #if defined(LAMMPS_FFMPEG)
" -DLAMMPS_FFMPEG" " -DLAMMPS_FFMPEG"
#endif #endif
"\nImage library support: " "\nImage library support :"
#if defined(LAMMPS_JPEG) #if defined(LAMMPS_JPEG)
" -DLAMMPS_JPEG" " -DLAMMPS_JPEG"
#endif #endif
#if defined(LAMMPS_PNG) #if defined(LAMMPS_PNG)
" -DLAMMPS_PNG" " -DLAMMPS_PNG"
#endif #endif
"\nFFT library support: " "\nFFT library support :"
#if defined(FFT_SINGLE) #if defined(FFT_SINGLE)
" -DFFT_SINGLE" " -DFFT_SINGLE"
#endif #endif
@ -1033,14 +1033,14 @@ static const char lammps_config_options[]
#else #else
" -DFFT_KISSFFT" " -DFFT_KISSFFT"
#endif #endif
"\nMemory alignment: " "\nMemory alignment :"
#if defined(LAMMPS_MEMALIGN) #if defined(LAMMPS_MEMALIGN)
" -DLAMMPS_MEMALIGN=" lmp_xstr(LAMMPS_MEMALIGN) " -DLAMMPS_MEMALIGN=" lmp_xstr(LAMMPS_MEMALIGN)
#else #else
" (default)" " (default)"
#endif #endif
"\nException support: " "\nException support :"
#if defined(LAMMPS_EXCEPTIONS) #if defined(LAMMPS_EXCEPTIONS)
" -DLAMMPS_EXCEPTIONS\n" " -DLAMMPS_EXCEPTIONS\n"
#else #else
@ -1048,12 +1048,10 @@ static const char lammps_config_options[]
#endif #endif
"\n"; "\n";
#include "lmpcompiledate.h"
#include "lmpinstalledpkgs.h" #include "lmpinstalledpkgs.h"
void LAMMPS::print_config(FILE *fp) void LAMMPS::print_config(FILE *fp)
{ {
fprintf(fp,"LAMMPS compiled on: %s\n\n",lammps_compile_date);
fputs(lammps_config_options,fp); fputs(lammps_config_options,fp);
fprintf(fp,"Installed packages:%s\n\n",lammps_installed_packages); fprintf(fp,"Installed packages:%s\n\n",lammps_installed_packages);
} }