0

I'm trying to emulate this rule with bmake

%.o: %.c
    echo $< $@

This is valid in GNU make but I'm having a hard time to replicate it with BSD make.

Thanks in advance!

Mateusz Piotrowski
  • 8,029
  • 10
  • 53
  • 79
argot
  • 77
  • 7

1 Answers1

0

Somewhat out of my depth here, but I think there are two things to change:

  1. Use suffix rules instead of (unsupported, GNU Make feature) pattern rules.
  2. Use the bmake names for automatic variables (bmake supports GNU Make automatic variables but are not recommended)
.SUFFIXES: .o
.c.o:
    echo ${.TARGET} ${.IMPSRC}

From netbsd wiki

BSD make (aka bmake) uses traditional suffix rules (.c.o: ...) instead of pattern rules like gmake's (%.c:%.o: ...) which are more general and flexible.

See also https://linux.die.net/man/1/bmake

Andreas
  • 5,086
  • 3
  • 16
  • 36
  • Thanks this worked perfectly. I also found this resource https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html – argot May 02 '22 at 13:08