help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch to Add Lua Support


From: Ken Smith
Subject: Re: Patch to Add Lua Support
Date: Tue, 17 Oct 2006 12:16:02 -0700

Has anyone had a chance to look at this patch?  If you've ever wished
GNU make had Guile support, then this patch may be very interesting to
you.  Lua is easy to learn and offers a fairly complete basic library.

Have you ever wanted to do math in GNU make?  The GMSL can do an
impressive set of basic math but imagine if, instead of writing

 x := $(call int_decode,$(call int_divide,$(call
int_encode,15),$(call int_encode,3)))

you could write this

 $(info x=$(lua printmake(15/3)))

And that is only the beginning.  With Lua support, you can use hash
tables to store and manilpuate information, you can express
complicated functions with ease, and still keep your build files neat.

To the GNU make maintainers:
Please let me know what you need me to do to get this patch accepted
into the next release.

To the GNU make community:
Please check out

 http://lua.org

and apply this patch to GNU make 3.81.  One of the biggest gripes
people have with GNU make is that its language isn't as expressive as
they want.  Hence SCons and the slew of other make replacements.  I
think make does one thing and does it well; it manages dependencies.
So let's leverage make's power to manage dependencies and leave the
heavy lifting up to a drop in language like Lua.

 Ken

On 10/15/06, Ken Smith <address@hidden> wrote:
Hi All,

Please consider this patch a request for comments.  I have added Lua
5.1.1 support to GNU make 3.81.  Attached to this email are patches
for two files.  The patch for  function.c should work for any
platform.  The patches for the Makefile were generated under Darwin
and Linux.  Both are included to give a bigger picture to the nature
of the changes required to build this patch.  You may have to modify
your Makefile by hand to get this patch to build and/or link.  This is
just to get you up and running since, if this patch is accepted, the
autoconf processing would need to be modified to properly support
linking to Lua.

Readers of this list may know that you can apply these patches with
the following steps.

  tar xjvf make-3.81.tar.bz2
  cd make-3.81
  ./configure
  patch -p1 < make-3.81-lua-5.1.1-Makefile.patch
  patch -p1 < make-3.81-lua-5.1.1-function.c.patch

The attached GNUmakefile will produce something akin to the following
output when run with a patched GNU make 3.81.

  Detected Lua support.
  lua result = "5"
  Make is 3.81 or later.
  Hello from Lua (x = table: 0x305380)

  t.1 = 4
  t.2 = 5
  t.something_else = true
  t.x.1 = 1
  t.x.2 = 2
  t.x.3 = 3
  t.hi = value

  Terminado.

This patch requires Lua 5.1.1 to be installed but requires no
modifications to the Lua codebase.  The patch adds one function to
Lua's global namespace, "printmake", which prints a string back to
make rather than to stdout.  You can use $(lua printmake('text')) like
you would use $(shell echo 'text').

This patch was developed under Darwin 8.8.1 (Mac OS X 10.4.8 Intel).

  Ken







reply via email to

[Prev in Thread] Current Thread [Next in Thread]