-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathBUILDSYSTEM
89 lines (65 loc) · 2.41 KB
/
BUILDSYSTEM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/************************************/
/* General Makefile building system */
/************************************/
Each package exports a number of symbols:
* CFLAGS_X should be "whatever needs to be passed to the compiler
in order to successfully build package Y". It is usually a list of -I
options.
* LDFLAGS_X should be "whatever needs to be passed to the linker in
order to successfully build package Y". It is usually a list of -L and
-l options, and a list of libraries.
* DEPS_X -- Is used to force relinking of a package if _X has been
modified. It is closely related to LDFLAGS_X, but contains only
library paths that should trigger linking (and does not contain other
linker options.)
For "leaf" packages (i.e., an actual program), you probably don't need
to export anything.
------------------
Rules.mk
------------------
The Rules.mk file is part of the "package-level" build system. In this
file, you:
1. Pick a package name, by convention all lowercase (with underscores).
We will assume 'foo_bar'.
2. Define CFLAGS_FOO_BAR, LDFLAGS_FOO_BAR, and
DEPS_FOO_BAR. These are for use by people who have a
dependence ON your package, not for use in building your
package.
3. Define phony targets "foo_bar" and "foo_bar_clean". Add these targets to
the system-wide 'all' and clean' rules: e.g.:
.phony foo_bar foo_bar_clean
all: foo_bar
<---- NOTE: do not include any action here!
clean: foo_bar_clean
<---- NOTE: do not include any action here!
4. For foo_bar, foo_bar_clean, simply invoke 'make' on the
appropriate Build.mk
5. Recursively include any sub-packages' Rules.mk files.
------------------
Build.mk
------------------
This is where you build your actual package. It will be invoked with
knowledge of every package's CFLAGS_X, LDFLAGS_X, and DEPS_X
variables.
* HDEPS -- Is used to force relinking of a package if some shared
used header files are changed.
------------------
Build System Summary
------------------
--------------
Root Directory
--------------
Builds are invoked from the root.
Binaries and libs are built into the bin/ and lib/ folders in the rootdir, respectively.
--------
Makefile
--------
/*************************/
/* Meson Building system */
/*************************/
$ sudo apt install ninja-build
$ sudo pip3 install meson
mkdir build
meson --prefix $PWD ..
ninja
ninja install