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