forked from SchoolyB/EZ
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
87 lines (77 loc) · 3.03 KB
/
Makefile
File metadata and controls
87 lines (77 loc) · 3.03 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# EZ Language Build System
.PHONY: build install uninstall clean test integration-test help
BINARY_NAME=ez
INSTALL_PATH=/usr/local/bin
GO=go
# Version info
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
BUILD_TIME=$(shell date -u '+%Y-%m-%d_%H:%M:%S')
LDFLAGS=-ldflags "-X main.Version=$(VERSION) -X main.BuildTime=$(BUILD_TIME)"
help:
@echo "EZ Language Build System"
@echo ""
@echo "Available targets:"
@echo " make build - Build the ez binary"
@echo " make install - Install ez to $(INSTALL_PATH)"
@echo " make uninstall - Remove ez from $(INSTALL_PATH)"
@echo " make clean - Remove built binaries and test artifacts"
@echo " make test - Run Go unit tests"
@echo " make integration-test - Run integration test suite"
@echo " make release - Build for multiple platforms"
build:
@echo "Building EZ..."
$(GO) build $(LDFLAGS) -o $(BINARY_NAME) ./cmd/ez
@echo "Build complete! Binary: ./$(BINARY_NAME)"
install: build
@echo "Installing EZ to $(INSTALL_PATH)..."
@if [ -w $(INSTALL_PATH) ]; then \
mkdir -p $(INSTALL_PATH); \
cp $(BINARY_NAME) $(INSTALL_PATH)/$(BINARY_NAME); \
chmod +x $(INSTALL_PATH)/$(BINARY_NAME); \
else \
echo "Need sudo permissions to install to $(INSTALL_PATH)"; \
sudo mkdir -p $(INSTALL_PATH); \
sudo cp $(BINARY_NAME) $(INSTALL_PATH)/$(BINARY_NAME); \
sudo chmod +x $(INSTALL_PATH)/$(BINARY_NAME); \
fi
@echo "EZ installed successfully!"
@echo "Try: ez help"
uninstall:
@echo "Uninstalling EZ..."
@rm -f $(INSTALL_PATH)/$(BINARY_NAME)
@echo "EZ uninstalled"
clean:
@echo "Cleaning build artifacts..."
@rm -f $(BINARY_NAME)
@rm -rf dist/
@rm -f *.ezdb
@echo "Clean complete"
test:
$(GO) test ./... -v
integration-test: build
./integration-tests/run_tests.sh
# Build for multiple platforms
release:
@echo "Building releases for version $(VERSION)..."
@mkdir -p dist
@# Build binaries
GOOS=darwin GOARCH=amd64 $(GO) build $(LDFLAGS) -o dist/$(BINARY_NAME) ./cmd/ez && \
tar -czf dist/$(BINARY_NAME)-darwin-amd64.tar.gz -C dist $(BINARY_NAME) && \
rm dist/$(BINARY_NAME)
GOOS=darwin GOARCH=arm64 $(GO) build $(LDFLAGS) -o dist/$(BINARY_NAME) ./cmd/ez && \
tar -czf dist/$(BINARY_NAME)-darwin-arm64.tar.gz -C dist $(BINARY_NAME) && \
rm dist/$(BINARY_NAME)
GOOS=linux GOARCH=amd64 $(GO) build $(LDFLAGS) -o dist/$(BINARY_NAME) ./cmd/ez && \
tar -czf dist/$(BINARY_NAME)-linux-amd64.tar.gz -C dist $(BINARY_NAME) && \
rm dist/$(BINARY_NAME)
GOOS=linux GOARCH=arm64 $(GO) build $(LDFLAGS) -o dist/$(BINARY_NAME) ./cmd/ez && \
tar -czf dist/$(BINARY_NAME)-linux-arm64.tar.gz -C dist $(BINARY_NAME) && \
rm dist/$(BINARY_NAME)
GOOS=windows GOARCH=amd64 $(GO) build $(LDFLAGS) -o dist/$(BINARY_NAME).exe ./cmd/ez && \
zip -j dist/$(BINARY_NAME)-windows-amd64.zip dist/$(BINARY_NAME).exe && \
rm dist/$(BINARY_NAME).exe
@# Generate checksums
@echo "Generating checksums..."
@cd dist && shasum -a 256 *.tar.gz *.zip > checksums.txt
@echo "Release builds complete in dist/"
@cat dist/checksums.txt