Re: [RFC] adding a variable to .mk and Makefile.inc1 to point to top of the FreeBSD source tree

2013-05-08 Thread Warner Losh

On May 7, 2013, at 11:41 PM, Simon J. Gerraty wrote:

 
 On Tue, 7 May 2013 21:25:37 -0600, Warner Losh writes:
 where does MAKEOBJDIRPREFIX come into play?
 
 I don't normally use it, it is a handy but rather crude implement.
 I normally use 
 
 MAKEOBJDIR='${.CURDIR:S,${SRCTOP},${OBJTOP},}'
 
 which gives you a similar - but much neater result than
 MAKEOBJDIRPREFIX.

Isn't that backwards. MAKEOBJDIRPREFIX in today's FreeBSD is much more like 
OBJTOP than what you've quoted here. That's how I set the top of the tree 
today, usually with a 'setenv MAKEOBJDIRPREFIX $HOME/obj' in my .cshrc so it is 
always active. That way I can just buildworld or buildkernel without having to 
worry where things will wind up, or having problems with /usr/obj being 
unwritable...  I know this trick doesn't work for netbsd's make (or didn't 
years ago when I was building it on a regular basis), so I assume it is FreeBSD 
make centric.

 We do it both ways: on some architectures we have multiple =
 MACHINE_ARCHes per MACHINE (like mips and arm) and on others we have one =
 MACHINE_ARCH and mutliple machines (like i386 and pc98).
 
 Yes, which is why I'm adjusting accordingly.
 
 We currently use ${MACHINE}.${MACHINE_ARCH} for cross builds, which =
 works out nicely. For historical reasons that turn out to be =
 inconvenient, we don't do this for native builds.
 
 Why is this gratuitously different than the current scheme? 
 
 Do you mean why not simply use ${MACHINE}.${MACHINE_ARCH} always?
 Encoding both MACHINE and MACHINE_ARCH always is doable, but I avoid '.'
 because it prevents being able to  use modifiers like :R and :E
 to separate the directory component from the target machine spec.

The project currently uses dots without issue. Not quite sure why you'd need to 
generate things that way. Sure it sounds useful, but it seems rather a 
backwards way to work out MACHINE and MACHINE_ARCH (or I'm misunderstanding 
what you are saying).

 The projects/bmake branch is about showing how freebsd can be built in
 meta mode.  The tree dependencies are represented as dir.target_spec
 
 would I build a pc98 build with this? And why have it be different for =
 
 it would just get pc98 since there's no ambiguity.
 But as noted above, if you wanted to always be explicit that wouldn't be
 a problem (assuming '.' is avoided).
 

___
freebsd-toolchain@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to freebsd-toolchain-unsubscr...@freebsd.org


Re: [RFC] adding a variable to .mk and Makefile.inc1 to point to top of the FreeBSD source tree

2013-05-07 Thread Garrett Cooper
On Tue, May 7, 2013 at 1:12 PM, Xin Li delp...@delphij.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA512

 On 05/07/13 13:05, Garrett Cooper wrote:
  Hi, A common pattern that I've seen at Isilon and something else
  that I've wanted to have for a while is the ability to designate
  where the top of a source tree was. This is important and helpful
  when dealing with source files that build upon each other or depend
  on sources located in other sections of the tree; contrib stuff
  needs to set .PATH appropriately to point to sources at the top of
  the tree, sys stuff is riddled with S= in order to point to where
  /sys, etc lives, we build upon FreeBSD within an expected directory
  structure as well. I haven't come up with a name, but was wondering
  if this was a good idea, and if so does anyone have any outstanding
  patches for this that can be pushed into FreeBSD?

 Is there anything wrong with the current '../../' approach?


Not in particular, other than our variable (ISI_TOP) is used in
referencing ${.CURDIR} and ${.OBJDIR}, and it's easy to make mistakes if
you goof up the dot-dots. With a properly defined directory like that it
makes things unambiguous in my mind and with a proper name it makes pathing
more intuitive than it currently is. Besides, it would make some other
things cleaner, like the dot-dot magic that config(8), etc does.
Thanks!
-Garrett
___
freebsd-toolchain@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to freebsd-toolchain-unsubscr...@freebsd.org


Re: [RFC] adding a variable to .mk and Makefile.inc1 to point to top of the FreeBSD source tree

2013-05-07 Thread Warner Losh

