mirror of
https://github.com/JakeHillion/scx.git
synced 2024-11-30 04:50:24 +00:00
22 lines
642 B
Bash
Executable File
22 lines
642 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
clang="$1"
|
|
|
|
#
|
|
# Get Clang's default includes on this system, as opposed to those seen by
|
|
# '-target bpf'. This fixes "missing" files on some architectures/distros,
|
|
# such as asm/byteorder.h, asm/socket.h, asm/sockios.h, sys/cdefs.h etc.
|
|
#
|
|
# Use '-idirafter': Don't interfere with include mechanics except where the
|
|
# build would have failed anyways.
|
|
#
|
|
|
|
"$clang" -v -E - < /dev/null 2>&1 \
|
|
| sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }' \
|
|
|
|
"$clang" -dM -E - < /dev/null \
|
|
| grep '__riscv_xlen ' \
|
|
| awk '{printf("-D__riscv_xlen=%d -D__BITS_PER_LONG=%d", $$3, $$3)}'
|