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:
1
src/.gitignore
vendored
1
src/.gitignore
vendored
@ -5,7 +5,6 @@
|
||||
/lmp_*
|
||||
|
||||
/style_*.h
|
||||
/lmpcompiledate.h
|
||||
/lmpinstalledpkgs.h
|
||||
|
||||
/*_gpu.h
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
# Make.sh = update Makefile.lib, Makefile.shlib, Makefile.list
|
||||
# or style_*.h files
|
||||
# Syntax: sh Make.sh style
|
||||
# sh Make.sh date
|
||||
# sh Make.sh Makefile.lib
|
||||
# sh Make.sh Makefile.shlib
|
||||
# sh Make.sh Makefile.list
|
||||
@ -56,10 +55,6 @@ style () {
|
||||
fi
|
||||
}
|
||||
|
||||
if (test $1 = "date") then
|
||||
echo "static const char lammps_compile_date[] = \"`date`\";" > lmpcompiledate.h
|
||||
fi
|
||||
|
||||
# create individual style files
|
||||
# called by "make machine"
|
||||
# col 1 = string to search for
|
||||
|
||||
26
src/Makefile
26
src/Makefile
@ -18,7 +18,7 @@ OBJDIR = Obj_$@
|
||||
OBJSHDIR = Obj_shared_$@
|
||||
|
||||
SRC = $(wildcard *.cpp)
|
||||
INC = $(wildcard *.h)
|
||||
INC = $(filter-out lmpinstalledpkgs.h,$(wildcard *.h))
|
||||
OBJ = $(SRC:.cpp=.o)
|
||||
|
||||
SRCLIB = $(filter-out main.cpp,$(SRC))
|
||||
@ -150,6 +150,18 @@ help:
|
||||
for file in $$files; do head -1 $$file; done
|
||||
@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
|
||||
# exe = exe with static compile in Obj_machine (default)
|
||||
# shexe = exe with shared compile in Obj_shared_machine
|
||||
@ -163,17 +175,7 @@ help:
|
||||
-f MAKE/MACHINES/Makefile.$@ -o -f MAKE/MINE/Makefile.$@
|
||||
@if [ ! -d $(objdir) ]; then mkdir $(objdir); fi
|
||||
@$(SHELL) Make.sh style
|
||||
@$(SHELL) Make.sh date
|
||||
@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
|
||||
@$(MAKE) $(MFLAGS) lmpinstalledpkgs.h
|
||||
@echo 'Compiling LAMMPS for machine $@'
|
||||
@if [ -f MAKE/MACHINES/Makefile.$@ ]; \
|
||||
then cp MAKE/MACHINES/Makefile.$@ $(objdir)/Makefile; fi
|
||||
|
||||
@ -983,7 +983,7 @@ void print_style(FILE *fp, const char *str, int &pos)
|
||||
|
||||
static const char lammps_config_options[]
|
||||
= "LAMMPS compile time settings:\n\n"
|
||||
"MPI library setting: "
|
||||
"MPI library setting : "
|
||||
#if defined(MPI_STUBS)
|
||||
"Serial version using STUBS"
|
||||
#elif defined(MPICH_VERSION)
|
||||
@ -996,31 +996,31 @@ static const char lammps_config_options[]
|
||||
#else
|
||||
"Parallel version using unknown MPI library"
|
||||
#endif
|
||||
"\nInteger sizes setting: "
|
||||
"\nInteger sizes setting : "
|
||||
#if defined(LAMMPS_SMALLSMALL)
|
||||
" -DLAMMPS_SMALLSMALL"
|
||||
"-DLAMMPS_SMALLSMALL"
|
||||
#elif defined(LAMMPS_SMALLBIG)
|
||||
" -DLAMMPS_SMALLBIG"
|
||||
"-DLAMMPS_SMALLBIG"
|
||||
#elif defined(LAMMPS_BIGBIG)
|
||||
" -DLAMMPS_BIGBIG"
|
||||
"-DLAMMPS_BIGBIG"
|
||||
#else
|
||||
" (unkown)"
|
||||
"(unkown)"
|
||||
#endif
|
||||
"\nExternal commands support:"
|
||||
"\nExternal commands support :"
|
||||
#if defined(LAMMPS_GZIP)
|
||||
" -DLAMMPS_GZIP"
|
||||
#endif
|
||||
#if defined(LAMMPS_FFMPEG)
|
||||
" -DLAMMPS_FFMPEG"
|
||||
#endif
|
||||
"\nImage library support: "
|
||||
"\nImage library support :"
|
||||
#if defined(LAMMPS_JPEG)
|
||||
" -DLAMMPS_JPEG"
|
||||
#endif
|
||||
#if defined(LAMMPS_PNG)
|
||||
" -DLAMMPS_PNG"
|
||||
#endif
|
||||
"\nFFT library support: "
|
||||
"\nFFT library support :"
|
||||
#if defined(FFT_SINGLE)
|
||||
" -DFFT_SINGLE"
|
||||
#endif
|
||||
@ -1033,14 +1033,14 @@ static const char lammps_config_options[]
|
||||
#else
|
||||
" -DFFT_KISSFFT"
|
||||
#endif
|
||||
"\nMemory alignment: "
|
||||
"\nMemory alignment :"
|
||||
#if defined(LAMMPS_MEMALIGN)
|
||||
" -DLAMMPS_MEMALIGN=" lmp_xstr(LAMMPS_MEMALIGN)
|
||||
#else
|
||||
" (default)"
|
||||
#endif
|
||||
|
||||
"\nException support: "
|
||||
"\nException support :"
|
||||
#if defined(LAMMPS_EXCEPTIONS)
|
||||
" -DLAMMPS_EXCEPTIONS\n"
|
||||
#else
|
||||
@ -1048,12 +1048,10 @@ static const char lammps_config_options[]
|
||||
#endif
|
||||
"\n";
|
||||
|
||||
#include "lmpcompiledate.h"
|
||||
#include "lmpinstalledpkgs.h"
|
||||
|
||||
void LAMMPS::print_config(FILE *fp)
|
||||
{
|
||||
fprintf(fp,"LAMMPS compiled on: %s\n\n",lammps_compile_date);
|
||||
fputs(lammps_config_options,fp);
|
||||
fprintf(fp,"Installed packages:%s\n\n",lammps_installed_packages);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user