| 1 | # This program is free software; you can redistribute it and/or modify |
| 2 | # it under the terms of the GNU General Public License as published by |
| 3 | # the Free Software Foundation; either version 2 of the License, or |
| 4 | # (at your option) any later version. |
| 5 | # |
| 6 | # This program is distributed in the hope that it will be useful, |
| 7 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 8 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 9 | # GNU General Public License for more details. |
| 10 | # |
| 11 | # You should have received a copy of the GNU General Public License |
| 12 | # along with this program; if not, write to the Free Software |
| 13 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 14 | # |
| 15 | # Copyright (C) Mathieu Desnoyers, 2009 |
| 16 | # |
| 17 | # Authors: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> |
| 18 | |
| 19 | #CFLAGS=-DSAFETY |
| 20 | #CFLAGS=-DHASH64 -DREACH |
| 21 | CFLAGS=-DHASH64 |
| 22 | |
| 23 | #try pan -i to get the smallest trace. |
| 24 | |
| 25 | SPINFILE=mem.spin |
| 26 | SPINFILE_FAIR=mem-progress.spin |
| 27 | |
| 28 | default: |
| 29 | make refcount | tee refcount.log |
| 30 | make lock_progress | tee lock_progress.log |
| 31 | make asserts | tee asserts.log |
| 32 | make summary |
| 33 | |
| 34 | #show trail : spin -v -t -N pan.ltl input.spin |
| 35 | # after each individual make. |
| 36 | |
| 37 | summary: |
| 38 | @echo |
| 39 | @echo "Verification summary" |
| 40 | @grep error *.log |
| 41 | |
| 42 | asserts: clean |
| 43 | cat DEFINES > .input.spin |
| 44 | cat ${SPINFILE} >> .input.spin |
| 45 | rm -f .input.spin.trail |
| 46 | spin -a -X .input.spin |
| 47 | gcc -w ${CFLAGS} -DSAFETY -o pan pan.c |
| 48 | ./pan -v -c1 -X -m10000 -w19 |
| 49 | cp .input.spin $@.spin.input |
| 50 | -cp .input.spin.trail $@.spin.input.trail |
| 51 | |
| 52 | refcount: clean refcount_ltl run |
| 53 | cp .input.spin $@.spin.input |
| 54 | -cp .input.spin.trail $@.spin.input.trail |
| 55 | |
| 56 | refcount_ltl: |
| 57 | touch .input.define |
| 58 | cat DEFINES > pan.ltl |
| 59 | cat .input.define >> pan.ltl |
| 60 | spin -f "!(`cat refcount.ltl | grep -v ^//`)" >> pan.ltl |
| 61 | |
| 62 | lock_progress: clean lock_progress_ltl run_weak_fair |
| 63 | cp .input.spin $@.spin.input |
| 64 | -cp .input.spin.trail $@.spin.input.trail |
| 65 | |
| 66 | lock_progress_ltl: |
| 67 | touch .input.define |
| 68 | cat .input.define > pan.ltl |
| 69 | cat DEFINES >> pan.ltl |
| 70 | spin -f "!(`cat lock_progress.ltl | grep -v ^//`)" >> pan.ltl |
| 71 | |
| 72 | run: pan |
| 73 | ./pan -a -v -c1 -X -m10000 -w19 |
| 74 | |
| 75 | run_weak_fair: pan_fair |
| 76 | ./pan_fair -a -f -v -c1 -X -m10000000 -w20 |
| 77 | |
| 78 | pan_fair: pan_fair.c |
| 79 | gcc -w ${CFLAGS} -o pan_fair pan_fair.c |
| 80 | |
| 81 | pan: pan.c |
| 82 | gcc -w ${CFLAGS} -o pan pan.c |
| 83 | |
| 84 | pan_fair.c: pan.ltl ${SPINFILE_FAIR} |
| 85 | cat DEFINES > .input.spin |
| 86 | cat .input.define >> .input.spin |
| 87 | cat ${SPINFILE_FAIR} >> .input.spin |
| 88 | rm -f .input.spin.trail |
| 89 | spin -a -X -N pan.ltl .input.spin |
| 90 | mv pan.c pan_fair.c |
| 91 | |
| 92 | pan.c: pan.ltl ${SPINFILE} |
| 93 | cat DEFINES > .input.spin |
| 94 | cat .input.define >> .input.spin |
| 95 | cat ${SPINFILE} >> .input.spin |
| 96 | rm -f .input.spin.trail |
| 97 | spin -a -X -N pan.ltl .input.spin |
| 98 | |
| 99 | .PHONY: clean default distclean summary |
| 100 | clean: |
| 101 | rm -f pan* trail.out .input.spin* *.spin.trail .input.define |
| 102 | distclean: |
| 103 | rm -f *.trail *.input *.log |