HELP: Makefile

HELP: Makefile

Post by Shreya Bha » Tue, 06 Aug 1996 04:00:00

Make Gurus,

In a makefile, I introduced a macro like this:

SRCS    = `for file in ${FOODIR}/*.C; do \
           echo $${file}; \

After introducing this macro, I have started facing the following two

Any suggestions will be appreciated:

(1)  I could not get macro-string substitution to work.  Specifically, I
     wanted to get a list of all the object targets by replacing ".C" by
     ".o" in my SRCS list generated as shown above.

     i.e. The macro-string substitution command
     OBJS = $(SRCS:.C=.o)
     did NOT work.

     The only way I could obtain the list of object file targets from
     the source file list was by doing something like this:

      OBJS    = ``${SRCS} | sed "s/\.C/\.o/g"``

(2)  Both SRCS and OBJS macros work fine in the rules section (I can echo
     ${SRCS} as well as ${OBJS}) but they do NOT work in the
     Dependency section.

     ${TARGET}: ${SRCS}

        as well as

     ${TARGET}: ${OBJS}

     do not work.

Since I am stuck, any help will be greatly appreciated.  Kindly e-mail your
suggestions directly to my e-mail address also since I am not a very avid
user of this newsgroup.


Shreya Bhat