tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

$(<) is used incorrectly in Makefile.kern.inc



The variable $(<) (.IMPSRC) is used in Makefile.kern.inc in
the NORMAL_C, NOPROF_C, and NORMAL_S macros.  These macros are then
used in _explicit_ rules instead of suffix transformation rules.
The variable is not supposed to be available, but as a side effect of
a bug (PR 49086, issue 8), it has been available.

    .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.

If the patch for the mentioned PR is applied, the kernel cannot be
compiled anymore.  Using ${>:M*.c} or ${>:M*.S} instead of ${<} seems
to work as a workaround, it probably isn't the proper fix.  I tried
to first use ${>:[1]}, but that didn't work because of lines like
these before the actual rules in the generated Makefile (amd64):

    locore.o machdep.o: Makefile
    acpi_wakeup_low.o amd64func.o busfunc.o cpufunc.o cpu_in_cksum.o: assym.h

Here is the ${>:M*.c} / ${>:M*.S} version:

# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
# NOPROF and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
NORMAL_C?=      @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}" && \
                ${_MKSHECHO}\
                ${CC} ${COPTS.${>:M*.c:T}} ${CFLAGS} ${CPPFLAGS} ${PROF} -c 
${>:M*.c} && \
                ${CC} ${COPTS.${>:M*.c:T}} ${CFLAGS} ${CPPFLAGS} ${PROF} -c 
${>:M*.c} && \
                ${COMPILE_CTFCONVERT}
NOPROF_C?=      @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}" && \
                ${_MKSHECHO}\
                ${CC} ${COPTS.${>:M*.c:T}} ${CFLAGS} ${CPPFLAGS} -c ${>:M*.c} 
&& \
                ${CC} ${COPTS.${>:M*.c:T}} ${CFLAGS} ${CPPFLAGS} -c ${>:M*.c} 
&& \
                ${COMPILE_CTFCONVERT}
NORMAL_S?=      @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}" && \
                ${_MKSHECHO}\
                ${CC} ${AFLAGS} ${AFLAGS.${>:M*.S:T}} ${CPPFLAGS} -c ${>:M*.S} 
&& \
                ${CC} ${AFLAGS} ${AFLAGS.${>:M*.S:T}} ${CPPFLAGS} -c ${>:M*.S}

-- 
Jarmo Jaakkola


Home | Main Index | Thread Index | Old Index