diff options
author | Ben Smith <binji@chromium.org> | 2015-09-24 13:22:11 -0700 |
---|---|---|
committer | Ben Smith <binji@chromium.org> | 2015-09-24 21:46:34 -0700 |
commit | 342320d25c3185d6f31a4e4e376ad1dcb17cf352 (patch) | |
tree | 2750abc19fade5a1c3bf2622a407c65872d48b26 /Makefile | |
parent | 4246fedb2468bcdc96f3b4a7ff54bd444433ac53 (diff) | |
download | wabt-342320d25c3185d6f31a4e4e376ad1dcb17cf352.tar.gz wabt-342320d25c3185d6f31a4e4e376ad1dcb17cf352.tar.bz2 wabt-342320d25c3185d6f31a4e4e376ad1dcb17cf352.zip |
add ASAN/MSAN build of sexpr-wasm
Also integrate these executables into into test runner, so that they can
be run by test/run-d8.py as well.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 47 |
1 files changed, 38 insertions, 9 deletions
@@ -1,32 +1,61 @@ .SUFFIXES: ALL = sexpr-wasm +EVERYHING = $(ALL) sexpr-wasm-asan sexpr-wasm-msan CFLAGS = -Wall -Werror -g +DEPEND_FLAGS = -MMD -MP -MF $(patsubst %.o,%.d,$@) +ASAN_FLAGS = -fsanitize=address +MSAN_FLAGS = -fsanitize=memory -OBJS = out/sexpr-wasm.o out/wasm-parse.o out/wasm-gen.o +SRCS = sexpr-wasm.c wasm-parse.c wasm-gen.c +OBJS = $(addprefix out/,$(patsubst %.c,%.o,$(SRCS))) +ASAN_OBJS = $(addprefix out/,$(patsubst %.c,%.asan.o,$(SRCS))) +MSAN_OBJS = $(addprefix out/,$(patsubst %.c,%.msan.o,$(SRCS))) .PHONY: all all: $(addprefix out/,$(ALL)) +.PHONY: everything +everything: $(addprefix out/,$(EVERYHING)) + out/: mkdir $@ -out/%.o: src/%.c - $(CC) $(CFLAGS) -c -o $@ -MMD -MP -MF $(patsubst %.o,%.d,$@) $< -out/sexpr-wasm: out $(OBJS) - $(CC) -o $@ $(OBJS) + +$(OBJS): out/%.o: src/%.c | out + $(CC) $(CFLAGS) -c -o $@ $(DEPEND_FLAGS) $< +out/sexpr-wasm: $(OBJS) | out + $(CC) -o $@ $^ + +# ASAN +$(ASAN_OBJS): out/%.asan.o: src/%.c | out + clang $(ASAN_FLAGS) $(CFLAGS) -c -o $@ $(DEPEND_FLAGS) $< +out/sexpr-wasm-asan: $(ASAN_OBJS) | out + clang $(ASAN_FLAGS) -o $@ $^ + +# MSAN +$(MSAN_OBJS): out/%.msan.o: src/%.c | out + clang $(MSAN_FLAGS) $(CFLAGS) -c -o $@ $(DEPEND_FLAGS) $< +out/sexpr-wasm-msan: $(MSAN_OBJS) | out + clang $(MSAN_FLAGS) -o $@ $^ src/hash.h: src/hash.txt gperf --compare-strncmp --readonly-tables --struct-type $< --output-file $@ --include $(OBJS:.o=.d) +-include $(OBJS:.o=.d) $(ASAN_OBJS:.o=.d) $(MSAN_OBJS:.o=.d) #### TESTS #### -TEST_EXES=$(shell python test/run-tests.py --list-exes) - .PHONY: test -test: $(TEST_EXES) +test: out/sexpr-wasm @python test/run-tests.py +.PHONY: test-asan +test-asan: out/sexpr-wasm-asan + @python test/run-tests.py -e $< + +.PHONY: test-msan +test-msan: out/sexpr-wasm-msan + @python test/run-tests.py -e $< + #### CLEAN #### .PHONY: clean clean: |