forked from Open-CMSIS-Pack/vidx2pidx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
45 lines (36 loc) · 1002 Bytes
/
Copy pathmakefile
File metadata and controls
45 lines (36 loc) · 1002 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
39
40
41
42
43
44
45
# Having these will allow CI scripts to build for many OS's and ARCH's
OS := $(or ${OS},${OS},linux)
ARCH := $(or ${ARCH},${ARCH},amd64)
# Path to lint tool
GOLINTER ?= golangci-lint
GOFORMATTER ?= gofmt
# Determine binary file name
BIN_NAME := vidx2pidx
PROG := build/$(BIN_NAME)
ifneq (,$(findstring windows,$(OS)))
PROG=build/$(BIN_NAME).exe
endif
SOURCES := $(wildcard *.go)
all:
@echo Pick one of:
@echo $$ make $(PROG)
@echo $$ make run
@echo $$ make clean
@echo
@echo Build for different OS's and ARCH's by defining these variables. Ex:
@echo $$ make OS=windows ARCH=amd64 build/$(BIN_NAME).exe \# build for windows 64bits
@echo $$ make OS=darwin ARCH=amd64 build/$(BIN_NAME) \# build for MacOS 64bits
@echo
@echo Clean everything
@echo $$ make clean
$(PROG): $(SOURCES)
@echo Building project
GOOS=$(OS) GOARCH=$(ARCH) go build -o $(PROG)
run: $(PROG)
@./$(PROG) $(ARGS) || true
lint:
$(GOLINTER) run
format:
$(GOFORMATTER) -s -w .
clean:
rm -rf build/*