-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (48 loc) · 1.54 KB
/
Copy pathMakefile
File metadata and controls
64 lines (48 loc) · 1.54 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
# Makefile for Go project
# Environment variables
ENV_FILE := .env
# Load environment variables from .env file
#include $(ENV_FILE)
export
# Variables
BINARY_NAME := CapyDrop
GO_FILES := $(wildcard *.go)
# Commands
.PHONY: build run clean
build:
@echo "Building $(BINARY_NAME)..."
@go build -o build/$(BINARY_NAME) -ldflags='-s -w -H=windowsgui' ./$(GO_FILES)
buildarm:
@echo "Building $(BINARY_NAME)..."
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build -o build/$(BINARY_NAME) -ldflags='-s -w -H=windowsgui' ./$(GO_FILES)
package:
@echo "Package $(BINARY_NAME)..."
@fyne package -os darwin -icon Icon.png -name $(BINARY_NAME)App ./$(GO_FILES)
build-win:
@echo "Building windows $(BINARY_NAME)..."
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 \
go build -a -ldflags '-extldflags "-static" -s -w -H=windowsgui ' -buildvcs=false -o build/$(BINARY_NAME).exe ./$(GO_FILES)
test:
@echo "Testing $(BINARY_NAME)..."
@go test ./src/$(GO_FILES)
lint:
@golangci-lint run -v
run:
@echo "Running $(BINARY_NAME)..."
@./build/$(BINARY_NAME)
clean:
@echo "Cleaning up..."
@rm -f $(BINARY_NAME)
# Target to run the application
start: build run
# Target to build and run the application
restart: clean start
# Help target
help:
@echo "Available targets:"
@echo " build : Build the Go application"
@echo " run : Run the Go application"
@echo " clean : Clean up generated files"
@echo " docs : Generated documentation files"
@echo " start : Build and run the Go application"
@echo " restart : Clean, build, and run the Go application"