-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
32 lines (23 loc) · 852 Bytes
/
Makefile
File metadata and controls
32 lines (23 loc) · 852 Bytes
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
# Makefile
# ディレクトリ
SRC_DIR=src
DIST_DIR=dist
# ソースとターゲットの定義
TS_FILES=$(wildcard $(SRC_DIR)/*.ts)
BOOKMARKLETS=$(patsubst $(SRC_DIR)/%.ts,$(DIST_DIR)/%.bookmarklet.js,$(TS_FILES))
BOOKMARKLET_MD=bookmarklets.md
# タスク
all: $(DIST_DIR) $(BOOKMARKLETS) bookmarklets.md
# distディレクトリがなければ作成
$(DIST_DIR):
mkdir -p $(DIST_DIR)
# パターンルール: すべてのTypeScriptファイルをブックマークレットに変換
$(DIST_DIR)/%.bookmarklet.js: $(SRC_DIR)/%.ts
npx tsc $< --outFile /dev/stdout --target ES5 | npx uglify-js --compress --mangle | tr -d '\n' | sed 's/^/javascript:/' > $@
clean:
rm -rf $(DIST_DIR)
bookmarklets.md: $(BOOKMARKLETS) scripts/gen-bookmarklet-md.js
node scripts/gen-bookmarklet-md.js
bookmarklet-md: bookmarklets.md
@true
.PHONY: all clean