Skip to content

Commit

Permalink
(#30) Fix parallel Make with slibtool + other issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mario4tier committed Nov 16, 2024
1 parent a928c84 commit 9c35f01
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 13 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -73,4 +74,4 @@ Session.vim
*.pdb

# Never ignore .gitkeep files
!**/.gitkeep
!**/.gitkeep
7 changes: 4 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 0 additions & 1 deletion bin/gen_code

This file was deleted.

4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions src/tools/gen_code/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 17 additions & 0 deletions src/tools/post-build-bin.sh
Original file line number Diff line number Diff line change
@@ -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
7 changes: 5 additions & 2 deletions src/tools/ta_regtest/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9c35f01

Please sign in to comment.