On May 7, 2013, at 9:42 PM, Garrett Cooper wrote:

 On Tue, May 7, 2013 at 2:26 PM, Garrett Cooper yaneg...@gmail.com wrote:
 
 On Tue, May 7, 2013 at 2:00 PM, Warner Losh i...@bsdimp.com wrote:
 
 On May 7, 2013, at 2:46 PM, Garrett Cooper wrote:
 
  On May 7, 2013, at 1:39 PM, Brooks Davis wrote:
 
  On Tue, May 07, 2013 at 01:05:07PM -0700, Garrett Cooper wrote:
  Hi,
A common pattern that I've seen at Isilon and something else that I've
  wanted to have for a while is the ability to designate where the top of a
  source tree was. This is important and helpful when dealing with source
  files that build upon each other or depend on sources located in other
  sections of the tree; contrib stuff needs to set .PATH appropriately to
  point to sources at the top of the tree, sys stuff is riddled with S= in
  order to point to where /sys, etc lives, we build upon FreeBSD within an
  expected directory structure as well.
I haven't come up with a name, but was wondering if this was a good
  idea, and if so does anyone have any outstanding patches for this that can
  be pushed into FreeBSD?
 
  I'd like to see this.  There's a variable for this in NetBSD and I've
  wanted to do this because it makes code easier to relocate within the
  tree.
 
This is another good reason. It would make porting code to/from 
  NetBSD a LOT easier… especially because I plan on pulling a lot of 
  test/test infrastructure code from NetBSD and I really don't want to commit 
  too many local changes to the Makefiles. Less divergence - better 
  cross-pollination - less work for all - win for the BSDs.
Thanks for the reminder.. I'll base it off what NetBSD did :).
 
 SRCDIR
 
 EVARINUSE?
 
 share/mk/bsd.doc.mk:# SRCDIRDirectory where source files live.  
 [${.CURDIR}]
 share/mk/bsd.doc.mk:TRFLAGS+=   -I${SRCDIR}
 share/mk/bsd.doc.mk:.PATH: ${.CURDIR} ${SRCDIR}
 share/mk/bsd.doc.mk:cd ${SRCDIR}; \
 share/mk/bsd.doc.mk:SRCDIR?=${.CURDIR}
 share/mk/bsd.doc.mk:cd ${SRCDIR}; ${UNROFF} ${MACROS} ${UNROFFFLAGS} \
 share/mk/bsd.doc.mk:cd ${SRCDIR}; ${UNROFF} -ms ${UNROFFFLAGS} \
 share/mk/bsd.info.mk:SRCDIR?=   ${.CURDIR}
 ...
 share/doc/llvm/Makefile:SRCDIR= ${.CURDIR}/../../../contrib/llvm
 share/doc/llvm/Makefile:.PATH: ${SRCDIR} ${SRCDIR}/lib/Support
 share/doc/llvm/clang/Makefile:SRCDIR=   
 ${.CURDIR}/../../../../contrib/llvm/tools/clang
 share/doc/llvm/clang/Makefile:.PATH: ${SRCDIR}
  
 Once upon a time, this *HAD* to be set, and wasn't inferred from the current 
 top of the tree. Please, for the love of god, make sure that we don't lose 
 the infer from top of tree ability, or I will hurt you. Often. Through all 
 the minions that owe me minor favors.
 
 I don't want to break that ever; it's a fantastic feature. If you could point 
 me to where that magic awesomeness lives (make?), I'll be more than happy to 
 address it in my branch where I'm going to do this.
 
 I really don't like how NetBSD turned their top-level build command into a 
 shell script [in part because it needs to bootstrap a bunch of tools]. It 
 makes things painful when doing iterative builds..
 
 So all in all, I completely and wholeheartedly agree with your concerns.
 
 Oh sweet.. this is something to keep in mind too (from bsd.port.mk)...
 
 # SRC_BASE  - The root of the src tree.  (Some ports require this to get
 # kernel sources).  Default: /usr/src
 
 All else fails, ports has done it first -_-...
 
 Not the first var I've seen this done with...

I thought ports specifically named things differently to avoid conflicts.
Warner

___
freebsd-toolchain@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to freebsd-toolchain-unsubscr...@freebsd.org


Re: [RFC] adding a variable to .mk and Makefile.inc1 to point to top of the FreeBSD source tree

