upload android base code part3

This commit is contained in:
August 2018-08-08 16:48:17 +08:00
parent 71b83c22f1
commit b9e30e05b1
15122 changed files with 2089659 additions and 0 deletions

View file

@ -0,0 +1,6 @@
foo = $(abspath ./foo bar/../foo bar//..//foo / /usr)
bar = $(abspath .. ./. ./ /aa/.. a///)
test:
echo $(foo)
echo $(bar)

View file

@ -0,0 +1,2 @@
test:
echo $(addprefix src/,foo bar)

View file

@ -0,0 +1,2 @@
test:
echo $(addsuffix .c,foo bar)

View file

@ -0,0 +1,17 @@
TRUE:=foo
FALSE:=
XY:=x y
X:=$(subst y, ,$(XY))
Y:=$(subst x, ,$(XY))
$(and ${TRUE}, $(info PASS_1))
$(and ${FALSE}, $(info FAIL_2))
# Too many arguments.
$(info $(and ${TRUE}, PASS, PASS))
$(info $(and ${TRUE}, $(X) ))
$(info $(and ${TRUE}, $(Y) ))
$(and ${FALSE} , $(info FAIL_3))
test:
echo OK

View file

@ -0,0 +1,8 @@
x := one
x += two $(x)
$(info $(x))
# TODO: shouldn't crash.
#y = one
#y += two $(y)
#$(info $(y))

View file

@ -0,0 +1,8 @@
# This is an assignment.
X=Y
FOO=test:
# But this is a recipe.
$(FOO)
X=$(X)

View file

@ -0,0 +1,3 @@
$(foreach varname,x,$(eval $(varname)=PASS))
test:
echo $(x)

View file

@ -0,0 +1,11 @@
A = a
B = $(A)
C := $(A)
A = aa
D = b
D += b
E ?= c
E ?= d
test:
echo $(B) $(C) $(D) $(E)

View file

@ -0,0 +1,12 @@
a := Y # comment
$(info X$(a)Z)
a := Y
$(info X$(a)Z)
a := Y
$(info X$(a)Z)
sp := $(subst S, ,S)
a := Y$(sp)
$(info X$(a)Z)
a := $(sp)Y
$(info X$(a)Z)

View file

@ -0,0 +1,26 @@
test1:
mkdir adir bdir
touch adir/afile bdir/bfile afile bfile
test2: tdir/tfile tfile
tdir/tfile: adir/afile bdir/bfile
echo $(@D)
echo $(@F)
echo $(<D)
echo $(<F)
echo $(^D)
echo $(^F)
echo $(+D)
echo $(+F)
mkdir -p tdir # for ninja.
tfile: afile bfile
echo $(@D)
echo $(@F)
echo $(<D)
echo $(<F)
echo $(^D)
echo $(^F)
echo $(+D)
echo $(+F)

View file

@ -0,0 +1,17 @@
test1: foo bar foo
echo $<
echo $@
echo $^
echo $+
foo: baz
echo $<
bar:
echo $<
baz:
test2: foo bar foo
echo $^
echo $+

View file

@ -0,0 +1,15 @@
# TODO(c): Fix
x=FAIL
$(foreach x,FAIL PASS,$(eval x+=$(x)))
# x will leak if assigned.
$(info $(x))
$(info $(flavor x))
$(info $(origin x))
x=PASS
$(foreach x,FAIL,)
# x won't leak
$(info $(x))
$(info $(flavor x))
$(info $(origin x))

View file

@ -0,0 +1,4 @@
A:=X \
test:
echo PASS

View file

@ -0,0 +1,3 @@
test:
echo \ " #"

View file

@ -0,0 +1,2 @@
test:;echo foo\
bar

View file

@ -0,0 +1,2 @@
test:
echo $(basename src/foo.c src-1.0/bar hacks)

View file

@ -0,0 +1,8 @@
test1: foo
echo test1
test2: foo
echo test2
foo:
echo foo > $@

View file

@ -0,0 +1,4 @@
test: foo
foo:
echo foo

View file

@ -0,0 +1,4 @@
VAR=var
test:
echo $(VAR)

View file

@ -0,0 +1,5 @@
# TODO(c|go-ninja): "include: Command not found" should come before "*** [test] Error 127."
test:
include foo

View file

@ -0,0 +1,30 @@
# expect protoc compile/link only once.
test: foo
foo: foo.o bar.o
echo link $@ from $<
%.o: %.c FORCE_DO_CMD
echo compile $@ from $<
.PHONY: FORCE_DO_CMD
FORCE_DO_CMD:
foo.c: | protoc
foo.c: foo.proto
echo protoc $@ from $<
foo.proto:
bar.c: | protoc
bar.c: bar.proto
echo protoc $@ from $<
bar.proto:
protoc: proto.o
echo link $@ from $<
proto.c:

View file

@ -0,0 +1,11 @@
CFLAGS:=-g
CXXFLAGS:=-O
TARGET_ARCH:=-O2
CPPFLAGS:=-S
test1:
touch foo.c bar.cc
test2: foo.o bar.o
# TODO: Add more builtin rules.

View file

@ -0,0 +1,6 @@
test:
echo $(CC)
echo $(CXX)
echo $(SHELL)
# TODO: Add more builtin vars.

View file

@ -0,0 +1,16 @@
# from gyp-generated Makefile
empty :=
space := $(empty) $(empty)
replace_spaces = $(subst $(space),?,$1)
unreplace_spaces = $(subst ?,$(space),$1)
dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1)))
test: foo
echo $(call dirx,foo/bar)
echo $(call dirx,foo bar/baz quux)
echo $(call dirx,foo,bar)
foo:
mkdir foo "foo bar"

