diff --git a/daemon/Makefile b/daemon/Makefile index 89860063d..8d99e93a6 100644 --- a/daemon/Makefile +++ b/daemon/Makefile @@ -90,8 +90,3 @@ PODS= rtpengine.pod MANS= $(PODS:.pod=.8) include ../lib/common.Makefile - -ifeq ($(with_transcoding),yes) -codec.c: dtmf_rx_fillin.h -t38.c: spandsp_logging.h -endif diff --git a/lib/common.Makefile b/lib/common.Makefile index 2a2f52816..fa84d9758 100644 --- a/lib/common.Makefile +++ b/lib/common.Makefile @@ -36,23 +36,16 @@ $(DAEMONSRCS) $(HASHSRCS): $(patsubst %,../daemon/%,$(DAEMONSRCS)) $(patsubst %, resample.c: fix_frame_channel_layout.h +ifeq ($(with_transcoding),yes) +codec.c: dtmf_rx_fillin.h +endif + +t38.c: spandsp_logging.h + %.strhash.c: %.c ../utils/const_str_hash - ../utils/const_str_hash < $< > $@ + ../utils/const_str_hash < "$<" > "$@" $(BUILD_TEST_ALTS): ../lib/$(@:.h=-*) - echo "Looking for usable alternative for $@"; \ - rm -f $(@:.h=-test{.c,}); \ - ln -s ../lib/$(@:.h=-test.c); \ - for x in ../lib/$(@:.h=-*.h); do \ - echo "Trying build with $$x"; \ - rm -f "$@"; \ - echo '/******** GENERATED FILE ********/' > "$@"; \ - cat "$$x" >> "$@"; \ - $(MAKE) $(@:.h=-test) && break; \ - echo "Failed build with $$x"; \ - rm -f "$@"; \ - done; \ - rm -f $(@:.h=-test{.c,}); \ - test -f "$@" + ../utils/build_test_wrapper "$@" .PHONY: all debug clean install diff --git a/t/Makefile b/t/Makefile index 544635991..c7732e3ab 100644 --- a/t/Makefile +++ b/t/Makefile @@ -172,5 +172,7 @@ test-const_str_hash.strhash: test-const_str_hash.strhash.o $(COMMONOBJS) tests-preload.so: tests-preload.c $(CC) -g -D_GNU_SOURCE -std=c99 -o $@ -Wall -shared -fPIC $< -ldl -codec.c: dtmf_rx_fillin.h -t38.c: spandsp_logging.h +spandsp_send_fax_pcm.c: spandsp_logging.h +spandsp_send_fax_t38.c: spandsp_logging.h +spandsp_recv_fax_t38.c: spandsp_logging.h +spandsp_recv_fax_pcm.c: spandsp_logging.h diff --git a/utils/build_test_wrapper b/utils/build_test_wrapper new file mode 100755 index 000000000..6bbaace72 --- /dev/null +++ b/utils/build_test_wrapper @@ -0,0 +1,19 @@ +#!/bin/sh +TARGET=$1 +ROOT=$(echo "$TARGET" | sed 's/\.h$//') +if test "x$MAKE" = x; then + MAKE=make +fi +echo "Looking for usable alternative for $TARGET" +rm -f "$ROOT"-test "$ROOT"-test.c +ln -s ../lib/"$ROOT"-test.c +for x in ../lib/"$ROOT"*.h; do + echo "Trying build with $x" + rm -f "$TARGET" + (echo '/******** GENERATED FILE ********/'; cat "$x") > "$TARGET" + $MAKE "$ROOT"-test && break + echo "Failed build with $x" + rm -f "$TARGET" +done +rm -f "$ROOT"-test "$ROOT"-test.c +test -f "$TARGET"