aboutsummaryrefslogtreecommitdiff
path: root/Makefile-explained.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile-explained.txt')
-rw-r--r--Makefile-explained.txt5
1 files changed, 5 insertions, 0 deletions
diff --git a/Makefile-explained.txt b/Makefile-explained.txt
index 0a624d0..98d73d0 100644
--- a/Makefile-explained.txt
+++ b/Makefile-explained.txt
@@ -1,3 +1,4 @@
+## Makefile
To maintain order, all files created with the use of make, that is binaries, object files, natively executed helper programs, etc. get placed in build/.
Our project contains 2 Makefiles: one in it's root directory and one in build/. The reason is that it is easier to use Makefile to simply, elegantly and efficiently produce files in the same directory where it is. To produce files in directory other than Makefile's own, it requires this directory to be specified in many rules across the Makefile and in general it complicates things. Also, a problem arises when trying to link objects not from within the current directory. If an object is referenced by name in linker script (which is a frequent practice in our scripts) and is passed to gcc with a path, then it'd need to also appear with that path in the linker script.
@@ -16,6 +17,8 @@ Variables dirs and dirs_colon are defined to store list of all directories withi
The vpath directive tells make to look for assembler sources, C sources and linker scripts in all direct and indirect subdirectories of src/ (including itself). All other files shall be found/created in build/.
+### Targets
+
The default target is the binary image of the kernel.
The generic rule for compiling C sources uses cross-compiler or native compiler with appropriate flags depending on whether the source file is located somewhere under arm/ directory (which lies in src/) or enywhere else.
@@ -32,6 +35,8 @@ Simple ram filesystem is created from files it should contain with the use of ou
Another 2 rules specify how native programs (for the machine we're working on) are to be linked.
+### Aliased Rules
+
Rule qemu-elf runs the kernel in qemu emulating RaspberryPi 2 with 256MiB of memory by passing the elf file of the kernel to the emulator.
Rule qemu-bin does the same, but passes the binary image of the kernel to qemu.