]>
Commit | Line | Data |
---|---|---|
f892ac66 MTL |
1 | define get-config |
2 | $(shell git config --local --get "shim.$(1)") | |
3 | endef | |
031e5cce SM |
4 | |
5 | define add-vendor-sbat | |
6 | $(OBJCOPY) --add-section ".$(patsubst %.csv,%,$(1))=$(1)" $(2) | |
7 | ||
8 | endef | |
9 | ||
10 | # true if the strings are the same | |
11 | define str-eq | |
12 | $(if $(subst $(1),,$(2)),,$(1)) | |
13 | endef | |
14 | ||
15 | # true if 1 is in 2 | |
16 | define has-flag | |
17 | $(if $(findstring $(space)$(1)$(space),$(space)$(2)$(space)),$(1)) | |
18 | endef | |
19 | ||
20 | # true if 1 is not in 2 | |
21 | define has-not-flag | |
22 | $(if $(call has-flag,$(1),$(2)),,$(1)) | |
23 | endef | |
24 | ||
25 | # if 1 is set and 2 isn't in the thing named by 3, | |
26 | # add 4 to the thing named by 3 | |
27 | define conditional-add-flag | |
28 | $(if $(and $(strip $(1)),$(strip $(call has-not-flag,$(2),$($(3))))),$(eval override $(value 3) += $(4))) | |
29 | endef | |
30 | ||
31 | # Add everything from DEFAULT_$(1) to $(1) if it isn't there (in whole) | |
32 | define update-variable | |
33 | $(strip $(foreach x,$(DEFAULT_$(1)), | |
34 | $(if $(call has-flag,$(x),$($(1))),, | |
35 | $(eval override $(1)+=$(x))))) | |
36 | endef | |
37 | ||
38 | # vim:filetype=make |