Subject: bin/4102: make(1) needs makefile relative exists() or .include
To: None <>
From: Simon J. Gerraty <>
List: netbsd-bugs
Date: 09/10/1997 20:33:05
>Number:         4102
>Category:       bin
>Synopsis:       one should be able to .include a file it it exists relative to the current makefile
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 10 03:35:00 1997
>Originator:     Simon J. Gerraty
Zen Programming...
>Release:        1.2G
System: NetBSD 1.2G NetBSD 1.2G (ZEN) #2: Mon Jul 14 00:52:17 EST 1997 i386

make(1) allows for .include "" to act relative to the current makefile
for example, it is common practice for to contain
.include "../"
this process proceeds up the tree...

At various points in the tree one would like to be able to do:

.include "Makefile.${MACHINE}.inc" 

if it exits.  As things stand, because .include fails if the file cannot be found, and because exists() does not handle the same ``relaive to the current makefile'' logic as .include, one must do things like:

.if exists(${.CURDIR}/../Makefile.${MACHINE}.inc)
.include "${.CURDIR}/../Makefile.${MACHINE}.inc"
.elif exists(${.CURDIR}/../../Makefile.${MACHINE}.inc)

Either an exists_here() function so one could do
.include "../"
.if exists_here("Makefile.${MACHINE}.inc")
.include "Makefile.${MACHINE}.inc"

or an .include version that does not vomit if it fails, would 
be a very useful enhancement.