-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (43 loc) · 1.18 KB
/
Makefile
File metadata and controls
61 lines (43 loc) · 1.18 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
.PHONY: all distclean clean info compile doc install
REBAR3_URL = https://s3.amazonaws.com/rebar3/rebar3
# If there is a rebar in the current directory, use it
ifeq ($(wildcard rebar3),rebar3)
REBAR = $(CURDIR)/rebar3
endif
# Fallback to rebar on PATH
REBAR ?= $(shell which rebar3)
# And finally, prep to download rebar if all else fails
ifeq ($(REBAR),)
REBAR = $(CURDIR)/rebar3
endif
#
# Check for required packages
#
REQUIRED_PKGS := \
erl \
dialyzer
_ := $(foreach pkg,$(REQUIRED_PACKAGES),\
$(if $(shell which $(pkg)),\
$(error Missing required package $(pkg)),))
ERLANG_VER=$(shell erl -noinput -eval 'io:put_chars(erlang:system_info(system_version)),halt().')
QDHSERV := _build/default/bin/qdhserv
all: compile
$(QDHSERV): src/*
$(REBAR) do clean, escriptize
clean: $(REBAR)
$(REBAR) clean --all
distclean:
@rm -rf _build
compile: $(QDHSERV)
info: $(REBAR)
@echo 'Erlang/OTP system version: $(ERLANG_VER)'
@$(REBAR) --version
doc: $(QDHSERV)
$(REBAR) edoc
install: $(QDHSERV)
install -d $(DESTDIR)/usr/local/bin
install -m755 $< $(DESTDIR)/usr/local/bin
$(REBAR):
curl -s -Lo rebar3 $(REBAR3_URL) || wget $(REBAR3_URL)
chmod a+x $(REBAR)
# ex: ts=4 sts=4 sw=4 noet