41 lines
900 B
Makefile
41 lines
900 B
Makefile
# Makefile
|
|
|
|
# Project name / binary name
|
|
BINARY_NAME := furnacecheck
|
|
|
|
# Default target
|
|
all: build
|
|
|
|
# Run go app from CLI
|
|
run:
|
|
go run .
|
|
|
|
install-linux:
|
|
sudo apt install libopencv-dev
|
|
|
|
install-macos:
|
|
brew install opencv
|
|
|
|
# Build for the host system
|
|
build:
|
|
export CGO_CPPFLAGS="$(pkg-config --cflags opencv4)"
|
|
export CGO_LDFLAGS="$(pkg-config --libs opencv4 | sed 's/-lopencv_hdf//g' | sed 's/-lopencv_viz//g')"
|
|
go build -tags customenv -o build/$(BINARY_NAME) .
|
|
|
|
# Cross-compile for macOS ARM64
|
|
build-macos-arm64:
|
|
GOOS=darwin GOARCH=arm64 go build -o build/$(BINARY_NAME)-macos-arm64 .
|
|
|
|
# Cross-compile for Linux AMD64
|
|
build-linux-amd64:
|
|
GOOS=linux GOARCH=amd64 go build -o build/$(BINARY_NAME)-linux-amd64 .
|
|
|
|
# Build all targets
|
|
build-all: build-macos-arm64 build-linux-amd64
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
rm -rf build
|
|
|
|
.PHONY: all build build-macos-arm64 build-linux-amd64 build-all clean
|