add "make mode=print <machine>" to print out compiler and linker flags and libs for any available makefile

This commit is contained in:
Axel Kohlmeyer 2020-02-19 18:11:34 +01:00
parent 8a52e5dbe7
commit 94d1aa45bb
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
2 changed files with 27 additions and 0 deletions

View File

@ -247,6 +247,11 @@ ifeq ($(mode),shlib)
@rm -f $(SHLINK)
@ln -s $(SHLIB) $(SHLINK)
endif
ifeq ($(mode),print)
@cd $(objdir); \
$(MAKE) $(MFLAGS) "OBJ = $(OBJLIB)" "INC = $(INC)" \
"EXE = ../$(SHLIB)" -f ../Makefile.print
endif
# Remove machine-specific object files

22
src/Makefile.print Normal file
View File

@ -0,0 +1,22 @@
# Makefile to allow printing current COMPILER/LINKER flags and settings
print: do-print
include Makefile
# get location of the LAMMPS tree
LMPDIR=$(shell echo $${PWD} | sed -e 's,/src/Obj_[+0-9a-z_-]\+$$,,')
do-print:
@echo '# LAMMPS source tree is in:' $(LMPDIR)
@echo '# Compiler: '
@echo CXX=$(CC)
@echo '# Linker: '
@echo LD=$(LINK)
@echo '# Compilation: '
@echo CXXFLAGS=$(CCFLAGS) $(EXTRA_INC) | sed -e s,-I\\.\\./\\.\\./,-I${LMPDIR}/,g -e s,-I\\.\\./,-I${LMPDIR}/src/,g -e s,$(HOME),\\$$\\{HOME\\},g
@echo '# Linking: '
@echo LDFLAGS=$(LINKFLAGS)
@echo '# Libraries: '
@echo LDLIBS=$(EXTRA_PATH) $(EXTRA_LIB) $(LIB) | sed -e s,-L\\.\\./\\.\\./,-L${LMPDIR}/,g -e s,-L\\.\\./,-L${LMPDIR}/src/,g -e s,$(HOME),\\$$\\{HOME\\},g