smithy

ref: v0.3.0

./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
42
43
44
BUILD_VERSION ?= $(shell git describe --always --abbrev=40 --dirty)

SCDOC = scdoc
PREFIX?=/usr/local
BINDIR?=$(PREFIX)/bin
SHAREDIR?=$(PREFIX)/share/smithy
MANDIR?=$(PREFIX)/share/man

LDFLAGS="-X github.com/honza/smithy/cmd.SmithyVersion=${BUILD_VERSION}"
MODCACHE := $(shell go env GOMODCACHE)

export CGO_ENABLED=0

all: smithy smithy.yml

smithy: pkg/smithy/*
	go build -ldflags $(LDFLAGS) -o smithy main.go

smithy.yml:
	./smithy generate > smithy.yml

docs:
	$(SCDOC) < docs/smithy.1.scd > smithy.1
	$(SCDOC) < docs/smithy.yml.5.scd > smithy.yml.5

install: all
	mkdir -m755 -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(SHAREDIR)
	cp -f smithy $(DESTDIR)$(BINDIR)/smithy
	cp -f smithy.yml $(DESTDIR)$(SHAREDIR)/smithy.yml
	cp -f smithy.1 $(DESTDIR)$(MANDIR)/man1/smithy.1 2>/dev/null || true
	cp -f smithy.yml.5 $(DESTDIR)$(MANDIR)/man5/smithy.yml.5 2>/dev/null || true

uninstall: all
	rm -r $(DESTDIR)$(BINDIR)/smithy
	rm -fr $(DESTDIR)$(SHAREDIR)

gofmt:
	go fmt ./pkg/... ./cmd/...

clean:
	rm -rf smithy smithy.yml smithy.1 smithy.yml.5

.PHONY:
	smithy smithy.yml clean