[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: make -f $dir/Makefile clean
From: |
Paul D. Smith |
Subject: |
Re: make -f $dir/Makefile clean |
Date: |
Mon, 11 Nov 2002 09:16:27 -0500 |
%% address@hidden (Allan Wind) writes:
aw> clean:
aw> find . -name \*.o | xargs rm -f
aw> which works fine when I do `make clean`, but `make -f
aw> $dir/Makefile` work "better" than expected. Is there a good way
aw> to find out what directory the current make file is executing in
aw> (${CURDIR} does not work of course and ${MAKEFILES} is empty in
aw> 3.79.1).
MAKEFILES will always be empty in all versions, unless you set it.
That's a user-defined variable.
aw> I noticed in the archives that there is no way of getting the
aw> value of -f, but perhaps there is a way of solving this problem in
aw> a correct and elegant way?
Not really; not in versions before 3.80.
1) Don't use constructs like the find above; instead use something
like:
rm -f $(OBJECTS)
2) Set a variable in the Makefile which has the path of the directory:
THIS = some/dir
...
clean:
find $(THIS) -name \*.o | xargs rm -f
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist