1*de1e4e89SAndroid Build Coastguard Worker#!/bin/bash 2*de1e4e89SAndroid Build Coastguard Worker 3*de1e4e89SAndroid Build Coastguard Worker# This is the rule from the end of Makefile, with $* instead of $^ on the 4*de1e4e89SAndroid Build Coastguard Worker# first line, and $ instead of $$ on the other lines, but otherwise identical. 5*de1e4e89SAndroid Build Coastguard Worker# (Which is why the indentation is weird!) 6*de1e4e89SAndroid Build Coastguard Worker 7*de1e4e89SAndroid Build Coastguard Worker files="$*" ; \ 8*de1e4e89SAndroid Build Coastguard Worker for s in `grep -B 3 '\<dlsym' $files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \ 9*de1e4e89SAndroid Build Coastguard Worker sed -n '/'$s'[^ ]* =/{s:.* \([^ ]*'$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $files ; \ 10*de1e4e89SAndroid Build Coastguard Worker done 11