Update rc.d scripts to use the correct path for the named pidfile.
[dragonfly.git] / Makefile
1 #
2 # $FreeBSD: src/Makefile,v 1.234.2.19 2003/04/16 09:59:40 ru Exp $
3 # $DragonFly: src/Makefile,v 1.5 2004/03/22 20:57:17 dillon Exp $
4 #
5 # The user-driven targets are:
6 #
7 # buildworld          - Rebuild *everything*, including glue to help do
8 #                       upgrades.
9 # quickworld          - Skip bootstrap, build and cross-build tool steps
10 # realquickworld      - Skip above steps, plus depend
11 # crossworld          - Just do the bootstrap, build, and cross-build steps
12 # installworld        - Install everything built by "buildworld".
13 # world               - buildworld + installworld.
14 # buildkernel         - Rebuild the kernel and the kernel-modules.
15 # installkernel       - Install the kernel and the kernel-modules.
16 # reinstallkernel     - Reinstall the kernel and the kernel-modules.
17 # kernel              - buildkernel + installkernel.
18 # update              - Convenient way to update your source tree (cvs).
19 # upgrade             - Upgrade a.out (2.2.x/3.0) system to the new ELF way
20 # most                - Build user commands, no libraries or include files.
21 # installmost         - Install user commands, no libraries or include files.
22 # aout-to-elf         - Upgrade an system from a.out to elf format (see below).
23 # aout-to-elf-build   - Build everything required to upgrade a system from
24 #                       a.out to elf format (see below).
25 # aout-to-elf-install - Install everything built by aout-to-elf-build (see
26 #                       below).
27 # move-aout-libs      - Move the a.out libraries into an aout sub-directory
28 #                       of each elf library sub-directory.
29 #
30 # This makefile is simple by design. The FreeBSD make automatically reads
31 # the /usr/share/mk/sys.mk unless the -m argument is specified on the 
32 # command line. By keeping this makefile simple, it doesn't matter too
33 # much how different the installed mk files are from those in the source
34 # tree. This makefile executes a child make process, forcing it to use
35 # the mk files from the source tree which are supposed to DTRT.
36 #
37 # The user-driven targets (as listed above) are implemented in Makefile.inc1.
38 #
39 # If you want to build your system from source be sure that /usr/obj has
40 # at least 400MB of diskspace available.
41 #
42 # For individuals wanting to build from the sources currently on their
43 # system, the simple instructions are:
44 #
45 # 1.  `cd /usr/src'  (or to the directory containing your source tree).
46 # 2.  `make world'
47 #
48 # For individuals wanting to upgrade their sources (even if only a
49 # delta of a few days):
50 #
51 # 1.  `cd /usr/src'       (or to the directory containing your source tree).
52 # 2.  `make buildworld'
53 # 3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
54 # 4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
55 # 5.  `reboot'        (in single user mode: boot -s from the loader prompt).
56 # 6.  `mergemaster -p'
57 # 7.  `make installworld'
58 # 8.  `mergemaster'
59 # 9.  `reboot'
60 #
61 # See src/UPDATING `COMMON ITEMS' for more complete information.
62 #
63 # If TARGET_ARCH=arch (e.g. alpha) is specified you can
64 # cross build world for other architectures using the buildworld target,
65 # and once the world is built you can cross build a kernel using the
66 # buildkernel target.
67 #
68 # ----------------------------------------------------------------------------
69 #
70 #           Upgrading an i386 system from a.out to elf format
71 #
72 #
73 # The aout->elf transition build is performed by doing a `make upgrade' (or
74 # `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed
75 # by a `make aout-to-elf-install', depending on user preference.
76 # You need to have at least 320 Mb of free space for the object tree.
77 #
78 # The upgrade process checks the installed release. If this is 3.0-CURRENT,
79 # it is assumed that your kernel contains all the syscalls required by the
80 # current sources.
81 #
82 # The upgrade procedure will stop and ask for confirmation to proceed
83 # several times. On each occasion, you can type Ctrl-C to abort the
84 # upgrade.  Optionally, you can also start it with NOCONFIRM=yes and skip
85 # the confirmation steps.
86 #
87 # ----------------------------------------------------------------------------
88 #
89 #
90 # Define the user-driven targets. These are listed here in alphabetical
91 # order, but that's not important.
92 #
93 TGTS=   all all-man buildkernel buildworld crossworld quickworld \
94         realquickworld checkdpadd clean \
95         cleandepend cleandir depend distribute distributeworld everything \
96         hierarchy install installcheck installkernel \
97         reinstallkernel installmost installworld libraries lint maninstall \
98         mk most obj objlink regress rerelease tags update
99
100 BITGTS= files includes
101 BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
102
103 .ORDER: buildworld installworld
104 .ORDER: buildworld distributeworld
105 .ORDER: buildworld buildkernel
106 .ORDER: buildkernel installkernel
107 .ORDER: buildkernel reinstallkernel
108
109 PATH=   /sbin:/bin:/usr/sbin:/usr/bin
110 MAKE=   PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
111
112 #
113 # Handle the user-driven targets, using the source relative mk files.
114 #
115 ${TGTS} ${BITGTS}: upgrade_checks
116         @cd ${.CURDIR}; \
117                 ${MAKE} ${.TARGET}
118
119 # Set a reasonable default
120 .MAIN:  all
121
122 STARTTIME!= LC_ALL=C date
123 #
124 # world
125 #
126 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
127 # success, regardless of how old your existing system is.
128 #
129 world: upgrade_checks
130         @echo "--------------------------------------------------------------"
131         @echo ">>> elf make world started on ${STARTTIME}"
132         @echo "--------------------------------------------------------------"
133 .if target(pre-world)
134         @echo
135         @echo "--------------------------------------------------------------"
136         @echo ">>> Making 'pre-world' target"
137         @echo "--------------------------------------------------------------"
138         @cd ${.CURDIR}; ${MAKE} pre-world
139 .endif
140         @cd ${.CURDIR}; ${MAKE} buildworld
141         @cd ${.CURDIR}; ${MAKE} -B installworld
142 .if target(post-world)
143         @echo
144         @echo "--------------------------------------------------------------"
145         @echo ">>> Making 'post-world' target"
146         @echo "--------------------------------------------------------------"
147         @cd ${.CURDIR}; ${MAKE} post-world
148 .endif
149         @echo
150         @echo "--------------------------------------------------------------"
151         @printf ">>> elf make world completed on `LC_ALL=C date`\n                        (started ${STARTTIME})\n"
152         @echo "--------------------------------------------------------------"
153
154 #
155 # kernel
156 #
157 # Short hand for `make buildkernel installkernel'
158 #
159 kernel: buildkernel installkernel
160
161 #
162 # Perform a few tests to determine if the installed tools are adequate
163 # for building the world. These are for older systems (prior to 2.2.5).
164 #
165 # From 2.2.5 onwards, the installed tools will pass these upgrade tests,
166 # so the normal make world is capable of doing what is required to update
167 # the system to current.
168 #
169 upgrade_checks:
170         @cd ${.CURDIR}; \
171         if ! make -m ${.CURDIR}/share/mk -Dnotdef test >/dev/null 2>&1; then \
172                 make make; \
173         fi
174         @cd ${.CURDIR}; \
175         if make -V .CURDIR:C/.// 2>&1 >/dev/null | \
176             grep -q "Unknown modifier 'C'"; then \
177                 make make; \
178         fi
179
180 #
181 # A simple test target used as part of the test to see if make supports
182 # the -m argument.  Also test that make will only evaluate a conditional
183 # as far as is necessary to determine its value.
184 #
185 test:
186 .if defined(notdef)
187 .undef notdef
188 .if defined(notdef) && ${notdef:U}
189 .endif
190 .endif
191
192 #
193 # Upgrade the installed make to the current version using the installed
194 # headers, libraries and build tools. This is required on installed versions
195 # prior to 2.2.5 in which the installed make doesn't support the -m argument.
196 #
197 make:
198         @echo
199         @echo "--------------------------------------------------------------"
200         @echo " Upgrading the installed make"
201         @echo "--------------------------------------------------------------"
202         @cd ${.CURDIR}/usr.bin/make; \
203                 make obj && make depend && make all && make install
204
205 #
206 # Define the upgrade targets. These are listed here in alphabetical
207 # order, but that's not important.
208 #
209 UPGRADE=        aout-to-elf aout-to-elf-build aout-to-elf-install \
210                 move-aout-libs
211
212 #
213 # Handle the upgrade targets, using the source relative mk files.
214 #
215
216 upgrade:        upgrade_etc
217
218 #
219 # Handle post-installworld updating of static files (e.g. like /etc/rc)
220 #
221 upgrade_etc:
222         @cd ${.CURDIR}/etc; make upgrade_etc
223
224 ${UPGRADE} : upgrade_checks
225         @cd ${.CURDIR}; \
226                 ${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}