makefile: Add a basic makefile wrapping rebar3 commands
This basic makefile allows for easy integration with the deb helper packaging tools. It is not particularly sophisticated or efficient, and could probably be simplified/improved by someone more familiar with make and/or autotools. I attempted to leave most dependency management logic within rebar3, relying on it to execute the correct dependency commands and track which objects need to be rebuilt rather than specifying them within make. Change-Id: Id2ba6d37cfab9fcb6c3c12ad4a27c4878d111bb9
This commit is contained in:
parent
6ac795b254
commit
654ebc02fe
|
@ -0,0 +1,98 @@
|
|||
# Simple shim makefile wrapping a rebar3 toolchain
|
||||
#
|
||||
# (C) 2020 Matt Johnson <matt9j@cs.washington.edu>
|
||||
#
|
||||
# All Rights Reserved
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Additional Permission under GNU AGPL version 3 section 7:
|
||||
#
|
||||
# If you modify this Program, or any covered work, by linking or
|
||||
# combining it with runtime libraries of Erlang/OTP as released by
|
||||
# Ericsson on http://www.erlang.org (or a modified version of these
|
||||
# libraries), containing parts covered by the terms of the Erlang Public
|
||||
# License (http://www.erlang.org/EPLICENSE), the licensors of this
|
||||
# Program grant you additional permission to convey the resulting work
|
||||
# without the need to license the runtime libraries of Erlang/OTP under
|
||||
# the GNU Affero General Public License. Corresponding Source for a
|
||||
# non-source form of such a combination shall include the source code
|
||||
# for the parts of the runtime libraries of Erlang/OTP used as well as
|
||||
# that of the covered work.
|
||||
|
||||
REBAR3?=$(shell which rebar3)
|
||||
|
||||
.PHONY: rebar3
|
||||
ifeq ($(REBAR3),)
|
||||
rebar3:
|
||||
$(info Install rebar3 from https://rebar3.org)
|
||||
$(error No rebar3 executable found on path. At least one target will fail)
|
||||
else
|
||||
rebar3:
|
||||
endif
|
||||
|
||||
.PHONY: all
|
||||
all: build test docs release
|
||||
$(info Extended tests skipped. To run all tests explicitly run `$$ make full-test`)
|
||||
|
||||
.PHONY: fetch
|
||||
fetch: rebar3
|
||||
@$(REBAR3) get-deps
|
||||
|
||||
.PHONY: build
|
||||
build: rebar3
|
||||
@$(REBAR3) compile
|
||||
|
||||
.PHONY: test
|
||||
test: rebar3
|
||||
@$(REBAR3) do eunit, cover, xref
|
||||
|
||||
.PHONY: full-test
|
||||
full-test: test rebar3
|
||||
@$(REBAR3) dialyzer
|
||||
|
||||
.PHONY: dev-release
|
||||
dev-release: rebar3
|
||||
@$(REBAR3) release -n dev
|
||||
|
||||
.PHONY: release
|
||||
release: rebar3
|
||||
@$(REBAR3) release -n prod
|
||||
|
||||
.PHONY: docs
|
||||
docs: rebar3
|
||||
@$(REBAR3) edoc
|
||||
|
||||
.PHONY: clean
|
||||
clean: rebar3
|
||||
@$(REBAR3) clean
|
||||
|
||||
.PHONY: distclean
|
||||
distclean: rebar3
|
||||
@$(REBAR3) clean --all
|
||||
-rm -r _build/default/rel
|
||||
|
||||
PREFIX=/usr/share
|
||||
SYSTEMD_PREFIX=/usr/lib/systemd/system
|
||||
.PHONY: install
|
||||
install: release
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/osmo_dia2gsup
|
||||
cp -r _build/default/rel/prod/* $(DESTDIR)$(PREFIX)/osmo_dia2gsup
|
||||
mkdir -p $(DESTDIR)$(SYSTEMD_PREFIX)
|
||||
cp contrib/systemd/osmo-dia2gsup.service $(DESTDIR)$(SYSTEMD_PREFIX)
|
||||
|
||||
.PHONY: uninstall
|
||||
uninstall:
|
||||
rm -r $(DESTDIR)$(PREFIX)/osmo_dia2gsup
|
||||
rm $(DESTDIR)$(SYSTEMD_PREFIX)/osmo-dia2gsup.service
|
Loading…
Reference in New Issue