[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Dependency of a dependency in make?
From: |
Nestor Amaya |
Subject: |
RE: Dependency of a dependency in make? |
Date: |
Thu, 22 Nov 2001 15:34:45 -0500 |
Hi,
You're not rebuilding header1.h, so its date doesn't change and therefore
source.o is not recompiled.
What you need is:
source.o: header1.h header2.h
There are automatic ways of doing this (and I'm not an expert), but the
above would give you want you need.
-----Original Message-----
From: Peter Sherwood [mailto:address@hidden
Sent: Thursday, November 22, 2001 2:26 PM
To: address@hidden
Subject: 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