-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (28 loc) · 1.11 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
.DEFAULT_GOAL := all
include Makefile.env.mk
USERSCRIPT_TARGETS := \
UrlAutoHelper \
ByeByeAnnoyingThumbnails
env_check:
$(call assert, $(TEST) -n "$(TARGET)", "You must specific a target need to continue")
$(call assert, $(TEST) -d $(TARGET), "Directory \"$(TARGET)\" not found")
$(call echo-h, Installing global dependencies)
@npm i $(IGNORE_STDOUT)
build: env_check
@TARGET_LOWER=$(shell echo $(TARGET) | $(TR) '[:upper:]' '[:lower:]') && \
cd $(TARGET) && \
$(call echo, Installing dependencies for $(TARGET)) && npm i $(IGNORE_STDOUT) && \
$(call echo, Building $(TARGET)) && npm run build $(IGNORE_STDOUT) && \
$(call echo, Moving distribution of $(TARGET)) && $(MOVE) -f dist/$$TARGET_LOWER.user.js ../dist/$$TARGET_LOWER.user.js
$(call echo-h, Done)
debug: env_check
@cd $(TARGET) && \
$(call echo, Installing dependencies for $(TARGET)) && npm i $(IGNORE_STDOUT) && \
npm run dev
clean:
@$(RM) -rf dist
build_prepare:
@$(MKDIR) -p dist
all: build_prepare
@$(foreach target, $(USERSCRIPT_TARGETS), $(MAKE) build TARGET=$(target);)
.PHONY: build_prepare clean