views:

164

answers:

2

I use this tool called Lazy C++ which breaks a single C++ .lzz file into a .h and .cpp file. I want Makepp to expect both of these files to exist after my rule for building .lzz files, but I'm not sure how to put two targets into a single build line.

+3  A: 

I've never used Makepp personally, but since it's a drop-in replacement for GNU Make, you should be able to do something like:

build: foo.h foo.cpp
   g++ $(CFLAGS) foo.cpp -o $(LFLAGS) foo

foo.h foo.cpp: foo.lzz
   lzz foo.lzz

Also not sure about the lzz invocation there, but that should help. You can read more about this at http://theory.uwinnipeg.ca/gnu/make/make_37.html.

Tynan
+1  A: 

Lzz is amazing! This is just what I was looking for http://groups.google.com/group/comp.lang.c++/browse_thread/thread/c50de73b70a6a957/f3f47fcdcfb6bc09

Actually all you need is to depend (typically) on foo.o in your link rule, and a pattern rule to call lzz:

%.cpp %.h: %.lzz
    lzz $(input)

The rest will fall into place automatically. When compiling any source that includes foo.h, or linking foo.o to a library or program, lzz will first get called automatically.

Makepp will also recognize if only the timestamp but not the content of the produced file changed, and ignore that. But it can't hurt to give it less to do, by using the lzz options to suppress recreating an identical file.

Regards -- Daniel

Daniel