| 1 |
AUTOMAKE_OPTIONS = foreign |
| 2 |
|
| 3 |
lib_LTLIBRARIES = libsandbox.la |
| 4 |
bin_PROGRAMS = sandbox |
| 5 |
|
| 6 |
AM_CPPFLAGS = \ |
| 7 |
-DPIC -fPIC -D_REENTRANT \ |
| 8 |
-DETCDIR=\"$(sysconfdir)\" \ |
| 9 |
-DLIBSANDBOX_PATH=\"$(libdir)\" \ |
| 10 |
-DSANDBOX_BASHRC_PATH=\"$(pkgdatadir)\" \ |
| 11 |
-I$(top_srcdir) -Wall |
| 12 |
|
| 13 |
INCLUDES = -I$(top_srcdir)/librcutil/include |
| 14 |
LOCAL_INCLUDES = $(top_srcdir)/localdecls.h |
| 15 |
|
| 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 |
# Do not add -nostdlib or -nostartfiles, as then our constructor |
| 20 |
# and destructor will not be executed ... |
| 21 |
libsandbox_la_LIBADD = \ |
| 22 |
-lc $(LIBDL) \ |
| 23 |
$(top_builddir)/librcutil/.libs/librcutil.a |
| 24 |
# Could use the following, but then libtool link it with --whole-archive |
| 25 |
# $(top_builddir)/librcutil/librcutil.la |
| 26 |
libsandbox_la_LDFLAGS = \ |
| 27 |
-nodefaultlibs \ |
| 28 |
-Wl,--version-script,libsandbox.map |
| 29 |
libsandbox_la_SOURCES = \ |
| 30 |
libsandbox.c \ |
| 31 |
canonicalize.c \ |
| 32 |
sandbox_utils.c \ |
| 33 |
$(LOCAL_INCLUDES) |
| 34 |
|
| 35 |
sandbox_CFLAGS = -DOUTSIDE_LIBSANDBOX |
| 36 |
sandbox_LDADD = $(top_builddir)/librcutil/librcutil.la |
| 37 |
sandbox_SOURCES = \ |
| 38 |
sandbox.c \ |
| 39 |
sandbox.h \ |
| 40 |
sandbox_utils.c \ |
| 41 |
$(LOCAL_INCLUDES) |
| 42 |
|
| 43 |
libsandbox.c: libsandbox.map symbols.h |
| 44 |
|
| 45 |
SYMBOLS_FILE = $(srcdir)/symbols.h.in |
| 46 |
SYMBOLS_LIST = $(shell $(EGREP) -v '^\#' $(SYMBOLS_FILE)) |
| 47 |
GEN_VERSION_MAP_SCRIPT = $(top_srcdir)/scripts/gen_symbol_version_map.awk |
| 48 |
GEN_HEADER_SCRIPT = $(top_srcdir)/scripts/gen_symbol_header.awk |
| 49 |
|
| 50 |
libsandbox.map: $(SYMBOLS_FILE) $(GEN_VERSION_MAP_SCRIPT) |
| 51 |
@echo "Generating $@"; \ |
| 52 |
if [ ! -e "$(LIBC_PATH)" ]; then\ |
| 53 |
echo -e "\n*** Cannot find LIBC_PATH '$(LIBC_PATH)' !\n"; \ |
| 54 |
exit 1; \ |
| 55 |
fi; \ |
| 56 |
export SYMBOLS="$(SYMBOLS_LIST)"; \ |
| 57 |
if ! $(READELF) -h -s $(LIBC_PATH) | \ |
| 58 |
$(AWK) -f $(GEN_VERSION_MAP_SCRIPT) > $@ ; \ |
| 59 |
then \ |
| 60 |
echo "\n*** Failed to generate '$@' !\n"; \ |
| 61 |
exit 1; \ |
| 62 |
fi |
| 63 |
|
| 64 |
symbols.h: $(SYMBOLS_FILE) $(GEN_HEADER_SCRIPT) |
| 65 |
@echo "Generating $@"; \ |
| 66 |
if [ ! -e "$(LIBC_PATH)" ]; then\ |
| 67 |
echo -e "\n*** Cannot find LIBC_PATH '$(LIBC_PATH)' !\n"; \ |
| 68 |
exit 1; \ |
| 69 |
fi; \ |
| 70 |
export SYMBOLS="$(SYMBOLS_LIST)"; \ |
| 71 |
if ! $(READELF) -h -s $(LIBC_PATH) | \ |
| 72 |
$(AWK) -f $(GEN_HEADER_SCRIPT) > $@ ; \ |
| 73 |
then \ |
| 74 |
echo "\n*** Failed to generate '$@' !\n"; \ |
| 75 |
exit 1; \ |
| 76 |
fi |
| 77 |
|
| 78 |
EXTRA_DIST = $(SYMBOLS_FILE) |
| 79 |
|
| 80 |
CLEANFILES = libsandbox.map symbols.h |
| 81 |
DISTCLEANFILES = $(CLEANFILES) |