[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with target specific variables
From: |
Patrick West |
Subject: |
Problem with target specific variables |
Date: |
Thu, 17 Apr 2003 16:26:01 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.2.1) Gecko/20030327 |
I have a makefile that looks like this
progs:=prog1 prog2
all : $(progs)
$(progs) : PROG=$@
$(progs) : % : %info
@echo $(PROG)
%info :
@echo $(PROG)
Pretty simple, except for one problem. Whe I get down to %info I am not
getting what I want to get. The target specific variable PROG is set to
$@, which I would think would be set to prog1 and prog2. Then the prog1
depends on prog1info. The echo in %info now echos out prog1info instead
of prog1. How can I get it so that PROG is set to prog1 for all the
dependencies of prog1 (prog1info)?
I understand what is happening. PROG is set to $@, and $(PROG) is
expanded within the context of the target. So in prog1info, for example,
$@ is prog1info, so $(PROG) expands to prog1info.
The output I get is:
prog1info
prog1
prog2info
prog2
The output I would like to get is:
prog1
prog1
prog2
prog2
Any suggestions?
Thank you for your help!
Patrick West
address@hidden
- Problem with target specific variables,
Patrick West <=