Skip to content

drivers: add driver specific Makefile.dep#14386

Merged
fjmolinas merged 3 commits intoRIOT-OS:masterfrom
aabadie:pr/drivers/makefile_dep
Jul 20, 2020
Merged

drivers: add driver specific Makefile.dep#14386
fjmolinas merged 3 commits intoRIOT-OS:masterfrom
aabadie:pr/drivers/makefile_dep

Conversation

@aabadie
Copy link
Contributor

@aabadie aabadie commented Jun 29, 2020

Contribution description

This PR splits the main drivers/Makefile.dep in driver specific Makefile.deps.

The dependency resolution for drivers modules defined as pseudo-modules still have to be done in the main drivers/Makefile.dep but just add the "real" module as a dependency.

There was a dependency resolution for nrfmin in drivers/Makefile.dep but it has nothing to do here, this PR moves it to cpu/nrf5x_common/Makefile.dep.

Testing procedure

  • A green Murdock
  • Use build system tools to ensure no dependency has changed (help: what are the commands already ?)

Issues/PRs references

Similar to #14369 but for Makefile.dep

@aabadie aabadie added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: build system Area: Build system Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jun 29, 2020
@aabadie aabadie requested a review from fjmolinas June 29, 2020 08:49
@aabadie aabadie force-pushed the pr/drivers/makefile_dep branch from 72f2063 to d9e4301 Compare June 29, 2020 08:55
@aabadie
Copy link
Contributor Author

aabadie commented Jun 29, 2020

I fear that this one will be hard to maintain in the long run...

@gschorcht
Copy link
Contributor

  • Use build system tools to ensure no dependency has changed (help: what are the commands already ?)

Would be dist/tools/buildsystem_sanity_check/save_all_dependencies_resolution_variables.sh sufficient?

@fjmolinas
Copy link
Contributor

I fear that this one will be hard to maintain in the long run...

You mean this PR, or the actual changes? If no dependencies have changed I think we can move quickly with this one, but is @miri64 OK with us merging this one in soft feature freeze?

@fjmolinas
Copy link
Contributor

You mean this PR, or the actual changes? If no dependencies have changed I think we can move quickly with this one, but is @miri64 OK with us merging this one in soft feature freeze?

I'm currently running the script for #14353 I can run i for this PR after wards.

FEATURES_REQUIRED += periph_spi
endif

ifneq (,$(filter ccs811_full,$(USEMODULE)))
Copy link
Contributor

@gschorcht gschorcht Jun 29, 2020

Choose a reason for hiding this comment

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

I wonder if it would be better to always address driver variants defined by pseudomodules with %, for example.

Suggested change
ifneq (,$(filter ccs811_full,$(USEMODULE)))
ifneq (,$(filter ccs811%,$(USEMODULE)))

