On Wed, Jan 30, 2019 at 01:56:04PM -0600, Scott Cheloha wrote:
> We need to tell ${CC} about b.o explicitly.
>
> ok?
>
> -Scott
>
> P.S. How was BSD $> or GNU $^ or an equivalent *not* standardized as
> an automatic variable? I get that it isn't a silver bullet, but in
> the relatively common "let's take several <X> and make a <Y>" case it
> is extremely useful and totally missing from the portable syntax.
Well, it's not standardized.
As far as adding extensions to bsd tools, it's always a bit annoying,
because we then foster making things *less* portable to other environments
that don't have it. So generally, it's more a question of knowing when
it's wide-spread enough (e.g., sed -i).
make is *very* sneaky in that regard... :(
In general, the portable way to do things properly is that as soon as you
have two objects files, you got thru a variable, which is good practice
anyway.
> Index: make.1
> ===================================================================
> RCS file: /cvs/src/usr.bin/make/make.1,v
> retrieving revision 1.127
> diff -u -p -r1.127 make.1
> --- make.1 4 Jul 2018 14:11:49 -0000 1.127
> +++ make.1 30 Jan 2019 19:45:15 -0000
> @@ -464,7 +464,7 @@ from sources a.c and b.c, with header fi
> ${CC} ${CFLAGS} -c $<
>
> prog: a.o b.o
> - ${CC} ${CFLAGS} -o $@ a.o
> + ${CC} ${CFLAGS} -o $@ a.o b.o
>
> a.o b.o: a.h
>
Yep, okay