varmod-order-string.mk revision 1.2
11.2Srillig# $NetBSD: varmod-order-string.mk,v 1.2 2021/08/03 04:46:49 rillig Exp $ 21.1Srillig# 31.1Srillig# Tests for the :O variable modifier, which returns the words, sorted in 41.1Srillig# ascending order. 51.1Srillig 61.1Srillig# Simple words are sorted lexicographically. 71.2SrilligWORDS= one two three four five six seven eight nine ten 81.1Srillig.if ${WORDS:O} != "eight five four nine one seven six ten three two" 91.1Srillig. error ${WORDS:O} 101.1Srillig.endif 111.1Srillig 121.1Srillig# Double quotes and single quotes delimit words, while backticks are just 131.1Srillig# regular characters. Therefore '`in' is a separate word from 'backticks`', 141.1Srillig# and the additional spaces between them are removed. 151.1SrilligQUOTED_WORDS= none "double quoted" 'single quoted' `in backticks` 161.1Srillig.if ${QUOTED_WORDS:O} != "\"double quoted\" 'single quoted' `in backticks` none" 171.1Srillig. error ${QUOTED_WORDS:O} 181.1Srillig.endif 191.1Srillig 201.1Srillig# Numbers are sorted lexicographically as well. 211.1Srillig# To sort the words numerically, use ':On' instead; since var.c 1.939 from 221.1Srillig# 2021-07-30. 231.1SrilligNUMBERS= -100g -50m -7k -50 -13 0 000 13 50 5k1 7k 50m 100G 241.1Srillig.if ${NUMBERS:O} != "-100g -13 -50 -50m -7k 0 000 100G 13 50 50m 5k1 7k" 251.1Srillig. error ${NUMBERS:O} 261.1Srillig.endif 271.1Srillig 281.1Srilligall: 29