Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Jul 1996 13:08:48 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, mark@linus.demon.co.uk, pst@freefall.freebsd.org
Cc:        hackers@freebsd.org
Subject:   Re: cvs commit: src/share/mk bsd.obj.mk
Message-ID:  <199607140308.NAA11262@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> >  Modified:    share/mk  bsd.obj.mk
>> >  Log:
>> >  Add whereobj target to find that pesky obj dir

BTW, this doesn't actually work.  There are a couple of errors in the sh
command.

>> I still think that this is important enough to justify builtin support.
>> E.g., `make -P variable' could print make's idea of the value of `variable'.
>> Then `make -P .OBJDIR' would show where the obj dir is.

>Yes!  I'd been puzzling over a way to do this which wasn't a special purpose
>hack.  So, here's an implementation (the man page patch also includes a small
>bug fix for the description of the -D option).  -P was (sort of) taken, so I
>used -V.

>(This patch is against -current's make; I actually compiled and lightly tested
>a variant of this - against a slightly older make [prior to jkh's changes].)

Thanks for the implementation.  I can hardly object to it :-).  I will
commit it in a day or two if there are no problems.

Here are some fixes for new and old bugs in the options processing and
synopsis printing (and one hunk of whitespace changes).  The missing colon
on D: is most important.

===
*** make.1~~	Sun Jul 14 11:44:30 1996
--- make.1	Sun Jul 14 12:07:47 1996
***************
*** 40,44 ****
  .Sh SYNOPSIS
  .Nm make
! .Op Fl eiknqrstv
  .Op Fl D Ar variable
  .Op Fl d Ar flags
--- 40,44 ----
  .Sh SYNOPSIS
  .Nm make
! .Op Fl eiknqrst
  .Op Fl D Ar variable
  .Op Fl d Ar flags
*** main.c~~	Sun Jul 14 11:44:30 1996
--- main.c	Sun Jul 14 12:12:02 1996
***************
*** 158,162 ****
  # define OPTFLAGS "BD:I:L:PSVd:ef:ij:knqrst"
  #else
! # define OPTFLAGS "DV:I:d:ef:ij:knqrst"
  #endif
  rearg:	while((c = getopt(argc, argv, OPTFLAGS)) != EOF) {
--- 158,162 ----
  # define OPTFLAGS "BD:I:L:PSVd:ef:ij:knqrst"
  #else
! # define OPTFLAGS "D:I:V:d:ef:ij:knqrst"
  #endif
  rearg:	while((c = getopt(argc, argv, OPTFLAGS)) != EOF) {
***************
*** 640,645 ****
  		    ln = Lst_Succ(ln)) {
  			char *value = Var_Value((char *)Lst_Datum(ln),
! 			    VAR_GLOBAL, &p1);
! 			printf("%s\n", value? value : "");
  			if (p1)
  				free(p1);
--- 640,646 ----
  		    ln = Lst_Succ(ln)) {
  			char *value = Var_Value((char *)Lst_Datum(ln),
! 					  VAR_GLOBAL, &p1);
! 
! 			printf("%s\n", value ? value : "");
  			if (p1)
  				free(p1);
***************
*** 946,951 ****
  {
  	(void)fprintf(stderr,
! "usage: make [-eiknqrst] [-D variable] [-d flags] [-f makefile ]\n\
!             [-I directory] [-j max_jobs] [variable=value]\n");
  	exit(2);
  }
--- 947,952 ----
  {
  	(void)fprintf(stderr,
! "usage: make [-eiknqrst] [-D variable] [-d flags] [-f makefile] [-I directory]\n\
!             [-j max_jobs] [-V variable] [variable=value] [target ...]\n");
  	exit(2);
  }
===

>For example, for /usr/src/games/boggle/Makefile:

>  MKDICTOBJ != cd ${.CURDIR}/mkdict; make -V .OBJDIR
>  MKINDXOBJ != cd ${.CURDIR}/mkindex; make -V .OBJDIR

>  MKDICT = ${MKDICTOBJ}/mkdict
>  MKINDX = ${MKINDXOBJ}/mkindex

>The old version of the Makefile failed for most obj directory configurations;
>the -current version of the Makefile (and the new build system in general) only
>allows one (broken) way to do obj directories.

I think the old way worked provided the source directories contained the
correct obj links.  I think the above method is too slow except in special
cases.  It is probably most useful for nightmare cases like tn3270.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199607140308.NAA11262>