File size: 814 Bytes
de6631a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# make            the command-line tool (basicpitch) and a static library (libbp.a)
# make wasm       ../basicpitch/bp.wasm and bp-plain.wasm, the model for the browser (notes.js does the rest)
CC ?= cc
CFLAGS ?= -O3
EXPORTS = _bp_load,_bp_unload,_bp_run,_bp_frame_count,_bp_transcribe,_bp_window_count,_bp_window,_malloc,_free
EMFLAGS = -O3 --no-entry -s STANDALONE_WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_FUNCTIONS=$(EXPORTS)

all: basicpitch libbp.a

basicpitch: cli.c bp.c notes.c bp.h
	$(CC) $(CFLAGS) cli.c bp.c notes.c -o $@ -lm

libbp.a: bp.c notes.c bp.h
	$(CC) $(CFLAGS) -c bp.c notes.c
	ar rcs $@ bp.o notes.o

wasm: bp.c bp.h
	emcc $(EMFLAGS) -msimd128 bp.c -o ../basicpitch/bp.wasm
	emcc $(EMFLAGS) bp.c -o ../basicpitch/bp-plain.wasm

clean:
	rm -f basicpitch libbp.a *.o

.PHONY: all wasm clean