[PATCH] Fix build: don't recompile all C++ every time

Lubomir I. Ivanov neolit123 at gmail.com
Sat Oct 5 05:14:13 UTC 2013


forgot the patch
(attachment)

lubomir
--

On 5 October 2013 15:13, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
> On 4 October 2013 19:54, Thiago Macieira <thiago at macieira.org> wrote:
>> This was caused by the %.o: %.cpp rule depending on "uicables". Since
>> it's a phony target, the file never exists, so make will always try to
>> rebuild it. Regardless of whether anything got run because of that,
>> the target will then be "newer" than the .o file that was being
>> considered. Therefore, make thought it had to recompile again.
>>
>> Fix it by skipping the intermediate, phony target and telling make
>> that the C++ objects depend directly on the header files.
>>
>> Signed-off-by: Thiago Macieira <thiago at macieira.org>
>> ---
>>  Rules.mk | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/Rules.mk b/Rules.mk
>> index 30e2e21..ce1ba59 100644
>> --- a/Rules.mk
>> +++ b/Rules.mk
>> @@ -185,7 +185,7 @@ MOCFLAGS = $(filter -I%, $(CXXFLAGS) $(EXTRA_FLAGS)) $(filter -D%, $(CXXFLAGS) $
>>         @mkdir -p .dep/$(@D)
>>         $(COMPILE_PREFIX)$(CC) $(CFLAGS) $(EXTRA_FLAGS) -MD -MF .dep/$@.dep -c -o $@ $<
>>
>> -%.o: %.cpp uicables
>> +%.o: %.cpp $(UIC_HEADERS)
>>         @$(PRETTYECHO) '    CXX' $<
>>         @mkdir -p .dep/$(@D)
>>         $(COMPILE_PREFIX)$(CXX) $(CXXFLAGS) $(EXTRA_FLAGS) -I.uic -Iqt-ui -MD -MF .dep/$@.dep -c -o $@ $<
>> --
>> 1.7.11.7
>>
>> _______________________________________________
>> subsurface mailing list
>> subsurface at hohndel.org
>> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
>
> this patch broke it for me after a 'make confclean'.
>
> g++ -Wall -g     -c -o qthelper.o qthelper.cpp
> In file included from qthelper.cpp:1:0:
> qthelper.h:4:21: fatal error: QMultiMap: No such file or directory
>
> ^ looks like the includes are strangely gone from the command line?
>
> attached patch fixes it for me - adds $(UIC_HEADERS) in the $(TARGET) rule.
>
> BTW, i've noticed that the qt-ui/ui_*.h * files do not recompile on
> *.ui changes because they are in a sub-folder (vpath?), but if a
> create a new .ui file and put it in ./ it does trigger a UIC recompile
> and CXX recompile that follows. one problem here is that a single .ui
> file change recompiles the whole CXX stack, because the %.o: %.cpp
> rule is fed with all UIC headers, but i'm not sure this can be easily
> avoided.
>
> lubomir
> --
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Rules.mk-call-UIC-before-everything-else.patch
Type: application/octet-stream
Size: 830 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20131005/def8d0b2/attachment.obj>


More information about the subsurface mailing list