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