Re: [CMake] automatically re-generating makefiles

2009-03-17 Thread Eric Noulard
2009/3/16 Matthew Woehlke mw_tr...@users.sourceforge.net:
 Eric Noulard wrote:

 2009/2/26 Alex Flint alex.fl...@gmail.com:

 Hi there,

 I've noticed that when I run make blah then the makefile is
 automatically re-generated if I've changed anything in CMakeLists.txt
 since the last time I built blah. However, if I add a new target to
 CMakeLists.txt then I have to run cmake manually or else I just get
 to rule to make foo.

 I think this already works if you call
 make
 and not
 make foo

 Because existing target do depends on cmake_check_build_system
 which should check for CMakeLists.txt changes (not verified just a guess).

 Actually, it's supposed to be possible to make the makefile itself dependent
 on something.

You may be right but currently I do not see anything like a DIRECT
dependency between Makefile and CMakeLists.txt in the CMake
generated Makefile.

The dependency exists  (cmake_check_build_system)
but it is somehow lazy, that is it is checked if
you try to build any **already existing** target and not when trying
to build a new target freshly added to a CMakeLists.txt.

 I think if this isn't working, either a: cmake isn't writing
 optimal dependencies for the makefiles themselves,

Optimal depends in which sense. With the current scheme
I would say that dependency is checked almost always when needed,
with your propose scheme it would have to be checked
always even if not needed, I would bet that unconditionnally checking
dependency for non-existing target may be sub-optimal because
it may cost you many unneeded check for rare case of needed checks.

I may be wrong, may be some CMake developer, expert in Unix Makefiles
generator dependency may shed the light on this?

 or b: 'make' could be doing better.

I would say that make is an almost stupid tool, it does not check
for unspecified dependency :-)

Current CMake generated Makefiles lacks some rule like:

Makefile : cmake_check_build_system

My point of view is, I don't think it would be worth the cost to add it.


-- 
Erk
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] automatically re-generating makefiles

2009-03-17 Thread Matthew Woehlke

Eric Noulard wrote:

2009/3/16 Matthew Woehlke mw_tr...@users.sourceforge.net:

I think if this isn't working, either a: cmake isn't writing
optimal dependencies for the makefiles themselves,


Optimal depends in which sense. With the current scheme
I would say that dependency is checked almost always when needed,
with your propose scheme it would have to be checked
always even if not needed, I would bet that unconditionnally checking
dependency for non-existing target may be sub-optimal because
it may cost you many unneeded check for rare case of needed checks.


Other than make help and make bogus_target, what would cause a check 
if this change was made that wouldn't cause it currently? Maybe I miss 
something?



Makefile : cmake_check_build_system


Shouldn't this rather be:
Makefile: list of CMakeLists.txt, etc
cmake_check_build_system
?

...in which case, the only thing that should get checked is if the 
CMakeLists.txt are newer than the Makefile. So in most cases this should 
be fast.


--
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
--
You're on your own for the pony. -- Richard Hughes, on feature requests

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] automatically re-generating makefiles

2009-03-17 Thread Bill Hoffman

Matthew Woehlke wrote:


Makefile : cmake_check_build_system


Shouldn't this rather be:
Makefile: list of CMakeLists.txt, etc
cmake_check_build_system
?

...in which case, the only thing that should get checked is if the 
CMakeLists.txt are newer than the Makefile. So in most cases this should 
be fast.


We need to run cmake_check_build_system first because make can not 
handle missing depend .h files.   The check build system step makes sure 
the current set of depends won't kill make.   It is also useful for 
getting around some other make limitations that I can not remember right 
now.



-Bill

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] automatically re-generating makefiles

2009-03-17 Thread Matthew Woehlke

Bill Hoffman wrote:

Matthew Woehlke wrote:

Makefile : cmake_check_build_system


Shouldn't this rather be:
Makefile: list of CMakeLists.txt, etc
cmake_check_build_system
?

...in which case, the only thing that should get checked is if the 
CMakeLists.txt are newer than the Makefile. So in most cases this 
should be fast.


We need to run cmake_check_build_system first because make can not 
handle missing depend .h files.


I'm not saying to stop doing anything that is currently done.

AFAICT, right now the Makefile itself does not have any dependencies; it 
seems that adding 'Makefile: build system files' with the rule from 
cmake_check_build_system would fix the original problem. So the question 
is if running cmake_check_build_system twice in a row can either be 
eliminated or kept reasonable.


--
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
--
You're on your own for the pony. -- Richard Hughes, on feature requests

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] automatically re-generating makefiles

2009-03-17 Thread Bill Hoffman

Matthew Woehlke wrote:

Bill Hoffman wrote:

Matthew Woehlke wrote:

Makefile : cmake_check_build_system


Shouldn't this rather be:
Makefile: list of CMakeLists.txt, etc
cmake_check_build_system
?

...in which case, the only thing that should get checked is if the 
CMakeLists.txt are newer than the Makefile. So in most cases this 
should be fast.


We need to run cmake_check_build_system first because make can not 
handle missing depend .h files.


