Skip to content

Makefile.base: fix AR keeping removed source files objects#7952

Merged
kYc0o merged 2 commits intoRIOT-OS:masterfrom
cladmi:pr/ar_delete_old_files
Mar 14, 2018
Merged

Makefile.base: fix AR keeping removed source files objects#7952
kYc0o merged 2 commits intoRIOT-OS:masterfrom
cladmi:pr/ar_delete_old_files

Conversation

@cladmi
Copy link
Copy Markdown
Contributor

@cladmi cladmi commented Nov 7, 2017

AR incrementally adds file without removing files.
If a c file is deleted or disabled(submodule removal) it is not removed from
archive and still ends up in the final elf file.

This fix removes the need to do 'make clean' for this case.

However it will break cases where an APPLICATION and a MODULE or two modules
have the same name and only worked because source files names where different.

This requires: #7951 to not break compilation. I only tested native and samr21-xpro right now.

Edit: This also requires #8019, I added a fix that will be proposed as a separate PR. The only important file change for this PR is Makefile.base.

@cladmi cladmi added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: build system Area: Build system labels Nov 7, 2017
@kaspar030 kaspar030 added the State: waiting for other PR State: The PR requires another PR to be merged first label Nov 9, 2017
@cladmi cladmi added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Nov 10, 2017
@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Nov 10, 2017

I enable murdock to show the broken output and see if other fixes than #7951 could be necessary.

@cladmi cladmi force-pushed the pr/ar_delete_old_files branch 3 times, most recently from e830f10 to 688a90c Compare November 13, 2017 11:44
@cladmi cladmi force-pushed the pr/ar_delete_old_files branch from 688a90c to 5fea2ae Compare November 13, 2017 14:31
@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Nov 13, 2017

It also requires fix for mips cpus to work #8019
I will do a proper PR for it.

@cladmi cladmi force-pushed the pr/ar_delete_old_files branch 2 times, most recently from 80057d9 to 3a71827 Compare November 14, 2017 12:19
@cladmi cladmi force-pushed the pr/ar_delete_old_files branch from 3a71827 to e56ca23 Compare January 26, 2018 18:04
@cladmi cladmi removed the State: waiting for other PR State: The PR requires another PR to be merged first label Jan 26, 2018
@cladmi cladmi force-pushed the pr/ar_delete_old_files branch from e56ca23 to cf1f032 Compare January 29, 2018 14:29
@cladmi cladmi added the State: waiting for other PR State: The PR requires another PR to be merged first label Jan 29, 2018
@cladmi cladmi force-pushed the pr/ar_delete_old_files branch 2 times, most recently from f3e4e8e to c729d32 Compare January 30, 2018 13:37
@kYc0o kYc0o added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Feb 28, 2018
@kYc0o
Copy link
Copy Markdown
Contributor

kYc0o commented Feb 28, 2018

Is this still waiting for other PR?

@cladmi cladmi force-pushed the pr/ar_delete_old_files branch from c729d32 to 710f4d2 Compare March 1, 2018 10:55
@cladmi cladmi added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed State: waiting for other PR State: The PR requires another PR to be merged first CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Mar 1, 2018
@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 1, 2018

It should not be anymore.

I will add another PR to add a note in the http://doc.riot-os.org/creating-modules.html page to mention that MODULE names should be unique because with this it will be explicitly enforced.

@kYc0o
Copy link
Copy Markdown
Contributor

kYc0o commented Mar 1, 2018

I will add another PR to add a note in the http://doc.riot-os.org/creating-modules.html page to mention that MODULE names should be unique because with this it will be explicitly enforced.

I'd say put it here, it's the right context and more easy to find if everything is here.

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 1, 2018

I added some lines in the section talking about the MODULE name.

### Pitfalls ###

The `MODULE` name should be uniq or build will break as modules overwrite
the same output file.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I suggest to change this to "unique" or build breaks.

* Packages root directory (libfixmath/u8g2)
* boards/cpu/periph and their common boards/cpu/periph

Note: even if all boards and cpus implement the `board` and `cpu` modules only
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I suggest to rephrase: "... modules, only ..."

Copy link
Copy Markdown
Contributor

@kYc0o kYc0o left a comment

Choose a reason for hiding this comment

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

Looks ok but I have some doubts...

$(Q)$(AR) $(ARFLAGS) $@ $?
@# Recreate archive to cleanup deleted/non selected source files objects
$(Q)$(RM) $@
$(Q)$(AR) $(ARFLAGS) $@ $^
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are we sure we want to remove it ALWAYS, and not only under certain conditions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes always, because we want to re-create a new archive. If not, old files are kept as ar is incremental.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When doing gcc -o out.o it overwrites the previous object with the new one, and that is what we expect.
The RM here, is implementing an --overwrite option that ar does not have.

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 5, 2018

Updated the doc as you suggested.

@cladmi cladmi force-pushed the pr/ar_delete_old_files branch from a1958fb to 03ea7ba Compare March 6, 2018 12:38
@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 6, 2018

I re-worded the commit messages to fix "unique" too.

@cladmi cladmi requested a review from jnohlgard March 9, 2018 10:31
@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 14, 2018

@kYc0o Do you like the changes ? And so can I rebase.

@kYc0o
Copy link
Copy Markdown
Contributor

kYc0o commented Mar 14, 2018

Yep, let's go ahead.

@kYc0o
Copy link
Copy Markdown
Contributor

kYc0o commented Mar 14, 2018

Murdock, complains though. Can you check?

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 14, 2018

I think it's on the fixup, I will rebase to re-run.

cladmi added 2 commits March 14, 2018 12:29
AR incrementally adds file without removing files.
If a c file is deleted or disabled(submodule removal) it is not removed from
archive and still ends up in the final elf file.

This fix removes the need to do 'make clean' for this case.

However it will break cases where an APPLICATION and a MODULE or two modules
have the same name and only worked because source files names where different.
Modules produce an output archive called `${MODULE}.a` if several modules use
the same name, the output is overwritten.
@cladmi cladmi force-pushed the pr/ar_delete_old_files branch from 03ea7ba to e5d234e Compare March 14, 2018 11:29
@kYc0o kYc0o merged commit 3af570b into RIOT-OS:master Mar 14, 2018
@cladmi cladmi deleted the pr/ar_delete_old_files branch March 15, 2018 12:56
@cladmi cladmi added this to the Release 2018.04 milestone Nov 7, 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 Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants