-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
30 lines (25 loc) · 855 Bytes
/
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
# Define the output directory for binaries
OUTPUT_DIR = bin
# Define package name (this should be the name of your Go project)
PACKAGE_NAME = wav-extract
# Platforms to build for (add/remove as needed)
PLATFORMS = \
windows/amd64 \
linux/amd64 \
darwin/amd64 \
darwin/arm64
# Default target when running `make`
.PHONY: all
all: clean build
# Build for each platform
.PHONY: build
build: $(PLATFORMS)
$(PLATFORMS):
@GOOS=$(word 1, $(subst /, ,$@)) \
GOARCH=$(word 2, $(subst /, ,$@)) \
go build -o $(OUTPUT_DIR)/$(word 1, $(subst /, ,$@))/$(word 2, $(subst /, ,$@))/$(PACKAGE_NAME)$(if $(filter windows,$(word 1, $(subst /, ,$@))),.exe) .
# Clean the output directory
.PHONY: clean
clean:
@rm -rf $(OUTPUT_DIR)
@mkdir -p $(OUTPUT_DIR)/windows/amd64 $(OUTPUT_DIR)/linux/amd64 $(OUTPUT_DIR)/darwin/amd64 $(OUTPUT_DIR)/darwin/arm64