-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (47 loc) · 1.57 KB
/
Copy pathMakefile
File metadata and controls
56 lines (47 loc) · 1.57 KB
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
# Variables
WEB_DIR=.
DIST_DIR=.dist
RELEASE_DIR=.release
OS=$(shell uname)
binary_name=duckdbstudio
# Ensure variables are exported to all uses in the Makefile
export
# Phony targets ensure that Make doesn't look for files named like the target
.PHONY: clean generate copy build package ensure_releases_dir
all: clean generate copy build package
clean:
@echo "Cleaning previous web build artifacts..."
@find $(DIST_DIR) -mindepth 1 -delete || mkdir -p $(DIST_DIR)
@echo "Cleaned..."
ensure_releases_dir:
@echo "Ensuring $(RELEASE_DIR) exists..."
@mkdir -p $(RELEASE_DIR)
generate:
@echo "Installing web dependencies..."
@cd $(WEB_DIR) && npm i
@echo "Dependencies installed..."
@echo "Generating build..."
@cd $(WEB_DIR) && npm run generate || (echo "Error generating build. Exiting..." && exit 1)
@echo "Generated..."
copy:
@echo "Copying to $(DIST_DIR) for embedding..."
@mkdir -p $(DIST_DIR)
@cp -r $(WEB_DIR)/.output/public/* $(DIST_DIR)/
@echo "Copied..."
build: ensure_releases_dir
@echo "Building Go binary for $(OS)..."
ifeq ($(OS),Linux)
@go build -o $(RELEASE_DIR)/$(binary_name)-linux-aarch64 -v .
else ifeq ($(OS),Darwin)
#@go build -o $(RELEASE_DIR)/$(binary_name)-macos -v .
@go build -o $(RELEASE_DIR)/$(binary_name)-linux-aarch64 -v .
else
@echo "Unsupported OS: $(OS). Exiting..."
@exit 1
endif
@echo "Binary built in $(RELEASE_DIR)..."
package: ensure_releases_dir
@echo "Packaging files..."
@ZIP_NAME="$(RELEASE_DIR)/$(binary_name)_bundle_`date +%s`.zip"; \
zip $$ZIP_NAME $(RELEASE_DIR)/$(binary_name)-* config.yml
@echo "Packaged into $$ZIP_NAME..."