mastering makefiles for embedded C/C++ (practical, step-by-step, real-world demo)
🧱 Makefiles from scratch – In this standalone sideline to the Embedded C++ series, we take a deep dive into how real-world Makefiles work by building a complete, flexible build system for a mixed C/C++ project. From hello.c to recursive Fibonacci in lib.cpp, we craft an intelligent, portable, and maintainable Makefile from first principles.
🔍 What you’ll learn:
- How make works: targets, recipes, and phony goals
- Generating build directories and handling dependencies
- Auto-discovery of C and C++ source files
- Separating flags, toolchains, and output binaries
- Supporting .c, .cpp, .h files with recursive builds
- Profiling builds with make timed and /dev/null redirection
- Understanding = vs. :=, $@, $^, and $(info ...)
- Using -MMD and including dependency files
💡 Bonus: Learn how to structure your builds for clean debug/release separation and add dynamic programming to your code (because... Fibonacci).
The code is on GitHub:
https://github.com/yephick/embeddedpp/tree/makefile-tutorial/makefile_tutorial
00:00 intro
00:30 workplace setup
01:14 what is a makefile?
01:46 writing the simplest makefile
03:12 using `make help`
03:36 default recipes explained
04:35 planning a full-featured makefile
07:00 creating `main.c`
08:00 manual build (GCC commands)
08:50 build via makefile
09:40 understanding dependencies
10:14 phony targets
11:40 makefile variables
15:40 separating build directory
18:57 `make clean` target
19:57 generic compilation rule
25:25 auto-generate source file list
28:30 adding a C library
33:25 using `$(info ...)`
35:44 header dependencies with `-MMD`
41:54 adding a C++ library
53:00 measuring build with `make timed`
58:25 final recap
1:02:00 defining `$(dir_guard)`
1:03:25 `=` vs. `:=` in makefiles
1:06:00 fixing real build dependency
1:08:50 redirecting to `/dev/null`
Видео mastering makefiles for embedded C/C++ (practical, step-by-step, real-world demo) канала Embedded C++ with MSVC IDE
🔍 What you’ll learn:
- How make works: targets, recipes, and phony goals
- Generating build directories and handling dependencies
- Auto-discovery of C and C++ source files
- Separating flags, toolchains, and output binaries
- Supporting .c, .cpp, .h files with recursive builds
- Profiling builds with make timed and /dev/null redirection
- Understanding = vs. :=, $@, $^, and $(info ...)
- Using -MMD and including dependency files
💡 Bonus: Learn how to structure your builds for clean debug/release separation and add dynamic programming to your code (because... Fibonacci).
The code is on GitHub:
https://github.com/yephick/embeddedpp/tree/makefile-tutorial/makefile_tutorial
00:00 intro
00:30 workplace setup
01:14 what is a makefile?
01:46 writing the simplest makefile
03:12 using `make help`
03:36 default recipes explained
04:35 planning a full-featured makefile
07:00 creating `main.c`
08:00 manual build (GCC commands)
08:50 build via makefile
09:40 understanding dependencies
10:14 phony targets
11:40 makefile variables
15:40 separating build directory
18:57 `make clean` target
19:57 generic compilation rule
25:25 auto-generate source file list
28:30 adding a C library
33:25 using `$(info ...)`
35:44 header dependencies with `-MMD`
41:54 adding a C++ library
53:00 measuring build with `make timed`
58:25 final recap
1:02:00 defining `$(dir_guard)`
1:03:25 `=` vs. `:=` in makefiles
1:06:00 fixing real build dependency
1:08:50 redirecting to `/dev/null`
Видео mastering makefiles for embedded C/C++ (practical, step-by-step, real-world demo) канала Embedded C++ with MSVC IDE
makefile tutorial makefile from scratch makefile c++ embedded development build system C and C++ build makefile dependencies phony target make clean recursive makefile auto source discovery make timed makefile optimization build automation gcc g++ WSL C++ project modular build makefile step by step dir_guard makefile best practices embedded C++ build integration real-world makefile makefile vim C/C++ professional tutorial detailed step-by-step build
Комментарии отсутствуют
Информация о видео
17 марта 2025 г. 18:52:47
01:09:28
Другие видео канала