Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Modular build system #15

Open
wants to merge 155 commits into
base: master
Choose a base branch
from
Open

Modular build system #15

wants to merge 155 commits into from

Conversation

matheusmoreira
Copy link
Owner

@matheusmoreira matheusmoreira commented May 14, 2019

The build system has the potential to be a reusable framework. It should be split into its own git repository.

  • Move all build system framework code out of make/ and into .make/
  • Move all liblinux-specific code out of .make/ and into make/
  • Split the .make/ directory into its own git repository
  • Replace the .make/ directory with a git submodule

This information is specific to the project being built
and doesn't belong in the make/ directory.
This makes it easy to use true and false values anywhere in makefiles.
This function converts a value to a truth value.
This is basic and extremely useful functionality
that simply isn't provided by make.
False values are empty. This is an inconvenient representation.
Outputting an empty variable can be confusing.
A symbol that represents false, though logically true, is much better.
This function converts a value to its symbolic truth value.
Useful when outputting a boolean variable as text.
This allows a project to specify the C standard it wants to use
while at the same time providing a sensible default.
The new C.freestanding make variable can be set
in order to turn on freestanding mode.
Files are defined as entries that are not directories
for the purposes of the build system.
Also a good opportunity to improve the documentation
and convert the result to a boolean value.
This function augments make's built-in wildcard function
with a default value, sorting and duplicate removal.
This function applies the given function recursively to compute results.
This allows better documentation of the semantics of the default value
and reuse of the default value by functions building on top of glob.
"The specified pattern" is too verbose for the short description
of the returned value. It's better to refer to the first argument.
This function lists all matching entries in the given directories.
By default, it operates on the current directory.
This function walks the file system recursively,
returning all paths it finds.
Should be useful to build lists of all kinds of files.
Fixes a bug where directory? would always return true
if called without any arguments.
That happens because the variable would be empty,
and the "/." path would have no prefix.
The root directory is always a directory by definition.
This allows the user of the function to pass in more than one path.
In this case, it will return true if any path refers to a directory.
This function finds all files that satisfy the given predicate function.
Extremely useful for finding source files.
These variables are specific to each project.
They don't belong in a modular build system.
This variable is specific to each project.
It doesn't belong in a modular build system.
This variable is specific to each project.
It doesn't belong in a modular build system.
These variables are specific to each project.
They don't belong in a modular build system.
When find was invoked with a predicate function,
the result was the empty string for every path
that did not satisfy the predicate function.
This resulted in a lot of extraneous white spaces
in the positions the paths would have otherwise occupied.
Stripping the result gets rid of the spaces.

The recurse and file_system.traverse functions didn't need this fix
because they always return elements in each iteration of foreach.
There are no spaces to strip out.
@matheusmoreira matheusmoreira added the build Build system issues label May 14, 2019
@matheusmoreira matheusmoreira self-assigned this May 14, 2019
These variables are specific to liblinux.
This variable belongs with the other variables defining the build tree.
These variables are specific to liblinux.
These variables are specific to liblinux.
The library and object rule template functions now propagate
additional dependencies to the general rule template function.
This brings those functions to feature parity with the executable rule
template function.
The scripts and libraries/start nodes no longer exist in the build tree.
These variables are not used anymore.
This function joins all values of the given list.
It's called coalesce because GNU make already defines a join function.
This variable represents the file system path separator.
It can be customized on systems that don't use forward slash.
This function joins elements of a list to form a new file system path.
This allows customizing the name of the configuration directory.
It takes the value of the configuration variable into account,
leaving its definition to the user of the build system.
It is now possible to customize the configuration variable.
If left undefined, the build system will simply not create
configuration directories in the build tree.
Should make it easier to work with the build tree.
The first step towards revamping the compiler interface.
The compiler makes a huge difference in the output.
The build configuration should contain the chosen compiler
when multiple compilers are supported by the project.
This function generates a GCC command line that links objects
and produces an executable or dynamic library.
Now the project can specify the compiler and linker options.
All lists of compiler and linker options are merged.
The most specific compiler and linker choices are applied.

This allows multiscope configuration of compilation and linking.
These symbols are no longer used after the compiler interface redesign.
Now they use a dot to denote the hierarchy of their values.
These variables are too specific to be applicable to the build system's
compiler interface. They will be provided by the user.
The build system interface has been redesigned around a project
specification in the form of variables whose names follow a specific
pattern. Projects contain targets, which can be of any supported type.
The build system will generate all the rules based on the specification.

The new rule generation interface allows specifying compiler flags
for the whole project, for individual targets and even individual files.
The generated rules do not depend on the build system framework,
letting the user configure the build by writing them out to a makefile.
Users can now specify which variables form a build configuration.
Remove reference to the undefined build_scripts_directory variable.
Doesn't make sense to have a scripts directory in the build tree,
so the location of the targets is now its root.
Directories are now created unconditionally.
This allows a list of files to be passed, including empty lists.
Now the GCC executable can be passed as parameter.
It is no longer being referenced by any makefile.
Optimization and instrumentation options are application-specific.
Make the description of the return value more accurate.
Make the description of the return value more accurate.
It is no longer being referenced by any makefile.
The ensure_target_directory_exists function is easier to understand
compared to directory creation commands.
This eliminates the need to reverse the list later,
simplifying the already rather complicated functions.

The executable and library targets don't add their outputs to the build
stack because their symbolic names are enough to represent the outputs.
Handle empty namespace lists: just call resolve.name directly.
Reimplement resolve.first in terms of the new function.
This makes the function names more consistent.
These functions resolve variables in caller-provided namespaces
as well as an implicit global namespace.
One merges the results while the other does not.

Only the values in the global namespace are meant to be inheritable.
Other namespaces override each other according to their order.
Now only values present in the global namespace are inherited.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
build Build system issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant