forked from cloudamqp/amqproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (51 loc) · 1.67 KB
/
Makefile
File metadata and controls
64 lines (51 loc) · 1.67 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
SOURCES := $(shell find src/amqproxy -name '*.cr' 2> /dev/null)
LDFLAGS ?= -Wl,-O1 -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -pie
CRYSTAL_FLAGS ?= --release
override CRYSTAL_FLAGS += --error-on-warnings --link-flags="$(LDFLAGS)" --stats
.PHONY: all
all: bin/amqproxy
bin/%: src/%.cr $(SOURCES) lib | bin
crystal build $< -o $@ $(CRYSTAL_FLAGS)
lib: shard.yml shard.lock
shards install --production
bin man1:
mkdir -p $@
man1/amqproxy.1: bin/amqproxy | man1
help2man -Nn "connection pool for AMQP connections" $< -o $@
.PHONY: deps
deps: lib
.PHONY: lint
lint: lib
lib/ameba/bin/ameba src/
.PHONY: test
test: lib
crystal spec
.PHONY: format
format:
crystal tool format --check
DESTDIR :=
PREFIX := /usr
BINDIR := $(PREFIX)/bin
DOCDIR := $(PREFIX)/share/doc
MANDIR := $(PREFIX)/share/man
SYSCONFDIR := /etc
UNITDIR := /lib/systemd/system
.PHONY: install
install: bin/amqproxy man1/amqproxy.1 config/example.ini extras/amqproxy.service README.md CHANGELOG.md
install -D -m 0755 -t $(DESTDIR)$(BINDIR) bin/amqproxy
install -D -m 0644 -t $(DESTDIR)$(MANDIR)/man1 man1/amqproxy.1
install -D -m 0644 -t $(DESTDIR)$(UNITDIR) extras/amqproxy.service
install -D -m 0644 -t $(DESTDIR)$(DOCDIR)/amqproxy README.md
install -D -m 0644 config/example.ini $(DESTDIR)$(SYSCONFDIR)/amqproxy.ini
install -D -m 0644 CHANGELOG.md $(DESTDIR)$(DOCDIR)/amqproxy/changelog
.PHONY: uninstall
uninstall:
$(RM) $(DESTDIR)$(BINDIR)/amqproxy
$(RM) $(DESTDIR)$(MANDIR)/man1/amqproxy.1
$(RM) $(DESTDIR)$(SYSCONFDIR)/amqproxy/amqproxy.ini
$(RM) $(DESTDIR)$(UNITDIR)/amqproxy.service
$(RM) $(DESTDIR)$(DOCDIR)/amqproxy/{README.md,changelog}
$(RM) -r $(DESTDIR)$(DOCDIR)/amqproxy
.PHONY: clean
clean:
rm -rf bin