From 6a4dd8790c5c98466087a5374611f72131eff958 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Mon, 2 May 2022 05:58:26 -0700 Subject: web: generate all required files in new dir --- web/.gitignore | 1 + web/Makefile | 8 +++++--- web/dartboat_wasm.c | 31 ------------------------------- web/web_main.c | 31 +++++++++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 34 deletions(-) create mode 100644 web/.gitignore delete mode 100644 web/dartboat_wasm.c create mode 100644 web/web_main.c diff --git a/web/.gitignore b/web/.gitignore new file mode 100644 index 0000000..6166a4e --- /dev/null +++ b/web/.gitignore @@ -0,0 +1 @@ +dartboat_web diff --git a/web/Makefile b/web/Makefile index bdddb14..66d88f7 100644 --- a/web/Makefile +++ b/web/Makefile @@ -6,16 +6,18 @@ CFLAGS += -O3 -Wall -Wextra -Wno-unknown-warning-option -I../ \ -sEXPORTED_FUNCTIONS=_main,_malloc,_free \ -sEXPORTED_RUNTIME_METHODS=UTF8ToString,stringToUTF8,lengthBytesUTF8 -TARGET := static/dartboat_wasm.js +TARGET := dartboat_web SRC := $(wildcard *.c) ../comp.c ../match.c ../board.c ../checkouts.c all: $(TARGET) $(TARGET): $(SRC) - $(CC) $(CFLAGS) $^ -o $@ + mkdir $(TARGET) + $(CC) $(CFLAGS) $^ -o $(TARGET)/dartboat_wasm.js + cp static/* $(TARGET)/ clean: - rm -f $(TARGET) $(TARGET:.js=.wasm) + rm -rf $(TARGET) .PHONY: all clean diff --git a/web/dartboat_wasm.c b/web/dartboat_wasm.c deleted file mode 100644 index 42535aa..0000000 --- a/web/dartboat_wasm.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "web_control.h" -#include "web_opts.h" -#include "web_prompt.h" -#include "web_svg.h" - -#include "comp.h" - -#include -#include - -#include - -EMSCRIPTEN_KEEPALIVE -void init() -{ - srand(time(NULL)); - init_board(); - svg_draw_board(); - - EM_ASM(readOpts()); - EM_ASM({updateDelay($0)}, delay_ms); - EM_ASM({updateStdev($0)}, horizontal_stdev); - - set_prompt_mode(PM_VISIT); - handle_next(); -} - -int main() -{ - EM_ASM(boatAfloat()); -} diff --git a/web/web_main.c b/web/web_main.c new file mode 100644 index 0000000..42535aa --- /dev/null +++ b/web/web_main.c @@ -0,0 +1,31 @@ +#include "web_control.h" +#include "web_opts.h" +#include "web_prompt.h" +#include "web_svg.h" + +#include "comp.h" + +#include +#include + +#include + +EMSCRIPTEN_KEEPALIVE +void init() +{ + srand(time(NULL)); + init_board(); + svg_draw_board(); + + EM_ASM(readOpts()); + EM_ASM({updateDelay($0)}, delay_ms); + EM_ASM({updateStdev($0)}, horizontal_stdev); + + set_prompt_mode(PM_VISIT); + handle_next(); +} + +int main() +{ + EM_ASM(boatAfloat()); +} -- cgit v1.2.3-70-g09d2