TT#59703 generalise build test make macros

also add a linker stage to the test build

Change-Id: Ief9dcabbb77dd682b6e7188c296f4713c1c234a3
changes/26/30426/4
Richard Fuchs 6 years ago
parent 5ad55f4314
commit 7803930d21

1
daemon/.gitignore vendored

@ -16,3 +16,4 @@ socket.c
streambuf.c streambuf.c
ssllib.c ssllib.c
dtmflib.c dtmflib.c
*-test

@ -11,9 +11,11 @@ debug:
dep: .depend dep: .depend
BUILD_TEST_ALTS = fix_frame_channel_layout.h
clean: clean:
rm -f $(OBJS) $(TARGET) $(LIBSRCS) $(DAEMONSRCS) $(MANS) $(ADD_CLEAN) .depend core core.* rm -f $(OBJS) $(TARGET) $(LIBSRCS) $(DAEMONSRCS) $(MANS) $(ADD_CLEAN) .depend core core.*
rm -f fix_frame_channel_layout.h fix_frame_channel_layout-test.[co] *.strhash.c $(HASHSRCS) rm -f $(BUILD_TEST_ALTS) $(BUILD_TEST_ALTS:.h=-test{.c,}) *.strhash.c $(HASHSRCS)
.depend: $(SRCS) $(LIBSRCS) $(DAEMONSRCS) Makefile .depend: $(SRCS) $(LIBSRCS) $(DAEMONSRCS) Makefile
$(CC) $(CFLAGS) -M $(SRCS) $(LIBSRCS) $(DAEMONSRCS) | sed -e 's/:/ .depend:/' > .depend $(CC) $(CFLAGS) -M $(SRCS) $(LIBSRCS) $(DAEMONSRCS) | sed -e 's/:/ .depend:/' > .depend
@ -44,20 +46,20 @@ resample.c: fix_frame_channel_layout.h
%.strhash.c: %.c ../utils/const_str_hash %.strhash.c: %.c ../utils/const_str_hash
../utils/const_str_hash < $< > $@ ../utils/const_str_hash < $< > $@
fix_frame_channel_layout.h: ../lib/fix_frame_channel_layout-* $(BUILD_TEST_ALTS): ../lib/$(@:.h=-*)
echo "Looking for usable alternative for $@"; \ echo "Looking for usable alternative for $@"; \
rm -f fix_frame_channel_layout-test.[co]; \ rm -f $(@:.h=-test{.c,}); \
ln -s ../lib/fix_frame_channel_layout-test.c; \ ln -s ../lib/$(@:.h=-test.c); \
for x in ../lib/fix_frame_channel_layout-*.h; do \ for x in ../lib/$(@:.h=-*.h); do \
echo "Trying build with $$x"; \ echo "Trying build with $$x"; \
rm -f "$@"; \ rm -f "$@"; \
echo '/******** GENERATED FILE ********/' > "$@"; \ echo '/******** GENERATED FILE ********/' > "$@"; \
cat "$$x" >> "$@"; \ cat "$$x" >> "$@"; \
$(MAKE) fix_frame_channel_layout-test.o && break; \ $(MAKE) $(@:.h=-test) && break; \
echo "Failed build with $$x"; \ echo "Failed build with $$x"; \
rm -f "$@"; \ rm -f "$@"; \
done; \ done; \
rm -f fix_frame_channel_layout-test.[co]; \ rm -f $(@:.h=-test{.c,}); \
test -f "$@" test -f "$@"
.PHONY: all debug dep clean install .PHONY: all debug dep clean install

@ -1,5 +1,6 @@
#include "fix_frame_channel_layout.h" #include "fix_frame_channel_layout.h"
void test(void) { int main(void) {
AVFrame *f = NULL; AVFrame *f = NULL;
fix_frame_channel_layout(f); fix_frame_channel_layout(f);
return 0;
} }

@ -15,3 +15,4 @@ socket.c
streambuf.c streambuf.c
ssllib.c ssllib.c
dtmflib.c dtmflib.c
*-test

1
t/.gitignore vendored

@ -50,3 +50,4 @@ timerthread.c
media_player.c media_player.c
dtmflib.c dtmflib.c
test-dtmf-detect test-dtmf-detect
*-test

Loading…
Cancel
Save