kernel - Add support for %z[d,x,etc].
[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.25 2008/07/14 03:49:58 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 from scratch
15 #                       using build/bootstrap/cross tools from the last
16 #                       buildworld.
17 # nativekernel        - Rebuild the kernel and the kernel-modules from scratch
18 #                       using native tools.
19 # quickkernel         - rebuild the kernel quickly (build or native), skip
20 #                       the make depend step and do not clean out the obj
21 #                       modules.
22 # installkernel       - Install the kernel and the kernel-modules.
23 # reinstallkernel     - Reinstall the kernel and the kernel-modules.
24 # kernel              - buildkernel + installkernel.
25 # update              - Convenient way to update your source tree (cvs).
26 # preupgrade          - Certain upgrades may have to be done before installworld.
27 #                       installworld will complain if they have not been done.  This
28 #                       target will do those upgrades... typically the addition of
29 #                       new special groups and users used by installed utilities.
30 # upgrade             - Upgrade the files in /etc and also setup the rest
31 #                       of the system for DragonFly. ex. two compilers
32 # most                - Build user commands, no libraries or include files.
33 # installmost         - Install user commands, no libraries or include files.
34 #
35 # This makefile is simple by design. The DragonFly make automatically reads
36 # /usr/share/mk/sys.mk unless the -m argument is specified on the 
37 # command line. By keeping this makefile simple, it doesn't matter too
38 # much how different the installed mk files are from those in the source
39 # tree. This makefile executes a child make process, forcing it to use
40 # the mk files from the source tree which are supposed to DTRT.
41 #
42 # The user-driven targets (as listed above) are implemented in Makefile.inc1.
43 #
44 # If you want to build your system from source be sure that /usr/obj has
45 # at least 800MB of diskspace available.
46 #
47 # For individuals wanting to build from the sources currently on their
48 # system, the simple instructions are:
49 #
50 # 1.  `cd /usr/src'  (or to the directory containing your source tree).
51 # 2.  `make world'
52 #
53 # For individuals wanting to upgrade their sources (even if only a
54 # delta of a few days):
55 #
56 # 1.  `cd /usr/src'       (or to the directory containing your source tree).
57 # 2.  `make buildworld'
58 # 3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
59 # 4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
60 # 5.  `make installworld'
61 # 6.  `make upgrade'
62 # 7.  `reboot'
63 #
64 # See src/UPDATING `COMMON ITEMS' for more complete information.
65 #
66 # If TARGET_ARCH=arch (e.g. amd64) is specified you can
67 # cross build world for other architectures using the buildworld target,
68 # and once the world is built you can cross build a kernel using the
69 # buildkernel target.
70 #
71 # Define the user-driven targets. These are listed here in alphabetical
72 # order, but that's not important.
73 #
74 TGTS=   all all-man buildkernel quickkernel nativekernel \
75         buildworld crossworld quickworld realquickworld checkdpadd clean \
76         cleandepend cleandir depend everything \
77         hierarchy install installcheck installkernel \
78         reinstallkernel installmost installworld libraries lint maninstall \
79         manlint mk most obj objlink regress rerelease tags update \
80         _obj _includes _libraries _depend _worldtmp \
81         _bootstrap-tools _obj _build-tools _cross-tools
82
83 BITGTS= files includes
84 BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
85
86 .ORDER: buildworld installworld
87 .ORDER: buildworld buildkernel
88 .ORDER: buildworld nativekernel
89 .ORDER: buildworld quickkernel
90 .ORDER: buildkernel installkernel
91 .ORDER: buildkernel reinstallkernel
92 .ORDER: quickworld installworld
93 .ORDER: quickworld buildkernel
94 .ORDER: quickworld nativekernel
95 .ORDER: quickworld quickkernel
96 .ORDER: quickkernel installkernel
97 .ORDER: quickkernel reinstallkernel
98
99 PATH=   /sbin:/bin:/usr/sbin:/usr/bin
100 MAKE=   PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
101
102 #
103 # Handle the user-driven targets, using the source relative mk files.
104 #
105 ${TGTS} ${BITGTS}:
106         @cd ${.CURDIR}; \
107                 ${MAKE} ${.TARGET}
108
109 # Set a reasonable default
110 .MAIN:  all
111
112 STARTTIME!= LC_ALL=C date
113 #
114 # world
115 #
116 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
117 # success, regardless of how old your existing system is.
118 #
119 world:
120         @echo "--------------------------------------------------------------"
121         @echo ">>> elf make world started on ${STARTTIME}"
122         @echo "--------------------------------------------------------------"
123 .if target(pre-world)
124         @echo
125         @echo "--------------------------------------------------------------"
126         @echo ">>> Making 'pre-world' target"
127         @echo "--------------------------------------------------------------"
128         @cd ${.CURDIR}; ${MAKE} pre-world
129 .endif
130         @cd ${.CURDIR}; ${MAKE} buildworld
131         @cd ${.CURDIR}; ${MAKE} -B installworld
132 .if target(post-world)
133         @echo
134         @echo "--------------------------------------------------------------"
135         @echo ">>> Making 'post-world' target"
136         @echo "--------------------------------------------------------------"
137         @cd ${.CURDIR}; ${MAKE} post-world
138 .endif
139         @echo
140         @echo "--------------------------------------------------------------"
141         @printf ">>> elf make world completed on `LC_ALL=C date`\n                        (started ${STARTTIME})\n"
142         @echo "--------------------------------------------------------------"
143
144 #
145 # kernel
146 #
147 # Short hand for `make buildkernel installkernel'
148 #
149 kernel: buildkernel installkernel
150
151 #
152 # A simple test target used as part of the test to see if make supports
153 # the -m argument.  Also test that make will only evaluate a conditional
154 # as far as is necessary to determine its value.
155 #
156 test:
157 .if defined(notdef)
158 .undef notdef
159 .if defined(notdef) && ${notdef:U}
160 .endif
161 .endif
162
163 #
164 # Upgrade the installed make to the current version using the installed
165 # headers, libraries and build tools. This is required on installed versions
166 # prior to 2.2.5 in which the installed make doesn't support the -m argument.
167 #
168 make:
169         @echo
170         @echo "--------------------------------------------------------------"
171         @echo " Upgrading the installed make"
172         @echo "--------------------------------------------------------------"
173         @cd ${.CURDIR}/usr.bin/make; \
174                 make obj && make depend && make all && make install
175
176 #
177 # Handle the upgrade of /etc
178 #
179
180 preupgrade:
181         @cd ${.CURDIR}/etc; make -m ${.CURDIR}/share/mk preupgrade
182
183 upgrade:        upgrade_etc
184
185 #
186 # Handle post-installworld updating of static files (e.g. like /etc/rc)
187 #
188 upgrade_etc:
189         @cd ${.CURDIR}/etc; make -m ${.CURDIR}/share/mk upgrade_etc
190
191 ## Remove obsolete CVS commands, we are using GIT now.
192 ##
193 ## Convenient targets for use by the CVS repository meister.
194 ##
195 #update_preview_tag:     iamoncrater
196 #       cvs -d /cvs rtag -a -F DragonFly_Preview src
197 #
198 #update_release1_2_slip_tag:     iamoncrater
199 #       cvs -d /cvs rtag -a -F -rDragonFly_RELEASE_1_2 DragonFly_RELEASE_1_2_Slip src
200 #
201 #update_release1_4_slip_tag:     iamoncrater
202 #       cvs -d /cvs rtag -a -F -rDragonFly_RELEASE_1_4 DragonFly_RELEASE_1_4_Slip src
203 #
204 #update_release1_6_slip_tag:     iamoncrater
205 #       cvs -d /cvs rtag -a -F -rDragonFly_RELEASE_1_6 DragonFly_RELEASE_1_6_Slip src
206 #
207 #update_release1_8_slip_tag:     iamoncrater
208 #       cvs -d /cvs rtag -a -F -rDragonFly_RELEASE_1_8 DragonFly_RELEASE_1_8_Slip src
209 #
210 #update_release1_10_slip_tag:     iamoncrater
211 #       cvs -d /cvs rtag -a -F -rDragonFly_RELEASE_1_10 DragonFly_RELEASE_1_10_Slip src
212 #
213 #update_release1_12_slip_tag:     iamoncrater
214 #       cvs -d /cvs rtag -a -F -rDragonFly_RELEASE_1_12 DragonFly_RELEASE_1_12_Slip src
215 #
216 #update_release2_0_slip_tag:     iamoncrater
217 #       cvs -d /cvs rtag -a -F -rDragonFly_RELEASE_2_0 DragonFly_RELEASE_2_0_Slip src
218
219 iamoncrater:
220         @ [ "`hostname`" = "crater.dragonflybsd.org" ] || \
221                 (echo "You are not on the master cvs host"; exit 1)