Skip to content

Commit 483c8fd

Browse files
kellegoussalemhilal
authored andcommitted
Update Makefile to reflect the move to a go module.
1 parent 61620be commit 483c8fd

File tree

3 files changed

+23
-21
lines changed

3 files changed

+23
-21
lines changed

Makefile

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CMDS := $(GOPATH)/bin/houndd $(GOPATH)/bin/hound
1+
CMDS := .build/bin/houndd .build/bin/hound
22

33
SRCS := $(shell find . -type f -name '*.go')
44

@@ -11,25 +11,27 @@ ALL: $(CMDS)
1111

1212
ui: ui/bindata.go
1313

14-
node_modules:
14+
# the mtime is updated on a directory when its files change so it's better
15+
# to rely on a single file to represent the presence of node_modules.
16+
node_modules/build:
1517
npm install
18+
date -u >> $@
1619

17-
$(GOPATH)/bin/houndd: ui/bindata.go $(SRCS)
18-
go install github.com/hound-search/hound/cmds/houndd
20+
.build/bin/houndd: ui/bindata.go $(SRCS)
21+
go build -o $@ github.com/hound-search/hound/cmds/houndd
1922

20-
$(GOPATH)/bin/hound: ui/bindata.go $(SRCS)
21-
go install github.com/hound-search/hound/cmds/hound
23+
.build/bin/hound: ui/bindata.go $(SRCS)
24+
go build -o $@ github.com/hound-search/hound/cmds/hound
2225

2326
.build/bin/go-bindata:
24-
GOPATH=`pwd`/.build go get github.com/go-bindata/go-bindata/...
27+
go build -o $@ github.com/go-bindata/go-bindata/go-bindata
2528

26-
ui/bindata.go: .build/bin/go-bindata node_modules $(wildcard ui/assets/**/*)
29+
ui/bindata.go: .build/bin/go-bindata node_modules/build $(wildcard ui/assets/**/*)
2730
rsync -r ui/assets/* .build/ui
2831
npx webpack $(WEBPACK_ARGS)
2932
$< -o $@ -pkg ui -prefix .build/ui -nomemcopy .build/ui/...
3033

31-
dev: ALL
32-
npm install
34+
dev: node_modules/build
3335

3436
test:
3537
go test github.com/hound-search/hound/...

README.md

+5-11
Original file line numberDiff line numberDiff line change
@@ -125,21 +125,15 @@ Currently the following editors have plugins that support Hound:
125125
* make
126126
* Node.js ([Installation Instructions](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager))
127127

128-
Hound includes a `Makefile` to aid in building locally, but it depends on the source being added to a proper Go workspace so that
129-
Go tools work accordingly. See [Setting GOPATH](https://github.com/golang/go/wiki/SettingGOPATH) for further details about setting
130-
up your Go workspace. With a `GOPATH` set, the following commands will build hound locally.
128+
While Hound is a proper go module that can be installed with `go install`, there is also a `Makefile` to aid in building locally.
131129

132130
```
133-
git clone https://github.com/hound-search/hound.git ${GOPATH}/src/github.com/hound-search/hound
134-
cd ${GOPATH}/src/github.com/hound-search/hound
131+
git clone https://github.com/hound-search/hound.git
132+
cd hound
135133
make
136134
```
137135

138-
If this is your only Go project, you can set your GOPATH just for Hound:
139-
```
140-
git clone https://github.com/hound-search/hound.git src/github.com/hound-search/hound
141-
GOPATH=$(pwd) make -C src/github.com/hound-search/hound
142-
```
136+
The hound executables will be available in `.build/bin`.
143137

144138
### Testing
145139

@@ -182,7 +176,7 @@ make dev
182176
Then run the hound server with the --dev option:
183177

184178
```
185-
bin/houndd --dev
179+
.build/bin/houndd --dev
186180
```
187181

188182
## Get in Touch

tools/tools.go

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package tools
2+
3+
import (
4+
// used for bundling ui assets
5+
_ "github.com/go-bindata/go-bindata"
6+
)

0 commit comments

Comments
 (0)