Closed Bug 1353640 Opened 6 years ago Closed 6 years ago

Improvements to the build system code handling preprocessing

Categories

(Firefox Build System :: General, enhancement)

enhancement
Not set
normal

Tracking

(firefox55 fixed)

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: glandium, Assigned: glandium)

Details

Attachments

(4 files)

For bug 1349022, I did try builds getting the entire (well, most) code tree in preprocessed form. Essentially, I added %.$(OBJ_SUFFIX): %.i dependencies, and removed the condition hiding the .i rules.

This unveiled a couple issues:
- The .i rules don't work for generated sources.
- We uselessly create .deps files.
Comment on attachment 8854744 [details]
Bug 1353640 - Factor the preprocessing rules to avoid all the redundancy.

https://reviewboard.mozilla.org/r/126718/#review129616
Attachment #8854744 - Flags: review?(mshal) → review+
Comment on attachment 8854745 [details]
Bug 1353640 - Avoid the preprocessor rules creating dependency files.

https://reviewboard.mozilla.org/r/126720/#review129624

::: config/rules.mk:1033
(Diff revision 1)
>  define PREPROCESS_RULES
>  _PREPROCESSED_$1_FILES := $$(call _group_srcs,$1,$2)
>  # Make preprocessed files PHONY so they are always executed, since they are
>  # manual targets and we don't necessarily write to $@.
>  .PHONY: $$(_PREPROCESSED_$1_FILES)
> -$$(_PREPROCESSED_$1_FILES): %.i: %.$1 $$(call mkdir_deps,$$(MDDEPDIR))
> +$$(_PREPROCESSED_$1_FILES): _DEPEND_CFLAGS=

The eval/call logic always has be slightly confused, but I don't think this is doing what you want. Since you are using $(COMPILE_CXXFLAGS) in the $(call) function, the cxxflags are expanded during the call and not during the rule processing. If you change $(eval) to $(info) you can see that the -MD and such flags are already in the rule. I think you want to use $$(COMPILE_CXXFLAGS) and the like below in order for this to take effect.. Otherwise I get this:

$ rm -rf .deps
$ make Unified_cpp_xpcom_ds1.i
/usr/bin/ccache /usr/bin/g++ ...
<built-in>: fatal error: opening dependency file .deps/.pp: No such file or directory
compilation terminated.
/home/mshal/mozilla-central-git/config/rules.mk:1066: recipe for target 'Unified_cpp_xpcom_ds1.i' failed
make: *** [Unified_cpp_xpcom_ds1.i] Error 1
Attachment #8854745 - Flags: review?(mshal)
Comment on attachment 8854746 [details]
Bug 1353640 - Use more targetted vpath instead of broad VPATH for preprocessor rules.

https://reviewboard.mozilla.org/r/126722/#review129626
Attachment #8854746 - Flags: review?(mshal) → review+
Comment on attachment 8854747 [details]
Bug 1353640 - Also check sources in the objdir to preprocess generated sources.

https://reviewboard.mozilla.org/r/126724/#review129630
Attachment #8854747 - Flags: review?(mshal) → review+
Attachment #8854744 - Flags: review+ → review?(mshal)
Attachment #8854746 - Flags: review+ → review?(mshal)
Comment on attachment 8854744 [details]
Bug 1353640 - Factor the preprocessing rules to avoid all the redundancy.

https://reviewboard.mozilla.org/r/126718/#review129752
Attachment #8854744 - Flags: review?(mshal) → review+
Comment on attachment 8854745 [details]
Bug 1353640 - Avoid the preprocessor rules creating dependency files.

https://reviewboard.mozilla.org/r/126720/#review129754
Attachment #8854745 - Flags: review?(mshal) → review+
Comment on attachment 8854746 [details]
Bug 1353640 - Use more targetted vpath instead of broad VPATH for preprocessor rules.

https://reviewboard.mozilla.org/r/126722/#review129756
Attachment #8854746 - Flags: review?(mshal) → review+
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/f83bc4b3dfa6
Factor the preprocessing rules to avoid all the redundancy. r=mshal
https://hg.mozilla.org/integration/autoland/rev/388684b808db
Avoid the preprocessor rules creating dependency files. r=mshal
https://hg.mozilla.org/integration/autoland/rev/a614823d73f4
Use more targetted vpath instead of broad VPATH for preprocessor rules. r=mshal
https://hg.mozilla.org/integration/autoland/rev/7632e3ba8262
Also check sources in the objdir to preprocess generated sources. r=mshal
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.