Everything else is done by drivers/*/Makefile.dep. For most of the pseudomodules it's already done in that way, but for some of them direct names are used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I started with the brute force way but we can refine for sure !

Copy link
Contributor

Choose a reason for hiding this comment

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

Since we touch it once, we should change it with this PR. If I'm right, there are less than 10 occurrences.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed, I prefer to use ccs811_%.

@aabadie
Copy link
Contributor Author

aabadie commented Jun 29, 2020

I'm currently running the script for #14353 I can run i for this PR after wards.

Thanks!

@gschorcht
Copy link
Contributor

@aabadie I went through all the changes. From what I have seen, it should be the same. But we should rely on tools. If it helps, I could run the script if @fjmolinas run for PR #14353 takes too long.

@fjmolinas
Copy link
Contributor

@aabadie I went through all the changes. From what I have seen, it should be the same. But we should rely on tools. If it helps, I could run the script if @fjmolinas run for PR #14353 takes too long.

The script is still running on my side, so feel free to run it yourself. I would probably run it tonight and look at the results tomorrow/

@gschorcht
Copy link
Contributor

gschorcht commented Jun 29, 2020

@aabadie I went through all the changes. From what I have seen, it should be the same. But we should rely on tools. If it helps, I could run the script if @fjmolinas run for PR #14353 takes too long.

The script is still running on my side, so feel free to run it yourself. I would probably run it tonight and look at the results tomorrow/

Ok, I will start it immediatly. My computer is borrowing 😉 (edit: bored 😆)

@gschorcht
Copy link
Contributor

@fjmolinas for each application I get the two warnings

boards/arduino-nano-33-ble/Makefile.include:27: warning: overriding recipe for target 'term-delay'
makefiles/tools/usb_board_reset.mk:35: warning: ignoring old recipe for target 'term-delay'

Is that normal?

@fjmolinas
Copy link
Contributor

@fjmolinas for each application I get the two warnings

boards/arduino-nano-33-ble/Makefile.include:27: warning: overriding recipe for target 'term-delay'
makefiles/tools/usb_board_reset.mk:35: warning: ignoring old recipe for target 'term-delay'

Is that normal?

Not sure if normal, but unrelated. I'll take a look.

@aabadie aabadie force-pushed the pr/drivers/makefile_dep branch from d9e4301 to ffbcb8a Compare June 29, 2020 14:21
@fjmolinas
Copy link
Contributor

The output of running ./dist/tools/buildsystem_sanity_check/save_all_dependencies_resolution_variables.sh diff.txt, there are only differences in FEATURES_REQUIRED and FEATURES_OPTIONAL, but no diff in FEATURES_USED or USEMODULE. So there is no dependencies have changed, it is probably parsed more times than before. I wan't to try to understand why, but I dont' necessarily see this as a problem.

Wow, you have already finished it. My one is still running since I forgot to start the second run yesterday in the evening 😟

I have a second machine, useful for running this kind of things while keeping my laptop free.

@gschorcht
Copy link
Contributor

The output of running ./dist/tools/buildsystem_sanity_check/save_all_dependencies_resolution_variables.sh diff.txt, there are only differences in FEATURES_REQUIRED and FEATURES_OPTIONAL

FEATURES_REQUIRED and FEATURES_OPTIONAL look really weird at times. But as I understand it, it is important that the sorted versions of these lists do not differ.

@aabadie aabadie force-pushed the pr/drivers/makefile_dep branch from 32c4817 to 56ad5a0 Compare July 10, 2020 14:34
@gschorcht
Copy link
Contributor

Now that the release branch was created after the hard feature freeze, we should merge this PR as soon as possible before new drivers are merged.

@aabadie Please squash.
@fjmolinas Based on the results of your comparison in #14386 (comment), can we be sure that the dependencies are resolved correctly, even if FEATURES_REQUIRED and FEATURES_OPTIONAL sometimes look very strange (the complete list of features multiple times)? Sorted versions of these variables don't differ.

@aabadie aabadie force-pushed the pr/drivers/makefile_dep branch from 56ad5a0 to 7d8d89a Compare July 10, 2020 16:57
@aabadie
Copy link
Contributor Author

aabadie commented Jul 10, 2020

I had conflicts when rebasing the last time (a couple of hours ago) so I think it's safer to re-run the checks. I rebased again and squashed the branch.

Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

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

Soft feature freeze is over, Murdock is happy and this is a good improvement.
Let's get this in before new merge conflicts pop up.

@aabadie aabadie force-pushed the pr/drivers/makefile_dep branch from 7d8d89a to 3b8ac51 Compare July 15, 2020 18:43
@aabadie
Copy link
Contributor Author

aabadie commented Jul 15, 2020

rebased once again.

@aabadie aabadie force-pushed the pr/drivers/makefile_dep branch from 3b8ac51 to de3d388 Compare July 15, 2020 18:53
@aabadie aabadie 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 Jul 15, 2020
@gschorcht
Copy link
Contributor

Again, looks good from my point of view.

Ping @fjmolinas Based on the results of your comparison in #14386 (comment), can we be sure that the dependencies are resolved correctly, even if FEATURES_REQUIRED and FEATURES_OPTIONAL sometimes look very strange (the complete list of features is in multiple times)? Sorted versions of these variables don't differ.

@aabadie aabadie force-pushed the pr/drivers/makefile_dep branch from de3d388 to 0357b44 Compare July 20, 2020 11:13
@aabadie
Copy link
Contributor Author

aabadie commented Jul 20, 2020

rebased to solve the conflict introduced when #14497 was just merged.

@gschorcht
Copy link
Contributor

We should merge it before further conflicts pop up. But I'm a bit unsure without the final statement from @fjmolinas 😟

@aabadie
Copy link
Contributor Author

aabadie commented Jul 20, 2020

But I'm a bit unsure without the final statement from @fjmolinas

I can ping him IRL :D

@gschorcht
Copy link
Contributor

gschorcht commented Jul 20, 2020

But I'm a bit unsure without the final statement from @fjmolinas

I can ping him IRL :D

That would be good. My concern was that although the sorted versions of FEATURES_REQUIRED and FEATURES_OPTIONAL were the same in his test, the unsorted versions of these variables sometimes looked really strange (the same list of features multiple times). I would rely on his oppinion if he says that it doesn't matter.

Copy link
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

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

Found why there are repeated features, you can squash right away.

Makefile.dep Outdated
include $(RIOTBASE)/drivers/Makefile.dep

# pull Makefile.dep of each driver modules if they exist
-include $(USEMODULE:%=$(RIOTBASE)/drivers/%/Makefile.dep)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-include $(USEMODULE:%=$(RIOTBASE)/drivers/%/Makefile.dep)
-include $(sort $(USEMODULE:%=$(RIOTBASE)/drivers/%/Makefile.dep))

This will fix having the list included multiple times.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed

@aabadie aabadie force-pushed the pr/drivers/makefile_dep branch from 0357b44 to 0c86b72 Compare July 20, 2020 12:32
Copy link
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

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

ACK

@fjmolinas fjmolinas merged commit 14e232d into RIOT-OS:master Jul 20, 2020
@aabadie aabadie deleted the pr/drivers/makefile_dep branch July 20, 2020 13:27
@nagrawal63
Copy link
Contributor

nagrawal63 commented Jul 27, 2020

driver-guide.md is not updated to include these changes since it still says that you have to add the driver dependencies in the Makefile.dep file in $(RIOTBASE)/drivers/Makefile.dep (at line no. 307).

Could you kindly check into it ?

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 Area: drivers Area: Device drivers 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.

5 participants