[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Dependency of a dependency in make?
From: |
Peter Sherwood |
Subject: |
Dependency of a dependency in make? |
Date: |
Thu, 22 Nov 2001 14:26:18 -0500 |
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?
- Dependency of a dependency in make?,
Peter Sherwood <=