blob: 98dbb0f690875ce3d60640cd401371fcd22698f8 [file] [log] [blame]
Yifan Hongc49bddf2018-09-21 16:39:37 -07001#
2# Copyright (C) 2018 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17###########################################################
18## Convert to lower case without requiring a shell, which isn't cacheable.
19##
20## $(1): string
21###########################################################
22to-lower=$(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))
23
24###########################################################
25## Convert to upper case without requiring a shell, which isn't cacheable.
26##
27## $(1): string
28###########################################################
29to-upper=$(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$1))))))))))))))))))))))))))
30
31# Sanity-check to-lower and to-upper
32lower := abcdefghijklmnopqrstuvwxyz-_
33upper := ABCDEFGHIJKLMNOPQRSTUVWXYZ-_
34
35ifneq ($(lower),$(call to-lower,$(upper)))
36 $(error to-lower sanity check failure)
37endif
38
39ifneq ($(upper),$(call to-upper,$(lower)))
40 $(error to-upper sanity check failure)
41endif
42
43lower :=
44upper :=