on acefa65 help sign in
searx/utils/makefile.include
103 lines 3.6 kB history raw
1# -*- coding: utf-8; mode: makefile-gmake -*-
2# SPDX-License-Identifier: AGPL-3.0-or-later
4ifeq (,$(wildcard /.lxcenv.mk))
5PHONY += lxc-activate lxc-purge
6lxc-activate:
7 @$(MAKE) -s -f "$$(dirname $(abspath $(lastword $(MAKEFILE_LIST))))/makefile.lxc" lxc-activate
8lxc-purge:
9 $(Q)rm -rf ./lxc-env
10else
11 include /.lxcenv.mk
12endif
14PHONY += make-help
15ifeq (,$(wildcard /.lxcenv.mk))
16make-help:
17else
18make-help: lxc-help
19endif
20 @echo 'options:'
21 @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
22 @echo ' make V=2 [targets] 2 => give reason for rebuild of target'
24ifeq ("$(origin V)", "command line")
25 VERBOSE = $(V)
26endif
27ifndef VERBOSE
28 VERBOSE = 0
29endif
31export VERBOSE
33ifeq ($(VERBOSE),1)
34 quiet =
35 Q =
36else
37 quiet=quiet_
38 Q = @
39endif
41# stolen from linux/scripts/Kbuild.include
44# Convenient variables
45squote := '
46#' this comment is only for emacs highlighting
48# Find any prerequisites that is newer than target or that does not exist.
49# PHONY targets skipped in both cases.
50any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)
52###
53# why - tell why a a target got build
54# enabled by make V=2
55# Output (listed in the order they are checked):
56# (1) - due to target is PHONY
57# (2) - due to target missing
58# (3) - due to: file1.h file2.h
59# (4) - due to command line change
60# (5) - due to missing .cmd file
61# (6) - due to target not in $(targets)
62# (1) PHONY targets are always build
63# (2) No target, so we better build it
64# (3) Prerequisite is newer than target
65# (4) The command line stored in the file named dir/.target.cmd
66# differed from actual command line. This happens when compiler
67# options changes
68# (5) No dir/.target.cmd file (used to store command line)
69# (6) No dir/.target.cmd file and target not listed in $(targets)
70# This is a good hint that there is a bug in the kbuild file
71ifeq ($(VERBOSE),2)
72why = \
73 $(if $(filter $@, $(PHONY)),- due to target is PHONY, \
74 $(if $(wildcard $@), \
75 $(if $(strip $(any-prereq)),- due to: $(any-prereq), \
76 $(if $(arg-check), \
77 $(if $(cmd_$@),- due to command line change, \
78 $(if $(filter $@, $(targets)), \
79 - due to missing .cmd file, \
80 - due to $(notdir $@) not in $$(targets) \
81 ) \
82 ) \
83 ) \
84 ), \
85 - due to target missing \
86 ) \
87 )
89echo-why = $(call escsq, $(strip $(why)))
90endif
92###
93# Escape single quote for use in echo statements
94escsq = $(subst $(squote),'\$(squote)',$1)
96# echo command.
97# Short version is used, if $(quiet) equals `quiet_', otherwise full one.
98echo-cmd = $(if $($(quiet)cmd_$(1)),echo '$(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';)
100# printing commands
101cmd = @$(echo-cmd) $(cmd_$(1))
103.PHONY: $(PHONY)