[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: New precompiled headers support in gnustep-make
From: |
Nicola Pero |
Subject: |
RE: New precompiled headers support in gnustep-make |
Date: |
Sun, 21 Jan 2007 04:19:49 +0100 (CET) |
I updated Renaissance to use this -- on my machine it now builds twice as fast
with GCC 3.4.6, so precompiled headers seem to work fine if your compiler
supports it! :-)
Thanks
-----Original Message-----
From: Nicola Pero <address@hidden>
Sent: Tue, January 16, 2007 3:20 am
To: address@hidden
Subject: New precompiled headers support in gnustep-make
I implemented (experimental) precompiled headers support in gnustep-make.
Precompiled headers can speed up the compilation of your project significantly
if you're using a gcc that supports it.
Here is how you use them in gnustep-make:
0. install gnustep-make from subversion/trunk. Make sure you reconfigure it.
Make sure that ./configure tells you that precompiled headers are enabled (you
need GCC >= 3.4 to get them). ;-)
1. create the header to precompile. In practice, create a new header that
include all the headers that you repeatedly include in all the files of your
project, especially library headers that never change (eg,
Foundation/Foundation.h, AppKit/AppKit.h, etc).
2. now modify your source so that in all files to compile, you include this
main header at the beginning, *before anything else happens*.
3. your project should still compile fine; you have just refactored your
headers a bit, putting includes for all the commonly included headers into a
single header to include. Make sure it still compiles. You can time how long
it takes if you want. ;-)
4. now add the line
xxx_OBJC_PRECOMPILED_HEADERS = MyPrecompiledHeader.h
to your GNUmakefile (in the same place as your xxx_OBJC_FILES etc declarations
appear). Obviously replace 'xxx' with the name of the tool/library/app/...
that would use the precompiled header, and 'MyPrecompiledHeader.h' with the
name of your precompiled header.
5. now try compiling. GNUstep-make will precompile your header first, and put
it into a special ./obj/PrecompiledHeaders/ObjC/ directory. Then it will
compile the other files as usual, but using -I./obj/PrecompiledHeaders/ObjC/ so
that gcc will find the precompiled file and use it.
You should see a considerable speed-up in compilation times if you include the
precompiled header often enough in your project (and if it's big enough).
The features of the current implementation include:
* everything works as usual on platforms where precompiled headers are not
available.
* support for multiple precompiled headers; eg, you can have part of your
project files include MyPrecompiledHeader1.h and part of your project files
include MyPrecompiledHeader2.h.
* support for multiple languages; eg, you can precompile MyPrecompiledHeader.h
for both ObjC and C, and the right one will automatically be used at runtime.
* only the precompile header(s) that you specify, for the languages that you
specify, will be precompiled.
* you can add/remove compilation flags to each precompiled file if you need
them to be precompiled with specific flags (the usual xxx_FILE_FLAGS and
xxx_FILE_FILTER_OUT_FLAGS are available).
Suggestions/comments/feedback welcome! Please try it out with your project and
let me know. :-)
Important: This is all experimental, so variable names/implementation/makefile
API are subject to change without notice for a while.
Thanks
_______________________________________________
Discuss-gnustep mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/discuss-gnustep
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- RE: New precompiled headers support in gnustep-make,
Nicola Pero <=