Newer
Older
# ** header v3.0
# This file is a part of the CaosDB Project.
#
# Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
# Copyright (C) 2021 Daniel Hornung <d.hornung@indiscale.com>
#
# 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 Affero 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 <https://www.gnu.org/licenses/>.
#
# ** end header
# This Makefile is a wrapper for several other scripts.
.PHONY: help
help:
@echo "Targets:"
@echo " pkg - create tar.gz archive of the octave package."
@echo " style - auto-format the source files."
@echo " test - run unit tests."
@echo " doc - create the documentation."
.PHONY: doc
doc:
###############################################################################
# Styling #
###############################################################################
style: style_octave style_cpp
style_octave:
mh_style --octave src doc test || echo "You may want to run `make style_fix`."
.PHONY: style_octave
style_cpp:
clang-format-11 --dry-run --verbose --Werror $(shell find test/ src/ -type f -iname "*.cpp" -o -iname "*.hpp" -o -iname "*.h" -o -iname "*.h.in") || echo "You may want to run `make style_fix`."
.PHONY: style_cpp
mh_style --fix --octave src doc test
clang-format-11 -i --verbose --Werror $(shell find test/ src/ -type f -iname "*.cpp" -o -iname "*.hpp" -o -iname "*.h" -o -iname "*.h.in")
.PHONY: style_fix
###############################################################################
# Linting #
###############################################################################
linting: linting_octave linting_cpp
.PHONY: linting
linting_octave:
mh_lint --octave ./
.PHONY: linting_octave
linting_cpp:
cd src \
&& ./configure \
&& cd ../build \
&& cmake -D LINTING=On .. \
&& cmake --build .
.PHONY: linting_cpp
###############################################################################
# Tests #
###############################################################################
###############################################################################
# Packaging and Installation #
###############################################################################
octave --eval "pkg install -verbose dist/caosdb.tar.gz"
dist/caosdb.tar.gz: dist/
tar -czf dist/caosdb.tar.gz \
--exclude=.git* \
--exclude=env* \
--exclude=doc/_build_octave* \
--exclude=build* \
--exclude=.docker* \
--exclude=dist* \
--exclude=inst* \
--exclude-ignore-recursive=.gitignore \
--transform 's,^\.,caosdb,' .
.PHONY: dist/
dist/:
mkdir -p dist