Add libmagic and reorder/restructure the list of the libraries to be build.
[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.9 2004/11/12 09:09:56 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 FreeBSD make automatically reads
36 # the /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 400MB 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.  `reboot'        (in single user mode: boot -s from the loader prompt).
61 # 6.  `mergemaster -p'
62 # 7.  `make installworld'
63 # 8.  `mergemaster'
64 # 9.  `reboot'
65 #
66 # See src/UPDATING `COMMON ITEMS' for more complete information.
67 #
68 # If TARGET_ARCH=arch (e.g. amd64) is specified you can
69 # cross build world for other architectures using the buildworld target,
70 # and once the world is built you can cross build a kernel using the
71 # buildkernel target.
72 #
73 # Define the user-driven targets. These are listed here in alphabetical
74 # order, but that's not important.
75 #
76 TGTS=   all all-man buildkernel quickkernel nativekernel \
77         buildworld crossworld quickworld realquickworld checkdpadd clean \
78         cleandepend cleandir depend distribute distributeworld everything \
79         hierarchy install installcheck installkernel \
80         reinstallkernel installmost installworld libraries lint maninstall \
81         mk most obj objlink regress rerelease tags update
82
83 BITGTS= files includes
84 BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
85
86 .ORDER: buildworld installworld
87 .ORDER: buildworld distributeworld
88 .ORDER: buildworld buildkernel nativekernel quickkernel
89 .ORDER: buildkernel nativekernel quickkernel installkernel
90 .ORDER: buildkernel nativekernel quickkernel reinstallkernel
91
92 PATH=   /sbin:/bin:/usr/sbin:/usr/bin
93 MAKE=   PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
94
95 #
96 # Handle the user-driven targets, using the source relative mk files.
97 #
98 ${TGTS} ${BITGTS}:
99         @cd ${.CURDIR}; \
100                 ${MAKE} ${.TARGET}
101
102 # Set a reasonable default
103 .MAIN:  all
104
105 STARTTIME!= LC_ALL=C date
106 #
107 # world
108 #
109 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
110 # success, regardless of how old your existing system is.
111 #
112 world:
113         @echo "--------------------------------------------------------------"
114         @echo ">>> elf make world started on ${STARTTIME}"
115         @echo "--------------------------------------------------------------"
116 .if target(pre-world)
117         @echo
118         @echo "--------------------------------------------------------------"
119         @echo ">>> Making 'pre-world' target"
120         @echo "--------------------------------------------------------------"
121         @cd ${.CURDIR}; ${MAKE} pre-world
122 .endif
123         @cd ${.CURDIR}; ${MAKE} buildworld
124         @cd ${.CURDIR}; ${MAKE} -B installworld
125 .if target(post-world)
126         @echo
127         @echo "--------------------------------------------------------------"
128         @echo ">>> Making 'post-world' target"
129         @echo "--------------------------------------------------------------"
130         @cd ${.CURDIR}; ${MAKE} post-world
131 .endif
132         @echo
133         @echo "--------------------------------------------------------------"
134         @printf ">>> elf make world completed on `LC_ALL=C date`\n                        (started ${STARTTIME})\n"
135         @echo "--------------------------------------------------------------"
136
137 #
138 # kernel
139 #
140 # Short hand for `make buildkernel installkernel'
141 #
142 kernel: buildkernel installkernel
143
144 #
145 # A simple test target used as part of the test to see if make supports
146 # the -m argument.  Also test that make will only evaluate a conditional
147 # as far as is necessary to determine its value.
148 #
149 test:
150 .if defined(notdef)
151 .undef notdef
152 .if defined(notdef) && ${notdef:U}
153 .endif
154 .endif
155
156 #
157 # Upgrade the installed make to the current version using the installed
158 # headers, libraries and build tools. This is required on installed versions
159 # prior to 2.2.5 in which the installed make doesn't support the -m argument.
160 #
161 make:
162         @echo
163         @echo "--------------------------------------------------------------"
164         @echo " Upgrading the installed make"
165         @echo "--------------------------------------------------------------"
166         @cd ${.CURDIR}/usr.bin/make; \
167                 make obj && make depend && make all && make install
168
169 #
170 # Handle the upgrade of /etc
171 #
172
173 preupgrade:
174         @cd ${.CURDIR}/etc; make preupgrade
175
176 upgrade:        upgrade_etc
177
178 #
179 # Handle post-installworld updating of static files (e.g. like /etc/rc)
180 #
181 upgrade_etc:
182         @cd ${.CURDIR}/etc; make upgrade_etc