Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Makefiles: Writing list to screen

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 01-18-2013
kristinu kristinu is offline
Registered User
 
Join Date: Dec 2009
Last Activity: 5 November 2016, 8:06 PM EDT
Posts: 892
Thanks: 67
Thanked 8 Times in 8 Posts
Makefiles: Writing list to screen

I have a make file and want to write some information and am doing


Code:
@echo "  RAYPK_LIBSRC = $(RAYPK_LIBSRC)"

The line of code produces


Code:
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


Code:
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


Code:
    @echo "RAYPK_LIBOBJ ="
    for i in $(RAYPK_LIBOBJ); do \
      echo "                 $$i"; \
    done

producing


Code:
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


Code:
 ./BUILD_DIR/obj/time.o

needs to be next to


Code:
RAYPK_LIBOBJ =

---------- Post updated at 06:39 AM ---------- Previous update was at 06:31 AM ----------

And doing something like this


Code:
$(foreach s,$(RAYPK_LIBOBJ), @echo "                 $(s)"\n;)

gives errors


Code:
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: *** [list] Error 127

---------- Post updated at 11:00 AM ---------- Previous update was at 06:39 AM ----------

I have made some progress on this


Code:
    @echo "RAYPK_LIBOBJ = $(word 1, $(RAYPK_LIBOBJ))"
    @$(foreach s,$(RAYPK_LIBOBJ), echo "               $(s)";)

This produces


Code:
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


Code:
./BUILD_DIR/obj/time.o

when dong the foreach loop.
Sponsored Links
    #2  
Old Unix and Linux 01-23-2013
DGPickett DGPickett is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Last Activity: 1 February 2016, 3:35 PM EST
Location: Southern NJ, USA (Nord)
Posts: 4,673
Thanks: 8
Thanked 587 Times in 560 Posts
I like
Code:
echo ... | while read l ;do ...; done

Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Makefiles for different programs kristinu Programming 1 01-03-2013 06:56 PM
makefiles klam UNIX for Advanced & Expert Users 0 09-23-2006 03:56 PM
How can I print variables im using in makefiles? umen Shell Programming and Scripting 1 05-07-2006 10:57 AM
makefiles in a directory and subdirectories benjie_asu UNIX for Dummies Questions & Answers 0 10-28-2005 02:34 PM
Combining makefiles Dan Rooney UNIX for Advanced & Expert Users 4 05-07-2004 09:19 AM



All times are GMT -4. The time now is 10:13 AM.