-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
41 lines (31 loc) · 814 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
31
32
33
34
35
36
37
38
39
40
41
# SPDX-FileCopyrightText: 2020 Pier Luigi Fiorini <[email protected]>
#
# SPDX-License-Identifier: CC0-1.0
TAGS :=
LDFLAGS := -w -s
GOFLAGS :=
DESTDIR :=
PREFIX := /usr/local
BINDIR := $(CURDIR)/bin
BINNAME ?= oic
C_SRC := $(shell find . -type f -name "*.[ch]")
GO_SRC := $(shell find . -type f -name "*.go")
.PHONY: all
all: build
.PHONY: build
build: $(BINDIR)/$(BINNAME)
$(BINDIR)/$(BINNAME): $(GO_SRC) $(C_SRC)
(cd cmd/oic && GO111MODULE=on go build $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o $@)
.PHONY: install
install: $(BINDIR)/$(BINNAME)
install -Dm755 $< $(DESTDIR)$(PREFIX)/bin/$(BINNAME)
.PHONY: clean
clean:
@rm -rf $(BINDIR)
.PHONY: test
test:
GO111MODULE=on go test $(GOFLAGS) -run . ./...
.PHONY: format
format:
GO111MODULE=on gofmt -w .
clang-format -i $(C_SRC)