help-gnu-utils
[Top][All Lists]
Advanced

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

Re: Make: multiple files to GCC


From: Paul Jarc
Subject: Re: Make: multiple files to GCC
Date: Sat, 05 Aug 2006 14:51:42 -0400
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.4 (gnu/linux)

Thomas Matthews <Thomas_Hates_Spam@cox.network> wrote:
> file_a.o : file_a.c file_a.h
>
> file_b.o : file_b.c file_b.h
>
> file_c.o : file_c.c file_c.h
>
> file_d.o : file_d.c file_d.h
>
> In the above scenario, if all the '.o' file are deleted, the gcc 
> compiler will be invoked four times, once for each file.

You can do this:
file_a.o file_b.o file_c.o file_d.o: \
  file_a.c file_b.c file_c.c file_d.c \
  file_a.h file_b.h file_c.h file_d.h
        gcc -c file_a.c file_b.c file_c.c file_d.c

The downside this way is that all four files will be recompiled even
if only one is out of date.  You should probably measure the build
time for each of the two Makefiles, and in each situation (full
rebuild vs. updating one file) to see which is better overall.


paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]