@@ -47,16 +47,6 @@ INSTFLAGS = \
4747 $(C_INSTFLAGS) $(O_INSTFLAGS) $(H_INSTFLAGS) \
4848 # empty
4949
50- # ____________________________________________________________________
51- # Rules
52- #
53- # Rules for building a:FR object files. These are not harness-specific,
54- # and several harnesses might depend on a particular a:FR object, so
55- # define them all once here.
56-
57- @RULE_GOTO@
58- $(GOTO_CC) @COMPILE_ONLY@ @RULE_OUTPUT@ $(INC) $(CFLAGS) @RULE_INPUT@
59-
6050# ____________________________________________________________________
6151# Rules
6252#
@@ -73,14 +63,27 @@ unpatch:
7363#
7464# Rules for building the CBMC harness
7565
76- #queue_datastructure.h: $(H_OBJS_EXCEPT_HARNESS)
77- # python3 @TYPE_HEADER_SCRIPT@ --binary $(FREERTOS)/Source/queue.goto --c-file $(FREERTOS)/Source/queue.c
66+ C_SOURCES = $(patsubst %.goto,%.c,$(H_OBJS_EXCEPT_HARNESS))
7867
79- $(ENTRY)_harness.goto: $(ENTRY)_harness.c $(H_GENERATE_HEADER)
68+ # Build each goto-binary out-of-source (i.e. in a 'gotos' directory
69+ # underneath each proof directory, to make it safe to build all proofs
70+ # in parallel
71+ OOS_OBJS = $(patsubst %.c,gotos/%.goto,$(C_SOURCES))
72+
73+ CWD=$(abspath .)
74+
75+ gotos/%.goto: %.c
76+ mkdir -p $(dir $@)
8077 $(GOTO_CC) @COMPILE_ONLY@ @RULE_OUTPUT@ $(INC) $(CFLAGS) @RULE_INPUT@
8178
82- $(ENTRY)1.goto: $(OBJS)
83- $(GOTO_CC) @COMPILE_LINK@ @RULE_OUTPUT@ --function harness $(OBJS)
79+ queue_datastructure.h: gotos/$(FREERTOS)/freertos_kernel/queue.goto
80+ python3 @TYPE_HEADER_SCRIPT@ --binary $(CWD)/gotos$(FREERTOS)/freertos_kernel/queue.goto --c-file $(FREERTOS)/freertos_kernel/queue.c
81+
82+ $(ENTRY)_harness.goto: $(ENTRY)_harness.c $(H_GENERATE_HEADER)
83+ $(GOTO_CC) @COMPILE_ONLY@ @RULE_OUTPUT@ $(INC) $(CFLAGS) $(ENTRY)_harness.c
84+
85+ $(ENTRY)1.goto: $(ENTRY)_harness.goto $(OOS_OBJS)
86+ $(GOTO_CC) @COMPILE_LINK@ @RULE_OUTPUT@ --function harness @RULE_INPUT@
8487
8588$(ENTRY)2.goto: $(ENTRY)1.goto
8689 $(GOTO_INSTRUMENT) --add-library @RULE_INPUT@ @RULE_OUTPUT@ \
@@ -110,17 +113,16 @@ $(ENTRY).goto: $(ENTRY)5.goto
110113# Rules for running CBMC
111114
112115goto:
113- $(MAKE) patch
114- $(MAKE) $(ENTRY).goto
116+ $(MAKE) -B $(ENTRY).goto
115117
116118cbmc.txt: $(ENTRY).goto
117- - cbmc $(CBMCFLAGS) --unwinding-assertions --trace @RULE_INPUT@ > $@ 2>&1
119+ cbmc $(CBMCFLAGS) --unwinding-assertions --trace @RULE_INPUT@ 2>&1 | tee $@
118120
119121property.xml: $(ENTRY).goto
120- cbmc $(CBMCFLAGS) --unwinding-assertions --show-properties --xml-ui @RULE_INPUT@ > $@ 2>&1
122+ cbmc $(CBMCFLAGS) --unwinding-assertions --show-properties --xml-ui @RULE_INPUT@ 2>&1 | tee $@
121123
122124coverage.xml: $(ENTRY).goto
123- cbmc $(CBMCFLAGS) --cover location --xml-ui @RULE_INPUT@ > $@ 2>&1
125+ cbmc $(CBMCFLAGS) --cover location --xml-ui @RULE_INPUT@ 2>&1 | tee $@
124126
125127cbmc: cbmc.txt
126128
@@ -133,7 +135,7 @@ report: cbmc.txt property.xml coverage.xml
133135 --goto $(ENTRY).goto \
134136 --srcdir $(FREERTOS_PLUS_TCP) \
135137 --blddir $(FREERTOS_PLUS_TCP) \
136- --htmldir html \
138+ --htmldir $(CWD)/ html \
137139 --srcexclude "(.@FORWARD_SLASH@doc|.@FORWARD_SLASH@tests|.@FORWARD_SLASH@vendors)" \
138140 --result cbmc.txt \
139141 --property property.xml \
0 commit comments