small enhancement idea for 'make installworld' et al.

Jeroen Ruigrok/asmodai asmodai at wxs.nl
Tue May 11 22:04:56 PDT 2004


>...is repeated four times in the patch.  This is exactly the sort of
>thing that should be abstracted into a procedure - except I'm not sure
>how to do that with make(1), which doesn't have procedures (that I'm
>aware of.)  I'm sure there's a way to hack it up - but that raises the
>question of what's uglier.  At least the cut-and-pasted version would
>have the advantage of having fairly obvious behaviour.

Make a macro with the use of .USE.

>The second issue is that ports Makefiles have a convention of having
>variables for almost every command name, whereas the base Makefiles
>don't.  I added a ${SU_CMD} variable, but I didn't bother to add
>${ECHO_MSG} (since other messages in Makefile.inc1 were done with a
>plain 'echo') or ${ID} (since it was only used once.)  If the above code
>sequence was abstracted out, it might not make sense to have ${SU_CMD}
>either... I gather that the base system has less need to play games with
>command names than the ports tree does.

Yeah, I think you are allowed to make assumptions here.  With TenDRA's
makefiles I hung on to just using 'env' to get the command paths.

>The third issue is that this only works for "top-level" targets like
>"installkernel" and "installworld".  If you manually go and do something
>like "cd /usr/src/usr.sbin/blah && make all install" as a regular user,
>this patch won't catch that.  I'll look into a patch to do that as well,
>but I get the impression that the wrapping the ultra-generic "install"
>target in this way would be trickier (i.e. you wouldn't want it to su
>for each individual subdir, asking you for the root password each time)

Probably some icky things would need to be done with the subdir handling
and some checking based on uid or a variable setting (.if $(IS_ROOT) ==
yes).

-- 
Jeroen Ruigrok van der Werven <asmodai(at)wxs.nl> / asmodai / kita no mono
PGP fingerprint: 2D92 980E 45FE 2C28 9DB7  9D88 97E6 839B 2EAC 625B
http://www.tendra.org/   | http://diary.in-nomine.org/
Necessity is the mother of invention...





More information about the Submit mailing list