Skip to content

Commit 2235198

Browse files
committed
Makefile: replace script/bootstrap with 'make', 'make all'
1 parent b78688a commit 2235198

File tree

11 files changed

+103
-384
lines changed

11 files changed

+103
-384
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ In general, contributors should develop on branches based off of `master` and pu
5858
## Submitting a pull request
5959

6060
0. [Fork][] and clone the repository
61-
0. Configure and install the dependencies: `script/bootstrap`
61+
0. Configure and install the dependencies: `make`
6262
0. Make sure the tests pass on your machine: `make test`
6363
0. Create a new branch based on `master`: `git checkout -b <my-branch-name> master`
6464
0. Make your change, add tests, and make sure the tests still pass
@@ -107,8 +107,8 @@ your projects in a specific directory, you can symlink it from `$GOPATH`:
107107
$ cd ~/path/to/your/projects
108108
$ ln -s $GOPATH/src/github.com/git-lfs/git-lfs
109109

110-
From here, run `script/bootstrap` to build Git LFS in the `./bin` directory.
111-
Before submitting changes, be sure to run the Go tests and the shell integration
110+
From here, run `make` to build Git LFS in the `./bin` directory. Before
111+
submitting changes, be sure to run the Go tests and the shell integration
112112
tests:
113113

114114
$ make test # runs just the Go tests
@@ -128,11 +128,11 @@ If you are the current maintainer:
128128

