Skip to content

Commit

Permalink
build: do not use -Wp with the preprocessor and use -o instead of a r…
Browse files Browse the repository at this point in the history
…edirection

This patch cleans up the command line where we use the C preprocessor
to better reflect the documented usage in the GCC man page, thus
preparing for Clang support.

1. When invoking the C preprocessor, there is no need for -Wp to pass
arguments, so remove it.

2. -MD is not supposed to take a file name when passed to cpp. The
dependency output file name is overridden with -MF.

3. Lastly, it is better to use -o to specify the output file instead
of redirecting standard output, because if an error occurs during
preprocessing we don't want the output file to be created.

Signed-off-by: Jerome Forissier <[email protected]>
Reviewed-by: Jens Wiklander <[email protected]>
  • Loading branch information
jforissier committed Sep 2, 2019
1 parent b516aa9 commit 2f6dffb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions core/arch/arm/kernel/link.mk
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ cleanfiles += $(link-script-pp) $(link-script-dep)
$(link-script-pp): $(link-script) $(link-script-extra-deps)
@$(cmd-echo-silent) ' CPP $@'
@mkdir -p $(dir $@)
$(q)$(CPPcore) -Wp,-P,-MT,$@,-MD,$(link-script-dep) \
$(link-script-cppflags) $< > $@
$(q)$(CPPcore) -P -MT $@ -MD -MF $(link-script-dep) \
$(link-script-cppflags) $< -o $@

define update-buildcount
@$(cmd-echo-silent) ' UPD $(1)'
Expand Down
4 changes: 2 additions & 2 deletions ldelf/link.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ $(link-script-pp$(sm)): $(link-script$(sm)) $(conf-file) \
$(link-script-pp-makefiles$(sm))
@$(cmd-echo-silent) ' CPP $$@'
$(q)mkdir -p $$(dir $$@)
$(q)$(CPP$(sm)) -Wp,-P,-MT,$$@,-MD,$(link-script-dep$(sm)) \
$(link-script-cppflags-$(sm)) $$< > $$@
$(q)$(CPP$(sm)) -P -MT $$@ -MD -MF $(link-script-dep$(sm)) \
$(link-script-cppflags-$(sm)) $$< -o $$@

$(link-out-dir$(sm))/ldelf.elf: $(objs) $(libdeps) $(link-script-pp$(sm))
@$(cmd-echo-silent) ' LD $$@'
Expand Down
4 changes: 2 additions & 2 deletions ta/arch/arm/link.mk
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ define gen-link-t
$(link-script-pp$(sm)): $(link-script$(sm)) $(conf-file) $(link-script-pp-makefiles$(sm))
@$(cmd-echo-silent) ' CPP $$@'
$(q)mkdir -p $$(dir $$@)
$(q)$(CPP$(sm)) -Wp,-P,-MT,$$@,-MD,$(link-script-dep$(sm)) \
$(link-script-cppflags-$(sm)) $$< > $$@
$(q)$(CPP$(sm)) -P -MT $$@ -MD -MF $(link-script-dep$(sm)) \
$(link-script-cppflags-$(sm)) $$< -o $$@

$(link-out-dir$(sm))/$(user-ta-uuid).elf: $(objs) $(libdeps) \
$(link-script-pp$(sm)) \
Expand Down

0 comments on commit 2f6dffb

Please sign in to comment.