on engine-data help sign in
searx/utils/makefile.include
142 lines 4.5 kB history raw
1# -*- coding: utf-8; mode: makefile-gmake -*-
3ifeq (,$(wildcard /.lxcenv.mk))
4PHONY += lxc-activate lxc-purge
5lxc-activate:
6 @$(MAKE) -s -f "$$(dirname $(abspath $(lastword $(MAKEFILE_LIST))))/makefile.lxc" lxc-activate
7lxc-purge:
8 $(Q)rm -rf ./lxc-env
9else
10 include /.lxcenv.mk
11endif
13ifeq (,$(wildcard /.lxcenv.mk))
14make-help:
15else
16make-help: lxc-help
17endif
18 @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
19 @echo ' make V=2 [targets] 2 => give reason for rebuild of target'
21quiet_cmd_common_clean = CLEAN $@
22 cmd_common_clean = \
23 find . -name '*.orig' -exec rm -f {} + ;\
24 find . -name '*.rej' -exec rm -f {} + ;\
25 find . -name '*~' -exec rm -f {} + ;\
26 find . -name '*.bak' -exec rm -f {} + ;\
28FMT = cat
29ifeq ($(shell which fmt >/dev/null 2>&1; echo $$?), 0)
30FMT = fmt
31endif
33# MS-Windows
35# For a minimal *make-environment*, I'am using the gnu-tools from:
37# - GNU MCU Eclipse Windows Build Tools, which brings 'make', 'rm' etc.
38# https://github.com/gnu-mcu-eclipse/windows-build-tools/releases
40# - git for Windows, which brings 'find', 'grep' etc.
41# https://git-scm.com/download/win
44# normpath
46# System-dependent normalization of the path name
48# usage: $(call normpath,/path/to/file)
50normpath = $1
51ifeq ($(OS),Windows_NT)
52 normpath = $(subst /,\,$1)
53endif
56# stolen from linux/Makefile
59ifeq ("$(origin V)", "command line")
60 KBUILD_VERBOSE = $(V)
61endif
62ifndef KBUILD_VERBOSE
63 KBUILD_VERBOSE = 0
64endif
66ifeq ($(KBUILD_VERBOSE),1)
67 quiet =
68 Q =
69else
70 quiet=quiet_
71 Q = @
72endif
74# stolen from linux/scripts/Kbuild.include
77# Convenient variables
78comma := ,
79quote := "
80#" this comment is only for emacs highlighting
81squote := '
82#' this comment is only for emacs highlighting
83empty :=
84space := $(empty) $(empty)
85space_escape := _-_SPACE_-_
87# Find any prerequisites that is newer than target or that does not exist.
88# PHONY targets skipped in both cases.
89any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)
91###
92# why - tell why a a target got build
93# enabled by make V=2
94# Output (listed in the order they are checked):
95# (1) - due to target is PHONY
96# (2) - due to target missing
97# (3) - due to: file1.h file2.h
98# (4) - due to command line change
99# (5) - due to missing .cmd file
100# (6) - due to target not in $(targets)
101# (1) PHONY targets are always build
102# (2) No target, so we better build it
103# (3) Prerequisite is newer than target
104# (4) The command line stored in the file named dir/.target.cmd
105# differed from actual command line. This happens when compiler
106# options changes
107# (5) No dir/.target.cmd file (used to store command line)
108# (6) No dir/.target.cmd file and target not listed in $(targets)
109# This is a good hint that there is a bug in the kbuild file
110ifeq ($(KBUILD_VERBOSE),2)
111why = \
112 $(if $(filter $@, $(PHONY)),- due to target is PHONY, \
113 $(if $(wildcard $@), \
114 $(if $(strip $(any-prereq)),- due to: $(any-prereq), \
115 $(if $(arg-check), \
116 $(if $(cmd_$@),- due to command line change, \
117 $(if $(filter $@, $(targets)), \
118 - due to missing .cmd file, \
119 - due to $(notdir $@) not in $$(targets) \
120 ) \
121 ) \
122 ) \
123 ), \
124 - due to target missing \
125 ) \
126 )
128echo-why = $(call escsq, $(strip $(why)))
129endif
131###
132# Escape single quote for use in echo statements
133escsq = $(subst $(squote),'\$(squote)',$1)
135# echo command.
136# Short version is used, if $(quiet) equals `quiet_', otherwise full one.
137echo-cmd = $(if $($(quiet)cmd_$(1)),echo '$(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';)
139# printing commands
140cmd = @$(echo-cmd) $(cmd_$(1))
142.PHONY: $(PHONY)