NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
toolchain/58229: BSD make and GNU make differ in $< and $> handling in an annoying way
>Number: 58229
>Category: toolchain
>Synopsis: BSD make and GNU make differ in $< and $> handling in an annoying way
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: toolchain-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon May 06 19:55:00 +0000 2024
>Originator: Jason Thorpe
>Release: NetBSD 10.99.10
>Organization:
Just the BASICs
>Environment:
NetBSD the-ripe-vessel 10.99.10 NetBSD 10.99.10 (GENERIC) #68: Fri Nov 17 14:40:27 PST 2023 thorpej@the-ripe-vessel:/space/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
For the following Makefile snippet behaves differently in GNU make vs BSD make:
---- snip ----
OBJS= tbvm.o
CLEANFILES= $(OBJS) tbvm_program.h libtbvm.a
CFLAGS= -Os -g -Wall -Wformat
all: libtbvm.a
tbvm.o: Makefile tbvm.c tbvm.h tbvm_opcodes.h tbvm_program.h
tbvm_program.h: tbvm_program.asm
../tbasm/tbasm -H $<
libtbvm.a: $(OBJS)
rm -f $@
ar -r $@ $(OBJS)
ranlib $@
clean:
-rm -f $(CLEANFILES)
---- snip ----
BSD make:
the-ripe-vessel:thorpej 51$ make tbvm_program.h
../tbasm/tbasm -H
usage: tbasm [-o output.bin] input.asm
usage: tbasm -H[output.h] input.asm
*** Error code 1
Stop.
make: stopped in /home/thorpej/Github/thorpej/JTTB/tbvm
the-ripe-vessel:thorpej 52$
GNU make:
the-ripe-vessel:thorpej 52$ gmake tbvm_program.h
../tbasm/tbasm -H tbvm_program.asm
parsed 388 instructions (129 labels, 220 references)
program size: 1128 bytes
the-ripe-vessel:thorpej 53$
$< is ${.IMPSRC} in BSD make, and the behavior is documented:
.IMPSRC In suffix-transformation rules, the name/path of the
source from which the target is to be transformed
(the "implied" source); also known as `<'. It is not
defined in explicit rules.
...but here's the annoying part: If I change to $> (${.ALLSRC}) it works in BSD make, but then fails in GNU make:
the-ripe-vessel:thorpej 57$ gmake
../tbasm/tbasm -H
usage: tbasm [-o output.bin] input.asm
usage: tbasm -H[output.h] input.asm
gmake: *** [Makefile:10: tbvm_program.h] Error 1
the-ripe-vessel:thorpej 58$
>How-To-Repeat:
See above.
>Fix:
that would be nice.
Home |
Main Index |
Thread Index |
Old Index