forked from oleiade/trousseau
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (50 loc) · 1.09 KB
/
Copy pathMakefile
File metadata and controls
67 lines (50 loc) · 1.09 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#
# VARIABLES
#
#
# Golang packages definition
#
PROJECT_PACKAGE = github.com/oleiade/trousseau
TROUSSEAU_PACKAGE = github.com/oleiade/trousseau/trousseau
#
# Directories
#
GOPATH_DIR = $(CURDIR)/.gopath
SRC_DIR = $(GOPATH_DIR)/src
BIN_DIR = $(CURDIR)/bin
PROJECT_DIR = $(SRC_DIR)/$(PROJECT_PACKAGE)
TROUSSEAU_DIR = $(SRC_DIR)/$(TROUSSEAU_PACKAGE)
#
# Executables definition
#
TROUSSEAU_BIN = $(BIN_DIR)/trousseau
#
# GOPATH definition
#
GOPATH ?= $(GOPATH_DIR)
export GOPATH
#
# Compilations options
#
GO_OPTIONS = -a
#
# Compilation rules
#
all: $(TROUSSEAU_BIN)
$(TROUSSEAU_BIN): $(TROUSSEAU_DIR)
@mkdir -p $(dir $@)
@cd $<; go build -o $@
@echo $@ created.
$(PROJECT_DIR):
@mkdir -p $(dir $@)
@if [ -h $@ ]; then rm -f $@; fi; ln -sf $(CURDIR)/ $@
$(TROUSSEAU_DIR): $(PROJECT_DIR)
@cd $<; go get -d
clean:
@rm -rf $(dir $(TROUSSEAU_BIN))
ifeq ($(GOPATH), $(BUILD_DIR))
@rm -rf $(BUILD_DIR)
else ifneq ($(PROJECT_DIR), $(realpath $(PROJECT_DIR)))
@rm -f $(PROJECT_DIR)
endif
.PHONY: all clean $(TROUSSEAU_BIN) $(TROUSSEAU_DIR) $(PROJECT_DIR)