1+ THIS_FILE := $(lastword $(MAKEFILE_LIST ) )
2+ UNSAFE =no
13GOCC ?= go
24
3- .PHONY : install build gx
5+ # build plugin and ipfs daemon
6+ .PHONY : build
7+ build :
8+ mkdir build
9+ @$(MAKE ) -f $(THIS_FILE ) plugin-ipfs
10+ @$(MAKE ) -f $(THIS_FILE ) ipfs
411
5- build : go-ipfs-plugin-i2p-gateway.so
12+ # build the actual plugin
13+ .PHONY : plugin-ipfs
14+ plugin-ipfs :
15+ $(GOCC ) build -o build/go-ipfs-plugin-i2p-gateway.so -buildmode=plugin
16+ chmod +x " build/go-ipfs-plugin-i2p-gateway.so"
617
18+ # build ipfs daemon
19+ .PHONY : ipfs
20+ ipfs :
21+ ( cd vendor/github.com/ipfs/go-ipfs/cmd/ipfs ; go build -o ../../../../../../build/ipfs ; cp ipfs $( GOPATH) /bin)
22+
23+ # clean up files
24+ .PHONY : clean
725clean :
8- rm -f go-ipfs-plugin-i2p-gateway.so
26+ rm -rf build
927 find . -name ' *.i2pkeys' -exec rm -vf {} \;
1028 find . -name ' *i2pconfig' -exec rm -vf {} \;
1129
12- install : build
30+ # install plugin to ipfs plugin folder
31+ .PHONY : install
32+ install :
1333 mkdir -p $(IPFS_PATH ) /plugins
14- install -Dm700 go-ipfs-plugin-i2p-gateway.so " $( IPFS_PATH) /plugins/go-ipfs-plugin-i2p-gateway.so"
34+ install -Dm700 build/ go-ipfs-plugin-i2p-gateway.so " $( IPFS_PATH) /plugins/go-ipfs-plugin-i2p-gateway.so"
1535
36+ # grab tooling to deal with gx
37+ .PHONY : gx
1638gx :
1739 go get -u github.com/whyrusleeping/gx
1840 go get -u github.com/whyrusleeping/gx-go
1941 go get -u github.com/karalabe/ungx
2042
21- go-ipfs-plugin-i2p-gateway.so : plugin.go
22- $(GOCC ) build -buildmode=plugin
23- chmod +x " go-ipfs-plugin-i2p-gateway.so"
2443
44+ # build libp2p plugin
45+ .PHONY : plugin-libp2p
2546plugin-libp2p :
2647 $(GOCC ) build -a -tags libp2p -buildmode=plugin
2748
49+ # fetch dependencies
50+ .PHONY : deps
2851deps :
2952 go get -u github.com/RTradeLtd/go-garlic-tcp-transport
3053 go get -u github.com/RTradeLtd/go-ipfs-plugin-i2p-gateway/config
3154 $(GX_GO_PATH ) get github.com/RTradeLtd/go-ipfs-plugin-i2p-gateway
3255
33- clobber :
34- rm -rf $(GOPATH )
35-
36- b :
56+ # build i2p folder
57+ .PHONY : build-i2p
58+ build-i2p :
3759 go build ./i2p
3860
61+ # format i2p and config golang files
62+ .PHONY : fmt
3963fmt :
4064 find ./i2p ./config -name ' *.go' -exec gofmt -w {} \;
4165
66+ # run tests
67+ .PHONY : test
4268test :
4369 go test ./config -v
4470 go test ./i2p -v
4571
72+ # vet go code
73+ .PHONY : vet
4674vet :
4775 go vet ./config
4876 go vet ./i2p
4977
78+ # import gx ipfs
79+ .PHONY : import
5080import :
5181 gx import github.com/ipfs/go-ipfs
5282
83+ # completely rebuild vendor
5384.PHONY : vendor
5485vendor :
5586 # Nuke vendor directory
@@ -65,8 +96,4 @@ vendor:
6596 mv vendor/github.com/ipfs/go-ipfs/vendor/* vendor
6697
6798 # Remove problematic dependencies
68- find . -name test-vectors -type d -exec rm -r {} +
69-
70- .PHONY : ipfs
71- ipfs :
72- ( cd vendor/github.com/ipfs/go-ipfs/cmd/ipfs ; go build ; cp ipfs $( GOPATH) /bin)
99+ find . -name test-vectors -type d -exec rm -r {} +
0 commit comments