On Mon, 10 Dec 2012, Antti Kantee wrote:
+# If the toolchain does not know about a file, --print-file-name echoes +# the input file name (why??). In that case we want an empty string for +# dependencies to work correctly. Note: do _not_ use TOOL_SED here because +# this file is used before TOOL_SED is built.
It's probably a bug if bsd.gcc.mk is used before TOOL_SED is built. However, you have to .include <bsd.own.mk> before you try to use any of its variables in a "!=" line.
+_GCC_CRTBEGINS!= ${CC} --print-file-name=crtbeginS.o \ + | sed 's|^crtbeginS.o$$||'
You can remove the dependency on sed by using make :C/// variable modifiers, like this (untested):
_GCC_CRTBEGINS!= ${CC} --print-file-name=crtbeginS.o _GCC_CRTENDS!= ${CC} --print-file-name=crtendS.o _GCC_CRTI!= ${CC} --print-file-name=crti.o _GCC_CRTN!= ${CC} --print-file-name=crtn.o .for v in _GCC_CRTBEGINS _GCC_CRTENDS _GCC_CRTI _GCC_CRTN # If the value does not contain '/' then replace it with the empty string ${v} := ${${v}:C,^[^/]*$,,} .endfor --apb (Alan Barrett)