diff --git a/Makefile b/Makefile index 829304c..d8381e2 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,28 @@ -GOPATH := $(PWD) +# Use shadowsocks as command prefix to avoid name conflict +# Maybe ss-local/server is better because easier to type +PREFIX := shadowsocks +LOCAL := $(GOBIN)/$(PREFIX)-local +SERVER := $(GOBIN)/$(PREFIX)-server +TEST := $(GOBIN)/$(PREFIX)-test -all: bin/local bin/server bin/test +# TODO define the install package path for use in clean and detect whether +# package need re-build + +all: $(LOCAL) $(SERVER) $(TEST) .PHONY: clean clean: - rm -rf bin/* pkg/* + rm -rf $(LOCAL) $(SERVER) $(TEST) -bin/local: src/shadowsocks/*.go src/local/*.go - go install local +$(LOCAL): shadowsocks/*.go cmd/$(PREFIX)-local/*.go + cd shadowsocks; go install + cd cmd/$(PREFIX)-local; go install -bin/server: src/shadowsocks/*.go src/server/*.go - go install server +$(SERVER): shadowsocks/*.go cmd/$(PREFIX)-server/*.go + cd shadowsocks; go install + cd cmd/$(PREFIX)-server; go install -bin/test: src/shadowsocks/*.go src/test/*.go - go install test +$(TEST): shadowsocks/*.go cmd/$(PREFIX)-test/*.go + cd shadowsocks; go install + cd cmd/$(PREFIX)-test; go install diff --git a/src/local/local.go b/cmd/shadowsocks-local/local.go similarity index 97% rename from src/local/local.go rename to cmd/shadowsocks-local/local.go index afec318..5fea382 100644 --- a/src/local/local.go +++ b/cmd/shadowsocks-local/local.go @@ -4,7 +4,7 @@ import ( "fmt" "log" "net" - "shadowsocks" + "github.com/cyfdecyf/shadowsocks-go/shadowsocks" ) func handleConnection(conn net.Conn, server string) { diff --git a/src/server/server.go b/cmd/shadowsocks-server/server.go similarity index 97% rename from src/server/server.go rename to cmd/shadowsocks-server/server.go index 5cc9676..48305ca 100644 --- a/src/server/server.go +++ b/cmd/shadowsocks-server/server.go @@ -6,7 +6,7 @@ import ( "fmt" "log" "net" - "shadowsocks" + "github.com/cyfdecyf/shadowsocks-go/shadowsocks" ) func handleConnection(conn shadowsocks.Conn) { diff --git a/src/test/test.go b/cmd/shadowsocks-test/test.go similarity index 99% rename from src/test/test.go rename to cmd/shadowsocks-test/test.go index ccce068..a0a756a 100644 --- a/src/test/test.go +++ b/cmd/shadowsocks-test/test.go @@ -1,7 +1,7 @@ package main import ( - "shadowsocks" + "github.com/cyfdecyf/shadowsocks-go/shadowsocks" "log" ) diff --git a/src/shadowsocks/config.go b/shadowsocks/config.go similarity index 100% rename from src/shadowsocks/config.go rename to shadowsocks/config.go diff --git a/src/shadowsocks/conn.go b/shadowsocks/conn.go similarity index 100% rename from src/shadowsocks/conn.go rename to shadowsocks/conn.go diff --git a/src/shadowsocks/encrypt.go b/shadowsocks/encrypt.go similarity index 100% rename from src/shadowsocks/encrypt.go rename to shadowsocks/encrypt.go diff --git a/src/shadowsocks/mergesort.go b/shadowsocks/mergesort.go similarity index 100% rename from src/shadowsocks/mergesort.go rename to shadowsocks/mergesort.go diff --git a/src/shadowsocks/pipe.go b/shadowsocks/pipe.go similarity index 100% rename from src/shadowsocks/pipe.go rename to shadowsocks/pipe.go