fixeria has uploaded this change for review.

View Change

Makefile: add 'install' target, use it in debian/rules

Change-Id: I0769ca5f922a41f2b0976bf283176040aae4c781
Related: OS#6148
---
M Makefile
M debian/rules
2 files changed, 25 insertions(+), 6 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/erlang/osmo_dia2gsup refs/changes/27/37727/1
diff --git a/Makefile b/Makefile
index a79ccae..be00efd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,9 @@
+# config file used by 'run' and 'shell'
CONFIG ?= examples/dev.config
+# directory paths for 'install'
+BINDIR ?= /usr/bin
+CONFDIR ?= /etc/osmocom
+SYSTEMDUNITDIR ?= /lib/systemd/system/

all: build

@@ -18,6 +23,14 @@
analyze:
rebar3 dialyzer

+install: build
+ install -d $(DESTDIR)$(BINDIR)
+ install -d $(DESTDIR)$(CONFDIR)
+ install -d $(DESTDIR)$(SYSTEMDUNITDIR)
+ install -m 0755 _build/default/bin/osmo-dia2gsup $(DESTDIR)$(BINDIR)
+ install -m 0644 -T examples/sys.config $(DESTDIR)$(CONFDIR)/osmo-dia2gsup.config
+ install -m 0644 contrib/systemd/osmo_dia2gsup.service $(DESTDIR)$(SYSTEMDUNITDIR)
+
clean:
# Avoid running rebar3 clean if _build doesn't exist, since it would try
# to fetch deps from the Internet and that may not be avaialble when in
diff --git a/debian/rules b/debian/rules
index 682631d..2921cb0 100755
--- a/debian/rules
+++ b/debian/rules
@@ -10,12 +10,8 @@
override_dh_auto_build:
if [ -e build_dep.tar.gz ] ; then tar xzf ./build_dep.tar.gz ; fi
dh_auto_build
- rebar3 compile
- rebar3 escriptize
- rebar3 eunit
- cp examples/sys.config examples/osmo-dia2gsup.config
+ make build install

override_dh_clean:
dh_clean
- rm -rf _build _checkouts
- rm -f examples/osmo-dia2gsup.config
+ make clean

To view, visit change 37727. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: erlang/osmo_dia2gsup
Gerrit-Branch: master
Gerrit-Change-Id: I0769ca5f922a41f2b0976bf283176040aae4c781
Gerrit-Change-Number: 37727
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>
Gerrit-MessageType: newchange