forked from chris-rudmin/opus-recorder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (51 loc) · 2.43 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
67
68
69
INPUT_DIR=./src
OUTPUT_DIR=./build
EMCC_OPTS=-O3 --llvm-lto 1 --memory-init-file 0 --closure 1 -s NO_FILESYSTEM=1 -s NO_BROWSER=1
DEFAULT_EXPORTS:='_free','_malloc'
LIBOPUS_ENCODER_SRC=$(INPUT_DIR)/encoderWorker.js
LIBOPUS_DECODER_SRC=$(INPUT_DIR)/decoderWorker.js
LIBOPUS_ENCODER=$(OUTPUT_DIR)/encoderWorker.min.js
LIBOPUS_DECODER=$(OUTPUT_DIR)/decoderWorker.min.js
LIBOPUS_STABLE=tags/v1.1.2
LIBOPUS_DIR=./opus
LIBOPUS_OBJ=$(LIBOPUS_DIR)/.libs/libopus.a
LIBOPUS_ENCODER_EXPORTS:='_opus_encoder_create','_opus_encode_float','_opus_encoder_ctl'
LIBOPUS_DECODER_EXPORTS:='_opus_decoder_create','_opus_decode_float','_opus_decoder_destroy'
LIBSPEEXDSP_STABLE=tags/SpeexDSP-1.2rc3
LIBSPEEXDSP_DIR=./speexdsp
LIBSPEEXDSP_OBJ=$(LIBSPEEXDSP_DIR)/libspeexdsp/.libs/libspeexdsp.a
LIBSPEEXDSP_EXPORTS:='_speex_resampler_init','_speex_resampler_process_interleaved_float','_speex_resampler_destroy'
UGLIFY_PATH=./node_modules/uglify-js/bin/uglifyjs
RECORDER=$(OUTPUT_DIR)/recorder.min.js
RECORDER_SRC=$(INPUT_DIR)/recorder.js
WAVE_WORKER=$(OUTPUT_DIR)/waveWorker.min.js
WAVE_WORKER_SRC=$(INPUT_DIR)/waveWorker.js
default: $(LIBOPUS_ENCODER) $(LIBOPUS_DECODER) $(RECORDER) $(WAVE_WORKER)
clean:
rm -rf $(OUTPUT_DIR) $(LIBOPUS_DIR) $(LIBSPEEXDSP_DIR)
mkdir $(OUTPUT_DIR)
test:
mocha
.PHONY: test
$(LIBOPUS_DIR):
git submodule update --init --recursive
cd $(LIBOPUS_DIR); git checkout ${LIBOPUS_STABLE}
$(LIBSPEEXDSP_DIR):
git submodule update --init --recursive
cd $(LIBSPEEXDSP_DIR); git checkout ${LIBSPEEXDSP_STABLE}
$(LIBOPUS_OBJ): $(LIBOPUS_DIR)
cd $(LIBOPUS_DIR); ./autogen.sh
cd $(LIBOPUS_DIR); emconfigure ./configure --disable-extra-programs --disable-doc
cd $(LIBOPUS_DIR); emmake make
$(LIBSPEEXDSP_OBJ): $(LIBSPEEXDSP_DIR)
cd $(LIBSPEEXDSP_DIR); ./autogen.sh
cd $(LIBSPEEXDSP_DIR); emconfigure ./configure --disable-examples
cd $(LIBSPEEXDSP_DIR); emmake make
$(LIBOPUS_ENCODER): $(LIBOPUS_OBJ) $(LIBSPEEXDSP_OBJ)
emcc -o $@ $(EMCC_OPTS) -s EXPORTED_FUNCTIONS="[$(DEFAULT_EXPORTS),$(LIBOPUS_ENCODER_EXPORTS),$(LIBSPEEXDSP_EXPORTS)]" --post-js $(LIBOPUS_ENCODER_SRC) $(LIBOPUS_OBJ) $(LIBSPEEXDSP_OBJ)
$(LIBOPUS_DECODER): $(LIBOPUS_OBJ) $(LIBSPEEXDSP_OBJ)
emcc -o $@ $(EMCC_OPTS) -s EXPORTED_FUNCTIONS="[$(DEFAULT_EXPORTS),$(LIBOPUS_DECODER_EXPORTS),$(LIBSPEEXDSP_EXPORTS)]" --post-js $(LIBOPUS_DECODER_SRC) $(LIBOPUS_OBJ) $(LIBSPEEXDSP_OBJ)
$(RECORDER):
$(UGLIFY_PATH) $(RECORDER_SRC) -c -m -o $@
$(WAVE_WORKER):
$(UGLIFY_PATH) $(WAVE_WORKER_SRC) -c -m -o $@