tech-toolchain archive

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

Re: make -C dir ?



On Thu, 27 Aug 2009 13:55:59 +0200, Emmanuel Vadot 
<elbarto%arcadebsd.org@localhost>
wrote:
> On Thu, 27 Aug 2009 10:30:38 +0200, Alan Barrett <apb%cequrux.com@localhost> 
> wrote:
>> On Wed, 26 Aug 2009, Simon J. Gerraty wrote:
>>> I've been asked about adding support for the command line switch 
>>> -C "dir" to bmake.  Since both gmake and freebsd's make support this,
>>> I thought it might make sense to add to our make (and hence bmake).
>> 
>> Are the semantics well defined when "-C chdir" and "-f makefile"
>> are intermixed?  For example, what does "make -f ./Makefile -C
>> /elsewhere target" do, and is it the same or different from "make
>> -C /elsewhere -f ./Makefile target"?
>> 
>> --apb (Alan Barrett)
> 
> Here is the test I've done on my FreeBSD (8-BETA3) :
> 
> elbarto@sonic> pwd
> /usr/home/elbarto/test
> elbarto@sonic> ls -R
> Makefile        test1
> 
> ./test1:
> Makefile
> elbarto@sonic> cat Makefile 
> all:
> @echo test
> elbarto@sonic> cat test1/Makefile 
> all:
> @echo test1
> elbarto@sonic> make -C test1 -f ./Makefile 
> test1
> elbarto@sonic> make -C test1 -f `pwd`/Makefile
> test
> elbarto@sonic> make -f ./Makefile -C test1
> test1
> elbarto@sonic> make -f `pwd`/Makefile -C test1
> test
> elbarto@sonic> 
> 
> So the -C argument is done before opening the Makefile.

And for gmake :

elbarto@sonic> gmake --version
GNU Make 3.81
Copyright (C) 2006  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.

This program built for i386-portbld-freebsd8.0
elbarto@sonic> gmake -C test1 -f ./Makefile 
gmake: Entering directory `/usr/home/elbarto/test/test1'
test1
gmake: Leaving directory `/usr/home/elbarto/test/test1'
elbarto@sonic> gmake -C test1 -f `pwd`/Makefile
gmake: Entering directory `/usr/home/elbarto/test/test1'
test
gmake: Leaving directory `/usr/home/elbarto/test/test1'
elbarto@sonic> gmake -f ./Makefile -C test1
gmake: Entering directory `/usr/home/elbarto/test/test1'
test1
gmake: Leaving directory `/usr/home/elbarto/test/test1'
elbarto@sonic> gmake -f `pwd`/Makefile -C test1
gmake: Entering directory `/usr/home/elbarto/test/test1'
test
gmake: Leaving directory `/usr/home/elbarto/test/test1'

-- 
Emmanuel Vadot
elbarto%arcadebsd.org@localhost


Home | Main Index | Thread Index | Old Index