Building small big things
Prefix.pch and how to use it in open toolchain 
Sunday, March 8, 2009, 04:21 PM - Resources
Posted by Administrator
Most if not all of the sample apps provided with the iphone SDK use a prefix.pch file which, under Xcode would be handled as a precompiled prefix header included with all source files.

I searched all over to see if anyone had already handled it but come up empty.

This is what I came up with to properly include the prefix header and also have it precompiled.


%.o: %.m Prefix.pch.gch
$(CC) -include Prefix.pch -c $(CFLAGS) $< -o $@

%.o: %.cpp Prefix.pch.gch
$(CXX) -include Prefix.pch -c $(CXXFLAGS) $< -o $@

Prefix.pch.gch: Prefix.pch
$(CC) -x objective-c-header $(CFLAGS) Prefix.pch


It adds the Prefix.pch.gch as a dependence and then includes it when creating an object file.
add comment ( 17 views )   |  0 trackbacks   |  permalink

<Back | 1 | 2 | 3 | 4 | 5 | 6 | 7 | Next> Last>>