2021-02-11 18:21:21 +00:00
|
|
|
GOESBUILD ?= off
|
|
|
|
ifeq ($(GOESBUILD), on)
|
|
|
|
ESBUILD := esbuild
|
|
|
|
else
|
|
|
|
ESBUILD := npx esbuild
|
|
|
|
endif
|
|
|
|
|
2021-01-05 18:16:23 +00:00
|
|
|
npm:
|
|
|
|
$(info installing npm dependencies)
|
|
|
|
npm install
|
2021-02-11 18:21:21 +00:00
|
|
|
@if [ "$(GOESBUILD)" = "off" ]; then\
|
|
|
|
npm install esbuild;\
|
|
|
|
else\
|
|
|
|
go get -u github.com/evanw/esbuild/cmd/esbuild;\
|
|
|
|
fi
|
2021-01-05 18:16:23 +00:00
|
|
|
|
2020-08-03 17:00:54 +00:00
|
|
|
configuration:
|
2020-09-21 21:03:20 +00:00
|
|
|
$(info Fixing config-base)
|
2021-01-05 18:16:23 +00:00
|
|
|
-mkdir -p build/data
|
|
|
|
python3 config/fixconfig.py -i config/config-base.json -o build/data/config-base.json
|
2020-09-21 21:03:20 +00:00
|
|
|
$(info Generating config-default.ini)
|
2021-01-05 18:16:23 +00:00
|
|
|
python3 config/generate_ini.py -i config/config-base.json -o build/data/config-default.ini
|
2020-08-03 17:00:54 +00:00
|
|
|
|
2020-10-17 23:57:53 +00:00
|
|
|
email:
|
2020-09-21 21:03:20 +00:00
|
|
|
$(info Generating email html)
|
2021-01-05 18:16:23 +00:00
|
|
|
python3 mail/generate.py -o build/data/
|
2020-08-03 17:00:54 +00:00
|
|
|
|
2021-01-05 18:40:19 +00:00
|
|
|
typescript:
|
2021-01-05 18:16:23 +00:00
|
|
|
$(info compiling typescript)
|
|
|
|
-mkdir -p build/data/web/js
|
2021-02-11 18:21:21 +00:00
|
|
|
-$(ESBUILD) --bundle ts/admin.ts --outfile=./build/data/web/js/admin.js --minify
|
|
|
|
-$(ESBUILD) --bundle ts/form.ts --outfile=./build/data/web/js/form.js --minify
|
|
|
|
-$(ESBUILD) --bundle ts/setup.ts --outfile=./build/data/web/js/setup.js --minify
|
2020-09-21 21:03:20 +00:00
|
|
|
|
2020-09-23 19:14:16 +00:00
|
|
|
ts-debug:
|
2021-01-05 18:16:23 +00:00
|
|
|
$(info compiling typescript w/ sourcemaps)
|
|
|
|
-mkdir -p build/data/web/js
|
2021-02-11 18:21:21 +00:00
|
|
|
-$(ESBUILD) --bundle ts/admin.ts --sourcemap --outfile=./build/data/web/js/admin.js
|
|
|
|
-$(ESBUILD) --bundle ts/form.ts --sourcemap --outfile=./build/data/web/js/form.js
|
|
|
|
-$(ESBUILD) --bundle ts/setup.ts --sourcemap --outfile=./build/data/web/js/setup.js
|
2021-01-05 18:16:23 +00:00
|
|
|
-rm -r build/data/web/js/ts
|
|
|
|
$(info copying typescript)
|
|
|
|
cp -r ts build/data/web/js
|
2020-09-23 19:14:16 +00:00
|
|
|
|
2020-09-24 16:51:13 +00:00
|
|
|
swagger:
|
2020-09-24 20:59:08 +00:00
|
|
|
go get github.com/swaggo/swag/cmd/swag
|
2020-09-24 16:51:13 +00:00
|
|
|
swag init -g main.go
|
|
|
|
|
2020-08-31 13:57:42 +00:00
|
|
|
version:
|
2020-09-15 11:12:51 +00:00
|
|
|
python3 version.py auto version.go
|
2020-08-31 13:57:42 +00:00
|
|
|
|
2020-08-03 17:00:54 +00:00
|
|
|
compile:
|
2020-09-21 21:03:20 +00:00
|
|
|
$(info Downloading deps)
|
2020-08-03 17:00:54 +00:00
|
|
|
go mod download
|
2020-09-21 21:03:20 +00:00
|
|
|
$(info Building)
|
2020-08-03 17:00:54 +00:00
|
|
|
mkdir -p build
|
2020-09-02 19:06:02 +00:00
|
|
|
CGO_ENABLED=0 go build -o build/jfa-go *.go
|
|
|
|
|
|
|
|
compress:
|
|
|
|
upx --lzma build/jfa-go
|
2020-08-03 17:00:54 +00:00
|
|
|
|
2021-01-23 18:53:14 +00:00
|
|
|
bundle-css:
|
2021-01-05 18:16:23 +00:00
|
|
|
-mkdir -p build/data/web/css
|
2021-01-23 18:53:14 +00:00
|
|
|
$(info bundling css)
|
2021-02-11 18:28:25 +00:00
|
|
|
$(ESBUILD) --bundle css/base.css --outfile=build/data/web/css/bundle.css --external:remixicon.css --minify
|
2021-01-23 18:53:14 +00:00
|
|
|
|
|
|
|
copy:
|
|
|
|
$(info copying fonts)
|
2021-01-05 18:16:23 +00:00
|
|
|
cp -r node_modules/remixicon/fonts/remixicon.css node_modules/remixicon/fonts/remixicon.woff2 build/data/web/css/
|
|
|
|
$(info copying html)
|
|
|
|
cp -r html build/data/
|
|
|
|
$(info copying static data)
|
|
|
|
-mkdir -p build/data/web
|
|
|
|
cp -r static/* build/data/web/
|
|
|
|
$(info copying language files)
|
|
|
|
cp -r lang build/data/
|
|
|
|
|
2020-08-03 17:00:54 +00:00
|
|
|
|
2020-08-19 11:10:34 +00:00
|
|
|
install:
|
|
|
|
cp -r build $(DESTDIR)/jfa-go
|
|
|
|
|
2021-01-23 18:53:14 +00:00
|
|
|
all: configuration npm email version typescript bundle-css swagger compile copy
|
|
|
|
debug: configuration npm email version ts-debug bundle-css swagger compile copy
|