129129
* Create a [new draft Release](https://github.com/git-lfs/git-lfs/releases/new).
130130
List any changes with links to related PRs.
131-
* Make sure your local dependencies are up to date: `script/bootstrap`
131+
* Make sure your local dependencies are up to date: `make vendor`
132132
* Ensure that tests are green: `script/cibuild`
133133
* Bump the version in `lfs/lfs.go`, [like this](https://github.com/git-lfs/git-lfs/commit/dd17828e4a6f2394cbba8621037199dc28f046e8).
134134
* Add the new version to the top of CHANGELOG.md
135-
* Build for all platforms with `script/bootstrap -all` (you need Go setup for
135+
* Build for all platforms with `make release` (you need Go setup for
136136
cross compiling with Mac, Linux, FreeBSD, and Windows support).
137137
* Test the command locally. The compiled version will be in `bin/releases/{os}-{arch}/git-lfs-{version}/git-lfs`
138138
* Get the draft Release ID from the GitHub API: `curl -in https://api.github.com/repos/git-lfs/git-lfs/releases`

Makefile

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
1+
GIT_LFS_SHA ?= $(shell git rev-parse --short HEAD)
2+
VERSION ?= $(shell git describe HEAD)
3+
14
GO ?= go
25

36
GO_TEST_EXTRA_ARGS =
47

8+
BUILTIN_LD_FLAGS =
9+
BUILTIN_LD_FLAGS += -X github.com/git-lfs/git-lfs/config.GitCommit=$(GIT_LFS_SHA)
10+
ifneq ("$(DWARF)","YesPlease")
11+
BUILTIN_LD_FLAGS += -s
12+
BUILTIN_LD_FLAGS += -w
13+
endif
14+
EXTRA_LD_FLAGS =
15+
LD_FLAGS = $(BUILTIN_LD_FLAGS) $(EXTRA_LD_FLAGS)
16+
17+
BUILTIN_GC_FLAGS =
18+
EXTRA_GC_FLAGS =
19+
GC_FLAGS = $(BUILTIN_GC_FLAGS) $(EXTRA_GC_FLAGS)
20+
521
GLIDE ?= glide
622

723
GREP ?= grep
@@ -33,6 +49,78 @@ PKGS += tools/kv
3349
PKGS += tq
3450
endif
3551

52+
ifeq ($(OS),Windows_NT)
53+
X ?= .exe
54+
else
55+
X ?=
56+
endif
57+
.DEFAULT_GOAL := bin/git-lfs$(X)
58+
59+
BUILD = GOOS=$(1) GOARCH=$(2) \
60+
$(GO) build \
61+
-ldflags="$(LD_FLAGS)" \
62+
-gcflags="$(GC_FLAGS)" \
63+
-o ./bin/git-lfs$(3) ./git-lfs.go
64+
65+
BUILD_TARGETS = bin/git-lfs-darwin-amd64 bin/git-lfs-darwin-386 \
66+
bin/git-lfs-linux-amd64 bin/git-lfs-linux-386 \
67+
bin/git-lfs-freebsd-amd64 bin/git-lfs-freebsd-386 \
68+
bin/git-lfs-windows-amd64.exe bin/git-lfs-windows-386.exe
69+
70+
.PHONY : all build
71+
all build : $(BUILD_TARGETS)
72+
73+
bin/git-lfs-darwin-amd64 : fmt
74+
$(call BUILD,darwin,amd64,-darwin-amd64)
75+
bin/git-lfs-darwin-386 : fmt
76+
$(call BUILD,darwin,386,-darwin-386)
77+
bin/git-lfs-linux-amd64 : fmt
78+
$(call BUILD,linux,amd64,-linux-amd64)
79+
bin/git-lfs-linux-386 : fmt
80+
$(call BUILD,linux,386,-linux-386)
81+
bin/git-lfs-freebsd-amd64 : fmt
82+
$(call BUILD,freebsd,amd64,-freebsd-amd64)
83+
bin/git-lfs-freebsd-386 : fmt
84+
$(call BUILD,freebsd,386,-freebsd-386)
85+
bin/git-lfs-windows-amd64.exe : version-info fmt
86+
$(call BUILD,windows,amd64,-windows-amd64.exe)
87+
bin/git-lfs-windows-386.exe : version-info fmt
88+
$(call BUILD,windows,386,-windows-386.exe)
89+
90+
bin/git-lfs : git-lfs.go $(PKGS)
91+
$(call BUILD,$(GOOS),$(GOARCH),)
92+
93+
bin/git-lfs.exe : git-lfs.go $(PKGS) version-info
94+
$(call BUILD,$(GOOS),$(GOARCH),.exe)
95+
96+
.PHONY : version-info
97+
version-info:
98+
go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo
99+
PATH=$$PATH:$$GOPATH/bin/windows_386 $(GO) generate
100+
101+
RELEASE_TARGETS = bin/releases/git-lfs-darwin-amd64-$(VERSION).tar.gz \
102+
bin/releases/git-lfs-darwin-386-$(VERSION).tar.gz \
103+
bin/releases/git-lfs-linux-amd64-$(VERSION).tar.gz \
104+
bin/releases/git-lfs-linux-386-$(VERSION).tar.gz \
105+
bin/releases/git-lfs-freebsd-amd64-$(VERSION).tar.gz \
106+
bin/releases/git-lfs-freebsd-386-$(VERSION).tar.gz \
107+
bin/releases/git-lfs-windows-amd64-$(VERSION).zip \
108+
bin/releases/git-lfs-windows-386-$(VERSION).zip
109+
110+
RELEASE_INCLUDES = README.md CHANGELOG.md script/install.sh
111+
112+
.PHONY : release
113+
release : $(RELEASE_TARGETS)
114+
shasum -a 256 $(RELEASE_TARGETS)
115+
116+
bin/releases/git-lfs-%-$(VERSION).tar.gz : $(RELEASE_INCLUDES) bin/git-lfs-%
117+
@mkdir -p bin/releases
118+
tar -s '!bin/git-lfs-.*!git-lfs!' -s '!script/!!' -czf $@ $^
119+
120+
bin/releases/git-lfs-%-$(VERSION).zip : $(RELEASE_INCLUDES) bin/git-lfs-%.exe
121+
@mkdir -p bin/releases
122+
zip -j -l $@ $^
123+
36124
TEST_TARGETS := test-bench test-verbose test-race
37125
.PHONY : $(TEST_TARGETS) test
38126
$(TEST_TARGETS) : test
@@ -53,9 +141,11 @@ vendor : glide.lock
53141
$(RM) -r vendor/github.com/davecgh/go-spew
54142
$(RM) -r vendor/github.com/pmezard/go-difflib
55143

144+
.PHONY : fmt
56145
fmt : $(PKGS) | lint
57146
$(GOIMPORTS) $(GOIMPORTS_EXTRA_OPTS) $?
58147

148+
.PHONY : lint
59149
lint : $(PKGS)
60150
$(GO) list -f '{{ join .Deps "\n" }}' . \
61151
| $(XARGS) $(GO) list -f '{{ if not .Standard }}{{ .ImportPath }}{{ end }}' \

appveyor.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
skip_branch_with_pr: true
22

33
environment:
4+
CYGWIN: "$(CYGWIN) winsymlinks:nativestrict"
5+
MSYS: "$(MSYS) winsymlinks:nativestrict"
46
GOPATH: $(HOMEDRIVE)$(HOMEPATH)\go
57
MSYSTEM: MINGW64
68

@@ -22,9 +24,9 @@ install:
2224
go version
2325
2426
build_script:
25-
- bash --login -c 'GOARCH=386 script/bootstrap'
27+
- bash --login -c 'GOARCH=386 make -B bin/git-lfs.exe'
2628
- mv bin\git-lfs.exe git-lfs-x86.exe
27-
- bash --login -c 'GOARCH=amd64 script/bootstrap'
29+
- bash --login -c 'GOARCH=amd64 make -B bin/git-lfs.exe'
2830
- mv bin\git-lfs.exe git-lfs-x64.exe
2931

3032
after_build:

rpm/SPECS/git-lfs.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ ln -s $(pwd) src/github.com/git-lfs/%{name}
3535

3636
pushd src/github.com/git-lfs/%{name}
3737
%if %{_arch} == i386
38-
GOARCH=386 ./script/bootstrap
38+
GOARCH=386 make
3939
%else
40-
GOARCH=amd64 ./script/bootstrap
40+
GOARCH=amd64 make
4141
%endif
4242
popd
4343
./script/man

rpm/build_rpms.bsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fi
140140

141141
pushd ${CURDIR}/..
142142
#Yes, compile lfs before compiling lfs...
143-
./script/bootstrap
143+
make
144144
#Use the version output to grab the version number and short sha
145145
#(that yes, I could have gotten from git myself)
146146
LFS_VERSION=$(./bin/git-lfs version | sed -r 's|.*/([0-9.]*).*|\1|')

script/bootstrap

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)