Mailing List Archive

Support open source code!


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

tlug: imake question



>>>>> "Marcus" == Marcus Metzler <mocm@example.com> writes:

    Marcus> does anybody know how to set dependencies for object files
    Marcus> in an Imakefile?

    Marcus> I want something that results in a Makefile saying:

    Marcus> foo.o:  foo.h foo.c bar.h
    Marcus>         cc -o foo.c

    Marcus> so that make knows that any change to bar.h requires a
    Marcus> rebuild of foo.o.

If foo is all you are building

PROGRAMS = foo
HEADERS = foo.h bar.h
OBJS = foo.o
SRCS = foo.c
NormalProgramTarget(foo,foo.o,,,)

should do what you want.  (Except for that fact that Imake is highly
unlikely to write an action like `cc -o foo.c' :-), but you don't
REALLY want that, do you?)

However, you are likely to end up with excessive recompiles if only
some of the object files depend on all of $HEADERS.  AFAIK there's
nothing to stop you from putting 

foo.o:  foo.h foo.c bar.h
        cc -o foo.c

directly in the Imakefile; it will be copied to the output.  This will
(possibly) screw up if foo depends on the details of your X
installation, but if foo depends only on foo.h, foo.c, and bar.h
you'll be OK.
--------------------------------------------------------------
Next Nomikai: 17 July, 19:30 Tengu TokyoEkiMae 03-3275-3691
Next Meeting: 8 August, Tokyo Station Yaesu central gate 12:30
*** 20 June: TLUG will be at the Tokyo Linux Fair
http://tlug.linux.or.jp/projects/linux-fair/fair.html
--------------------------------------------------------------
Sponsor: PHT, makers of TurboLinux http://www.pht.co.jp


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links