I'm not saying to stop doing anything that is currently done.

AFAICT, right now the Makefile itself does not have any dependencies; it 
seems that adding 'Makefile: build system files' with the rule from 
cmake_check_build_system would fix the original problem. So the question 
is if running cmake_check_build_system twice in a row can either be 
eliminated or kept reasonable.


I still don't get the original problem???   We used to have Makefile: 
build system files.  It was removed when that work was pushed into 
cmake_check_build_system.


-Bill

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] automatically re-generating makefiles

2009-03-17 Thread Matthew Woehlke

Bill Hoffman wrote:
I still don't get the original problem???   We used to have Makefile: 
build system files.  It was removed when that work was pushed into 
cmake_check_build_system.


Ah. Maybe it should come back?

The original problem is: 'make foo' doesn't work after adding a target 
'foo', because the Makefile needs to be regenerated to know about this 
target. It seems if Makefile depended on the build system files, this 
would cause Makefile to be regenerated, so 'make foo' would work in this 
instance.


--
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
--
You're on your own for the pony. -- Richard Hughes, on feature requests

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] automatically re-generating makefiles

2009-03-17 Thread Brad King

Matthew Woehlke wrote:

Bill Hoffman wrote:
I still don't get the original problem???   We used to have Makefile: 
build system files.  It was removed when that work was pushed into 
cmake_check_build_system.


Ah. Maybe it should come back?


The problem with

  Makefile: input-foo.txt input-bar.txt
regenerate-rule

is that when someone removes input-bar.txt from disk Make will refuse
to run the regeneration rule.  This is just a fundamental limitation of
using make to build.  AFAIK there is no way to implement the

  make my-new-target

interface reliably.  In the future we plan to create a cbuild tool to
drive native builds and a corresponding CMake generator for it.  That
tool will be able to provide whatever fancy interface we want.  Until
then we are limited by the fact that make runs before CMake can look
at the tree.

-Brad

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] automatically re-generating makefiles

2009-03-17 Thread Brad King

Brad King wrote:

AFAIK there is no way to implement the

  make my-new-target

interface reliably.


FYI, you can write the above like this:

  make rebuild_cache  make my-new-target

if you know that it is a new target.

-Brad
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] automatically re-generating makefiles

2009-03-17 Thread Matthew Woehlke

Brad King wrote:

The problem with

  Makefile: input-foo.txt input-bar.txt
regenerate-rule

is that when someone removes input-bar.txt from disk Make will refuse
to run the regeneration rule.


Ah, wasn't thinking about that. Thanks for the info.

--
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
--
You're on your own for the pony. -- Richard Hughes, on feature requests

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] automatically re-generating makefiles

2009-03-16 Thread Matthew Woehlke

Eric Noulard wrote:

2009/2/26 Alex Flint alex.fl...@gmail.com:

Hi there,

I've noticed that when I run make blah then the makefile is
automatically re-generated if I've changed anything in CMakeLists.txt
since the last time I built blah. However, if I add a new target to
CMakeLists.txt then I have to run cmake manually or else I just get
to rule to make foo.


I think this already works if you call
make
and not
make foo

Because existing target do depends on cmake_check_build_system
which should check for CMakeLists.txt changes (not verified just a guess).


Actually, it's supposed to be possible to make the makefile itself 
dependent on something. I think if this isn't working, either a: cmake 
isn't writing optimal dependencies for the makefiles themselves, or b: 
'make' could be doing better.


--
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
--
I don't question your existence -- God (seen on a church billboard)

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] automatically re-generating makefiles

2009-02-26 Thread Eric Noulard
2009/2/26 Alex Flint alex.fl...@gmail.com:
 Hi there,

 I've noticed that when I run make blah then the makefile is
 automatically re-generated if I've changed anything in CMakeLists.txt
 since the last time I built blah. However, if I add a new target to
 CMakeLists.txt then I have to run cmake manually or else I just get
 to rule to make foo. This makes perfect sense but I was wondering if
 there is there any way to get cmake to put a catch-all rule in the
 Makefile that will cause CMakeLists.txt to be re-read even if a
 nonexistent target is specified on the commandline. Hence I would like
 to be able to add a target foo to CMakeLists.txt then just run make
 foo and cmake should be invoked to regenerate the makefile and the
 makefile should be invoked.

I think this already works if you call
make
and not
make foo

Because existing target do depends on cmake_check_build_system
which should check for CMakeLists.txt changes (not verified just a guess).

Would you confirm it make with make (no target) ?

If it works with make with no target but your added target is
excluded from ALL
I would say that you are currently stuck, because when you run

make whatever_target

make will look for that whatever_target before CMake gets a chance to
be executed. What you ask for is somehow to force cmake to be run
each time make is run.

Another question is could you tell us which version of CMake do you use?

 This might sound pointless but I actually
 have a good motivation that I'd be happy to discuss if anyone is interested...

Yes please tell us why you need that
I currently cannot imagine your good motivations :-)

-- 
Erk
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake