diff --git a/.gitignore b/.gitignore index c63a05a70..57ce150ad 100644 --- a/.gitignore +++ b/.gitignore @@ -28,8 +28,9 @@ ar-lib src/tools/gen_code/gen_code src/tools/ta_regtest/ta_regtest bin/*.class +bin/gen_code +bin/ta_regtest !bin/HOLDER -!bin/gen_code ## File system .DS_Store @@ -73,4 +74,4 @@ Session.vim *.pdb # Never ignore .gitkeep files -!**/.gitkeep +!**/.gitkeep \ No newline at end of file diff --git a/Makefile.am b/Makefile.am index 0a939606e..ec690e1e5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,8 +11,9 @@ HEADER_FILES = $(shell find src -name '*.h') # Distribute some C files containing static data used for ta_regtest GDATA_FILES = $(shell find . -name 'ta_gData*.c') +# Distribute additional bash scripts needed to "make all" +BUILD_SHELL_FILES = src/tools/post-build-bin.sh + # Add more files to EXTRA_DIST to be included on "make dist" # This is only for files that are not auto-discovered by autotools. -# -# This is in-case the user choose to do "make" instead of "make install". -EXTRA_DIST = $(HEADER_FILES) $(GDATA_FILES) +EXTRA_DIST = $(HEADER_FILES) $(GDATA_FILES) $(BUILD_SHELL_FILES) diff --git a/bin/gen_code b/bin/gen_code deleted file mode 120000 index e1894ee85..000000000 --- a/bin/gen_code +++ /dev/null @@ -1 +0,0 @@ -../src/tools/gen_code/gen_code \ No newline at end of file diff --git a/configure.ac b/configure.ac index 3bc7f6182..a50b5256a 100644 --- a/configure.ac +++ b/configure.ac @@ -35,6 +35,10 @@ AC_FUNC_STRTOD AC_FUNC_VPRINTF AC_CHECK_FUNCS([floor isascii localeconv mblen memmove memset modf pow sqrt strcasecmp strchr strerror strncasecmp strrchr strstr strtol strtoul]) +# Checks for libm +LT_LIB_M +AC_SUBST([LIBM]) + # Versioning: # Only change this if library is no longer # ABI compatible with previous version diff --git a/src/tools/gen_code/Makefile.am b/src/tools/gen_code/Makefile.am index 002217b9d..88be49e78 100644 --- a/src/tools/gen_code/Makefile.am +++ b/src/tools/gen_code/Makefile.am @@ -5,9 +5,12 @@ noinst_PROGRAMS = gen_code gen_code_SOURCES = gen_code.c gen_code_CPPFLAGS = -I../../ta_common -gen_code_LDFLAGS = -L../../ta_common -L../../ta_abstract -L../../ta_func -gen_code_LDADD = -lta_common -lta_abstract_gc -lta_func -lm +gen_code_LDFLAGS = -no-undefined +gen_code_LDADD = \ + ../../ta_common/libta_common.la \ + ../../ta_abstract/libta_abstract_gc.la \ + ../../ta_func/libta_func.la \ + $(LIBM) -# all-local: -# $(MAKE) $(AM_MAKEFLAGS) gen_code -# cp gen_code ../../../bin +all-local: gen_code + $(LIBTOOL) --mode=execute ../post-build-bin.sh gen_code diff --git a/src/tools/post-build-bin.sh b/src/tools/post-build-bin.sh new file mode 100755 index 000000000..78c3433aa --- /dev/null +++ b/src/tools/post-build-bin.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# This is a work around for a slibtool bug with --mode=execute +# +# With slibtool the gen_code binary is created in the .libs directory while GNU +# libtool outputs in the same directory as the Makefile. This means that cp(1) +# needs to be invoked with $(LIBTOOL) --mode=execute. +# +# However slibtool currently has a bug where the destination argument is dropped +# which will result in the command failing. +# +# See https://bugs.gentoo.org/790770 + +set -eu + +mkdir -p ../../../bin +cp "${1}" ../../../bin diff --git a/src/tools/ta_regtest/Makefile.am b/src/tools/ta_regtest/Makefile.am index c9d5c8513..ecd8f6d0e 100644 --- a/src/tools/ta_regtest/Makefile.am +++ b/src/tools/ta_regtest/Makefile.am @@ -36,5 +36,8 @@ ta_regtest_CPPFLAGS = -I../../ta_func \ -I../../ta_common/mt \ -I../../ta_common \ -I../../ta_abstract -ta_regtest_LDFLAGS = -L../.. -lta_lib \ - -lm +ta_regtest_LDFLAGS = -no-undefined +ta_regtest_LDADD = ../../libta_lib.la $(LIBM) + +all-local: ta_regtest + $(LIBTOOL) --mode=execute ../post-build-bin.sh ta_regtest