Skip to content

Commit

Permalink
Allow space in build directory
Browse files Browse the repository at this point in the history
Now plumed should work if built on a directory which has a space in the path.
Notice that install directory should still not contain spaces.
This is because of some difficulties in making the
src/lib/Makefile rules compatible with names with spaces.

Addresses #157
  • Loading branch information
GiovanniBussi committed Jul 7, 2015
1 parent 43a266d commit 1dedccb
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion patches/patch.sh
Expand Up @@ -259,7 +259,7 @@ case "$action" in
fi

echo ""
if grep -q "D__PLUMED_MPI=1" $PLUMED_ROOT/src/config/compile_options.sh ; then
if grep -q "D__PLUMED_MPI=1" "$PLUMED_ROOT"/src/config/compile_options.sh ; then
echo "PLUMED is compiled with MPI support so you can configure $engine with MPI"
else
echo "PLUMED is compiled WITHOUT MPI support so you CANNOT configure $engine with MPI"
Expand Down
2 changes: 1 addition & 1 deletion scripts/mklib.sh
@@ -1,6 +1,6 @@
#! /bin/bash

source $PLUMED_ROOT/src/config/compile_options.sh
source "$PLUMED_ROOT"/src/config/compile_options.sh

if [ "$1" = --description ] ; then
echo "compile a .cpp file into a shared library"
Expand Down
2 changes: 1 addition & 1 deletion scripts/newcv.sh
Expand Up @@ -17,5 +17,5 @@ directive=$1
classname=$2

sed "s/TEMPLATE/$directive/g
s/Template/$classname/g" $PLUMED_ROOT/src/colvar/Template.cpp > ${classname}.cpp
s/Template/$classname/g" "$PLUMED_ROOT"/src/colvar/Template.cpp > ${classname}.cpp

2 changes: 1 addition & 1 deletion scripts/patch.sh
@@ -1,4 +1,4 @@
#! /bin/bash

${PLUMED_ROOT}/patches/patch.sh "$@"
"${PLUMED_ROOT}"/patches/patch.sh "$@"

2 changes: 1 addition & 1 deletion src/config/Makefile
Expand Up @@ -51,7 +51,7 @@ Makefile.conf.xxd: ../../Makefile.conf
# file to import compilation options inside a bash script
compile_options.sh:
@echo Building compile_options.sh, a sourceable bash script with some compilation options
@echo "compile='"$(CXX) -c -I'$$PLUMED_ROOT'/src $(CPPFLAGS) $(CXXFLAGS) -o"'" > $@
@echo "compile='"$(CXX) -c -I'"$$PLUMED_ROOT"'/src $(CPPFLAGS) $(CXXFLAGS) -o"'" > $@
@echo "link='"$(LDSO) -o"'" >> $@
@echo "soext='"$(SOEXT)"'" >> $@

Expand Down
4 changes: 2 additions & 2 deletions src/core/CLToolMain.cpp
Expand Up @@ -210,7 +210,7 @@ int CLToolMain::run(int argc, char **argv,FILE*in,FILE*out,Communicator& pc){
fprintf(out," plumed %s\n", manual.c_str());
}
for(unsigned j=0;j<availableShell.size();++j){
string cmd="env PLUMED_ROOT="+root+" "+root+"/scripts/"+availableShell[j]+".sh --description";
string cmd="env PLUMED_ROOT=\""+root+"\" \""+root+"/scripts/"+availableShell[j]+".sh\" --description";
FILE *fp=popen(cmd.c_str(),"r");
string line,manual;
while(Tools::getline(fp,line))manual+=line;
Expand Down Expand Up @@ -241,7 +241,7 @@ int CLToolMain::run(int argc, char **argv,FILE*in,FILE*out,Communicator& pc){
if(find(availableShell.begin(),availableShell.end(),command)!=availableShell.end()){
plumed_massert(in==stdin,"shell tools can only work on stdin");
plumed_massert(out==stdout,"shell tools can only work on stdin");
string cmd="env PLUMED_ROOT="+root+" "+root+"/scripts/"+command+".sh";
string cmd="env PLUMED_ROOT=\""+root+"\" \""+root+"/scripts/"+command+".sh\"";
for(int j=i+1;j<argc;j++) cmd+=string(" ")+argv[j];
system(cmd.c_str());
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Makefile
Expand Up @@ -206,7 +206,7 @@ $(PLUMED_MAIN_STATIC): $(OBJ_MAIN) $(OBJ_KERNEL) $(OBJ_WRAPPER)
$(LD) $(LDFLAGS) $^ -o $@ $(LIBS) $(DYNAMIC_LIBS)

$(PLUMED_MAIN_SHARED): $(OBJ_MAIN) $(PLUMED_SHARED_OBJ)
$(LD) $(LDFLAGS) $(OBJ_MAIN) $(realpath $(PLUMED_SHARED_OBJ)) -o $@ $(LIBS)
$(LD) $(LDFLAGS) $(OBJ_MAIN) "$(realpath $(PLUMED_SHARED_OBJ))" -o $@ $(LIBS)

$(PLUMED_MAIN_RUNTIME): $(OBJ_MAIN) $(OBJ_DYNAMIC_WRAPPER)
$(LD) $(LDFLAGS) $^ -o $@ $(LIBS)
Expand Down

0 comments on commit 1dedccb

Please sign in to comment.