-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
67 lines (40 loc) · 1.65 KB
/
Makefile
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
all: bch
CC = gcc
#CC = clang
CFLAGS = -O3 -fPIC -march=native -fopenmp -Wall
#CFLAGS = -O3 -fPIC -march=native -fopenmp -fsanitize=signed-integer-overflow -fsanitize=undefined -Wall
#CFLAGS = -g -fPIC -Wall
#CFLAGS = -g -fPIC -fsanitize=address -fsanitize=signed-integer-overflow -fsanitize=undefined -Wall
MAKE_SHARED_LIB = $(CC) -fopenmp -shared
SHARED_LIB = libbch.so
OBJS = phi.o expr.o lie_series.o lyndon.o rightnormed.o goldberg.o \
convert_lyndon.o convert_rightnormed.o convert_hall.o \
parser.tab.o lex.yy.o
parser.tab.c parser.tab.h: parser.y
bison -d parser.y
lex.yy.c: parser.tab.h parser.l
flex parser.l
convert_hall.c convert_lyndon.c: khash.h
%.o: %.c bch.h
$(CC) -c -o $@ $< $(CFLAGS)
$(SHARED_LIB): $(OBJS)
$(MAKE_SHARED_LIB) -o $(SHARED_LIB) $(OBJS)
bch: $(SHARED_LIB) bch.h bch.c
$(CC) $(CFLAGS) bch.c -o bch -L. -lbch
clean:
rm -f *.o $(SHARED_LIB) bch
tables: bch_lyndon_20.txt bch_rightnormed_20.txt bch_hall_20.txt
bch_lyndon_20.txt: bch
./bch N=20 verbosity_level=1 > bch_lyndon_20.txt
bch_rightnormed_20.txt: bch
./bch N=20 basis=1 verbosity_level=1 > bch_rightnormed_20.txt
bch_hall_20.txt: bch
./bch N=20 basis=2 verbosity_level=1 > bch_hall_20.txt
#Compile to WebAssembly (if the Emscripten SDK is properly installed):
wasm: bch.wasm bch.js bch.html
SRCS_WASM = bch.c phi.c expr.c lie_series.c lyndon.c rightnormed.c goldberg.c \
convert_lyndon.c convert_rightnormed.c convert_hall.c \
parser.tab.c lex.yy.c
bch.wasm bch.js bch.html: bch.h $(SRCS_WASM) shell_bch.html
emcc $(SRCS_WASM) -O3 -s EXIT_RUNTIME=1 -s ALLOW_MEMORY_GROWTH=1 \
-o bch.html --shell-file ./shell_bch.html