Commit 7f0c88c7 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

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
parent 1f770a6a
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@
/lmp_*

/style_*.h
/lmpcompiledate.h
/lmpinstalledpkgs.h

/*_gpu.h
+0 −5
Original line number Diff line number Diff line
# 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
+14 −12
Original line number Diff line number Diff line
@@ -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
+11 −13
Original line number Diff line number Diff line
@@ -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);
}