Author: marcel
Date: Wed Oct 26 15:58:41 2016
New Revision: 307967
URL: https://svnweb.freebsd.org/changeset/base/307967

Log:
  Allow config to be compiled from another source directory, such as one
  for building tools. This boils down to replacing ${.CURDIR} with
  ${SRCDIR}, where the latter is the directory in which this makefile
  lives.
  
  Also allow overriding where file2c comes from using ${FILE2C}.

Modified:
  head/usr.sbin/config/Makefile

Modified: head/usr.sbin/config/Makefile
==============================================================================
--- head/usr.sbin/config/Makefile       Wed Oct 26 15:19:18 2016        
(r307966)
+++ head/usr.sbin/config/Makefile       Wed Oct 26 15:58:41 2016        
(r307967)
@@ -1,15 +1,20 @@
 #      @(#)Makefile    8.1 (Berkeley) 6/6/93
 # $FreeBSD$
 
+SRCDIR:=${.PARSEDIR:tA}
+
 PROG=  config
 MAN=   config.5 config.8
 SRCS=  config.y main.c lang.l mkmakefile.c mkheaders.c \
        mkoptions.c y.tab.h kernconf.c
 
+FILE2C?=file2c
+
 kernconf.c: kernconf.tmpl
-       file2c 'char kernconfstr[] = {' ',0};' < ${.CURDIR}/kernconf.tmpl > 
kernconf.c
+       ${FILE2C} 'char kernconfstr[] = {' ',0};' < \
+           ${SRCDIR}/kernconf.tmpl > kernconf.c
 
-CFLAGS+= -I. -I${.CURDIR}
+CFLAGS+= -I. -I${SRCDIR}
 
 NO_WMISSING_VARIABLE_DECLARATIONS=
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to