]> git.saurik.com Git - apt.git/blame - README.make
test-indexes.sh: Add source related tests, which uncovers two regressions
[apt.git] / README.make
CommitLineData
93641593
AL
1The Make System
2~~~ ~~~~ ~~~~~~
3To compile this program you require GNU Make. In fact you probably need
4GNU Make 3.76.1 or newer. The makefiles contained make use of many
5GNU Make specific features and will not run on other makes.
6
7The make system has a number of interesting properties that are not found
8in other systems such as automake or the GNU makefile standards. In
9general some semblance of expectedness is kept so as not to be too
10surprising. Basically the following will work as expected:
11
12 ./configure
13 make
14 or
15 cd build
16 ../configure
17 make
18
19There are a number of other things that are possible that may make software
20development and software packaging simpler. The first of these is the
21environment.mak file. When configure is run it creates an environment.mak
22file in the build directory. This contains -all- configurable parameters
23for all of the make files in all of the subdirectories. Changing one
24of these parameters will have an immediate effect. The use of makefile.in
25and configure substitutions across build makefiles is not used at all.
26
27Furthermore, the make system runs with a current directory equal to the
28source directory irregardless of the destination directory. This means
4ae405e9 29#include "" and #include <> work as expected and more importantly
93641593 30running 'make' in the source directory will work as expected. The
4ae405e9 31environment variable or make parameter 'BUILD' sets the build directory.
93641593 32It may be an absolute path or a path relative to the top level directory.
4ae405e9
AL
33By default build-arch/ then build/ will be used with a fall back to ./ This
34means you can get all the advantages of a build directory without having to
93641593
AL
35cd into it to edit your source code!
36
37The make system also performs dependency generation on the fly as the
38compiler runs. This is extremely fast and accurate. There is however
7365ff46 39one failure condition that occurs when a header file is erased. In
93641593
AL
40this case you should run make clean to purge the .o and .d files to
41rebuild.
42
7365ff46
LB
43The final significant deviation from normal make practices is
44in how the build directory is managed. It is not nearly a mirror of
93641593
AL
45the source directory but is logically divided in the following manner
46 bin/
47 methods/
48 doc/
49 examples/
50 include/
51 apt-pkg/
93641593
AL
52 obj/
53 apt-pkg/
7365ff46 54 cmdline/
93641593
AL
55 [...]
56Only .o and .d files are placed in the obj/ subdirectory. The final compiled
57binaries are placed in bin, published headers for inter-component linking
58are placed in include/ and documentation is generated into doc/. This means
7365ff46 59all runnable programs are within the bin/ directory, a huge benefit for
93641593
AL
60debugging inter-program relationships. The .so files are also placed in
61bin/ for simplicity.
62
93bf083d
AL
63By default make is put into silent mode. During operation there should be
64no shell or compiler messages only status messages from the makefiles,
65if any pop up that indicates there may be a problem with your environment.
66For debugging you can disable this by setting NOISY=1, ala
67 make NOISY=1
68
93641593
AL
69Using the makefiles
70~~~~~ ~~~ ~~~~~~~~~
71The makefiles for the components are really simple. The complexity is hidden
72within the buildlib/ directory. Each makefile defines a set of make variables
73for the bit it is going to make then includes a makefile fragment from
74the buildlib/. This fragment generates the necessary rules based on the
75originally defined variables. This process can be repeated as many times as
76necessary for as many programs or libraries as are in the directory.
77
78Many of the make fragments have some useful properties involving sub
79directories and other interesting features. They are more completely
80described in the fragment code in buildlib. Some tips on writing fragments
81are included in buildlib/defaults.mak
82
93bf083d
AL
83The fragments are NEVER processed by configure, so if you make changes to
84them they will have an immediate effect.
85
86Autoconf
87~~~~~~~~
88Straight out of CVS you have to initialize autoconf. This requires
89automake (I really don't know why) and autoconf and requires doing
7365ff46 90 aclocal -I buildlib
93bf083d 91 autoconf
7365ff46 92[Alternatively you can run make startup in the top level build dir]
93bf083d
AL
93
94Autoconf is configured to do some basic system probes for optional and
95required functionality and generate an environment.mak and include/config.h
96from it's findings. It will then write a 'makefile' and run make dirs to
97create the output directory tree.
98
99It is not my belief that autoconf should be used to generate substantial
100source code markup to escape OS problems. If an OS problem does crop up
101it can likely be corrected by installing the correct files into the
102build include/ dir and perhaps writing some replacement code and
103linking it in. To the fullest extent possible the source code should conform
104to standards and not cater to broken systems.
105
7365ff46 106Autoconf will also write a makefile into the top level of the build dir,
93bf083d
AL
107this simply acts as a wrapper to the main top level make in the source tree.
108There is one big warning, you can't use both this make file and the
109ones in the top level tree. Make is not able to resolve rules that
110go to the same file through different paths and this will confuse the
111depends mechanism. I recommend always using the makefiles in the
92c26a2f 112source directory and exporting BUILD.