[Swan-dev] Some makefile variable tweaks

D. Hugh Redelmeier hugh at mimosa.com
Wed Jan 21 20:46:38 EET 2015


| From: Andrew Cagney <andrew.cagney at gmail.com>

Opinions expressed here are based on NOT understanding the current
makefiles.  They appear to be such an ugly morass that I've avoided
trying to understand them.

Anything that makes them simpler, clearer, and more correct is a very
good thing.

| I've been trying to get dependencies working better (there's a patch
| kicking round for pluto).

Good!

|  Unfortunately, it went a little pear shaped
| as each directory I looked at was annoyingly different.

Bad!

|  I'd like to
| impose a little of my view of sanity on the following:
| 
| - while OBJDIR is assumed, make files are hedging their bets
| -> I'll remove code assuming otherwise

Good!  The fewer cases the better.

In fact, I'd like make to be invoked with --warn-undefined-variables

This is likely to force a lot of work but I think that it would pay off.
Accidental misspellings are easy to make but hard to find in something
as complicated as our makefiles.

| - $(srcdir) and $(SRCDIR) are kind of redundant, while they might
| designate the same directory they are not even internally consistent.

Not sure what you mean, but it sounds bad.

"kind of redundant" scares me because I wonder just when are they not
redundant.

| For instance, "./", "$PWD" and "$PWD/" are all found

You mean as definitions for SRCDIR?

I assume that $PWD doesn't expand to have a trailing /.

That sounds dangerously inconsistent.

| -> I'll remove the existing $(srcdir) definition, and have SRCDIR be
| consistent - absolute and with a trailing / - so existing code works

I don't like the trailing / being in the variable.  Making the /
explicit in each use makes the use clearer.

The main advantage of including the slash in the variable is that it
make the default value (empty) mean "current directory" not "root".
But we don't want empty to work.  Empty fails more spectacularly and
clearly (good!) if the slash isn't assumed to be at the end of the
value.

"absolute" matters, but I don't have an educated opinion on that.

| - add a full set of directory variables THAT DO NOT ADD A TRAILING /
| so I can use those.

Ah, so you don't like trailing /.  Does anyone else?  Why can't we
just ditch it?  Perhaps a simple matter of a sed script.

|  For names I stole from autoconf: relative:
| srcdir, builddir, top_srcdir, top_builddir; absolute: abs_srcdir,
| abs_top_srcdir, abs_builddir abs_top_builddir.

I'd prefer that this wasn't redundant.  If SRCDIR is always $(srcdir)/
then get rid of SRCDIR.

I kind of like all uppercase variable names.  I'm not sure that I can
defend that preference.


More information about the Swan-dev mailing list