View file

@ -0,0 +1,6 @@
define func
$(11)$(12)$(13)$(14)
endef
test:
echo $(call func,1,2,3,4,5,6,7,8,9,10,P,A,S,S)

View file

@ -0,0 +1,9 @@
func = $(info called with '$(1)')
test = $(call $(1),$(1))
$(call test,func)
$(call test, func)
$(call test,func )
$(call test, func )
test:

View file

@ -0,0 +1,10 @@
# http://www.gnu.org/software/make/manual/make.html#Canned-Recipes
# canned recipes are used in gyp-generated Makefile (fixup_dep etc)
define run-echo
echo $@
endef
test:
$(run-echo)

View file

@ -0,0 +1,20 @@
# TODO(ninja): Fix?
test: self loop not_circular1 not_circular2
echo PASS
self: self
echo $@
loop: loop1
echo $@
loop1: loop2
echo $@
loop2: loop
echo $@
not_circular1: Makefile
not_circular2: Makefile

View file

@ -0,0 +1,3 @@
$(info }#)
test:
echo OK

View file

@ -0,0 +1,27 @@
#!/bin/sh
#
# Copyright 2016 Google Inc. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
mk="$@"
cat <<EOF > Makefile
CLVAR := FAIL
all:
@echo \$(CLVAR)
EOF
${mk} CLVAR:=PASS 2> /dev/null

View file

@ -0,0 +1,36 @@
#!/bin/sh
#
# Copyright 2016 Google Inc. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
mk="$@"
cat <<EOF > Makefile
CLVAR := FAIL
MFVAR := FAIL
FILEVAR := PASS
all:
@echo \$(ENVVAR) \$(origin ENVVAR)
@echo \$(MFVAR) \$(origin MFVAR)
@echo \$(CLVAR) \$(origin CLVAR)
@echo \$(FILEVAR) \$(origin FILEVAR)
EOF
export ENVVAR=PASS
export FILEVAR=FAIL
export MAKEFLAGS="MFVAR=PASS CLVAR=FAIL"
${mk} CLVAR=PASS 2> /dev/null

View file

@ -0,0 +1,27 @@
#!/bin/sh
#
# Copyright 2016 Google Inc. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
mk="$@"
cat <<EOF > Makefile
CLVAR := FAIL
all:
@echo \$(CLVAR)
EOF
${mk} CLVAR:=P CLVAR+=A CLVAR+=SS CLVAR?=FAIL 2> /dev/null

