Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!snorkelwacker!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!mucs!m1!bevan From: bevan@cs.man.ac.uk (Stephen J Bevan) Newsgroups: comp.lang.c Subject: C + Make Message-ID: Date: 10 Sep 90 21:00:41 GMT Sender: news@cs.man.ac.uk Organization: Department of Computer Science, University of Manchester Lines: 49 If you have .h files that include other .h files, such as the following :- /* foo.c */ #include "foo.h" /* foo.h */ #include "a.h" #include "b.h" /* a.h */ lots of #includes /* b.h */ lots of #includes then inorder to get `make' to update foo.c if anything in the headers change, you have to do something like :- foo.o: foo.c foo.h a.h b.h ... any file that a.h/b.h includes i.e. you have to flatten the hierarchy you have built up. What I'd like to know is there any way of writing this as :- foo.o: foo.c foo.h foo.h: a.h b.h a.h: a.h' includes b.h: b.h's includes i.e. maintaining the hierarchy, but so still forcing foo.c to be recompiled if one of a.h/b.h (or its includes) changes. I have a kludgy solution, but as I store stuff under RCS, it can take 2 or 3 `makes' to get all the dependencies to update correctly (a bit like using latex + bibtex :-) What I'd like to know is :- 1. Should I even be trying to do this or should I go back to the ONE TRUE WAY of flattening the hierarchy. 2. If its an ok idea, has somebody got a solution that will update all the dependencies with just one run of `make'. Ta Stephen J. Bevan bevan@cs.man.ac.uk