Nokia Networks Home

Nokia nmake Product Builder

Quick Links

Related Products

Variable Edit Operators

Feature Description

Variable edit operators allow variable values to be tested and modified during expansion. There are approximately 60 different edit operators which can perform many useful tasks, such as pattern matching, path manipulation, changing strings of characters, etc. Edit operators are often used to manipulate a list stored in a variable, such as a list of file names. Each string, separated by white space, contained in a variable is called a token and edit operations can apply to each token or to the variable as a whole. They can also be pipelined to form arbitrarily complex editing operations.



Consequence of Not Having the Feature


Here are some of commonly used edit operators.

Edit Op Description
:C Changer, perform sed-like operations
:D:B:S return or change Directory/Basename.Suffix
:L directory List
:N shell pattern match
:O Ordinal, returns tokens by position
:Y Yield, test for null value
$ cat Makefile 
FILES = src1/a.c src1/b.c src1/c.c src2/d.c src2/e.c
DIRS  = src1 src2 hdr obj

example : .MAKE
        print 1 - $(FILES:C/1/3/g)
        print 2 - $(FILES:D)
        print 3 - $(FILES:D:O=1)
        print 4 - $(FILES:D=src:B:S)
        print 5 - $(FILES:B:S=.o)
        print 6 - $(DIRS:L)
        print 7 - $(DIRS:N=src*)
        print 8 - $(DIRS:N=src*:L=*.c)
        print 9 - $(".":L:N=obj:Y??mkdir obj?)

$ ls src1
a.c  a.h  b.c  b.h  c.c

$ ls src2
d.c  d.h  e.c

$ ls obj
ls: obj: No such file or directory

$ nmake
1 - src3/a.c src3/b.c src3/c.c src2/d.c src2/e.c
2 - src1 src1 src1 src2 src2
3 - src1
4 - src/a.c src/b.c src/c.c src/d.c src/e.c
5 - a.o b.o c.o d.o e.o
6 - a.c b.c c.c d.c e.c a.h b.h d.h
7 - src1 src2
8 - a.c b.c c.c d.c e.c
9 - mkdir obj
Last Update: Friday,12-Aug-2016 10:52:49 EDT