optionally include file within a Makefile

chuckr chuckr at chuckr.org
Thu Dec 18 22:13:23 PST 2003


Dan Langille wrote:

>On 18 Dec 2003 at 19:02, Dan Langille wrote:
>
>  
>
>>My goal is provide a way to override values in a Makefile with values
>>from a local config file.
>>    
>>
>
>I'm getting further.  What's the proper way to do an include?
>
>[dan at polo:~] $ cat Makefile
>A?="things"
>
>all:
>        @echo A is $A
>        if [ -r ${HOME}/.bacula-regress ] ; then \
>                echo loading tha file; \
>                .include "${HOME}/.bacula-regress" ; \
>        fi
>
>        @echo A is $A
>[dan at polo:~] $ cat .bacula-regress
>BACULA_SOURCE="${HOME}/src/bacula-cvs"
>EMAIL=dan+bacula at langille.org
>AUTOCHANGER="/dev/null"
>
>A="stuff"
>echo yes, we have stuff here.
>[dan at polo:~] $ make
>A is things
>if [ -r /home/dan/.bacula-regress ] ; then  echo loading tha file;  
>.include "/home/dan/.bacula-regress" ;  fi
>loading tha file
>.include: not found
>*** Error code 127
>  
>
.if exists(your filename, relative to /usr/share/mk)
.include <whatever>    or
include (not documented, but it works, abs path)
.endif

>Stop in /usr/home/dan.
>[dan at polo:~] $
>  
>




More information about the freebsd-hackers mailing list