blob: 97db4ab0bad5c844cea570644e3a1cbacc7f705b (
plain) (
tree)
|
|
# See LICENSE file for copyright and license details.
LINUX_SYMBOL_TABLES != sed -n 's/^.*LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\+\)\b.*\$$\$$\$$.*\$$\$$\$$.*$$/\1/p' < linux/syscalls.h
LINUX_SYMBOL_TABLE_FILES != printf 'linux-src/symbols-$(LINUX_VERSION)/%s\n' $(LINUX_SYMBOL_TABLES)
LINUX_SYMBOL_TABLE_DEPS =\
$(LINUX_SOURCE)\
linux/symbols.mk\
linux/syscalls.h\
util/getdefs\
util/getenum
LINUX_SYMBOL_EXTRACTOR_DEPS =\
$(LINUX_SYMBOL_TABLE_FILES)\
linux/symbols.mk\
linux/syscalls.h\
util/make-enum\
util/make-mask\
util/make-multiextractor\
util/make-sym-extractor
libsyscalls_get_syscall_display_info.o: generated/linux-symbol-extractors.h linux/symbols.c
libsyscalls_get_syscall_display_info.lo: generated/linux-symbol-extractors.h linux/symbols.c
$(LINUX_SYMBOL_TABLE_FILES): $(LINUX_SYMBOL_TABLE_DEPS)
mkdir -p -- linux-src/symbols-$(LINUX_VERSION)
table="$$(printf '%s\n' "$@" | tr / '\n' | sed -n '$$p')" && \
command="$$(sed -n 's/^.*LINUX_SYMBOL_PRINTER_'"$$table"'\b.*\$$\$$\$$\s*\(.*\)\s*\$$\$$\$$.*$$/\1/p' < linux/syscalls.h)" && \
test -n "$$command" && \
printf '%s\n' "$$command" && \
(cd -- linux-src/linux-$(LINUX_VERSION) && env PATH="../../util:$${PATH}" sh -e -c "$$command") > $@
generated/linux-symbol-extractors.h: $(LINUX_SYMBOL_EXTRACTOR_DEPS)
mkdir -p -- generated
set -e; \
for tablefile in $(LINUX_SYMBOL_TABLE_FILES); do \
tablename="$$(printf '%s\n' "$$tablefile" | cut -d / -f 3)"; \
how="$$(sed -n < linux/syscalls.h \
's/^.*LINUX_SYMBOL_PRINTER_'"$$tablename"'\b.*\/\*\s*\(.*\)\s*\$$\$$\$$.*\$$\$$\$$.*$$/\1/p')"; \
printf '\n'; \
util/make-sym-extractor "$$tablename" "$$how" < "$$tablefile"; \
done > $@.tmp
set -e; \
pattern='\s\+LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\+\)\s*'; \
funcprefix='extract_linux_symbol_'; \
sed -n 's/^\s*\x23\s*define'"$$pattern$$pattern"'\(\/.*\)\?$$/\x23define '$$funcprefix'\1 '$$funcprefix'\2/p' \
< linux/syscalls.h | tr '[A-Z]' '[a-z]' > $@
storage_and_rettype="$$(sed '/^$$/d' < $@.tmp | sed 1q | sed 's/\*/\\\*/g' | sed 's/[^\*]$$/& /')"; \
sed -n 's/^extract_symbol_.*/'"$${storage_and_rettype}"'&;/p' < $@.tmp | cat - $@.tmp >> $@
-rm -f -- $@.tmp
set -e; \
sed 's/, */ /g' < linux/syscalls.h \
| sed -n 's/^.*LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\+\)\b.*[^$$]\$$\$$\s*SYMBOLS(\(.*\))\s*\$$\$$[^$$].*$$/\1 \2/p' \
| while read line; do \
printf '\n'; \
util/make-multiextractor $$line; \
done >> $@
printf '\n\43define LIST_LINUX_EXTRACTORS(X, D)\\\n' >> $@
set -e; \
phonies="$$(sed -n '/\$$\$$\$$\s*BEGIN\s\+PHONIES\s*\$$\$$\$$/,/\$$\$$\$$\s*END\s\+PHONIES\s*\$$\$$\$$/p' < linux/syscalls.h \
| sed -n 's/^\s*LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\+\)\b.*$$/\1/p')"; \
sed -n 's/^extract_symbol_\([^)]*\)(.*)\s*\/\*\s*\([0-9]\+\)\s*\*\/\s*$$/\1 \2/p' < $@ \
| while read name n; do \
if ! printf '%s\n' "$$phonies" | grep -i \^"$$name"\$$ > /dev/null; then \
printf '\tX(LINUX_SYMBOL_PRINTER_%s, extract_symbol_%s, %i) D\\\n' \
"$$(printf '%s\n' "$$name" | tr '[a-z]' '[A-Z]')" \
"$$name" \
"$$n"; \
fi; \
done \
| sed '$$s/ \D\\$$//' >> $@
sed 's/extract_symbol/extract_linux_symbol/g' < $@ > $@.tmp && mv -- $@.tmp $@
|