On Wed, Apr 21, 2004 at 01:18:11PM -0400, MenTaLguY wrote:
On Wed, 2004-04-21 at 10:32, Peter Moulder wrote:
Any other advantages/disadvantages?
Hmm, is there any way to (easily) construct stub makefiles so that it isn't necessary to cd up a couple levels before you can run 'make'?
Yes and no. src/blah/makefile can be of the form:
# Explicit so that it's the default rule. all: cd .. && $(MAKE) blah/all
%: cd .. && $(MAKE) blah/$@
.PHONY: all
I've already inserted a blah/all rule into src/blah/Makefile_insert for all blah. This works for `all' and for all real files (libblah.a), but `clean' may be trickier, due to different placement of object files (src/blah_libblah_a-foo.o instead of src/blah/foo.o). Maybe can be approximated with `rm -f $(blah_libblah_a_OBJECTS) blah/libblah.a' or `rm -f blah_libblah_a* blah/libblah.a'. For the purposes of deciding whether to go ahead with this change, let's conservatively assume that we don't succeed in implementing `clean': if ppl consider this a show-stopper then I'll see what I can implement before deciding on whether to switch. Similarly let me know if there are other rules that people consider important in this stub makefile.
On choice of name for src/blah/makefile: I deliberately wrote lower-case to facilitate tab completion. I'm currently considering not having them generated by configure, though that means requiring something like gnu make: e.g. it requires that $(MAKE) be defined, and it's desirable that `%' is understood. Explicitly setting the value of MAKE seems to destroy its special meaning. These stub makefiles are only for convenience, and are principally intended for developers, so I don't think it a problem for them not to be as portable as the generated src/Makefile. Variations:
- Have them generated by configure, which detects whether or not explicit MAKE = ... is required (`@SET_MAKE@'). The only disadvantages are having a few makefile.in files around and a bit of extra work & output from configure/config.status.
- Name them GNUmakefile so that non-gnu make programs don't even see the makefile. Avoids the possibility of a confusing error message if MAKE isn't defined (in which case that make will try to execute blah/something).
- Explicitly set `MAKE = make' in the makefile. The magic value of $(MAKE) in gnu make would be lost. May interfere with things like `make -n' working (I haven't tried).
pjrm.