C + Make

Mike Percy grimlok at hubcap.clemson.edu
Thu Sep 13 02:49:05 AEST 1990


[This doesn't really belong in this group but...]

If you want to make your makefile reflect the include heirarchy try
what I do.  Given some files like:
[NOTE: I use TurboC++ and the make and touch provided with it.
 Your milage may be different.]

File test.c
  #include "a.h"
  #include "b.h"

  main()
  {
    printf("testing");
  }

File a.h
  #include "c.h"

File a.h
  #include "d.h"
  #include <stdio.h>

File c.h
  #define test1 1

File d.h
  #define test2 2


I use a makefile like:

test.exe : test.obj
    tcc test.obj

test.obj : test.c a.h b.h
    tcc -c test.c

a.h : c.h
    touch a.h

b.h : d.h \tc\include\stdio.h
    touch b.h

This does have the side effect of perhaps changing the time stamps on
a,h and b.h when their contents haven't changed, but I don't mind that.
You might leave off the touch commands...I'm not sure how that would
work.

"I don't know about your brain, but mine is really...bossy."
Mike Percy                    grimlok at hubcap.clemson.edu
ISD, Clemson University       mspercy at clemson.BITNET
(803)656-3780                 mspercy at clemson.clemson.edu



More information about the Comp.lang.c mailing list