
Precompiled header-files on Unix using Make ?
Quote:
>Has anyone tried generating and using precompiled headers on the Unix
>platform ?
>A little background on this. I've been using MS Visual C++
>at home recently that has this feature. Basically, the idea is that
>since system library header-files rarely change it makes sense to
>maintain a "compiled" version (which I believe is a file generated by
>running the headers through the preprocessor) which cuts down on the
>compile time significantly. I was thinking it would make our compiles
>at work much faster if we maintained such "precompiled headers", more so
> since many of the header-files are on NFS mounted directories. Also
>all our programs use X and Motif libraries and their headers-files
>are huge !
>The issues to be tackled are:
>1) Maintaining a dependency of the "compiled header file" on the
> various header-files it includes.
>2) Making the use of precompiled-headers transparent to the code. In
>other words, I should not have to modify #includes in existing source
>code
>Any tips or pointers will be appreciated.
Preprocessing is a pretty straightforward process ;-), but parsing
the resulting bundles of declarations is time-consuming. So without
the help of your compiler, keeping "preprocessed" header files will
not be very helpful. If your compiler supports dumping the results
between parsing and code generation, and if it supports doing this
on a per-header basis, you can use this feature. Keeping "preprocessed"
versions of system headers, that depend on some header files and
your makefile, because you would want to rebuild them if you change
any defines that might affect them, like, e.g., POSIX_SOURCE, is
simply not worth the effort, imho. Keeping _one_ "preprocessed"
file that contains the bundeled, and, if you like, preprocessed
contents of a _group_ of header files may be useful, because it may
reduce file i/o during compilation.
Note, however, that compiler implementors are free to simply punch
the apropriate stuff into their current symbol table whenever
they meet a line like "#include <stdio.h>" or something similar.
As an aside: Does anyone know an implementation that does actually
_use_ this liberty?
Kurt
Quote:
>Thanks,
>Rajeev Singh
--
| Kurt Watzka Phone : +49-89-2180-6254