1 Build Framework 2 =============== 3 4 The perf build framework was adopted from the 5 idea and the way how objects are built is the 6 7 Basically the user provides set of 'Build' fil 8 directories to nest for specific target to be 9 10 Unlike the kernel we don't have a single build 11 we setup source objects, but we support more. 12 carry a sources list for multiple build object 13 14 15 Build framework makefiles 16 ------------------------- 17 18 The build framework consists of 2 Makefiles: 19 20 Build.include 21 Makefile.build 22 23 While the 'Build.include' file contains just s 24 'Makefile.build' file is the makefile used fro 25 interface/usage is following: 26 27 $ make -f tools/build/Makefile.build srctree 28 29 where: 30 31 KSRC - is the path to kernel sources 32 DIR - is the path to the project to be bu 33 OBJECT - is the name of the build object 34 35 When succefully finished the $(DIR) directory 36 called $(OBJECT)-in.o: 37 38 $ ls $(DIR)/$(OBJECT)-in.o 39 40 which includes all compiled sources described 41 42 43 Build makefiles 44 --------------- 45 46 The user supplies 'Build' makefiles that conta 47 the build to nested directories. 48 49 Assume we have the following project structure 50 51 ex/a.c 52 /b.c 53 /c.c 54 /d.c 55 /arch/e.c 56 /arch/f.c 57 58 Out of which you build the 'ex' binary ' and t 59 60 'ex' - consists of 'a.o', 'b.o' and lib 61 'libex.a' - consists of 'c.o', 'd.o', 'e.o' 62 63 The build framework does not create the 'ex' a 64 only prepares proper objects to be compiled an 65 66 To follow the above example, the user provides 67 68 ex/Build: 69 ex-y += a.o 70 ex-y += b.o 71 ex-y += b.o # duplicates in the lists are 72 73 libex-y += c.o 74 libex-y += d.o 75 libex-y += arch/ 76 77 ex/arch/Build: 78 libex-y += e.o 79 libex-y += f.o 80 81 and runs: 82 83 $ make -f tools/build/Makefile.build dir=. o 84 $ make -f tools/build/Makefile.build dir=. o 85 86 which creates the following objects: 87 88 ex/ex-in.o 89 ex/libex-in.o 90 91 that contain request objects names in Build fi 92 93 It's only a matter of 2 single commands to cre 94 95 $ ar rcs libex.a libex-in.o 96 $ gcc -o ex ex-in.o libex.a 97 98 You can check the 'ex' example in 'tools/build 99 100 101 Makefile.include 102 ---------------- 103 104 The tools/build/Makefile.include makefile coul 105 via user makefiles to get usefull definitions. 106 107 It defines following interface: 108 109 - build macro definition: 110 build := -f $(srctree)/tools/build/Makef 111 112 to make it easier to invoke build like: 113 make $(build)=ex 114 115 116 Fixdep 117 ------ 118 It is necessary to build the fixdep helper bef 119 The Makefile.include file adds the fixdep targ 120 invoked by the user. 121 122 123 Rules 124 ----- 125 126 The build framework provides standard compilat 127 compilation. 128 129 It's possible to include special rule if neede 130 code generation). 131 132 133 CFLAGS 134 ------ 135 136 It's possible to alter the standard object C f 137 138 CFLAGS_perf.o += '...' - adds CFLAGS 139 CFLAGS_gtk += '...' - adds CFLAGS 140 CFLAGS_REMOVE_perf.o += '...' - removes CFL 141 CFLAGS_REMOVE_gtk += '...' - removes CFL 142 143 This C flags changes has the scope of the Buil 144 145 146 Dependencies 147 ------------ 148 149 For each built object file 'a.o' the '.a.cmd' 150 151 - Command line used to built that object 152 (for each object) 153 154 - Dependency rules generated by 'gcc -Wp,-MD 155 (for compiled object) 156 157 All existing '.cmd' files are included in the 158 the dependencies and trigger a rebuild when ne 159 160 161 Single rules 162 ------------ 163 164 It's possible to build single object file by c 165 166 $ make util/map.o # objects 167 $ make util/map.i # preprocessor 168 $ make util/map.s # assembly
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.