forked from lesfurets/git-octopus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (55 loc) · 2.01 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
prefix = /usr/local
bindir = $(prefix)/bin
datarootdir = $(prefix)/share
mandir = $(datarootdir)/man
man1dir = $(mandir)/man1
docdir = $(datarootdir)/doc/git-doc
htmldir = $(docdir)
cat_scripts = cat $(2) $(3) $(4) $(5) > bin/$(1) \
&& chmod +x bin/$(1)
generate_docs = asciidoc -d manpage --out-file=doc/$(1).html src/doc/$(1).1.txt \
&& a2x -f manpage src/doc/$(1).1.txt --no-xmllint --destination-dir=doc
install_docs = cp -f doc/$(1).1 $(man1dir)/$(1).1 \
&& cp -f doc/$(1).html $(htmldir)
fmt:
gofmt -w **/*.go
build:
@mkdir -p bin
$(call cat_scripts,git-octopus,src/lib/common,src/lib/git-merge-octopus-fork.sh,src/git-octopus)
$(call cat_scripts,git-conflict,src/lib/common,src/lib/hash-conflict,src/git-conflict)
$(call cat_scripts,git-apply-conflict-resolution,src/lib/common,src/lib/hash-conflict,src/git-apply-conflict-resolution)
@echo 'Build success'
build-docs:
@mkdir -p doc
$(call generate_docs,git-octopus)
$(call generate_docs,git-conflict)
install-bin: build
@mkdir -p $(bindir)
@cp -f bin/git-octopus $(bindir) && echo 'Installing $(bindir)/git-octopus'
@cp -f bin/git-conflict $(bindir) && echo 'Installing $(bindir)/git-conflict'
@cp -f bin/git-apply-conflict-resolution $(bindir) && echo 'Installing $(bindir)/git-apply-conflict-resolution'
install-docs:
@echo 'Installing documentation'
@mkdir -p $(htmldir)
@mkdir -p $(man1dir)
$(call install_docs,git-octopus)
$(call install_docs,git-conflict)
install: install-bin install-docs
uninstall:
rm $(bindir)/git-octopus
rm $(bindir)/git-conflict
rm $(bindir)/git-apply-conflict-resolution
rm $(man1dir)/git-octopus.1
rm $(man1dir)/git-conflict.1
rm $(htmldir)/git-octopus.html
rm $(htmldir)/git-conflict.html
go-build = GOOS=$(1) GOARCH=$(2) go build -o git-octopus-$(1)-$(2)-2.0.beta3
go-cross-compile:
$(call go-build,darwin,386)
$(call go-build,darwin,amd64)
$(call go-build,freebsd,386)
$(call go-build,freebsd,amd64)
$(call go-build,linux,386)
$(call go-build,linux,amd64)
$(call go-build,windows,386)
$(call go-build,windows,amd64)