-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add USEPKG variable for Makefiles #576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
That's two changes: I am all in favor of the first. |
|
You could not find any use of In Makefile.include it is called |
|
I'm checking with https://github.com/authmillenon/projects/tree/libcoap |
|
Appears to work. |
|
Hm, maybe the PR should be extended:
I guess that would make to even easier to use packages. Should I amend my PR, or wait to open a new one? (Or don't you like my idea?) |
|
I'm not sure |
|
Of course we could make it a requirement. That would only require a documentation update ;-) I like the idea in any case. Maybe someone else could add some brain power to this.. @authmillenon @thomaseichinger ? |
|
(Rebased.) My second commit implements automatic adding to INCLUDES. I added the include folder for libcoap, but openwsn had multiple patching errors for me. |
|
openwsn appears to build (and patch) for RIOT/master with https://github.com/thomaseichinger/projects/tree/openwsn-pkg |
|
ACK from my side regarding the USEPKG variable. @Kijewski could you provide me a build log and the revision/branch/etc. these patching errors occur on so I can investigate them? |
|
I would rather let the package maintainers let configure the include path if possible (because situations might not be as easily to solve as in libcoap). Also: if we decide against this could you at least make this change a patch for the libcoap package and not a static change in RIOT (maybe libcoap gets a include directory in the future to). But for the rest I'm totally for it. |
|
Well |
|
I go with @authmillenon. ACK for everything except the include path change. |
|
I still think that the include path change is a good idea. To quote @authmillenon: "situations might not be as easily to solve as in libcoap". That's the reason why a standardized include folder would be useful. Otherwise you still have to define two variables in your project (USEPKG and INCLUDES). If there are deep changes to the include structure, then the forward compatibility of the package will be broken anyways. But maybe a Makefile.include for the PKGs would be a better option? With |
|
Ok, now that I've looked closer into it I'm confused, libcoap is actually using [1] https://github.com/authmillenon/projects/blob/libcoap/libcoap/Makefile#L37 |
|
@Kijewski, +1 for adding a |
|
How would a standardized include directory work without major changes to the upstream project? e.g. oonf_api has includes in src-api/common/ and src-api/rfc5444 if those two modules are used. With the current EXTERNAL_MODULE + USEMODULE, it's also possible for packages to offer multiple modules. |
|
@benpicco it never occurred to me that one would want to have multiple modules in one package. Is this really a use case? |
|
Well it's not absolutely necessary, it could as well be compiled into one monolithic module, but header files are still distributed over several subfolders. |
|
@benpicco You could just |
That doesn't sound like a good idea, I see this breaking in … interesting ways… Also, do I understand correctly that this pull request only renames I don't see a huge benefit in the latter, it's consistent with the rest of RIOT. |
|
Can you elaborate on the interesting ways? |
|
In case of oonf_api, it's common for header files to include types defined in other header files like Aside from that, links will also get out of sync when files are renamed/deleted. |
|
You're right. |
|
I don't think that changing file names is a problem. A PKG should check out a tag. Using |
|
Ping. |
|
@benpicco the ping was for you I assume. |
|
I find that worse than specifying the includes manually as it currently is, I'd rather +1 the (or |
|
My last patch does that: PKGs will have to define a Makefile.include:
@truewith a static
What INCLUDES += -I $(RIOTBASE)/pkg/.../includeor even an empty file. |
|
Are there comments on my proposed interface, @benpicco, @LudwigOrtmann, @authmillenon? |
|
With the following change and a rebase you'll get my ACK ;-) diff --git a/pkg/libcoap/Makefile.include b/pkg/libcoap/Makefile.include
index 0fbf281..e69de29 100644
--- a/pkg/libcoap/Makefile.include
+++ b/pkg/libcoap/Makefile.include
@@ -1 +0,0 @@
-INCLUDES += -I $(RIOTBASE)/pkg/libcoap/include
+INCLUDES += -I $(RIOTBASE)/pkg/libcoap/libcoap
diff --git a/pkg/libcoap/include/coap.h b/pkg/libcoap/include/coap.h
deleted file mode 100644
index b61cbd7..0000000
--- a/pkg/libcoap/include/coap.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../libcoap/coap.h" |
|
An empty Makefile.include for libcoap? Shouldn't that be -INCLUDES += -I $(RIOTBASE)/pkg/libcoap/include
+INCLUDES += -I $(RIOTBASE)/pkg/libcoap/libcoap |
|
I've realized that myself. That's why I edited the comment ;) |
Currently pkg/USING says one should use `EXTERNAL+=$(RIOTBASE)/pkg/<pkg_name>` to enable PKG modules. Using this line the PKG will be compiled but not linked. This change adds a USEPKG variable to be used like `USEPKG += <pkg_name>`, which looks less clumsy and gets the PKG linked in the binary.
Packages have to define a Makefile.include target in pkg/%/Makefile. pkg/%/Makefile.include will be loaded after all other dependencies.
|
Rebased. |
|
ACK |
|
Looks good, I'll update #630 as well |
|
Does someone want to hit the merge button? :) |
|
Feel free to do it yourself if you are confident, it's your PR after all ;-) |
Add USEPKG variable for Makefiles
Currently pkg/USING says one should use
EXTERNAL+=$(RIOTBASE)/pkg/<pkg_name>to enable PKG modules. Using this line the PKG will be compiled but not linked.This change adds a USEPKG variable to be used like
USEPKG += <pkg_name>, which looks less clumsy and gets the PKG linked in the binary.