-
Notifications
You must be signed in to change notification settings - Fork 365
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
Add documentation for MakeDeps #3348
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c0743ad
Add integration page for Makefile
uilianries ece2790
Add MakeDeps reference
uilianries fdc5c11
Add makedeps entry in gnu index
uilianries 97f65f1
Merge branch 'develop2' into feature/makedeps
czoido 4fab6bc
Add experimental warning to MakeDeps
uilianries df1d8c9
Merge branch 'feature/makedeps' of github.com:uilianries/conan-docs i…
uilianries ecd9cb2
Grammar fix
uilianries 167c63d
Grammar fix
uilianries f0bfe89
Grammar fix
uilianries 9e3ff3c
Update reference/tools/gnu/makedeps.rst
AbrilRBS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.. _integrations_makefile: | ||
|
||
|gnu_make_logo| Makefile | ||
======================== | ||
|
||
Conan provides different tools to help manage your projects using Make. They can be | ||
imported from ``conan.tools.gnu``. Besides the most popular variant, GNU Make, Conan also | ||
supports other variants like BSD Make. The most relevant tools are: | ||
|
||
- `MakeDeps`: the dependencies generator for Make, which generates a Makefile containing | ||
definitions that the Make build tool can understand. | ||
|
||
Currently, there is no ``MakeToolchain`` generator, it should be added in the future. | ||
|
||
For the full list of tools under ``conan.tools.gnu`` please check the :ref:`reference | ||
<conan_tools_gnu>` section. | ||
|
||
.. seealso:: | ||
|
||
- Reference for :ref:`MakeDeps<conan_tools_gnu_makedeps>`. | ||
|
||
.. |gnu_make_logo| image:: ../images/integrations/conan-autotools-logo.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
.. _conan_tools_gnu_makedeps: | ||
|
||
MakeDeps | ||
======== | ||
|
||
.. include:: ../../../common/experimental_warning.inc | ||
|
||
.. _MakeDeps: | ||
|
||
``MakeDeps`` is the dependencies generator for make. It generates a Makefile file named ``conandeps.mk`` | ||
containing a valid make file syntax with all dependencies listed, including their components. | ||
|
||
This generator can be used by name in conanfiles: | ||
|
||
.. code-block:: python | ||
:caption: conanfile.py | ||
|
||
class Pkg(ConanFile): | ||
generators = "MakeDeps" | ||
|
||
.. code-block:: text | ||
:caption: conanfile.txt | ||
|
||
[generators] | ||
MakeDeps | ||
|
||
And it can also be fully instantiated in the conanfile ``generate()`` method: | ||
|
||
.. code:: python | ||
|
||
from conan import ConanFile | ||
from conan.tools.gnu import MakeDeps | ||
|
||
class App(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
requires = "zlib/1.2.13" | ||
|
||
def generate(self): | ||
pc = MakeDeps(self) | ||
pc.generate() | ||
|
||
|
||
Generated files | ||
--------------- | ||
|
||
`make` format file named ``conandeps.mk``, containing a valid makefile file syntax. | ||
The ``prefix`` variable is automatically adjusted to the ``package_folder``: | ||
|
||
.. code-block:: makefile | ||
|
||
CONAN_DEPS = zlib | ||
|
||
# zlib/1.2.13 | ||
CONAN_NAME_ZLIB = zlib | ||
CONAN_VERSION_ZLIB = 1.2.13 | ||
CONAN_REFERENCE_ZLIB = zlib/1.2.13 | ||
CONAN_ROOT_ZLIB = /home/conan/.conan2/p/b/zlib273508b343e8c/p | ||
CONAN_INCLUDE_DIRS_ZLIB = $(CONAN_INCLUDE_DIR_FLAG)$(CONAN_ROOT_ZLIB)/include | ||
CONAN_LIB_DIRS_ZLIB = $(CONAN_LIB_DIR_FLAG)$(CONAN_ROOT_ZLIB)/lib | ||
CONAN_BIN_DIRS_ZLIB = $(CONAN_BIN_DIR_FLAG)$(CONAN_ROOT_ZLIB)/bin | ||
CONAN_LIBS_ZLIB = $(CONAN_LIB_FLAG)z | ||
|
||
CONAN_INCLUDE_DIRS = $(CONAN_INCLUDE_DIRS_ZLIB) | ||
CONAN_LIB_DIRS = $(CONAN_LIB_DIRS_ZLIB) | ||
CONAN_BIN_DIRS = $(CONAN_BIN_DIRS_ZLIB) | ||
CONAN_LIBS = $(CONAN_LIBS_ZLIB) | ||
|
||
Customization | ||
------------- | ||
|
||
Flags | ||
+++++ | ||
|
||
By default, the ``conandeps.mk`` will contain all dependencies listed, including their ``cpp_info`` information, but will not pass any flags to the compiler. | ||
|
||
Thus, the consumer should pass the following flags to the compiler: | ||
|
||
- **CONAN_LIB_FLAG**: Add a prefix to all libs variables, e.g. ``-l`` | ||
- **CONAN_DEFINE_FLAG**: Add a prefix to all defines variables, e.g. ``-D`` | ||
- **CONAN_SYSTEM_LIB_FLAG**: Add a prefix to all system_libs variables, e.g. ``-l`` | ||
- **CONAN_INCLUDE_DIR_FLAG**: Add a prefix to all include dirs variables, e.g. ``-I`` | ||
- **CONAN_LIB_DIR_FLAG**: Add a prefix to all lib dirs variables, e.g. ``-L`` | ||
- **CONAN_BIN_DIR_FLAG**: Add a prefix to all bin dirs variables, e.g. ``-L`` | ||
|
||
Those flags should be appended as prefixes to flags variables. For example, if the ``CONAN_LIB_FLAG`` is set to ``-l``, the ``CONAN_LIBS`` variable will be set to ``-lz``. | ||
|
||
Reference | ||
--------- | ||
|
||
.. currentmodule:: conan.tools.gnu | ||
|
||
.. autoclass:: MakeDeps | ||
:members: |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make is not a GNU tool, but GNU Make is the most famous.