I have a make file and want to write some information and am doing
@echo " RAYPK_LIBSRC = $(RAYPK_LIBSRC)"
The line of code produces
RAYPK_LIBSRC = ./source/library/raypk/time.f ./source/library/raypk/model.f ./source/library/raypk/tomo.f ./source/library/raypk/plt.f ./source/library/raypk/blkdat.f
I want the information displayed as follows
RAYPK_LIBSRC = ./source/library/raypk/time.f
./source/library/raypk/model.f
./source/library/raypk/tomo.f
./source/library/raypk/plt.f
./source/library/raypk/blkdat.f
---------- Post updated at 06:31 AM ---------- Previous update was at 06:09 AM ----------
I have done this
@echo "RAYPK_LIBOBJ ="
for i in $(RAYPK_LIBOBJ); do \
echo " $$i"; \
done
producing
RAYPK_LIBOBJ =
for i in ./BUILD_DIR/obj/time.o ./BUILD_DIR/obj/model.o ./BUILD_DIR/obj/tomo.o ./BUILD_DIR/obj/plt.o ./BUILD_DIR/obj/blkdat.o; do \
echo " $i"; \
done
./BUILD_DIR/obj/time.o
./BUILD_DIR/obj/model.o
./BUILD_DIR/obj/tomo.o
./BUILD_DIR/obj/plt.o
./BUILD_DIR/obj/blkdat.o
This is almost what I want. Got to remove the printing of the for loop. On addition, the first string
./BUILD_DIR/obj/time.o
needs to be next to
RAYPK_LIBOBJ =
---------- Post updated at 06:39 AM ---------- Previous update was at 06:31 AM ----------
And doing something like this
$(foreach s,$(RAYPK_LIBOBJ), @echo " $(s)"\n;)
gives errors
RAYPK_LIBOBJ =
./BUILD_DIR/obj/time.on
/bin/sh: @echo: command not found
/bin/sh: @echo: command not found
/bin/sh: @echo: command not found
/bin/sh: @echo: command not found
make: ***
Error 127
---------- Post updated at 11:00 AM ---------- Previous update was at 06:39 AM ----------
I have made some progress on this
@echo "RAYPK_LIBOBJ = $(word 1, $(RAYPK_LIBOBJ))"
@$(foreach s,$(RAYPK_LIBOBJ), echo " $(s)";)
This produces
RAYPK_LIBOBJ = ./BUILD_DIR/obj/time.o
./BUILD_DIR/obj/time.o
./BUILD_DIR/obj/model.o
./BUILD_DIR/obj/tomo.o
./BUILD_DIR/obj/plt.o
./BUILD_DIR/obj/blkdat.o
So the last thing remaining is not to print again
./BUILD_DIR/obj/time.o
when dong the foreach loop.