# The implementation of the configurable make options.
#
# Oracle Linux DTrace.
# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at
# http://oss.oracle.com/licenses/upl.

debugging ?= no
dof_dbg ?= no
coverage ?= no
verbose ?= no
libfuse2 ?= no

help-options::
	@printf "Options:\n\n" >&2
	@printf "make debugging=yes [targets]\tDisable optimization to make debugger use easier\n" >&2
	@printf "make coverage=yes [targets]\tTurn on coverage support in the testsuite\n" >&2
	@printf "make verbose=yes [target]\tEnable verbose building\n" >&2
	@printf "make dof_dbg=yes [targets]\tTurn on especially noisy DOF parser debugging\n\n" >&2

help-dependencies::
	@printf "Dependencies:\n\n" >&2
	@printf "make libfuse2=yes [targets]\tBuild against libfuse 2 even if libfuse 3 is found\n\n" >&2

help:: help-options help-dependencies

ifneq ($(debugging),no)
override CFLAGS += -O0 -g
endif

ifneq ($(dof_dbg),no)
override CFLAGS += -DDOF_DEBUG
endif

ifneq ($(coverage),no)
override CFLAGS += -O0 --coverage
override LDFLAGS += --coverage
endif

ifeq ($(verbose),no)
override MAKEFLAGS += --silent
endif

ifneq ($(libfuse2),no)
override WANTS_LIBFUSE2 = yes
endif