2013-05-07 Thread Garrett Cooper
On May 7, 2013, at 10:09 PM, Warner Losh i...@bsdimp.com wrote:

 
 On May 7, 2013, at 9:42 PM, Garrett Cooper wrote:
 
 On Tue, May 7, 2013 at 2:26 PM, Garrett Cooper yaneg...@gmail.com wrote:
 
 On Tue, May 7, 2013 at 2:00 PM, Warner Losh i...@bsdimp.com wrote:
 
 On May 7, 2013, at 2:46 PM, Garrett Cooper wrote:
 
 On May 7, 2013, at 1:39 PM, Brooks Davis wrote:
 
 On Tue, May 07, 2013 at 01:05:07PM -0700, Garrett Cooper wrote:
 Hi,
  A common pattern that I've seen at Isilon and something else that I've
 wanted to have for a while is the ability to designate where the top of a
 source tree was. This is important and helpful when dealing with source
 files that build upon each other or depend on sources located in other
 sections of the tree; contrib stuff needs to set .PATH appropriately to
 point to sources at the top of the tree, sys stuff is riddled with S= in
 order to point to where /sys, etc lives, we build upon FreeBSD within an
 expected directory structure as well.
  I haven't come up with a name, but was wondering if this was a good
 idea, and if so does anyone have any outstanding patches for this that can
 be pushed into FreeBSD?
 
 I'd like to see this.  There's a variable for this in NetBSD and I've
 wanted to do this because it makes code easier to relocate within the
 tree.
 
  This is another good reason. It would make porting code to/from NetBSD 
 a LOT easier… especially because I plan on pulling a lot of test/test 
 infrastructure code from NetBSD and I really don't want to commit too many 
 local changes to the Makefiles. Less divergence - better cross-pollination 
 - less work for all - win for the BSDs.
  Thanks for the reminder.. I'll base it off what NetBSD did :).
 
 SRCDIR
 
 EVARINUSE?
 
 share/mk/bsd.doc.mk:# SRCDIRDirectory where source files live.  
 [${.CURDIR}]
 share/mk/bsd.doc.mk:TRFLAGS+=   -I${SRCDIR}
 share/mk/bsd.doc.mk:.PATH: ${.CURDIR} ${SRCDIR}
 share/mk/bsd.doc.mk:cd ${SRCDIR}; \
 share/mk/bsd.doc.mk:SRCDIR?=${.CURDIR}
 share/mk/bsd.doc.mk:cd ${SRCDIR}; ${UNROFF} ${MACROS} ${UNROFFFLAGS} \
 share/mk/bsd.doc.mk:cd ${SRCDIR}; ${UNROFF} -ms ${UNROFFFLAGS} \
 share/mk/bsd.info.mk:SRCDIR?=   ${.CURDIR}
 ...
 share/doc/llvm/Makefile:SRCDIR= ${.CURDIR}/../../../contrib/llvm
 share/doc/llvm/Makefile:.PATH: ${SRCDIR} ${SRCDIR}/lib/Support
 share/doc/llvm/clang/Makefile:SRCDIR=   
 ${.CURDIR}/../../../../contrib/llvm/tools/clang
 share/doc/llvm/clang/Makefile:.PATH: ${SRCDIR}
 
 Once upon a time, this *HAD* to be set, and wasn't inferred from the current 
 top of the tree. Please, for the love of god, make sure that we don't lose 
 the infer from top of tree ability, or I will hurt you. Often. Through all 
 the minions that owe me minor favors.
 
 I don't want to break that ever; it's a fantastic feature. If you could 
 point me to where that magic awesomeness lives (make?), I'll be more than 
 happy to address it in my branch where I'm going to do this.
 
 I really don't like how NetBSD turned their top-level build command into a 
 shell script [in part because it needs to bootstrap a bunch of tools]. It 
 makes things painful when doing iterative builds..
 
 So all in all, I completely and wholeheartedly agree with your concerns.
 
 Oh sweet.. this is something to keep in mind too (from bsd.port.mk)...
 
 # SRC_BASE  - The root of the src tree.  (Some ports require this to get
 # kernel sources).  Default: /usr/src
 
 All else fails, ports has done it first -_-...
 
 Not the first var I've seen this done with...
 
 I thought ports specifically named things differently to avoid conflicts.

Perhaps. It matches autoconf too. It's just a pain when there isn't 
consistency, but oh well...
Thanks!
-Garrett
___
freebsd-toolchain@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to freebsd-toolchain-unsubscr...@freebsd.org