Compiling not in the source directory referring to the Makefile fails
According to the build/README.md file, it should be possible to compile the code in a different folder to where the source directory is located. Since no further explicit indications are given, the following possible interpretations came to my mind (in both case a compile_settings.txt
file must be present in the present working directory).
-
From any place in the system
ln -s /global/path/to/openqcd-fastsum/build/Makefile Makefile make qcd1 # for example
should work. Indeed, I tested it and it does.
-
According to the
make
manual, it should be possible to specify the makefile to be used at run time, via the-f
command line option.make -f /global/path/to/openqcd-fastsum/build/Makefile qcd1
However, this approach fails, resulting in
make: *** No rule to make target `Makefile', needed by `modules/archive/archive.o'. Stop.
Since creating a symlink for every different compilation, I would prefer the second approach. Can you comment on which was the intended approach to compile the code not from the source directory?
Speculation about why the latter approach above fails
Although I am not a makefile expert, I had a look to the code build/Makefile and I noticed that there are few occurrences of an hard-coded Makefile
. Is it intended? Trying to change them to a global path $(code_dir)/build/Makefile
, e.g. on line 345, make the compilation work as I would expect. I am not completely sure this has no side-effects and I would like to receive a feedback.
Side remark: I did the above tests from the feature/library branch on commit 3927dfe4 but this should not really play a role.
Bonus track
In the Makefile
you use colour codes to make the output prettier and I like this feature a lot. However, using a bash shell, the colour escape codes in the string to be print are not interpreted but simply printed, e.g.
\033[0;33m(LINK.c)\033[m qcd1.c
probably because the -e
option of the echo
builtin is not passed. This might not occur using a different shell.