]> granicus.if.org Git - esp-idf/blobdiff - docs/build_system.rst
Add SPI Master driver, example, test and docs
[esp-idf] / docs / build_system.rst
index aa14cdda56ab234486b96c64b7b78c31ce7df9ad..6687fa69ed2f8d70fa4ccb2a583052dc1bcb107e 100644 (file)
@@ -57,6 +57,7 @@ Example Project
 ---------------
 
 An example project directory tree might look like this::
+
     - myProject/
                  - Makefile
                  - sdkconfig
@@ -66,11 +67,11 @@ An example project directory tree might look like this::
                                - component2/ - component.mk
                                              - Kconfig
                                              - src1.c
-                                             - include/
-                                                    - component2.h
+                                             - include/ - component2.h
                  - main/       - src1.c
                                - src2.c
                                - component.mk
+
                  - build/
 
 This example "myProject" contains the following elements:
@@ -101,6 +102,7 @@ Minimal Example Makefile
 ^^^^^^^^^^^^^^^^^^^^^^^^
 
 ::
+
    PROJECT_NAME := myProject
    
    include $(IDF_PATH)/make/project.mk
@@ -135,7 +137,8 @@ Minimal Component Makefile
 ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 The minimal ``component.mk`` file is an empty file(!). If the file is empty, the default component behaviour is set:
-- All source files in the same directory as the makefile (*.c, *.cpp, *.S) will be compiled into the component library
+
+- All source files in the same directory as the makefile (``*.c``, ``*.cpp``, ``*.S``) will be compiled into the component library
 - A sub-directory "include" will be added to the global include search path for all other components.
 - The component library will be linked into the project app.
 
@@ -185,6 +188,10 @@ The following variables can be set inside ``component.mk`` to control build sett
   are available at all times. It is necessary if one component
   generates an include file which you then want to include in another
   component. Most components do not need to set this variable.
+- ``COMPONENT_ADD_LINKER_DEPS``: Optional list of component-relative paths
+  to files which should trigger a re-link of the ELF file if they change.
+  Typically used for linker script files and binary libraries. Most components do
+  not need to set this variable.
 
 The following variable only works for components that are part of esp-idf itself:
 
@@ -209,8 +216,8 @@ The following variables can be set inside ``component.mk`` to control the build
   ``COMPONENT_PRIV_INCLUDEDIRS`` variable, except these paths are not
   expanded relative to the component directory.
 - ``COMPONENT_SRCDIRS``: Directory paths, must be relative to the
-  component directory, which will be searched for source files (*.cpp,
-  *.c, *.S). Defaults to '.', ie the component directory
+  component directory, which will be searched for source files (``*.cpp``,
+  ``*.c``, ``*.S``). Defaults to '.', ie the component directory
   itself. Override this to specify a different list of directories
   which contain source files.
 - ``COMPONENT_OBJS``: Object files to compile. Default value is a .o
@@ -242,6 +249,12 @@ The following variables can be set inside ``component.mk`` to control the build
   +=``. It is also possible (although not recommended) to override
   this variable completely for a component.
 
+To apply compilation flags to a single source file, you can add a variable override as a target, ie::
+
+  apps/dhcpserver.o: CFLAGS += -Wno-unused-variable
+
+This can be useful if there is upstream code that emits warnings.
+
 Component Configuration
 -----------------------
 
@@ -366,12 +379,14 @@ The configuration system can be used to conditionally compile some files
 depending on the options selected in ``make menuconfig``:
 
 ``Kconfig``::
+
     config FOO_ENABLE_BAR
         bool "Enable the BAR feature."
         help
             This enables the BAR feature of the FOO component.
 
 ``component.mk``::
+
     COMPONENT_OBJS := foo_a.o foo_b.o
 
     ifdef CONFIG_FOO_BAR