-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.py
81 lines (65 loc) · 1.8 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import os
import sys
def depend():
os.system('dot doc/depend/depend.dot -Tpng -o doc/depend/depend.png')
def minisat():
os.system('make -C cnf/minisat')
os.system('cp cnf/minisat/build/release/bin/minisat cnfsat')
def parser():
res = os.system('flex parser/tbl.l')
if res != 0:
print 'Flex Error.'
exit()
os.system('mv lex.yy.c parser')
res = os.system('bison -y -d parser/tbl.y')
if res != 0:
print 'Bison Error.'
exit()
os.system('mv y.tab.c parser')
os.system('mv y.tab.h parser')
print 'Compiled Parser'
def sabr():
cmd = 'gcc -O3 -g -Wall -o sabr '
cmd += 'utils/linkedlist.c utils/skiplist.c utils/botlist.c utils/gendebug.c '
cmd += 'parser/y.tab.c parser/lex.yy.c '
cmd += 'core/arch.c core/structs.c core/debug.c core/tbl.c core/req.c core/var.c'
os.system(cmd)
print 'Compiled SABR'
def clean():
os.system('rm debug.txt cnf.txt vars.txt result.txt stats.txt cnfsat sabr')
def cleanall():
clean()
os.system('make clean -C cnf/minisat')
coms = """usage: python setup.py <command>
commands:
build Compile minisat and sabr
depend Create a dependency diagram using the dot file in doc
minisat Compile minisat, the default cnf solver used by SABR
parser Use flex and bison to create c files from parser directory
sabr Build SABR from core utils and parser
clean Clear all unnesary files in the SABR directory
cleanall Clear minisat installation
help Help screen
"""
if len(sys.argv) == 2:
if sys.argv[1] == 'depend':
depend()
elif sys.argv[1] == 'minisat':
minisat()
elif sys.argv[1] == 'parser':
parser()
elif sys.argv[1] == 'sabr':
sabr()
elif sys.argv[1] == 'build':
minisat()
sabr()
elif sys.argv[1] == 'clean':
clean()
elif sys.argv[1] == 'cleanall':
cleanall()
elif sys.argv[1] == 'help':
print coms
else:
print "Improper Command"
else:
print coms