[patch] include_once in make

Pietro Cerutti gahr at FreeBSD.org
Mon Mar 17 10:14:52 PDT 2008

Hash: SHA512

Harti Brandt wrote:
| On Mon, 17 Mar 2008, Pietro Cerutti wrote:
| PC>I have a patch which implements the include_once and sinclude_once
| PC>keywords in make. I think it would be useful in cases where a double
| PC>include would mess things up (i.e., ports).
| PC>
| PC>http://people.freebsd.org/~gahr/make.diff
| PC>
| PC>Any comment is welcome!
| I think your patch silently removes the recently added feature that
| Makefiles are only remade when .MAKEFILEDEPS is defined as a target.

Uhm.. why should it?

| Style:
| - in Main_AddSourceMakefile you should use the macros and functions from
| lst.h instead of rolling your own loop

The functions in lst.h don't implement looking for an element comparing
lexicographically equal to a given one. It's a specialization of
"equals". Better to implement it in lst.c?

| - paranthesis missing in return 1.

Thanks, fixed

| For the semantics:
| If it's needed, then, well. Given that a Makefile should be declarative
| not procedural it looks not strongly necessary, but I may be wrong. It
| introduces subtle semantic differences if the included makefile has
| procedural elements (.if or .for):
| .include_once Makefile.inc
| FOO = 1
| .include_once Makefile.inc
| If Makefile.inc does different things depending on the setting of FOO,
| hunting will get though, especially if the first .include_once is in and
| included file and not easily visible.
| If you're going to commit this, make sure to also document it.
| harti

- --
Pietro Cerutti
gahr at FreeBSD.org

PGP Public Key:

Version: GnuPG v1.4.8 (FreeBSD)


More information about the freebsd-current mailing list