help-make
[Top][All Lists]
Advanced

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

RE: Dependency of a dependency in make?


From: Marc Martinez
Subject: RE: Dependency of a dependency in make?
Date: Fri, 23 Nov 2001 08:04:12 +0100

Use makedepend at the enf of your Makefile

makedepend -p $(REP_OBJ)/ $(YOUR_C_FLAGS) $(ALL_YOUR_SOURCE)

this command generate IN your Makefile a liste of all dependencies of your
sources ....

i.e. :
makedepend .....

# DO NOT DELETE ---> GENERATED CODE

/stk/ing/dev/objects/ny/frm//stk/ing/dev/objects/ny/frm/nyfrm_grammaire.o:
/usr/include/stdio.h
/stk/ing/dev/objects/ny/frm//stk/ing/dev/objects/ny/frm/nyfrm_grammaire.o:
/usr/include/stdlib.h
/stk/ing/dev/objects/ny/frm//stk/ing/dev/objects/ny/frm/nyfrm_grammaire.o:
/usr/include/unistd.h


-----Message d'origine-----
De : Peter Sherwood [mailto:address@hidden
Envoye : jeudi, 22. novembre 2001 20:26
A : address@hidden
Objet : Dependency of a dependency in make?


I have a problem in using GNU make, probably because I don't understand how
to use it.

I have a C source file which includes a header file, which in turn includes
another,like this:

source.c                   header1.h
...                        ...
#include "header1.h"       #include "header2.h"

The relevant parts of my makefile looks like this:

OBJECTS = source.o 
LIBRARIES = /usr/X11R6/lib/libX11.a ../fftw-2.1.3/fftw/.libs/libfftw.a -lm
Source: $(OBJECTS) $(LIBRARIES)
        gcc -static -o source $(OBJECTS) $(LIBRARIES)
CFLAGS=-g -Wall -gstabs # used by the implicit rule $(CC) -c $(CPPFLAGS)
$(CFLAGS)
        
# Dependencies of source files which create the named objects
source.o: source.h header1.h

# Dependencies of header files
header1.h: header2.h

By writing the makefile in this way, I expected that changes in header2.h
would cause source.c to get recompiled to source.o, since source.o depends
on header1.h and header1.h depends on header2.h. But this is not the case.
>From make's debug (-d) output, the dependencies of header1.h were not
considered.

How can I accomplish what I want, without putting header2.h in as an
explicit dependency wherever I have header1.h now?


_______________________________________________
Help-make mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/help-make

Attachment: Makefile
Description: Binary data


reply via email to

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