| 1 |
AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip
|
| 2 |
EXTRA_DIST = sandbox.bashrc canonicalize.c symbols.in
|
| 3 |
CLEANFILES = symbols.h
|
| 4 |
|
| 5 |
AM_CPPFLAGS = -D_GNU_SOURCE -DPIC -fPIC -D_REENTRANT \
|
| 6 |
-DLIBSANDBOX_PATH=\"$(libdir)\" \
|
| 7 |
-DSANDBOX_BASHRC_PATH=\"$(pkgdatadir)\"
|
| 8 |
|
| 9 |
dist_pkgdata_DATA = sandbox.bashrc
|
| 10 |
|
| 11 |
lib_LTLIBRARIES = libsandbox.la
|
| 12 |
libsandbox_la_SOURCES = libsandbox.c localdecls.h
|
| 13 |
# Do not add -nostdlib or -nostartfiles, as then our constructor
|
| 14 |
# and destructor will not be executed ...
|
| 15 |
libsandbox_la_LDFLAGS = -nodefaultlibs -lc -ldl
|
| 16 |
# We need -fexceptions here, else we do not catch exceptions
|
| 17 |
# (nptl/tst-cancelx4.c in glibc among others fails for wrapped functions).
|
| 18 |
libsandbox_la_CFLAGS = -fexceptions
|
| 19 |
|
| 20 |
bin_PROGRAMS = sandbox
|
| 21 |
sandbox_SOURCES = sandbox.c sandbox.h sandbox_futils.c getcwd.c
|
| 22 |
sandbox_CFLAGS = -DOUTSIDE_LIBSANDBOX
|
| 23 |
|
| 24 |
libsandbox.c: symbols.h
|
| 25 |
|
| 26 |
# Basically generates symbols.h from the function names in symbols.in.
|
| 27 |
# Not sure if we can count on the latest version the only symbol
|
| 28 |
# countaining '@@' ...
|
| 29 |
symbols.h: symbols.in
|
| 30 |
@echo "Generating $@"; \
|
| 31 |
if [ ! -e "$(LIBC_PATH)" ]; then\
|
| 32 |
echo -e "\n*** Cannot find LIBC_PATH '$(LIBC_PATH)' !\n"; \
|
| 33 |
exit 1; \
|
| 34 |
fi; \
|
| 35 |
echo "#ifndef __symbol_h" > $@; \
|
| 36 |
echo -e "#define __symbol_h\n" >> $@; \
|
| 37 |
for x in `cat $^`; do \
|
| 38 |
sym=`readelf -s "$(LIBC_PATH)" 2>/dev/null | \
|
| 39 |
awk '{ print $$8 }' | \
|
| 40 |
grep "^$${x}@@" | \
|
| 41 |
sort -u | \
|
| 42 |
cut -d'@' -f3`; \
|
| 43 |
echo "#define symname_$${x} \"$${x}\"" >> $@; \
|
| 44 |
if [ -n "$${sym}" ]; then \
|
| 45 |
echo "#define symver_$${x} \"$${sym}\"" >> $@; \
|
| 46 |
else \
|
| 47 |
echo "#define symver_$${x} NULL" >> $@; \
|
| 48 |
fi; \
|
| 49 |
done; \
|
| 50 |
echo -e "\n#endif /* __symbol_h */" >> $@
|