On Tuesday 20 August 2002 9:18 am, Jean-Marc Lasgouttes wrote:
> >>>>> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:
>
> Angus> I'm damned if I can see what's wrong with this Makefile.
> Angus> Running make gives: aleem@thorax:xforms$ make make: *** No rule
> Angus> to make target `form_client.C', needed by `all'. Stop.
>
> Angus> all: ${FDC}
>
> Shouldn't this use parenthesis instead of curly brackets?

Thanks, all, for the help. I now have a Makefile that works perfectly and 
that I (mostly) understand. Things I don't understand:

* DEPS_MAGIC. 
        At what point is it invoked? 
        What does ":=" mean.
        Why is the body wrapped inside a $(...)
        That final ":"

* .C.o
        The intent is clear enough even if some of the particulars evade me ;-)
        I haven't come across $(*F) before. Why not just $* ?
        And Ok, I'll bite: what's the reason for the tr and sed magic? I can 
        see what it does (diff -u file.pp file.P): it creates dependency info 
        for the .C and .h files from the .o file dependency info generated 
        by the compiler, but I don't see why this is valuable info.

Regards,
Angus

CXX=g++
CXXFLAGS   = -I/usr/local/include -I/home/aleem//lyx/devel/boost -g
CXXCOMPILE = $(CXX) $(CXXFLAGS)
LIBS = -lforms -L/usr/X11R6/lib -lX11 -lm

.SUFFIXES: .C .o

CLIENTXFORMSOBJS = xforms/Client.o xforms/PipeMonitor.o \
                   xforms/FormClient.o xforms/form_client.o

CLIENTSRCS = ClientController.C  ClientView.C  main.C  support.C

CLIENTOBJS = $(CLIENTSRCS:.C=.o) 
CLIENTDEP = $(CLIENTOBJS:%.o=.deps/%.P)

ALLDEP = $(CLIENTDEP)

all: client

DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(ALLDEP)

client: xforms-all $(CLIENTOBJS)
        $(CXX) -o client $(CLIENTXFORMSOBJS) $(CLIENTOBJS) $(LIBS)

xforms-all xforms-clean xforms-distclean:
        target=`echo $@ | sed s/xforms-//`; \
        echo "Making $$target in xforms"; \
        (cd xforms && make $$target )

clean: xforms-clean
        rm -f client *.o

distclean: clean xforms-distclean
        rm -f *.orig *.rej *~; \
        rm -rf .deps

.C.o:
        @echo '$(CXXCOMPILE) -c $<'; \
        $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
        @-cp .deps/$(*F).pp .deps/$(*F).P; \
        tr ' ' '\012' < .deps/$(*F).pp \
                | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
                >> .deps/$(*F).P; \
        rm .deps/$(*F).pp

Reply via email to