]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile
First part of PicoBSD makeover, adding basic 'obj' facilities, allowing
[FreeBSD/FreeBSD.git] / Makefile
1 #
2 # $FreeBSD$
3 #
4 # The user-driven targets are:
5 #
6 # buildworld          - Rebuild *everything*, including glue to help do
7 #                       upgrades.
8 # installworld        - Install everything built by "buildworld".
9 # world               - buildworld + installworld.
10 # update              - Convenient way to update your source tree (cvs).
11 # upgrade             - Upgrade a.out (2.2.x/3.0) system to the new ELF way
12 # most                - Build user commands, no libraries or include files.
13 # installmost         - Install user commands, no libraries or include files.
14 # aout-to-elf         - Upgrade an system from a.out to elf format (see below).
15 # aout-to-elf-build   - Build everything required to upgrade a system from
16 #                       a.out to elf format (see below).
17 # aout-to-elf-install - Install everything built by aout-to-elf-build (see
18 #                       below).
19 # move-aout-libs      - Move the a.out libraries into an aout sub-directory
20 #                       of each elf library sub-directory.
21 #
22 # This makefile is simple by design. The FreeBSD make automatically reads
23 # the /usr/share/mk/sys.mk unless the -m argument is specified on the 
24 # command line. By keeping this makefile simple, it doesn't matter too
25 # much how different the installed mk files are from those in the source
26 # tree. This makefile executes a child make process, forcing it to use
27 # the mk files from the source tree which are supposed to DTRT.
28 #
29 # The user-driven targets (as listed above) are implemented in Makefile.inc0
30 # and the private targets are in Makefile.inc1. These are kept separate
31 # to help the bootstrap build from aout to elf format.
32 #
33 # For novices wanting to build from current sources, the simple instructions
34 # are:
35 #
36 # 1.  Ensure that your /usr/obj directory has at least 260 Mb of free space.
37 # 2.  `cd /usr/src'  (or to the directory containing your source tree).
38 # 3.  `make world'
39 #
40 # Be warned, this will update your installed system, except for configuration
41 # files in the /etc directory and for the kernel. You have to do those manually.
42 #
43 # If at first you're a little nervous about having a `make world' update
44 # your system, a `make buildworld' will build everything in the /usr/obj
45 # tree without touching your installed system. To be of any further use
46 # though, a `make installworld' is required.
47 #
48 # If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will
49 # update the legacy support for aout. This includes all libraries, ld.so
50 # and boot objects. This part of build should be regarded as
51 # deprecated and you should _not_ expect to be able to do this past the
52 # release of 4.0. You have exactly one major release to move entirely
53 # to elf.
54 #
55 # ----------------------------------------------------------------------------
56 #
57 #           Upgrading an i386 system from a.out to elf format
58 #
59 #
60 # The aout->elf transition build is performed by doing a `make upgrade' (or
61 # `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed
62 # by a `make aout-to-elf-install', depending on user preference.
63 # You need to have at least 320 Mb of free space for the object tree.
64 #
65 # The upgrade process checks the installed release. If this is 3.0-CURRENT,
66 # it is assumed that your kernel contains all the syscalls required by the
67 # current sources.
68 #
69 # The upgrade procedure will stop and ask for confirmation to proceed
70 # several times. On each occasion, you can type Ctrl-C to abort the
71 # upgrade.  Optionally, you can also start it with NOCONFIRM=yes and skip
72 # the confirmation steps.
73 #
74 # At the end of the upgrade procedure, /etc/objformat is created or
75 # updated to contain OBJFORMAT=elf. From then on, you're elf by default.
76 #
77 # ----------------------------------------------------------------------------
78 #
79 #
80 # Define the user-driven targets. These are listed here in alphabetical
81 # order, but that's not important.
82 #
83 TGTS=   afterdistribute all buildkernel buildworld checkdpadd clean \
84         cleandepend cleandir depend distribute everything hierarchy includes \
85         install installkernel installmost installworld libraries lint \
86         maninstall mk most obj objlink regress rerelease tags update
87
88 PATH=   /sbin:/bin:/usr/sbin:/usr/bin
89 MAKE=   PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
90
91 #
92 # Handle the user-driven targets, using the source relative mk files.
93 #
94 ${TGTS}: upgrade_checks
95         @cd ${.CURDIR}; \
96                 ${MAKE} ${.TARGET}
97
98 # Set a reasonable default
99 .MAIN:  all
100
101 STARTTIME!= LC_TIME=C date
102 #
103 # world
104 #
105 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
106 # success, regardless of how old your existing system is.
107 #
108 world: upgrade_checks
109         @echo "--------------------------------------------------------------"
110         @echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
111         @echo "--------------------------------------------------------------"
112 .if target(pre-world)
113         @echo
114         @echo "--------------------------------------------------------------"
115         @echo ">>> Making 'pre-world' target"
116         @echo "--------------------------------------------------------------"
117         @cd ${.CURDIR}; ${MAKE} pre-world
118 .endif
119         @cd ${.CURDIR}; ${MAKE} buildworld
120         @cd ${.CURDIR}; ${MAKE} -B installworld
121 .if target(post-world)
122         @echo
123         @echo "--------------------------------------------------------------"
124         @echo ">>> Making 'post-world' target"
125         @echo "--------------------------------------------------------------"
126         @cd ${.CURDIR}; ${MAKE} post-world
127 .endif
128         @echo
129         @echo "--------------------------------------------------------------"
130         @echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
131         @echo ">>> ${OBJFORMAT} make world completed on `LC_TIME=C date`"
132         @echo "--------------------------------------------------------------"
133
134 #
135 # Perform a few tests to determine if the installed tools are adequate
136 # for building the world. These are for older systems (prior to 2.2.5).
137 #
138 # From 2.2.5 onwards, the installed tools will pass these upgrade tests,
139 # so the normal make world is capable of doing what is required to update
140 # the system to current.
141 #
142 upgrade_checks:
143         @cd ${.CURDIR}; \
144                 if ! make -m ${.CURDIR}/share/mk test > /dev/null 2>&1; then \
145                         make make; \
146                 fi
147
148 #
149 # A simple test target used as part of the test to see if make supports
150 # the -m argument.
151 #
152 test:
153
154 #
155 # Upgrade the installed make to the current version using the installed
156 # headers, libraries and build tools. This is required on installed versions
157 # prior to 2.2.5 in which the installed make doesn't support the -m argument.
158 #
159 make:
160         @echo
161         @echo "--------------------------------------------------------------"
162         @echo " Upgrading the installed make"
163         @echo "--------------------------------------------------------------"
164         @cd ${.CURDIR}/usr.bin/make; \
165                 make obj && make depend && make all && make install
166
167 #
168 # Define the upgrade targets. These are listed here in alphabetical
169 # order, but that's not important.
170 #
171 UPGRADE=        aout-to-elf aout-to-elf-build aout-to-elf-install \
172                 move-aout-libs
173
174 #
175 # Handle the upgrade targets, using the source relative mk files.
176 #
177
178 upgrade:        aout-to-elf
179
180 ${UPGRADE} : upgrade_checks
181         @cd ${.CURDIR}; \
182                 ${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}