Difference between make build and make all

mattismyo
Posts: 29
Joined: Sat Jun 10, 2017 6:56 am

Difference between make build and make all

Postby mattismyo » Thu Aug 31, 2017 10:29 am

What is the difference between make build and make all?

ESP-IDF Programming Guide wrote:Compiling your project

make all

… will compile app, bootloader and generate a partition table based on the config.
But is make build not also doing the same?

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Difference between make build and make all

Postby kolban » Thu Aug 31, 2017 1:49 pm

Howdy,
Where are you finding "make build" as an exposed target for the Makesystem?

My understanding is that a Makefile can contain many potential targets that are not expected to be invoked directly but are instead used internally as sub-targets. If we run "make help" we see the following:

Code: Select all

Welcome to Espressif IDF build system. Some useful make targets:

make menuconfig - Configure IDF project
make defconfig - Set defaults for all new configuration options

make all - Build app, bootloader, partition table
make flash - Flash app, bootloader, partition table to a chip
make clean - Remove all build output
make size - Display the static memory footprint of the app
make size-components, size-files - Finer-grained memory footprints
make erase_flash - Erase entire flash contents
make monitor - Run idf_monitor tool to monitor serial output from app
make simple_monitor - Monitor serial output on terminal console
make list-components - List all components in the project

make app - Build just the app
make app-flash - Flash just the app
make app-clean - Clean just the app

See also 'make bootloader', 'make bootloader-flash', 'make bootloader-clean', 
'make partition_table', etc, etc
I would recommend sticking to these targets exclusively. If you find a "make build" documented, then its safe to use. I did a search of the source of the Makefiles and the "make build" target is found in "component_wrapper.mk".
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Difference between make build and make all

Postby ESP_Angus » Fri Sep 01, 2017 12:37 am

Kolban's answer is correct, the documented targets are the ones to use.

You had me really confused about how "make build" exists at all, because even though "build" is a (phony) target in each component's recursively sub-makefile, but you shouldn't be able to run it from the top-level as "make build"

I was very confused by this until I realised that "build" is also the name of the default build output directory, so "make build" is telling the build system to make sure this directory exists. It doesn't build anything else. If you set BUILD_DIR_BASE to some other name and remove the "build" directory, "make build" will start failing!

Who is online

Users browsing this forum: Google [Bot] and 48 guests