-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
36 lines (31 loc) · 1.22 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
# Find absolute path where Makedef resides with no difference how
# make utility is started (by current path, either with -C option).
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
# Take directories part path from absolute path to Makedef file.
mkfile_dir := $(dir $(mkfile_path))
current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
GOCMD=go
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
BINARY_NAME=gorsync
# Always reassign GOPATH here, because Makedef is used not only here, but in source archive file
# compile mode too. Move up by 4 folders from current dir to setup GOPATH as a point
# to root folder where src, bin, pkg folders are resided.
GOBUILD=eval 'GOPATH=$(mkfile_dir)../../../.. ./gorsync_build.sh --buildtype Release --output $(PWD)/$(BINARY_NAME)'
# GOBUILD=eval 'GOPATH=$(PWD) ./gorsync_build.sh --buildtype Release'
all: build
# Used for some debugging only.
print:
$(eval GOPATH=$(shell bash -c 'echo ${PWD%/*/*/*}'))
echo $(GOPATH)
$(eval GOPATH=$(shell bash -c "echo ${PWD}"))
echo $(GOPATH)
echo ../..$(GOPATH)
# echo '${PWD%/*/*/*}'
# Main build entry
build:
$(GOBUILD)
# Delete application binary from current folder and from $GOPATH/bin (if present).
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)