Apache OpenOffice (AOO) Bugzilla – Issue 66651
Potential speed up possibility for mkdepend
Last modified: 2013-08-07 15:34:52 UTC
Currently we call mkdpend once for each file to be compiled. The mkdepend documentation suggests that it might be worthwhile to call mkdepend for all files in one makefile at once. ==== snippet from mkdepend.man ==== The approach used in this program enables it to run an order of magnitude faster than any other "dependency generator" I have ever seen. Central to this performance are two assump- tions: that all files compiled by a single makefile will be compiled with roughly the same -I and -D options; and that most files in a single directory will include largely the same files. Given these assumptions, makedepend expects to be called once for each makefile, with all source files that are main- tained by the makefile appearing on the command line. It parses each source and include file exactly once, maintain- ing an internal symbol table for each. Thus, the first file on the command line will take an amount of time proportional to the amount of time that a normal C preprocessor takes. But on subsequent files, if it encounter's an include file that it has already parsed, it does not parse it again. ==== end snippet from mkdepend.man ====
*** Issue 66652 has been marked as a duplicate of this issue. ***
Created attachment 37469 [details] prototype for batched mkdepend call
@vq: if you look at the rule with the single echo, it might be handy to have some kind of "nop" command: command handled internally like "echo" but without any output... is this possible?
I didn't check, but do you know when target conditionals are evaluated? See CONDITIONAL MACROS in the dmake man page. That might work. If that fails I could convince dmake's runargv() command to skip the execution of commands if they start with a comment. That would mean the recipe line would still be created but not executed. Something like this: all : ; \#$(assign all_local_slo+:=$<) would trigger the assign but the execution would be inhibited. Or instead of the coment sign we could just invent a "virtual" nop command, only known to dmake, any suggestions for the name? __eval__ ? I have another one ;) Michael proposed that once, we could teach dmake to use its own (to be implemented) echo command whenever it is not executed in a shell (intentionally or forced by SHELLMETA because of variables/redirecting/etc.)
The conditional macro could work, I just tried: --- makefile.mk --- SHELL*:=/bin/sh SHELLFLAGS*:=-ce all : ; @echo all all ?= dummy := $(shell +date > qqq) --- makefile.mk --- $ dmake.exe -rf makefile.mk all ... and it creates a qqq file that contains the current date.
Alas, it seems we cannot use conditional macros for this purpose. From the man page: ... Activation [means setting the macro] occurrs after all inference, and .SETDIR directives have been processed and after $@ is assigned, but before prerequisites are processed; thereby making the values of conditional macro definitions available during construction of prerequisites. I checked that $< and $? are not set when evaluating the macro :(
Ok, this works for me: --- makefile.mk --- SHELL*:=/bin/sh SHELLFLAGS*:=-ce al% : ; $(not $(assign ALLDEP=$@)) doit : all @+echo "ALLDEP: $(ALLDEP)" --- makefile.mk --- $(nil ..) does not work, see issue 67585, but as assign returns the macro name $(not ..) works as well. This relies on the (undocumented) feature that empty recipe lines are not executed.
evaluating commented out lines looks somhow dirty to me ;) isn't the internal echo used already in these cases? i still remember the crash on "echo $(some_empty_var)" which vanished when prtepending "+" i tried $(nil ...) and didn't notice that it was the nil that didn't work. i'll play with $(not ... )
implemented in CWS ause060
Tricky implementation ;) Looks good to me.
.