-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
60 lines (45 loc) · 1.62 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
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
PROGRAM_NAME := $(shell basename $(shell pwd))
VERSION := $(shell git describe --dirty=+)
ifndef GOCOMPILER
GOCOMPILER = go build $(GOFLAGS)
endif
# If the root and prefix are not yet defined, define them here.
ifndef DESTDIR
DESTDIR = /
endif
ifndef prefix
prefix = usr/local
endif
GOFLAGS += -ldflags "-X main.Version $(VERSION) \
-X main.defaultResLocation $(DESTDIR)/$(prefix)/share/nodeatlas/ \
-X main.defaultConfLocation $(DESTDIR)etc/nodeatlas.conf"
.PHONY: all install clean deps
# DEPS are non-hidden files found in the assets directory. Because we
# are using the glob rather than `wildcard`, this rule is *not*
# skipped when there are no visible files in the deps directory.
DEPSFILE := depslist
DEPS := res/web/assets/*
all: $(DEPS) $(PROGRAM_NAME)
$(PROGRAM_NAME): $(wildcard *.go)
$(GOCOMPILER)
# Download dependencies if the dependency list has changed more
# recently than the directory (or the directory is empty).
$(DEPS): $(DEPSFILE)
@- $(RM) $(wildcard $(DEPS))
- ./getdeps.sh
install: all
test -d $(DESTDIR)/$(prefix)/bin || mkdir -p $(DESTDIR)/$(prefix)/bin
test -d $(DESTDIR)/$(prefix)/share/nodeatlas || \
mkdir -p $(DESTDIR)/$(prefix)/share/nodeatlas
install -m 0755 $(PROGRAM_NAME) $(DESTDIR)/$(prefix)/bin/nodeatlas
rm -rf $(DESTDIR)/$(prefix)/share/nodeatlas
cp --no-preserve=all -r res $(DESTDIR)/$(prefix)/share/nodeatlas
clean:
@- $(RM) $(PROGRAM_NAME) $(DEPS)
pkg_arch:
mkdir -p build
sed "s/pkgver=.*/pkgver=$(shell git describe | sed \
's/-/_/g')/" < packaging/PKGBUILD \
| sed 's/$${_gitver}/'$(shell git rev-parse HEAD)/g > build/PKGBUILD
updpkgsums build/PKGBUILD
# vim: set noexpandtab: