Hi -
I've created two enhancements to gnu make.  The first is procedure support, 
a'la macro's.  The second is a single-level recursive assignment.  Both are 
detailed below.  The patch is available on request, or at:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/makeng/patches/

Procedure Support:
Make currently lacks the ability to do multiple things on a single 
line.  As such, I've implemented 'procedure support', which is best 
displayed by the example below:

   define my-procedure
   var1 := $1
   foo := bar
   test :
        @echo This is a test
   endef

   ...

   $(proc my-procedure,somevalue)   # above fragment inserted at this point

This utilizes the 'define/endef' variable creation functionality already 
existing within make to create multi-line variables.  These multi-line 
variables are treated as makefile fragments, and are inserted in to the 
current flow via layered calls to "read_makefile".  The results of this 
functionality allow a given script to be executed at will without the need 
for  duplication of source.

Single Level Recursive Assignment:
Currently, make supports two different basic types of variable 
assignment.  ":=" assignment and "=" assignment create a simply expanded 
and recursively expanded variable, relatively.  I have added a third type 
of assignment without altering the two types of variables.  This operator, 
"^=", performs a single-level expansion to the rhs of the assignment, and 
copies the resulting value into the left hand variable, setting it to be a 
recursive variable.  For example, in current make:
   foo = $(bar)
   bar = end

   alph = $(foo)
The value of "alph" will, obviously, be "$(foo)".  However, if what you 
wanted was to copy the value of foo, there is no way of doing so.

Ergo:
   foo = $(bar)
   bar = end
   alph ^= $(foo)
Now, with a single level of expansion, alph will have the value of $(bar) 
such that it is independent from any future values of foo.  $(alph) will 
still result in 'end' as a value.

Both of these have been implemented against make-3.79.1, and have no known 
negative side effects against any current makefile functionality (i.e. all 
current makefiles will continue to function as expected).

I would dearly like to integrate these patches in with the rest of the 
source tree.  Please let me know any questions or comments you might have 
regarding these features.

Thanks,
--Benn


_______________________________________________
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make

Reply via email to