| 1 |
AUTOMAKE_OPTIONS = foreign
|
| 2 |
|
| 3 |
lib_LTLIBRARIES = libsandbox.la
|
| 4 |
bin_PROGRAMS = sandbox
|
| 5 |
|
| 6 |
AM_CPPFLAGS = \
|
| 7 |
-D_GNU_SOURCE -DPIC -fPIC -D_REENTRANT \
|
| 8 |
-DLIBSANDBOX_PATH=\"$(libdir)\" \
|
| 9 |
-DSANDBOX_BASHRC_PATH=\"$(pkgdatadir)\" \
|
| 10 |
-I$(top_srcdir) -Wall
|
| 11 |
|
| 12 |
LOCAL_INCLUDES = $(top_srcdir)/localdecls.h
|
| 13 |
|
| 14 |
# We need -fexceptions here, else we do not catch exceptions
|
| 15 |
# (nptl/tst-cancelx4.c in glibc among others fails for wrapped functions).
|
| 16 |
libsandbox_la_CFLAGS = -fexceptions
|
| 17 |
# Do not add -nostdlib or -nostartfiles, as then our constructor
|
| 18 |
# and destructor will not be executed ...
|
| 19 |
libsandbox_la_LIBADD = -lc -ldl
|
| 20 |
libsandbox_la_LDFLAGS = \
|
| 21 |
-nodefaultlibs \
|
| 22 |
-Wl,--version-script,libsandbox.map
|
| 23 |
libsandbox_la_SOURCES = \
|
| 24 |
libsandbox.c \
|
| 25 |
getcwd.c \
|
| 26 |
canonicalize.c \
|
| 27 |
sandbox_futils.c \
|
| 28 |
$(LOCAL_INCLUDES)
|
| 29 |
|
| 30 |
sandbox_CFLAGS = -DOUTSIDE_LIBSANDBOX
|
| 31 |
sandbox_SOURCES = \
|
| 32 |
sandbox.c \
|
| 33 |
sandbox.h \
|
| 34 |
sandbox_futils.c \
|
| 35 |
getcwd.c \
|
| 36 |
$(LOCAL_INCLUDES)
|
| 37 |
|
| 38 |
libsandbox.c: libsandbox.map symbols.h
|
| 39 |
|
| 40 |
SYMBOLS_FILE = $(srcdir)/symbols.in
|
| 41 |
SYMBOLS_LIST = $(shell $(EGREP) -v '^\#' $(SYMBOLS_FILE))
|
| 42 |
GEN_VERSION_MAP_SCRIPT = $(top_srcdir)/scripts/gen_symbol_version_map.awk
|
| 43 |
GEN_HEADER_SCRIPT = $(top_srcdir)/scripts/gen_symbol_header.awk
|
| 44 |
|
| 45 |
libsandbox.map: $(SYMBOLS_FILE) $(GEN_VERSION_MAP_SCRIPT)
|
| 46 |
@echo "Generating $@"; \
|
| 47 |
if [ ! -e "$(LIBC_PATH)" ]; then\
|
| 48 |
echo -e "\n*** Cannot find LIBC_PATH '$(LIBC_PATH)' !\n"; \
|
| 49 |
exit 1; \
|
| 50 |
fi; \
|
| 51 |
export SYMBOLS="$(SYMBOLS_LIST)"; \
|
| 52 |
if ! $(READELF) -s $(LIBC_PATH) | \
|
| 53 |
$(AWK) -f $(GEN_VERSION_MAP_SCRIPT) > $@ ; \
|
| 54 |
then \
|
| 55 |
echo "\n*** Failed to generate '$@' !\n"; \
|
| 56 |
exit 1; \
|
| 57 |
fi
|
| 58 |
|
| 59 |
symbols.h: $(SYMBOLS_FILE) $(GEN_HEADER_SCRIPT)
|
| 60 |
@echo "Generating $@"; \
|
| 61 |
if [ ! -e "$(LIBC_PATH)" ]; then\
|
| 62 |
echo -e "\n*** Cannot find LIBC_PATH '$(LIBC_PATH)' !\n"; \
|
| 63 |
exit 1; \
|
| 64 |
fi; \
|
| 65 |
export SYMBOLS="$(SYMBOLS_LIST)"; \
|
| 66 |
if ! $(READELF) -s $(LIBC_PATH) | \
|
| 67 |
$(AWK) -f $(GEN_HEADER_SCRIPT) > $@ ; \
|
| 68 |
then \
|
| 69 |
echo "\n*** Failed to generate '$@' !\n"; \
|
| 70 |
exit 1; \
|
| 71 |
fi
|
| 72 |
|
| 73 |
EXTRA_DIST = $(SYMBOLS_FILE)
|
| 74 |
|
| 75 |
CLEANFILES = libsandbox.map symbols.h
|
| 76 |
DISTCLEANFILES = $(CLEANFILES)
|