Closed Bug 747206 Opened 12 years ago Closed 12 years ago

makefiles: add pure make uppercase/lowercase functions

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: joey, Assigned: joey)

References

Details

Attachments

(1 file)

Removing more shell overhead in the makefiles
replacement for: $(shell echo $(var) | tr '[A-Z]' '[a-z]')
Blocks: 747211
uc() and lc() implemented in make.
unit test updated to validate functions.
Assignee: nobody → joey
Attachment #616779 - Flags: review?(ted.mielczarek)
That seems a whole lot of Make code to do something that could be written as:
lc = $(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))))))))))))))))))))))))))
uc = $(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))))))))))))))))))))))))))
True the functions could be written this way but hardcoding values will eventually force duplication.  If/when more string transforms are needed later on, next iteration will be to refactor lc & uc so 'trans_lower' and 'trans_upper' can be passed as a parameter.  Testing benefits by not having to exhaustively validate all of the one-off functions.

(In reply to Mike Hommey [:glandium] from comment #2)
> That seems a whole lot of Make code to do something that could be written as:
> lc = $(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))))))))))))))))))))))))))
> uc = $(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))))))))))))))))))))))))))
Comment on attachment 616779 [details] [diff] [review]
add native make uc() and lc() functions

Review of attachment 616779 [details] [diff] [review]:
-----------------------------------------------------------------

::: config/makefiles/makeutils.mk
@@ +61,5 @@
> +$(strip \
> +  $(eval __local_lc:=$(1))\
> +  $(foreach transform,$(trans_toLower),\
> +  $(eval __local_lc:=$(subst $(call getByDelim,$(transform),$(caret),1),$(call getByDelim,$(transform),$(caret),2),$(__local_lc))))\
> +  $(__local_lc)\

(In reply to Joey Armstrong [:joey] from comment #3)
> True the functions could be written this way but hardcoding values will
> eventually force duplication.  If/when more string transforms are needed
> later on, next iteration will be to refactor lc & uc so 'trans_lower' and
> 'trans_upper' can be passed as a parameter.

Please do so in this patch, then.
Attachment #616779 - Flags: review?(ted.mielczarek) → review-
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: