osmith has submitted this change. ( 
https://gerrit.osmocom.org/c/erlang/osmo_dia2gsup/+/40781?usp=email )

Change subject: Makefile: add REBAR_BASE_DIR variable
......................................................................

Makefile: add REBAR_BASE_DIR variable

This allows building and running osmo-dia2gsup out-of-tree. Specifically
it allows calling "make install" from osmo-dev, which it will do after
the related patch is merged.

Related: osmo-dev I92d6fc6eb5a11068d4b3baca55dfb3abdedbbbf1
Change-Id: I9511341bced7d658eacb34250569dfbfe37c084c
---
M Makefile
1 file changed, 9 insertions(+), 7 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved




diff --git a/Makefile b/Makefile
index 4fe7282..0033622 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,5 @@
+# where rebar3 stores build output
+REBAR_BASE_DIR ?= _build
 # config file used by 'run' and 'shell'
 CONFIG ?= examples/dev.config
 # directory paths for 'install'
@@ -12,7 +14,7 @@
        rebar3 escriptize

 run: build
-       ERL_FLAGS='-config $(CONFIG)' _build/default/bin/osmo-dia2gsup
+       ERL_FLAGS='-config $(CONFIG)' 
$(REBAR_BASE_DIR)/default/bin/osmo-dia2gsup

 shell: build
        rebar3 shell --config $(CONFIG)
@@ -24,7 +26,7 @@
        rebar3 dialyzer

 install: build
-       install -Dm0755 _build/default/bin/osmo-dia2gsup \
+       install -Dm0755 $(REBAR_BASE_DIR)/default/bin/osmo-dia2gsup \
                $(DESTDIR)$(BINDIR)/osmo-dia2gsup
        install -Dm0644 examples/sys.config \
                $(DESTDIR)$(CONFDIR)/osmo-dia2gsup.config
@@ -32,12 +34,12 @@
                $(DESTDIR)$(SYSTEMDUNITDIR)/osmo_dia2gsup.service

 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
-# OBS build.
-ifneq ("$(wildcard _build/.*)", "")
+# Avoid running rebar3 clean if $(REBAR_BASE_DIR) doesn't exist, since it would
+# try to fetch deps from the Internet and that may not be avaialble when in OBS
+# build.
+ifneq ("$(wildcard $(REBAR_BASE_DIR)/.*)", "")
        rebar3 clean
-       rm -rf _build/
+       rm -rf $(REBAR_BASE_DIR)
 else
        rm -f src/diameter_*.erl
 endif

--
To view, visit 
https://gerrit.osmocom.org/c/erlang/osmo_dia2gsup/+/40781?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: erlang/osmo_dia2gsup
Gerrit-Branch: master
Gerrit-Change-Id: I9511341bced7d658eacb34250569dfbfe37c084c
Gerrit-Change-Number: 40781
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osm...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanits...@sysmocom.de>
Gerrit-Reviewer: osmith <osm...@sysmocom.de>

Reply via email to