On 25 Jul 2005 at 12:04 UTC-0700, Angus Leeming wrote:
> Makefile.am et al have made me lazy. I come to create a simple
> makefile for gnu make and I find I can't :(
>
> Attached is my implementation. There are a number of things wrong
> with it.
>
> 1. I'd like to build the MOCS files before going on to compile the .cpp
> ones. However,
>
> srcdir = .
> MOCSRCS = foo.h bar.h baz.h
> MOCS = $(MOCSRCS:.h=.moc)
> .cpp.o: $(MOCS)
>         command to build .o file
> .h.moc:
>         moc -o $@ $(srcdir)/$<

Try pattern rules instead, they're more flexible.  For example,

    $(objdir)/%.o: $(srcdir)/%.cpp
         command to build .o file

    $(DEPSDIR)/%.moc: $(srcdir)/%.h
         moc -o $@ $<

>
> isn't working. Yes, I'm ignorant of all things vpath.
>
> 2. I have, in the past seen some magic to include all the .deps files in a
> simple rule, rather than
>
> include  ./$(DEPSDIR)/foo.Plo
> include  ./$(DEPSDIR)/bar.Plo
> include  ./$(DEPSDIR)/baz.Plo

  include $(DEPSFILES)

>
> but I can't for the life of me either remember what it is or find it
> through google. Anyway, the simple thing above doesn't work if
> foo.Plo etc don't yet exist. Any ideas?

Create a rule to build the .Plo files.  Then MAKE will know how to
make them.

>
> All help accepted most gratefully,
> Angus

-- 
 Frango ut patefaciam -- I break so that I may reveal



_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to