-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (27 loc) · 872 Bytes
/
Makefile
File metadata and controls
38 lines (27 loc) · 872 Bytes
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
SHELL := /bin/bash
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
APP_NAME := fimpgo
ARCH ?= armhf
BIN_DIR := ./build
TARGET_BIN := $(BIN_DIR)/$(APP_NAME)_$(VERSION)_$(ARCH)
MAIN_SRC := ./cli/client.go
all: build-arm
clean:
-rm -f $(BIN_DIR)/*
-rm -f $(APP_NAME)
-rm -f $(TARGET_BIN)
mkdir -p $(BIN_DIR)
build: clean
go build -ldflags="-s -w" -o $(APP_NAME) $(MAIN_SRC)
build-arm: ARCH=armhf
build-arm: clean
GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o $(TARGET_BIN) $(MAIN_SRC)
build-amd64: ARCH=amd64
build-amd64: clean
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o $(TARGET_BIN) $(MAIN_SRC)
build-mac: ARCH=amd64
build-mac: clean
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o $(TARGET_BIN) $(MAIN_SRC)
test:
go test ./...
.PHONY: all clean test build build-arm build-amd64 build-mac