bug-make
[Top][All Lists]
Advanced

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

$@ or address@hidden question


From: Kovalevich Victor
Subject: $@ or address@hidden question
Date: Wed, 20 Mar 2002 15:12:39 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020311

Hi.
I have a question: can I use automatic variables $@ or address@hidden in the dependency of a rule ? When these variables are defined exactly: after then all the dependencies of a rule are resolved or when the processing of a rule is started ?

Is the rule below correct?

CCC=gcc
CPPFLAGS=-DLINUX -UDEBUG -DNDEBUG -O0 -Winline -Wparentheses -c
SRCPATH=${HOME}/project/cpp/
OBJPATH=${HOME}/project/obj/
MAKEFILE=${HOME}/project/makefile

MODULES_CPP_1=module1.cpp module2.cpp module3.cpp
MODULES_CPP_1_O=${MODULES_CPP_1:%.cpp=${OBJPATH}%.o}

${MODULES_CPP_1_O}: ${SRCPATH:address@hidden:.o=.cpp}}  ${MAKEFILE}
    @ echo --- Compile address@hidden:.o=.cpp}'->'address@hidden
    @ ${CCC} ${CPPFLAGS}  -o $@ ${SRCPATH:address@hidden:.o=.cpp}}

I use GNU Make version 3.79.1, under linux:

GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for i386-redhat-linux-gnu
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

I tried to use -p option. make printed following  information concerning the rule above:

/home/vkc/project/obj/module1.o: /home/vkc/project/cpp/ /home/vkc/project/makefile
#  Implicit rule search has not been done.
#  Implicit/static pattern stem: `'
#  Last modified 2002-03-20 13:13:08
#  File has been updated.
#  Successfully updated.
# automatic
# ^ := /home/vkc/project/cpp/ /home/vkc/project/makefile
# automatic
# @ := /home/vkc/project/obj/module1.o
# automatic
# + := /home/vkc/project/cpp/ /home/vkc/project/makefile
# automatic
# ? := /home/vkc/project/cpp/
# automatic
# * :=
# automatic
# % :=
# automatic
# < := /home/vkc/project/cpp/
# 7 variables in 23 hash buckets.
# average of 0,3 variables per bucket, max 2 in one bucket.
#  commands to execute (from `../Makefile.actions.lib.inc', line 459):
    @ echo --- Compile address@hidden:.o=.cpp}'->'address@hidden
    @ ${CCC} ${CPPFLAGS}  -o $@ ${SRCPATH:address@hidden:.o=.cpp}}

As I see $@ and address@hidden are not defined in the dependencies but are defined in the action of a rule. Is it correct behaviour of the make or I ran into a defect ?

Thanks in advance.
-- 
Best regards, Kovalevich Victor
mailto:address@hidden


reply via email to

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