summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArturs Artamonovs <arturs.artamonovs@protonmail.com>2021-08-26 08:18:35 +0100
committerArturs Artamonovs <arturs.artamonovs@protonmail.com>2021-08-26 08:18:35 +0100
commit3834bc793857aae02198d8f4c8a8373957269678 (patch)
tree89d84ea6341795c79d538b53a76866faed00a795
parent12abfa14f5a3b328ddb78620486b40d46fe213ec (diff)
downloadNaiveFFT-3834bc793857aae02198d8f4c8a8373957269678.tar.gz
NaiveFFT-3834bc793857aae02198d8f4c8a8373957269678.zip
Added emcc compilation
-rw-r--r--Build/Makefile7
-rw-r--r--NaiveFFT/main.c3
2 files changed, 7 insertions, 3 deletions
diff --git a/Build/Makefile b/Build/Makefile
index 8b31c12..e19df12 100644
--- a/Build/Makefile
+++ b/Build/Makefile
@@ -1,12 +1,17 @@
-
+EMCC=emcc
CC=gcc
SOURCEDIR=../NaiveFFT
LDFLAGS=-lm
+EM_LDFALGS=-s LLD_REPORT_UNDEFINED
+
make:
$(CC) -c $(SOURCEDIR)/main.c -g3
$(CC) main.o -o NaiveFFT $(LDFLAGS)
+emcc:
+ $(EMCC) $(SOURCEDIR)/main.c ../NaiveFFT/fft.c -s WASM=1 -O3 -o index.js $(EM_LDFALGS) -s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]'
+
web:
darkhttpd ./ --port 12345
diff --git a/NaiveFFT/main.c b/NaiveFFT/main.c
index 718e5d0..036bb79 100644
--- a/NaiveFFT/main.c
+++ b/NaiveFFT/main.c
@@ -42,6 +42,7 @@ int main(int argc, const char * argv[]) {
ffti_shuffle_1(data_i, data_q, DATA_SIZE);
fft_1(data_i, data_q, DATA_SIZE, 0);
+ //run dft by default
//dft(data_i, data_q, DATA_SIZE,0);
printf("after FFT\n");
@@ -83,7 +84,6 @@ int main(int argc, const char * argv[]) {
free(d_q); d_q = NULL;
}
-
{
time_t timer;
char buffer[32];
@@ -94,7 +94,6 @@ int main(int argc, const char * argv[]) {
strftime(buffer, 32, "%H:%M:%S", tm_info);
puts(buffer);
-
}
return 0;
}