Skip to content
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

[WIP] Refector Makefile #786

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
60 changes: 60 additions & 0 deletions doc/build.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Design Document for build system

Build system is using make.

src/Makefile - this is meta Makefile which has the logic to find the right target under target/ folder and build it by invoke another make. It defines each target as a build target, each family as a build target. In addition to zip_<target> etc to build zip package for certain target.
Exported Variables:
SDIR = the full path src folder

src/Makefile.inc - this is core of the build logic. This makefile compose the final build steps and execute them. This file should included as last one in Makefile.
Import Variables:
TARGET = the target name, can be devo10 or emu_devo10
FAMILY = the family name
EXEEXT = the default exe extention name

CROSS = set this to prefix of cross-compiler. otherwise leave it as empty

SRCS_C = the c files to be compiled
SRCS_CPP = the cpp files to be compiled
CFLAGS = the C compile flags
CXXFLAGS = the C++ compile flags
LDFLAGS = the link flags
INCLUDES = the folder to includes
DEFINES = the macro definitions

MOD_SRCS_C = the c files for module
MOD_CFLAGS = the c compile flags for module
MOD_LDFLAGS = the link flags for modules

ALL = Additional targets beside $(TARGET).$(EXEEXT)

src/fs/Makefile.inc - this contains the logic to create filesystem folder for certain target
Import Variables:
TARGET = the target name
FILESYSTEM = the filesystem to be choosed between different predefined sets
FONTS = the fonts to be includes

src/target/<family>/<target>/Makefile - this file is entry point for build for target. It normally includes other makefile.inc to compose the build. Normally this file will includes src/target/<family>/common/Makefile.inc.
Export Variables:
TARGET = the target name
SRCS = default the files
ODIR = ODIR is defined as $(SDIR)/objs/$(TARGET)

Import Variables:
SDIR

src/target/<family>/common/Makefile.inc - this contains the logic to abstract common from a Tx family
Import Variables:
TARGET
DTU_PARAM

Export Variables:


src/drivres/mcu/<mcu>/Makefile.inc - this contains the logic for certain platform. For example, stm32 contains the logic for cross-compile and the logic to build libopencm3. x86 contains the logic to build tx on PC platform.

a typical include chain is like the following
target/<family>/<target>/Makefile <- target/<family>/common/Makefile.inc <- target/drivres/mcu/<mcu>/Makefile.inc
<- target/drivres/<other_drivers_type>/<driver>/Makefile.inc
<- fs/Makefile.inc
<- Makefile.inc
Loading