2022-11-21 08:09:01 +00:00
|
|
|
.DEFAULT_GOAL := build
|
2022-11-20 23:37:49 +00:00
|
|
|
APPLICATION_NAME ?= dndmusicbot
|
|
|
|
CURRENT_UID := $(shell id -u)
|
2022-11-21 07:30:02 +00:00
|
|
|
BIN := src/node_modules/.bin
|
2022-11-21 11:26:33 +00:00
|
|
|
YARN = docker run --rm --user $(CURRENT_UID) -v $(CURDIR)/src:/app -v $(CURDIR)/public:/public dndmusicbot-js-build
|
2022-11-20 23:37:49 +00:00
|
|
|
|
2022-11-21 11:26:33 +00:00
|
|
|
PHONY: js image build clean
|
2022-11-20 23:37:49 +00:00
|
|
|
|
2022-11-21 11:26:33 +00:00
|
|
|
js: image public/script.js
|
2022-11-20 23:37:49 +00:00
|
|
|
|
2022-11-21 07:30:02 +00:00
|
|
|
image: .jsimage
|
|
|
|
|
|
|
|
.jsimage: Dockerfile
|
|
|
|
@docker build -t dndmusicbot-js-build .
|
|
|
|
@touch .jsimage
|
|
|
|
|
2022-11-21 11:26:33 +00:00
|
|
|
src/node_modules:
|
|
|
|
mkdir -p $@
|
|
|
|
|
2022-11-21 11:28:52 +00:00
|
|
|
public:
|
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
src/yarn.lock: public src/node_modules src/package.json
|
2022-11-21 11:26:33 +00:00
|
|
|
$(YARN)
|
2022-11-21 07:30:02 +00:00
|
|
|
@touch -mr $(shell ls -Atd $? | head -1) $@
|
|
|
|
|
2022-11-21 11:26:33 +00:00
|
|
|
public/script.js: src/script.js src/yarn.lock
|
|
|
|
$(YARN) build
|
2022-11-21 07:30:02 +00:00
|
|
|
|
2022-11-23 07:39:41 +00:00
|
|
|
$(APPLICATION_NAME): *.go ffmpeg/*.go speaker/*.go go.mod go.sum
|
2022-11-21 07:30:02 +00:00
|
|
|
@go build
|
|
|
|
|
2022-11-21 08:09:01 +00:00
|
|
|
build: image js $(APPLICATION_NAME)
|
2022-11-21 11:26:33 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -r public/* src/node_modules .jsimage $(APPLICATION_NAME)
|