hopefully building properly now
This commit is contained in:
parent
3057c21f67
commit
7a59aab77d
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,3 +6,4 @@ frontend/package-lock.json
|
|||
frontend/package.json
|
||||
backend/target
|
||||
public/*
|
||||
elm-stuff/*
|
||||
|
|
41
Makefile
41
Makefile
|
@ -9,19 +9,33 @@ ELM_MAKE := elm make
|
|||
CARGO_BUILD := cargo build
|
||||
CARGO_RUN := cargo run
|
||||
|
||||
ifeq ($(DEBUG)$(RELEASE),) # Both are empty
|
||||
$(error You must set exactly one of DEBUG=1 or RELEASE=1)
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG)$(RELEASE),11) # Both are set
|
||||
$(error Both DEBUG and RELEASE cannot be set at the same time)
|
||||
endif
|
||||
|
||||
# Targets
|
||||
.PHONY: all frontend backend clean serve
|
||||
|
||||
frontend_release:
|
||||
make -C $(FRONTEND_DIR) release_build
|
||||
cp $(FRONTEND_DIR)/index.html $(PUBLIC_DIR)/
|
||||
cp $(FRONTEND_DIR)/elm.min.js $(PUBLIC_DIR)/
|
||||
cp $(FRONTEND_DIR)/src/ports.websocket.js $(PUBLIC_DIR)/
|
||||
mkdir -p $(PUBLIC_DIR)/assets
|
||||
$(PUBLIC_DIR):
|
||||
mkdir -p $(PUBLIC_DIR)
|
||||
|
||||
frontend_debug:
|
||||
make -C $(FRONTEND_DIR) debug_build
|
||||
cp $(FRONTEND_DIR)/index.html $(PUBLIC_DIR)/
|
||||
$(PUBLIC_DIR)/index.html: $(FRONTEND_DIR)/index.html $(PUBLIC_DIR)
|
||||
cp $< $@
|
||||
|
||||
$(FRONTEND_DIR)/elm.min.js:
|
||||
ifeq ($(DEBUG),1)
|
||||
make -C $(FRONTEND_DIR) DEBUG=1
|
||||
else ifeq ($(RELEASE),1)
|
||||
make -C $(FRONTEND_DIR) RELEASE=1
|
||||
endif
|
||||
|
||||
.PHONY: frontend backend
|
||||
|
||||
frontend: $(PUBLIC_DIR)/index.html $(FRONTEND_DIR)/elm.min.js $(PUBLIC_DIR)
|
||||
cp $(FRONTEND_DIR)/elm.min.js $(PUBLIC_DIR)/
|
||||
cp $(FRONTEND_DIR)/src/ports.websocket.js $(PUBLIC_DIR)/
|
||||
mkdir -p $(PUBLIC_DIR)/assets
|
||||
|
@ -29,11 +43,12 @@ frontend_debug:
|
|||
backend:
|
||||
$(CARGO_BUILD) --manifest-path=$(BACKEND_DIR)/Cargo.toml
|
||||
|
||||
serve: frontend_release backend
|
||||
$(CARGO_RUN) --manifest-path=$(BACKEND_DIR)/Cargo.toml
|
||||
|
||||
serve_debug: frontend_debug backend
|
||||
serve: frontend backend
|
||||
ifeq ($(DEBUG),1)
|
||||
RUST_LOG=info,actix_web=debug $(CARGO_RUN) --manifest-path=$(BACKEND_DIR)/Cargo.toml
|
||||
else ifeq ($(RELEASE),1)
|
||||
$(CARGO_RUN) --manifest-path=$(BACKEND_DIR)/Cargo.toml
|
||||
endif
|
||||
|
||||
clean:
|
||||
rm -rf $(PUBLIC_DIR)/*
|
||||
|
|
|
@ -2,10 +2,18 @@ SRC_FILES := $(shell find src -name "*.elm")
|
|||
|
||||
all: elm.min.js
|
||||
|
||||
debug_build: $(SRC_FILES)
|
||||
rm -f elm.min.js elm.js
|
||||
./build.sh --debug src/Main.elm
|
||||
ifeq ($(DEBUG)$(RELEASE),) # Both are empty
|
||||
$(error You must set exactly one of DEBUG=1 or RELEASE=1)
|
||||
endif
|
||||
|
||||
release_build: $(SRC_FILES)
|
||||
rm -f elm.min.js elm.js
|
||||
ifeq ($(DEBUG)$(RELEASE),11) # Both are set
|
||||
$(error Both DEBUG and RELEASE cannot be set at the same time)
|
||||
endif
|
||||
|
||||
|
||||
elm.min.js: $(SRC_FILES)
|
||||
ifeq ($(DEBUG),1)
|
||||
./build.sh --debug src/Main.elm
|
||||
else ifeq ($(RELEASE),1)
|
||||
./build.sh --optimize src/Main.elm
|
||||
endif
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -ex
|
||||
|
||||
js="elm.js"
|
||||
min="elm.min.js"
|
||||
|
@ -14,7 +14,8 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
uglifyjs $js --compress 'pure_funcs=[F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9],pure_getters,keep_fargs=false,unsafe_comps,unsafe' | uglifyjs --mangle --output $min
|
||||
uglifyjs elm.js --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters=true,keep_fargs=false,unsafe_comps=true,unsafe=true,passes=2' --output=elm.js
|
||||
uglifyjs elm.js --mangle --output=elm.js
|
||||
|
||||
echo "Compiled size: $(wc -c < $js) bytes ($js)"
|
||||
echo "Minified size: $(wc -c < $min) bytes ($min)"
|
||||
|
|
Loading…
Reference in a new issue