]> git.ipfire.org Git - thirdparty/util-linux.git/blob - Documentation/howto-build-sys.txt
Merge branch 'PR/libsmartcols-reduce-fix' of github.com:karelzak/util-linux-work
[thirdparty/util-linux.git] / Documentation / howto-build-sys.txt
1 util-linux build system
2 =======================
3
4 - the build system is non-recursive, individual subdirectories use
5 Makemodule.am files. These files are merged together by automake
6 into one global Makefile in the top-level directory
7
8 - all final build results (binaries, libtool scripts) are stored in top-level
9 source directory
10
11 - all Makemodule.am files have to be designed as top-level makefiles, it
12 means with full paths (e.g. foo_SOURCES = subdir/foo.c)
13
14 - always use '+=' operator for global variables (e.g. bin_PROGRAMS += foo)
15
16 - use libcommon.la (without path!) for lib/ stuff (e.g. foo_LDADD = libcommon.la)
17
18 - for libblkid, libuuid and libmount use lib<name>.la in _LDADD and
19 -I$(ul_lib<name>_incdir) in _CFLAGS, for example
20
21 foo_LDADD = libmount.la
22 foo_CFLAGS = -I$(ul_libmount_incdir)
23
24 - always use suffixes for hooks, for example
25
26 install-exec-hook-foo:
27 ln -sf foo foooo
28
29 INSTALL_EXEC_HOOKS += install-exec-hook-foo
30
31
32 - all util-linux specific autoconf macros use UL_ prefix
33
34 - utils in Makefile.am files are enabled/disabled according to BUILD_<NAME>
35 conditions (AM_CONDITIONAL), for example:
36
37 if BUILD_HWCLOCK
38 ...
39 endif
40
41 - "if BUILD_<NAME>" blocks are never nested within another "if BUILD_<NAME>",
42 all dependencies have to be resolved in configure.ac (see UL_REQUIRES_BUILD())
43
44 - all BUILD_<NAME> in configure.am are always based on build_<name> variables,
45 for example:
46
47 AM_CONDITIONAL([BUILD_HWCLOCK], test "x$build_hwclock" = xyes)
48
49 the $build_<name> should be available in whole configure script
50
51 - AC_ARG_ENABLE() status is always stored in $enable_<name> variable, possible
52 setting:
53
54 "check" - util/feature is optional, if any subcomponent (function, lib,
55 ...) is missing a warning is printed and the util/feature is
56 disabled
57
58 "yes" - util/feature is required, if any subcomponent (function, lib,
59 ...) is missing an error is printed and ./configure aborted
60
61 "no" - the util/feature is unwanted
62
63 The default status is always defined by UL_DEFAULT_ENABLE() and it might be
64 globally modified by $ul_default_estate (see AC_ARG_ENABLE([all-programs])).
65
66 - it's possible to disable all programs, but enable just one (or more)
67 explicitly specified, for example:
68
69 ./configure --disable-all-programs --enable-hwclock
70
71 - some basic scenarios for the ./configure script are defined in the
72 tools/config-gen.d/ directory. If you want to use these predefined scenarios
73 then call
74
75 ./tools/config-gen [<scenario> ...]
76
77 for example
78
79 ./tools/config-gen all selinux
80
81 will build all utils with enabled selinux support. You can also define some
82 CFLAGS, for example:
83
84 CFLAGS=$(rpm --eval '%optflags') ./tools/config-gen all
85
86 will use the default distro flags.
87
88 WARNING: config-gen is not designed for end-user or downstream distributions!
89 It's for development purpose only. All end-users and downstream have
90 to use standard ./configure script only.
91
92 - the tools/config-gen script is also used for build system regression tests,
93 the test is not enabled by default, you have to use
94
95 tests/run.sh build-sys --force