fixeria submitted this change.

View Change

Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve
Makefile: add REBAR_BASE_DIR variable

This allows building and running osmo-s1gw out-of-tree.

Change-Id: I7b6984c22253da69c0bda79ea8bef9608b2509cd
Related: SYS#7332
---
M Makefile
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index ad7b531..1f37da5 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 ?= config/sys.config
# arguments passed to eunit, used by 'check'
@@ -19,7 +21,7 @@
rebar3 escriptize

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

shell: build
rebar3 shell --config $(CONFIG)
@@ -39,13 +41,13 @@
$(DESTDIR)$(SYSTEMDUNITDIR)/osmo-s1gw.service

clean:
-# Avoid running rebar3 clean if _build doesn't exist, since it would try
+# 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 _build/.*)", "")
+ifneq ("$(wildcard $(REBAR_BASE_DIR)/.*)", "")
rebar3 asn clean
rebar3 clean
- rm -rf _build/
+ rm -rf $(REBAR_BASE_DIR)
else
rm -f $(GEN_FILES)
endif

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

Gerrit-MessageType: merged
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: I7b6984c22253da69c0bda79ea8bef9608b2509cd
Gerrit-Change-Number: 40776
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>