Subject: misc/1468: Change request for sys.mk to allow override of CC etc
To: None <gnats-bugs@gnats.netbsd.org>
From: Giles Lean <giles@nemeton.com.au>
List: netbsd-bugs
Date: 09/16/1995 09:52:15
>Number:         1468
>Category:       misc
>Synopsis:       Change request for sys.mk to allow override of CC etc
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 15 23:50:02 1995
>Last-Modified:
>Originator:     Giles Lean
>Organization:
Giles Lean                                             Nemeton Pty Ltd
<giles@nemeton.com.au>                           phone: +61 3 480 2118        
>Release:        September 10 1995
>Environment:
	
System: NetBSD topaz.nemeton.com.au 1.0A NetBSD 1.0A (TOPAZ) #8: Sun Sep 3 12:30:54 EST 1995 giles@topaz.nemeton.com.au:/usr/src/sys/arch/i386/compile/TOPAZ i386


>Description:
	/usr/share/mk/sys.mk clobbers CC, CFLAGS, LD etc unconditionally.
	This makes it difficult to override CFLAGS when debugging
	a single program, for example, or to direct the standard
	build environment to use /usr/bin/g++ in preferance to any
	other versions in $PATH.

	I have used the following patch for some time without ill
	effects.  Note that applying it means that the environment
	variables CFLAGS, CC etc matter so these variables need to
	be unset for a 'standard' make.

	An invitation to discuss this on tech-userlevel produced
	only one response (from cgd, in favour).
>How-To-Repeat:
>Fix:
	Note that MAKE and SHELL are *not* altered, although a
	case could be made for both it looked more dangerous
	than useful.

*** src/share/mk/sys.mk-orig	Sun Jun 25 17:07:11 1995
--- src/share/mk/sys.mk	Sat Sep 16 09:41:33 1995
***************
*** 7,41 ****
  
  .LIBS:		.a
  
! AR=		ar
! ARFLAGS=	rl
! RANLIB=		ranlib
  
! AS=		as
! AFLAGS=
  COMPILE.s=	${AS} ${AFLAGS}
  LINK.s=		${CC} ${AFLAGS} ${LDFLAGS}
  COMPILE.S=	${CC} ${AFLAGS} ${CPPFLAGS} -c
  LINK.S=		${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
  
! CC=		cc
! CFLAGS=		-O
  COMPILE.c=	${CC} ${CFLAGS} ${CPPFLAGS} -c
  LINK.c=		${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
  
! CXX=		g++
! CXXFLAGS=	${CFLAGS}
  COMPILE.cc=	${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
  LINK.cc=	${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
  
! CPP=		cpp
  .if defined(DESTDIR)
  CPPFLAGS+=	-nostdinc -idirafter ${DESTDIR}/usr/include
  .endif
  
! FC=		f77
! FFLAGS=		-O
! RFLAGS=
  COMPILE.f=	${FC} ${FFLAGS} -c
  LINK.f=		${FC} ${FFLAGS} ${LDFLAGS}
  COMPILE.F=	${FC} ${FFLAGS} ${CPPFLAGS} -c
--- 7,41 ----
  
  .LIBS:		.a
  
! AR?=		ar
! ARFLAGS?=	rl
! RANLIB?=	ranlib
  
! AS?=		as
! AFLAGS?=
  COMPILE.s=	${AS} ${AFLAGS}
  LINK.s=		${CC} ${AFLAGS} ${LDFLAGS}
  COMPILE.S=	${CC} ${AFLAGS} ${CPPFLAGS} -c
  LINK.S=		${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
  
! CC?=		cc
! CFLAGS?=	-O
  COMPILE.c=	${CC} ${CFLAGS} ${CPPFLAGS} -c
  LINK.c=		${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
  
! CXX?=		g++
! CXXFLAGS?=	${CFLAGS}
  COMPILE.cc=	${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
  LINK.cc=	${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
  
! CPP?=		cpp
  .if defined(DESTDIR)
  CPPFLAGS+=	-nostdinc -idirafter ${DESTDIR}/usr/include
  .endif
  
! FC?=		f77
! FFLAGS?=	-O
! RFLAGS?=
  COMPILE.f=	${FC} ${FFLAGS} -c
  LINK.f=		${FC} ${FFLAGS} ${LDFLAGS}
  COMPILE.F=	${FC} ${FFLAGS} ${CPPFLAGS} -c
***************
*** 43,69 ****
  COMPILE.r=	${FC} ${FFLAGS} ${RFLAGS} -c
  LINK.r=		${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
  
! LEX=		lex
! LFLAGS=
  LEX.l=		${LEX} ${LFLAGS}
  
! LD=		ld
! LDFLAGS=
  
! LINT=		lint
! LINTFLAGS=	-chapbx
  
  MAKE=		make
  
! PC=		pc
! PFLAGS=
  COMPILE.p=	${PC} ${PFLAGS} ${CPPFLAGS} -c
  LINK.p=		${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
  
  SHELL=		sh
  
! YACC=		yacc
! YFLAGS=		-d
  YACC.y=		${YACC} ${YFLAGS}
  
  # C
--- 43,69 ----
  COMPILE.r=	${FC} ${FFLAGS} ${RFLAGS} -c
  LINK.r=		${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
  
! LEX?=		lex
! LFLAGS?=
  LEX.l=		${LEX} ${LFLAGS}
  
! LD?=		ld
! LDFLAGS?=
  
! LINT?=		lint
! LINTFLAGS?=	-chapbx
  
  MAKE=		make
  
! PC?=		pc
! PFLAGS?=
  COMPILE.p=	${PC} ${PFLAGS} ${CPPFLAGS} -c
  LINK.p=		${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
  
  SHELL=		sh
  
! YACC?=		yacc
! YFLAGS?=	-d
  YACC.y=		${YACC} ${YFLAGS}
  
  # C
>Audit-Trail:
>Unformatted: