Discussion:
Weird conditional logic in lib/libpmc/Makefile
(too old to reply)
Shawn Webb
2018-06-03 01:07:50 UTC
Permalink
Hey all,

Below is some logic pasted from lib/libpmc/Makefile:

.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"

.if ${MACHINE_ARCH} == "aarch64"
EVENT_ARCH="arm64"
.elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
EVENT_ARCH="x86"
.elif ${MACHINE_ARCH} == "powerpc"
EVENT_ARCH="powerpc"
.endif

JEVENTS= ${BTOOLSPATH:U.}/pmu-events/jevents
# This file is built in a subdirectory so never try to rebuild
# it here due to missing meta file.
${JEVENTS}: .NOMETA

libpmc_events.c: ${JEVENTS}
${JEVENTS} ${EVENT_ARCH} ${.CURDIR}/pmu-events/arch libpmc_events.c
SRCS+= libpmc_events.c
.endif

Why perform the conditionals for aarch64 and powerpc when it can't be
those? "Am I missing something?

I'm looping in Matt Macy, who was the last person to touch the file.

Thanks,
--
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

Tor-ified Signal: +1 443-546-8752
Tor+XMPP+OTR: ***@is.a.hacker.sx
GPG Key ID: 0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE
Mark Millard
2018-06-03 05:27:22 UTC
Permalink
Shawn Webb shawn.webb at hardenedbsd.org wrote on
Post by Shawn Webb
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
.if ${MACHINE_ARCH} == "aarch64"
EVENT_ARCH="arm64"
.elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
EVENT_ARCH="x86"
.elif ${MACHINE_ARCH} == "powerpc"
EVENT_ARCH="powerpc"
.endif
JEVENTS= ${BTOOLSPATH:U.}/pmu-events/jevents
# This file is built in a subdirectory so never try to rebuild
# it here due to missing meta file.
${JEVENTS}: .NOMETA
libpmc_events.c: ${JEVENTS}
${JEVENTS} ${EVENT_ARCH} ${.CURDIR}/pmu-events/arch libpmc_events.c
SRCS+= libpmc_events.c
.endif
Why perform the conditionals for aarch64 and powerpc when it can't be
those? "Am I missing something?
I'm looping in Matt Macy, who was the last person to touch the file.
It appears that every version of lib/libpmc/Makefile from head -r334242
and later has some variation of the odd nesting/value combinations that
has "EVENT_ARCH" examples that are impossible to select as the code is
structured.

(The file version prior to -r334242 is from -r298107 .)

===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)

Loading...