[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
setting a variable to be the result of severla shell commands...
From: |
richard offer |
Subject: |
setting a variable to be the result of severla shell commands... |
Date: |
Mon, 24 Jun 2002 17:57:29 -0700 |
I'm trying to set a variable (build number) to be the result of several
commands, so far I have :-
# usage build-ver <upstream release number>
#
define build-ver
BUILD_NUM=$(shell [ -f .build_num ] && cat .build_num )
NUM=$(if $(BUILD_NUM),$(shell expr $(BUILD_NUM) + 1),1)
$(strip $(1)build$(NUM))
endef
REL=$(call build-ver,4)
all:: $(REL).fred # just for testing...
The intention being that if the file .build_num exists that the contents
are incremented by 1 and used to set REL, ie the first build would set REL
= 4build1, then, 4build2 etc (the code to write the result back to
.build_num is not shown).
Looking at the output of make -p, I'm getting....
make: *** No rule to make target `BUILD_NUM=
NUM=1
4build.fred', needed by `make.build'. Stop.
Any thoughts ?
I could do all this in a external shell script, but I'd like to keep it in
the makefile if at all possible.
richard.
PS: using := instead of = gives me the error
Makefile:35: *** target pattern contains no `%'.
--
-----------------------------------------------------------------------
Richard Offer Technical Lead, Trust Technology, SGI
"Specialization is for insects"
_______________________________________________________________________
- setting a variable to be the result of severla shell commands...,
richard offer <=