View file

@ -0,0 +1,27 @@
#!/bin/sh
#
# Copyright 2016 Google Inc. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
mk="$@"
cat <<EOF > Makefile
override CLVAR := PASS
all:
@echo \$(CLVAR)
EOF
${mk} CLVAR:=FAIL 2> /dev/null

View file

@ -0,0 +1,6 @@
# TODO(c): Fix
test: a\ b a\:b
a%:
echo $@

View file

@ -0,0 +1,10 @@
# TODO(c): Fix
test: a\ b
echo $@ / $<
a\ b: a\:b
echo $@ / $<
a\\\:b:
echo a\\\:b $@

View file

@ -0,0 +1,9 @@
test: foo
foo: bar baz
echo $@
echo $<
echo $^
bar:
baz:

View file

@ -0,0 +1,6 @@
FOO=OK # A comment
# A multiline comment \
FOO=fail
test:
echo $(FOO)

View file

@ -0,0 +1,27 @@
MAKEVER:=$(shell make --version | ruby -n0e 'puts $$_[/Make (\d)/,1]')
test1:
# foo
echo PASS
test2: make$(MAKEVER)
make4:
# foo \
echo PASS
make3:
# foo \
echo PASS
test3: $(shell echo foo #)
test4:
echo $(shell echo OK # FAIL \
FAIL2)
test5:
echo $(shell echo $$(echo PASS))
foo:
echo OK

View file

@ -0,0 +1,9 @@
define comment
# PASS
endef
a:=$(comment)
foo:
$(comment)
echo $(a)

View file

@ -0,0 +1,88 @@
VAR=var
VARREF=VAR
EMPTY=
UNDEFREF=UNDEFINED
RESULT=
ifdef VAR
RESULT += PASS
endif
ifdef VAR
RESULT += PASS
else
RESULT += FAIL
endif
ifdef $(VARREF)
RESULT += PASS
else
RESULT += FAIL
endif
ifdef UNDEFINED
RESULT += FAIL
else
RESULT += PASS
endif
ifdef $(UNDEFREF)
RESULT += FAIL
else
RESULT += PASS
endif
ifdef EMPTY
RESULT += FAIL
else
RESULT += PASS
endif
ifndef VAR
RESULT += FAIL
else
RESULT += PASS
endif
ifndef $(VARREF)
RESULT += FAIL
else
RESULT += PASS
endif
ifndef UNDEFINED
RESULT += PASS
else
RESULT += FAIL
endif
ifndef $(UNDEFREF)
RESULT += PASS
else
RESULT += FAIL
endif
ifeq ($(VAR),var)
RESULT += PASS
else
RESULT += FAIL
endif
ifneq ($(VAR),var)
RESULT += FAIL
else
RESULT += PASS
endif
ifeq ($(UNDEFINED),)
RESULT += PASS
else
RESULT += FAIL
endif
ifeq (,$(UNDEFINED))
RESULT += PASS
else
RESULT += FAIL
endif
ifeq ($(VAR), var)
RESULT += PASS
else
RESULT += FAIL
endif
test:
echo $(RESULT)

View file

@ -0,0 +1,6 @@
PASS := \
PASS \
PASS
test:
echo $(PASS)

View file

@ -0,0 +1,7 @@
ifdef foo
else
$(info PASS)
endif
define foo
endef

View file

@ -0,0 +1,15 @@
srcdir := .
test: foo.o bar.o
echo linking $@ from $<
foo.o: $(srcdir)/foo.c
echo compiling $@ from $<
bar.o: $(srcdir)/bar.c
echo compiling $@ from $<
$(srcdir)/foo.c:
echo source $@
bar.c:
echo source $@

View file

@ -0,0 +1,13 @@
srcdir := .
test: foo.o bar.o
echo linking $@ from $<
%.o: $(srcdir)/%.c
echo compiling $@ from $<
$(srcdir)/foo.c:
echo source $@
bar.c:
echo source $@

View file

@ -0,0 +1,2 @@
test:
echo $(CURDIR)

View file

@ -0,0 +1,5 @@
abc:
echo PASS
def:
echo FAIL

View file

@ -0,0 +1,24 @@
# http://www.gnu.org/software/make/manual/make.html#Multi_002dLine
# Note: in make 4.x
# define name =
# ...
# endef
#
# but in make 3.x
# define name
# ...
# endef
# i.e. no = needed after name.
# make 3.x defines "name =" for make 4.x example.
# TODO: should we provide flag to specify gnu make version?
# note: in make 4.x, there is `undefine`.
define two-lines
echo foo
echo $(bar)
endef
bar = xxx
test:
echo BEGIN $(two-lines) END

View file

@ -0,0 +1,9 @@
define newline
endef
$(info This should have$(newline)two lines)
test:
echo OK

View file

@ -0,0 +1,10 @@
define multiline
for i in 1 2 3 PASS; do\
echo $$i; \
done
endef
test:
echo "$(multiline)"
$(multiline)

View file

@ -0,0 +1,32 @@
define define_with_space
PASS1
endef
define define_with_comment # foo
PASS2
endef
define endef_with_comment
PASS3
endef # boo
define endef_with_not_comment
PASS4
endef bar
define endef_with_not_comment2
PASS5
endef baz
define endef_with_not_endef
endefPASS
endef
define with_immediate_comment#comment
PASS6
endef
# Note: for some reason, the following is an error.
#endef#comment
test:
echo $(define_with_space)
echo $(define_with_comment)
echo $(endef_with_comment)
echo $(endef_with_not_comment)
echo $(endef_with_not_comment2)
echo $(endef_with_not_endef)
echo $(with_immediate_comment)

View file

@ -0,0 +1,9 @@
# TODO: Fix for non-ninja mode.
.DELETE_ON_ERROR:
test: file
file:
touch $@
false

View file

@ -0,0 +1,13 @@
test: foo
echo $(dir foo)
echo $(dir foo,bar)
echo $(dir .)
echo $(dir )
echo $(dir src/foo.c hacks)
echo $(dir hacks src/foo.c)
echo $(dir /)
echo $(dir /foo)
foo:
mkdir foo bar

View file

@ -0,0 +1,7 @@
ifndef UNDEF
test:
echo PASS
DUMMY:=
else
endif

View file

@ -0,0 +1,5 @@
test: $$testfile
ls *testfile
$$testfile:
touch \$$testfile

View file

@ -0,0 +1,6 @@
# Rules start with dots cannot be the first rule.
.foo:
echo FAIL
test:
echo PASS

View file

@ -0,0 +1,9 @@
test::
echo FOO
test::
echo BAR
test:: A=B
# Merge a double colon rule with target specific variable is OK.
test: A=B

View file

@ -0,0 +1,18 @@
VAR:=FAIL
ifndef UNDEF
else ifndef VAR
else ifndef VAR
else
endif
ifdef UNDEF
else ifndef VAR
else ifndef VAR
else ifndef VAR
else
VAR:=PASS
endif
test:
echo $(VAR)

View file

@ -0,0 +1,21 @@
define foo
echo foo
endef
define bar
echo bar
endef
define baz
echo baz
echo baz
endef
test:
$(foo) $(foo)
$(bar) $(bar)
$(baz) $(baz)

View file

@ -0,0 +1,5 @@
:
echo FAIL
test:
echo PASS

View file

@ -0,0 +1,7 @@
# TODO(go): https://github.com/google/kati/issues/83
test: =foo
var==foo
$(var):
echo PASS

View file

@ -0,0 +1,11 @@
# TODO(go): https://github.com/google/kati/issues/83
define var
VAR:=1
endef
$(call var)
eq_one:==1
$(eq_one):
echo PASS

View file

@ -0,0 +1,5 @@
empty:=
test:
$(empty)
echo PASS

View file

@ -0,0 +1,2 @@
test:
echo $(PATH)

View file

@ -0,0 +1,7 @@
test: foo bar
foo: A=echo ; echo PASS
foo:
echo $(A)
bar: ; echo PASS=PASS

View file

@ -0,0 +1,9 @@
# TODO(c) fix parser. no rule to make target "test"?
TSV:=test: A=PASS
A_EQ_B:=A=B
EQ==
$(TSV)
test: A$(EQ)B
$(A_EQ_B):
echo $(A)

View file

@ -0,0 +1,4 @@
test:
echo FOO
test::
echo BAR

View file

@ -0,0 +1,2 @@
:
echo FAIL

View file

@ -0,0 +1 @@
:=foo

View file

@ -0,0 +1,4 @@
$(error foo)
test:

View file

@ -0,0 +1,2 @@
test:
$(error foo)

View file

@ -0,0 +1,12 @@
# TODO(c): Fix - "override export define A" is invalid "override" directive.
# GNU make 4 accepts this syntax. Note kati doesn't agree with make 4
# either.
MAKEVER:=$(shell make --version | ruby -n0e 'puts $$_[/Make (\d)/,1]')
ifeq ($(MAKE)$(MAKEVER),make4)
$(error test skipped)
endif
export override define A
PASS_A
endef

View file

@ -0,0 +1 @@
else

View file

@ -0,0 +1 @@
endif

View file

@ -0,0 +1,4 @@
# TODO(go): Fix
ifdef a b
endif

View file

@ -0,0 +1,5 @@
# TODO(go): Fix
x := a b
ifdef $(x)
endif

View file

@ -0,0 +1,8 @@
# TODO(go): Fix
B := $(subst S, ,Sa)
ifdef $(B)
$(info PASS)
else
$(error FAIL)
endif

View file

@ -0,0 +1 @@
include foo

View file

@ -0,0 +1,3 @@
ifdef UNDEF
else foo
endif

View file

@ -0,0 +1 @@
ifeq X

View file

@ -0,0 +1 @@
ifeq (

View file

@ -0,0 +1,7 @@
ifeq "foo" "bar" "baz"
else
endif
test:

View file

@ -0,0 +1,2 @@
ifeq
endif

View file

@ -0,0 +1,8 @@
# TODO(c) fix error message
ifeq (foo, bar) XXX
else
endif
test:

View file

@ -0,0 +1 @@
ifeq : foo

View file

@ -0,0 +1,4 @@
all:
echo FAIL
define foo
xx

View file

@ -0,0 +1,3 @@
all:
echo FAIL
ifdef foo

View file

@ -0,0 +1,5 @@
test:
foo
bar

View file

@ -0,0 +1 @@
test: missing

View file

@ -0,0 +1 @@
all:

View file

@ -0,0 +1,2 @@
$(empty)
all:

View file

@ -0,0 +1,7 @@
test: foo
foo:
echo FAIL
foo:
echo PASS

View file

@ -0,0 +1,12 @@
# TODO(c): Fix - "override export define A" is invalid "override" directive.
# GNU make 4 accepts this syntax. Note kati doesn't agree with make 4
# either.
MAKEVER:=$(shell make --version | ruby -n0e 'puts $$_[/Make (\d)/,1]')
ifeq ($(MAKE)$(MAKEVER),make4)
$(error test skipped)
endif
override export define A
PASS_A
endef

View file

@ -0,0 +1,5 @@
.c.o:
echo FAIL
%.o: %.c
echo FAIL

View file

@ -0,0 +1,2 @@
# This is an error. See also semicolon.mk
;

View file

@ -0,0 +1,2 @@
a;

View file

@ -0,0 +1,3 @@
# TODO(go): Fix
;

View file

@ -0,0 +1 @@
;

View file

@ -0,0 +1 @@
foo ; :

View file

@ -0,0 +1,10 @@
# TODO: Fix
test1:
touch a.src
test2: a.out
# This isn't in .SUFFIXES.
.src.out:
echo $< > $@

View file

@ -0,0 +1,8 @@
# TODO(go): Fix
test1:
touch a.c
test2: a.o
.SUFFIXES:

Some files were not shown because too many files have changed in this diff Show more