help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Make Not Setting Prerequisite List


From: Kent Wilson
Subject: Make Not Setting Prerequisite List
Date: Thu, 30 Aug 2001 18:12:54 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2) Gecko/20010726 Netscape6/6.1

All,

I am trying to compute a prerequisite list based on
the target's name. I have tried three approaches which
I would think would work but none have. In each case
the list of prerequisites ($^) is not set and make does
not attempt any recompilation. See the attachment for
the Makefiles.

Any ideas?

TIA,

Kent

address@hidden
PGMS = pgm1
pgm1_OBJS = pgm1obj1.o pgm1obj2.o pgm1obj3.o

all: $(PGMS)
        @echo Makefile PGMS $(PGMS)

#
# case A (This doesn't set $^, but note that $($(@)_OBJS) is okay).
#
$(PGMS): $($(@)_OBJS)
        @echo $$\@ = $@, $$^ = $^, $($(@)_OBJS)

#
# case B (This works as expected)
#
#$(PGMS): $(pgm1_OBJS)
#       @echo $$\@ = $@, $$^ = $^, $($(@)_OBJS)
PGMS = pgm1 pgm2

pgm1: OBJS = pgm1obj1.o pgm1obj2.o pgm1obj3.o
pgm2: OBJS = pgm2obj1.o pgm2obj2.o pgm2obj3.o

all: $(PGMS)
        @echo Makefile PGMS $(PGMS)

#
# OBJS gets set correctly for each target but $^ does not get set.
#
$(PGMS): $(OBJS)
        @echo $$\@ = $@, $$^ = $^, $(OBJS)
PGMS = pgm1
pgm1_OBJS = pgm1obj1.o pgm1obj2.o pgm1obj3.o

all: $(PGMS)
        @echo Makefile PGMS $(PGMS)

#
# Computed variables are correct but $^ doesn't get set.
#
$(PGMS): $($(addsuffix _OBJS, $(@)))
        @echo $$\@ = $@, $$^ = $^, $($(addsuffix _OBJS,$(@)))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]