-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
75 lines (58 loc) · 1.72 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Makefile for compiling pillar
# Author: 2023 (Hokanosekai)
# Usage: make [help|all|clean|install|uninstall|build-windows|build-linux|build-macos]
PROG_NAME=pillar
PROG_VERSION=0.1.2
OUTPUT_DIR=bin
FLAGS=-A --unstable --reload
OS := $(shell uname)
OUTPUT_FILE=$(OUTPUT_DIR)/$(PROG_NAME)-${PROG_VERSION}-${OS}
EXTENSION=
ifeq ($(OS),Windows_NT)
EXTENSION=.exe
endif
TARGET=
ifeq ($(OS),Darwin)
TARGET=x86_64-apple-darwin
endif
ifeq ($(OS),Linux)
TARGET=x86_64-unknown-linux-gnu
endif
ifeq ($(OS),Windows_NT)
TARGET=x86_64-pc-windows-msvc
endif
all: clean build
clean:
rm -rf $(OUTPUT_DIR)
@echo "Cleaned."
build:
@mkdir -p $(OUTPUT_DIR)
deno compile $(FLAGS) --output $(OUTPUT_FILE)$(EXTENSION) src/main.ts --target $(TARGET)
@echo ""
@echo "Done."
build-all: build-windows build-linux build-macos
build-windows:
@mkdir -p $(OUTPUT_DIR)
deno compile $(FLAGS) --output $(OUTPUT_DIR)/$(PROG_NAME)-${PROG_VERSION}-Windows.exe src/main.ts --target x86_64-pc-windows-msvc
@echo ""
@echo "Done."
build-linux:
@mkdir -p $(OUTPUT_DIR)
deno compile $(FLAGS) --output $(OUTPUT_DIR)/$(PROG_NAME)-${PROG_VERSION}-Linux src/main.ts --target x86_64-unknown-linux-gnu
@echo ""
@echo "Done."
build-macos:
@mkdir -p $(OUTPUT_DIR)
deno compile $(FLAGS) --output $(OUTPUT_DIR)/$(PROG_NAME)-${PROG_VERSION}-Darwin src/main.ts --target x86_64-apple-darwin
@echo ""
@echo "Done."
install:
@mkdir -p /usr/local/bin
@cp $(OUTPUT_FILE)$(EXTENSION) /usr/local/bin/$(PROG_NAME)
@echo "Installed $(PROG_NAME) $(PROG_VERSION)"
uninstall:
@rm -rf /usr/local/bin/$(PROG_NAME)
@echo "Uninstalled $(PROG_NAME) $(PROG_VERSION)"
help:
@echo "Usage: make [all|clean|install|uninstall|build-windows|build-linux|build-macos (default: build)]"
# End of file