Skip to content

make: replace curly braces with parenthesis#8822

Merged
cladmi merged 1 commit intoRIOT-OS:masterfrom
aabadie:pr/make_curly
Mar 27, 2018
Merged

make: replace curly braces with parenthesis#8822
cladmi merged 1 commit intoRIOT-OS:masterfrom
aabadie:pr/make_curly

Conversation

@aabadie
Copy link
Copy Markdown
Contributor

@aabadie aabadie commented Mar 22, 2018

Contribution description

This PR is a follow-up of #8815 but applied to all Makefiles. Then the use of $(variable) is consistent across all makefiles (instead of mixing it with ${variable}).

Maybe @cladmi is interested ?

Issues/PRs references

@aabadie aabadie added Area: build system Area: Build system Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Mar 22, 2018
@jnohlgard
Copy link
Copy Markdown
Member

Did you use a script to perform the replaces?

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Mar 22, 2018

Did you use a script to perform the replaces?

No, just query replaces by hand.

@jnohlgard jnohlgard removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 22, 2018
Copy link
Copy Markdown
Member

@jnohlgard jnohlgard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many places where the text in a makefile is passed to the shell, there curly braces can't be replaced or it will break

${COLOR_ECHO} -n "Building for $$board ... " ; \
BOARD=$${board} RIOT_CI_BUILD=1 RIOT_VERSION_OVERRIDE=buildtest \
$(COLOR_ECHO) -n "Building for $$board ... " ; \
BOARD=$$(board) RIOT_CI_BUILD=1 RIOT_VERSION_OVERRIDE=buildtest \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, the curly braces matter

$(MAKE) clean-intermediates >/dev/null 2>&1 || true; \
done ; \
$${RESULT}
$$(RESULT)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curly braces matter

for board in ${BOARDS}; do \
echo "$$(BOARD=$${board} $(MAKE) --no-print-directory info-buildsize 2>/dev/null | tail -n-1 | cut -f-4)" "$${board}"; \
for board in $(BOARDS); do \
echo "$$(BOARD=$$(board) $(MAKE) --no-print-directory info-buildsize 2>/dev/null | tail -n-1 | cut -f-4)" "$$(board)"; \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curly braces

for BINDIRBASE in $${OLDBIN} $${NEWBIN}; do \
BINDIRBASE=$${BINDIRBASE} BOARD=$${board} $(MAKE) info-buildsize --no-print-directory 2>/dev/null | tail -n-1 | cut -f-4; \
for board in $(BOARDS); do \
for BINDIRBASE in $$(OLDBIN) $$(NEWBIN); do \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must be curly

BINDIRBASE=$${BINDIRBASE} BOARD=$${board} $(MAKE) info-buildsize --no-print-directory 2>/dev/null | tail -n-1 | cut -f-4; \
for board in $(BOARDS); do \
for BINDIRBASE in $$(OLDBIN) $$(NEWBIN); do \
BINDIRBASE=$$(BINDIRBASE) BOARD=$$(board) $(MAKE) info-buildsize --no-print-directory 2>/dev/null | tail -n-1 | cut -f-4; \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more curlys

for I in 0 1 2 3; do echo -ne "$${NEW[I]-${COLOR_RED}ERR${COLOR_RESET}}\t"; done; echo -e "$${NEWBIN}\n"; \
echo "$$(board)"; \
for I in 0 1 2 3; do echo -ne "$$(OLD[I]-$(COLOR_RED)ERR$(COLOR_RESET))\t"; done; echo -e "$$(OLDBIN)"; \
for I in 0 1 2 3; do echo -ne "$$(NEW[I]-$(COLOR_RED)ERR$(COLOR_RESET))\t"; done; echo -e "$$(NEWBIN)\n"; \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curly all above


info-boards-features-missing:
@for f in $(BOARDS_FEATURES_MISSING); do echo $${f}; done | column -t
@for f in $(BOARDS_FEATURES_MISSING); do echo $$(f); done | column -t
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curly

tail -n+2 | \
sed -e 's#$(BINDIR)##' | \
sort -rnk$${SORTROW}
sort -rnk$$(SORTROW)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curly

@jnohlgard
Copy link
Copy Markdown
Member

I did not mark all mistakes, but look for double dollar signs in the diff and verify those one more time

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Mar 22, 2018

oups, you are right, I'll fix them.

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Mar 22, 2018

@gebart, I reverted the wrong changes. I think it should be ok now.

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Mar 26, 2018

@gebart do you see other problems here ?

Copy link
Copy Markdown
Member

@jnohlgard jnohlgard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine now

@aabadie aabadie added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 26, 2018
@cladmi cladmi self-assigned this Mar 27, 2018
@cladmi
Copy link
Copy Markdown
Contributor

cladmi commented Mar 27, 2018

I will check this afternoon.

Copy link
Copy Markdown
Contributor

@cladmi cladmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not find other occurrence of ${ in makefiles. I used this command to check:

git grep '${' | grep -v '$${' | grep -v -e '\.sh:' -e '^dist/' -e .murdock -e mkbootc -e README.md -e 'generate-cmake-xcompile.perl' -e 'doc/doxygen'

The changes look ok by looking at the diff.

@cladmi cladmi merged commit 21a9958 into RIOT-OS:master Mar 27, 2018
cladmi added a commit to cladmi/RIOT that referenced this pull request Apr 10, 2018
jcarrano pushed a commit to jcarrano/RIOT that referenced this pull request May 7, 2018
jcarrano pushed a commit to jcarrano/RIOT that referenced this pull request May 9, 2018
@aabadie aabadie deleted the pr/make_curly branch June 8, 2018 20:40
jia200x pushed a commit to jia200x/RIOT that referenced this pull request Jun 11, 2018
panail pushed a commit to panail/RIOT that referenced this pull request Oct 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: build system Area: Build system CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants