help-make
[Top][All Lists]
Advanced

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

Re: Including dependency files automagically + some basic pilot error


From: Ted Stern
Subject: Re: Including dependency files automagically + some basic pilot error
Date: Mon, 25 Jul 2005 12:31:31 -0700
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

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





reply via email to

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