-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
syntax: $(KATI_visibility_prefix var, prefix) 1, Add a func KATI_visibility_prefix that takes a variable name and a list of strings, set this variable's visibility to these strings. Each string represents the relative path from the root, and is considered as prefix. e.g. $(KATI_visibility_prefix VAR, vendor/ device/b baz.mk) --> VAR is visible to "vendor/foo.mk", "device/bar.mk", "device/baz.mk", "baz.mk", but not visible to "bar.mk", "vendor.mk" or "vendor/baz.mk". If variable visibility is set more than once, and with a different list of strings, an error will occur. 2. When a variable is being referenced, if this variable has visibility prefix set, check if the current referencing file matches the visibility prefix. Throw an error if not. 3. In $(KATI_visibility_prefix FOO, prefix) If FOO is not defined, create a variable FOO with empty value. The prefix can also be reference to variable. If so, this function will expand the reference and set the visibility_prefix.
- Loading branch information
Showing
17 changed files
with
224 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
|
||
// +build ignore | ||
|
||
//#define ENABLE_TID_CHECK | ||
// #define ENABLE_TID_CHECK | ||
|
||
#include "symtab.h" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FOO := foo | ||
BAR := bar | ||
PREFIX := pone/ptwo | ||
|
||
$(KATI_visibility_prefix FOO, pone/ptwo baz) | ||
$(KATI_visibility_prefix FOO, $(PREFIX) baz) | ||
|
||
$(KATI_visibility_prefix BAR, pone/ptwo baz) | ||
$(KATI_visibility_prefix BAR, baz $(PREFIX)) | ||
|
||
ifndef KATI | ||
$(info Visibility prefix conflict on variable: BAR) | ||
endif | ||
|
||
test: | ||
@: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
$(KATI_visibility_prefix FOO, Makefile) | ||
|
||
BAR := $(FOO) | ||
|
||
test: | ||
echo '$(BAR)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
$(KATI_visibility_prefix BAR, bar) | ||
FOO = $(BAR) # this should be okay, since it's not evaluated | ||
BAZ := $(FOO) | ||
|
||
define ERROR_MSG | ||
Makefile is not a valid file to reference variable BAR. Line #3. | ||
Valid file prefixes: | ||
bar | ||
endef | ||
|
||
ifndef KATI | ||
$(info $(ERROR_MSG)) | ||
endif | ||
|
||
test: | ||
@: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FOO := foo | ||
BAR := bar | ||
$(KATI_visibility_prefix FOO, Makefile) | ||
$(KATI_visibility_prefix BAR, ) | ||
$(KATI_visibility_prefix BAZ, baz) | ||
|
||
VAR0 := $(FOO) | ||
VAR1 := $(BAR) | ||
VAR2 := $$(BAZ) | ||
VAR3 := $($(BAZ)) | ||
|
||
define ERROR_MSG | ||
Makefile is not a valid file to reference variable BAZ. Line #10. | ||
Valid file prefixes: | ||
baz | ||
endef | ||
|
||
ifndef KATI | ||
$(info $(ERROR_MSG)) | ||
endif | ||
|
||
test: | ||
@: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
$(KATI_visibility_prefix BAR, bar) | ||
FOO := BAR | ||
BAZ := $($(FOO)) | ||
|
||
define ERROR_MSG | ||
Makefile is not a valid file to reference variable BAR. Line #3. | ||
Valid file prefixes: | ||
bar | ||
endef | ||
|
||
ifndef KATI | ||
$(info $(ERROR_MSG)) | ||
endif | ||
|
||
test: | ||
@: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
$(KATI_visibility_prefix FOO, foo/) | ||
|
||
ifndef KATI | ||
$(info Makefile:1: Visibility prefix foo/ is not normalized. Normalized prefix: foo) | ||
endif | ||
|
||
test: | ||
@: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
$(KATI_visibility_prefix FOO, /foo) | ||
|
||
ifndef KATI | ||
$(info Makefile:1: Visibility prefix should not start with /) | ||
endif | ||
|
||
test: | ||
@: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
$(KATI_visibility_prefix FOO, foo fo) # no error, different path prefixes | ||
$(KATI_visibility_prefix Bar, bar/baz bar) | ||
|
||
ifndef KATI | ||
$(info Makefile:2: Visibility prefix bar is the prefix of another visibility prefix bar/baz) | ||
endif | ||
|
||
test: | ||
@: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
$(KATI_visibility_prefix FOO, foo ../foo) | ||
|
||
ifndef KATI | ||
$(info Makefile:1: Visibility prefix should not start with ../) | ||
endif | ||
|
||
test: | ||
@: |