forked from alex-eg/sex
Only the text outputs knew `-' as stdout; compiling handed it to cc as a file name, and left a binary called `-' behind.
33 lines
1.1 KiB
Makefile
33 lines
1.1 KiB
Makefile
# The failure paths.
|
|
#
|
|
# Each needs a process to show itself, so none fits the unit suite:
|
|
# sexc has to fail when cc fails -- exiting 0 after a failed compile
|
|
# makes every driver, sextest included, read it as success -- it has to
|
|
# clean up its temporary .c when its own emission throws, and it has to
|
|
# refuse `-o -' for an executable, which cc would write to a file named
|
|
# `-'.
|
|
#
|
|
# Everything is built inside a scratch directory, so nothing is left
|
|
# here to clean up.
|
|
|
|
SEXC ?= ../../sexc
|
|
|
|
check:
|
|
@d=`mktemp -d`; \
|
|
TMPDIR=$$d $(SEXC) nested-pointer.sex -o $$d/out >/dev/null 2>&1; \
|
|
if [ -n "`find $$d -name '*.c'`" ]; then \
|
|
echo "exit code FAILED: the temporary .c survived a failed emission"; \
|
|
rm -rf $$d; exit 1; \
|
|
fi; \
|
|
if $(SEXC) hello.sex -o $$d/out -- -no-such-cc-flag >/dev/null 2>&1; then \
|
|
echo "exit code FAILED: sexc reported success after cc failed"; \
|
|
rm -rf $$d; exit 1; \
|
|
fi; \
|
|
if (cd $$d && $(abspath $(SEXC)) $(CURDIR)/hello.sex -o - >/dev/null 2>&1) || [ -e $$d/- ]; then \
|
|
echo "exit code FAILED: -o - built an executable"; \
|
|
rm -rf $$d; exit 1; \
|
|
fi; \
|
|
rm -rf $$d; echo "exit code ok"
|
|
|
|
.PHONY: check
|