Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Makefile 2.12 KiB
# ** 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.


CLANG_FORMAT ?= clang-format-11
CONAN_SETTINGS = "compiler.libcxx=libstdc++11"

# OS specific handling, with code by Ken Jackson and oHo,
# from https://stackoverflow.com/a/52062069/232888 and
# https://stackoverflow.com/a/14777895/232888
ifeq '$(findstring ;,$(PATH))' ';'
	DETECTED_OS := Windows
else
	DETECTED_OS := $(shell uname 2>/dev/null || echo Unknown)
	DETECTED_OS := $(patsubst CYGWIN%,Cygwin,$(DETECTED_OS))
	DETECTED_OS := $(patsubst MSYS%,MSYS,$(DETECTED_OS))
	DETECTED_OS := $(patsubst MINGW%,MSYS,$(DETECTED_OS))
endif
ifeq ($(DETECTED_OS),Darwin)  # Test if we are on MacOS
	CONAN_SETTINGS := "compiler.cppstd=17"
endif


.PHONY: help
help:
	@echo "Targets:"
	@echo "    conan-install - Install locally with Conan."
	@echo "    style - auto-format the source files."

style:
	$(CLANG_FORMAT) -i --verbose \
	 $$(find test/ src/ include/ -type f -iname "*.cpp" -o -iname "*.h" -o -iname "*.h.in")
.PHONY: style

conan-install:
	conan install . -s $(CONAN_SETTINGS) || \
	  (echo "'conan install' failed, trying to build from sources..."; \
	   conan install . -s $(CONAN_SETTINGS) --build=missing)
.PHONY: conan-install

conan-create:
	conan create . -s $(CONAN_SETTINGS)
.PHONY: conan-create

conan: conan-install conan-create
.PHONY: conan