FreeBSD/Linux Kernel Cross Reference
sys/conf/template.mk
1 #
2 # Mach Operating System
3 # Copyright (c) 1993-1986 Carnegie Mellon University
4 # All Rights Reserved.
5 #
6 # Permission to use, copy, modify and distribute this software and its
7 # documentation is hereby granted, provided that both the copyright
8 # notice and this permission notice appear in all copies of the
9 # software, derivative works or modified versions, and any portions
10 # thereof, and that both notices appear in supporting documentation.
11 #
12 # CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 # CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 # ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 #
16 # Carnegie Mellon requests users of this software to return to
17 #
18 # Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 # School of Computer Science
20 # Carnegie Mellon University
21 # Pittsburgh PA 15213-3890
22 #
23 # any improvements or extensions that they make and grant Carnegie Mellon
24 # the rights to redistribute these changes.
25 #
26 #
27 # HISTORY
28 # $Log: template.mk,v $
29 # Revision 2.10 93/08/02 21:43:37 mrt
30 # Added rule for mach_norma_user.c and mach_norma.h
31 # [93/06/28 mrt]
32 #
33 # Revision 2.9 93/06/02 20:49:55 rvb
34 # Added definition of NOSTRIP.
35 # [93/06/02 mrt]
36 #
37 # Revision 2.8 93/05/28 17:40:45 mrt
38 # Change relink rule to build mach.boot as well as linking the
39 # kernel.
40 # [93/05/28 mrt]
41 #
42 # Revision 2.7 93/05/17 17:17:17 mrt
43 # Removed EXPORTBASE/kernel from list of INDIRS. We now
44 # put all those files in the regular export dir.
45 # Removed use of version.minor
46 # [93/05/14 mrt]
47 #
48 # Revision 2.6 93/05/11 12:55:27 rvb
49 # We don't profile the kernel yet.
50 #
51 # Revision 2.5 93/05/10 19:40:54 rvb
52 # Added trailing ` on cat ${VERSION_FILES_SOURCE line.
53 # Fix courtesy of Ian Dall.
54 # [93/04/29 mrt]
55 #
56 # Revision 2.4 93/05/10 17:45:50 rvb
57 # Typo missing `
58 # Ian Dall <DALL@hfrd.dsto.gov.au> 4/28/93
59 # [93/05/10 13:17:11 rvb]
60 #
61 # Use CC_OPT_LEVEL and CC_OPT_EXTRA for max flexibility
62 # [93/05/07 rvb]
63 #
64 # Revision 2.3 93/02/15 14:18:09 mrt
65 # Fixed it to only install the bootable kernel.
66 # Added the CFLAGS macro
67 # [93/02/05 mrt]
68 #
69 # Revision 2.2 93/02/05 12:36:11 danner
70 # Fixed support for profiling.
71 # Added mach4. - danner
72 # Renamed Makefile.template to template.mk and modifed for ODE
73 # make.
74 # [93/01/21 mrt]
75 #
76 # Revision 2.34 92/04/05 18:28:30 rpd
77 # Added ${VOLATILE} to genassym.c processing.
78 # [92/03/27 rpd]
79 # Changed to use Makefile-common (for some definitions).
80 # New cross-compilation support.
81 # [92/03/18 jvh]
82 #
83 # Revision 2.33 92/03/05 18:53:45 rpd
84 # Corrected the dependencies for device/dev_forward.c
85 # and mach/mach_norma_user.c.
86 # Added a rule for mach/mach_user.c.
87 # [92/03/04 rpd]
88 #
89 # Revision 2.32 92/02/29 15:33:24 rpd
90 # Restored explicit vers.c/vers.o rules.
91 # [92/02/27 rpd]
92 #
93 # Revision 2.31 92/02/25 14:13:22 elf
94 # Defined ASCPP and initialized it to ${CPP}
95 # [92/02/23 elf]
96 #
97 # Moved definition of MKDIRS to where it can be overriden by the
98 # machine dependent makefile fragment.
99 # [92/02/21 elf]
100 #
101 # Revision 2.30 92/02/19 15:07:08 elf
102 # Simplified - no more *_RULE_[1234] stuff.
103 # Condensed history.
104 # [92/02/12 rpd]
105 #
106 #
107 # Condensed history:
108 # Changes for out-of-kernel bootstrap (dbg).
109 # Changes for norma (jsb).
110 # Changes for MACH_KERNEL (dbg).
111 # Added mach_host.defs and related files (dlb).
112 # Mucho hacking at Mig rules (rpd).
113 # Lint hacking (mwyoung).
114 # New memory_object files (mwyoung).
115 # CPATH and -I hacking (mja, rpd).
116 # Running Mig in the build directory (mwyoung).
117 # VOLATILE hacking (rvb).
118 # Created from old Makefile.vax (mja).
119 # Reorganized for simplified config program (mja).
120 # Introduced new make depend stuff (rvb).
121
122 VPATH =..
123
124 # We want the MK version & configuration to be part of this name.
125 # Makeconf defined KERNEL_CONFIG and VERSION for us.
126
127 CONFIG ?=${KERNEL_${TARGET_MACHINE}_CONFIG:U${KERNEL_CONFIG:UDEFAULT}}
128
129 .if exists( ${MAKETOP}Makefile-version)
130 .include "${MAKETOP}Makefile-version"
131 .endif
132
133 # set BINARIES to get the osf.obj.mk rules included
134 BINARIES =
135
136 MACH_KERNEL = mach_kernel.${VERSION}.${CONFIG}
137 MACH_BOOT = mach.boot.${VERSION}.${CONFIG}
138 BOOTSTRAP = bootstrap.${VERSION}
139 MKODIRS = mach/ mach_debug/ device/
140
141 OTHERS = ${MACH_BOOT}
142 ILIST = ${MACH_BOOT}
143 IDIR = /special/
144 NOSTRIP =
145
146 DEPENDENCIES =
147
148 INCFLAGS = -I..
149
150
151 # Pre-processor environment.
152 # config outputs a definition of IDENT.
153 # LOCAL_DEFINES can be set by makeoptions in MASTER.local.
154 # LINENO is (optionally) set from the config file
155 # (eg. -DTIMEZONE=-120)
156 # (VOLATILE should be defined as "-Dvolatile=" if your
157 # compiler doesn't support volatile declarations.)
158
159 VOLATILE ?=
160 DEFINES = ${LOCAL_DEFINES} ${IDENT} -DKERNEL ${VOLATILE}
161 CC_OPT_EXTRA ?= ${LINENO}
162
163 # CFLAGS are for all normal files
164 # DRIVER_CFLAGS are for files marked as device-driver
165 # NPROFILING_CFLAGS are for files which support profile and thus
166 # should not be compiled with the profiling flags
167 #CFLAGS = ${DEFINES} ${PROFILING:D-pg -DGPROF}
168 CFLAGS = ${DEFINES}
169 DRIVER_CFLAGS =${CFLAGS}
170 NPROFILING_CFLAGS=${DEFINES}
171
172
173 #
174 # Mig variables
175 #
176
177 MIGKSFLAGS = -DKERNEL -DKERNEL_SERVER
178 MIGKUFLAGS = -DKERNEL -DKERNEL_USER
179 _MIGKSFLAGS_ = -DKERNEL -DKERNEL_SERVER ${_MIGFLAGS_}
180 _MIGKUFLAGS_ = -DKERNEL -DKERNEL_USER ${_MIGFLAGS_}
181
182 # Files where mig only needs to produce one target and the
183 # standard mig rules can be used
184
185
186 MIG_HDRS = ${EXC_FILE}
187 MIG_SRVS = ${MACH_FILE} ${MACH_PORT_FILE} \
188 ${MACH_HOST_FILE} ${MACH_DEBUG_FILE} \
189 ${DEVICE_FILE} ${DEVICE_PAGER_FILE} \
190 ${DEFAULT_PAGER_OBJECT_FILE} \
191 ${MACH_NORMA_FILE} \
192 ${NORMA_INTERNAL_FILE} \
193 ${MACH4_FILE}
194
195 EXC_FILE = mach/exc.h
196 ${EXC_FILE}_MIGFLAGS = ${MIGKUFLAGS}
197
198 MACH_FILE = mach/mach_server.c
199 ${MACH_FILE}_MIGFLAGS = ${MIGKSFLAGS}
200 ${MACH_FILE}_MIGSDEF = mach/mach.defs
201
202 MACH_PORT_FILE = mach/mach_port_server.c
203 ${MACH_PORT_FILE}_MIGFLAGS = ${MIGKSFLAGS}
204 ${MACH_PORT_FILE}_MIGSDEF = mach/mach_port.defs
205
206 MACH_HOST_FILE = mach/mach_host_server.c
207 ${MACH_HOST_FILE}_MIGFLAGS = ${MIGKSFLAGS}
208 ${MACH_HOST_FILE}_MIGSDEF = mach/mach_host.defs
209
210 MACH_DEBUG_FILE = mach_debug/mach_debug_server.c
211 ${MACH_DEBUG_FILE}_MIGFLAGS = ${MIGKSFLAGS}
212 ${MACH_DEBUG_FILE}_MIGSDEF = mach_debug/mach_debug.defs
213
214 DEVICE_FILE = device/device_server.c
215 ${DEVICE_FILE}_MIGFLAGS = ${MIGKSFLAGS}
216 ${DEVICE_FILE}_MIGSDEF = device/device.defs
217
218 DEVICE_PAGER_FILE = device/device_pager_server.c
219 ${DEVICE_PAGER_FILE}_MIGFLAGS = ${MIGKSFLAGS}
220 ${DEVICE_PAGER_FILE}_MIGSDEF = mach/memory_object.defs
221
222 DEFAULT_PAGER_OBJECT_FILE = mach/default_pager_object_server.c
223 ${DEFAULT_PAGER_OBJECT_FILE}_MIGFLAGS = ${MIGKSFLAGS}
224 ${DEFAULT_PAGER_OBJECT_FILE}_MIGSDEF = mach/default_pager_object.defs
225
226 MACH_NORMA_FILE = mach/mach_norma_server.c
227 ${MACH_NORMA_FILE}_MIGFLAGS = ${MIGKSFLAGS}
228 ${MACH_NORMA_FILE}_MIGSDEF = mach/mach_norma.defs
229
230 NORMA_INTERNAL_FILE = mach/norma_internal_server.c
231 ${NORMA_INTERNAL_FILE}_MIGFLAGS = ${MIGKSFLAGS}
232 ${NORMA_INTERNAL_FILE}_MIGSDEF = norma/norma_internal.defs
233
234 MACH4_FILE = mach/mach4_server.c
235 ${MACH4_FILE}_MIGFLAGS = ${MIGKSFLAGS}
236 ${MACH4_FILE}_MIGSDEF = mach/mach4.defs
237
238 #
239 # LDOBJS is the set of object files which comprise the kernel.
240 # LDOBJS_PREFIX and LDOBJS_SUFFIX are defined in the machine
241 # dependent Makefile (if necessary).
242 #
243 LDOBJS=${LDOBJS_PREFIX} ${OBJS} ${LDOBJS_SUFFIX}
244
245 #
246 # LDDEPS is the set of extra dependencies associated with
247 # loading the kernel.
248 #
249 # LDDEPS_PREFIX is defined in the machine dependent Makefile
250 # (if necessary).
251 #
252 LDDEPS=${LDDEPS_PREFIX}
253
254
255 LDDEPS =${LDDEPS_PREFIX}
256
257 #
258 # These macros are filled in by the config program depending on the
259 # current configuration. The MACHDEP macro is replaced by the
260 # contents of the machine dependent makefile template and the others
261 # are replaced by the corresponding symbol definitions for the
262 # configuration.
263 #
264
265 %OBJS
266
267 %CFILES
268
269 %CFLAGS
270
271 %SFILES
272
273 %BFILES
274
275 %ORDERED
276
277
278 # All macro definitions should be before this point,
279 # so that the machine dependent fragment can redefine the macros.
280 # All rules (that use macros) should be after this point,
281 # so that they pick up any redefined macro values.
282
283 %MACHDEP
284
285
286 .include <${RULES_MK}>
287
288 # drop the standard .y .l and other suffixes which are not used
289 # in the kernel to save time
290
291 .SUFFIXES:
292 .SUFFIXES: .o .s .c .b .X .out .h
293
294 #
295 # OBJSDEPS is the set of files (defined in the machine dependent
296 # template if necessary) which all objects depend on (such as an
297 # in-line assembler expansion filter
298 #
299
300 ${OBJS}: ${OBJSDEPS}
301
302 .PRECIOUS: Makefile
303
304 #
305 # The machine dependent template.mk may define the load flags
306 # so this is only a default value.
307
308 MK_LDFLAGS ?= ${${TARGET_MACHINE}_LDFLAGS:U${LDFLAGS}}
309
310 NEWVERS_DEPS = \
311 conf/version.major \
312 conf/version.variant \
313 conf/version.edit \
314 conf/version.patch \
315 conf/newvers.sh \
316 conf/copyright
317
318 VERSION_FILES_SOURCE = \
319 ${conf/version.major:P} \
320 ${conf/version.variant:P} \
321 ${conf/version.edit:P} \
322 ${conf/version.patch:P}
323
324
325 ${MACH_KERNEL}: ${PRELDDEPS} ${LDOBJS} ${LDDEPS} ${SYSDEPS} \
326 ${CC_DEPS_NORMAL} ${NEWVERS_DEPS} LINKKERNEL
327
328 # The relink rule allows you to relink the kernel without checking
329 # all the dependencies.
330
331 relink: ${MACH_KERNEL}.relink
332
333 ${MACH_KERNEL}.relink: ${LDDEPS} ${NEWVERS_DEPS} LINKKERNEL MAKEBOOT
334
335
336 # We create vers.c/vers.o right here so that the timestamp in vers.o
337 # always reflects the time that the kernel binary is actually created.
338 # We link the kernel binary to "mach_kernel" so that there is a short name
339 # for the most recently created binary in the object directory.
340
341 LINKKERNEL: .USE
342 @echo "creating vers.o"
343 @${RM} -f vers.c vers.o
344 @sh ${conf/newvers.sh:P} ${conf/copyright:P} `cat ${VERSION_FILES_SOURCE}`
345 @${_CC_} -c ${_CCFLAGS_} vers.c
346 @${RM} -f ${MACH_KERNEL} ${MACH_KERNEL}.out ${MACH_KERNEL}.unstripped
347 @echo "loading ${MACH_KERNEL}"
348 ${_LD_} -o ${MACH_KERNEL}.out ${MK_LDFLAGS} \
349 ${LDOBJS} vers.o ${LIBS} ${LDLIBS} && \
350 ${MV} ${MACH_KERNEL}.out ${MACH_KERNEL}.unstripped
351 -${SIZE} ${MACH_KERNEL}.unstripped
352 ${CP} ${MACH_KERNEL}.unstripped ${MACH_KERNEL}.out
353 ${XSTRIP} ${MACH_KERNEL}.out && ${MV} ${MACH_KERNEL}.out ${MACH_KERNEL}
354 @${RM} -f mach_kernel
355 ln ${MACH_KERNEL} mach_kernel
356 ${CP} ${MACH_KERNEL} ${EXPORTBASE}/special/${MACH_KERNEL}
357
358
359
360 # mach.boot is made with makeboot, which combines a kernel image
361 # and a bootstrap image to produce a single bootable image.
362 # The sh mess does generates a dependency on makeboot
363 #
364 # Just as ${MACH_KERNEL} is linked to mach_kernel,
365 # ${MACH_BOOT} is linked to mach.boot.
366
367 # NB: ${MACH_KERNEL} is xstripped; That is the one we want
368
369 bootstrap = ${EXPORTBASE}/special/${BOOTSTRAP}
370 ${MACH_BOOT} : ${MACH_KERNEL} ${bootstrap} MAKEBOOT
371
372 MAKEBOOT: .USE
373 @echo "${MACH_BOOT}: $${makeboot}" >> ${MACH_BOOT}.d; \
374 echo "[ generating ${MACH_BOOT} from ${MACH_KERNEL} and ${bootstrap} ]";
375 makeboot="`${WH} -q makeboot`"; \
376 ${RM} -f ${MACH_BOOT} mach.boot; \
377 $${makeboot} -o ${MACH_BOOT} ${MACH_KERNEL} ${bootstrap} && \
378 ln ${MACH_BOOT} mach.boot
379 cp ${MACH_BOOT} ${EXPORTBASE}/special/${MACH_BOOT}
380
381
382 ${OBJS}: ${OBJSDEPS}
383
384 # Use the standard rules with slightly non-standard .IMPSRC
385
386 ${COBJS}: $${$${.TARGET}_SOURCE}
387
388 ${SOBJS}: $${$${.TARGET}_SOURCE}
389
390 ${BOBJS}: $${$${.TARGET}_SOURCE}
391
392
393 #
394 # Rules for components which are not part of the kernel proper or that
395 # need to be built in a special manner.
396 #
397
398 # genassym needs to be preprocessed as for the target machine but run
399 # on the host machine. In order to get the correct predefines it is
400 # necessary to use the target preprocessor.
401
402 HOST_INCDIRS = ${INCDIRS}
403 HOST_CFLAGS = ${DEFINES}
404 HOST_LDFLAGS = ${LDFLAGS}
405 genassym_CCTYPE = host
406
407 xxx_genassym.c: ${KERN_MACHINE_DIR}/genassym.c
408 ${ansi_CPP} -P ${_CCFLAGS_} ${${KERN_MACHINE_DIR}/genassym.c:P} > xxx_genassym.c
409 cat /dev/null >> genassym.d
410 sed 's/^genassym\.o/xxx_genassym.c/' genassym.d > xxx_genassym.c.d;
411 ${RM} -f genassym.d
412
413 genassym: xxx_genassym.c
414 ( LPATH="${_host_LPATH_}"; export LPATH; \
415 ${HOST_CC} ${_CC_CFLAGS_} -o genassym.X xxx_genassym.c )
416 ${MV} genassym.X genassym
417
418 #
419 # Special dependencies for locore.
420 #
421
422 assym.s: genassym
423 ./genassym > ${.TARGET}
424
425 locore.o: assym.s ${LOCORE_HEADS}
426
427 # Make all the directories in the object directory
428
429 .BEGIN:
430 -makepath ${MKODIRS}
431
432 vm_pageout.o: mach/memory_object_user.h mach/memory_object_default.h
433
434 vm_object.o: mach/memory_object_user.h mach/memory_object_default.h
435
436 vm_fault.o: mach/memory_object_user.h
437
438 memory_object.o: mach/memory_object_user.h
439
440 exception.o: mach/exc.h
441
442 dev_pager.o : device/device_pager_server.c mach/mach_user_kernel.h
443
444 ds_routines.o : device/device_reply.h
445
446
447 # The Mig-generated files go into subdirectories.
448 # and have non-standard names. Also mig rules that build
449 # multiple targets have to generate an intermediate "timestamp"
450 # target that the final targets can depend on in order
451 # to avoid being run redundently
452
453
454 MACH_KU_FUNCS = \
455 memory_object_data_provided memory_object_data_unavailable \
456 memory_object_data_error memory_object_set_attributes \
457 memory_object_data_supply memory_object_ready \
458 memory_object_change_attributes
459
460 MACH_KU_FFILES = ${MACH_KU_FUNCS:@.F.@mach/${.F.}.c@}
461 MACH_KU_FILES = mach/mach_user_kernel.h $(MACH_KU_FFILES)
462
463 $(MACH_KU_FILES): mach_stamp
464 mach_stamp: mach/mach.defs
465 @echo ""
466 @touch mach_stamp
467 ${MIG} ${_MIGKUFLAGS_} \
468 -header mach/mach_user_kernel.h \
469 -i mach/ -user '$$(MACH_KU_FFILES)' \
470 -server /dev/null \
471 ${mach/mach.defs:P}
472
473 MEMORY_OBJECT_FILES = mach/memory_object_user.h mach/memory_object_user.c
474
475 ${MEMORY_OBJECT_FILES}: memory_object_stamp
476 memory_object_stamp: mach/memory_object.defs
477 @echo ""
478 @touch memory_object_stamp
479 ${MIG} ${_MIGKUFLAGS_} -DSEQNOS \
480 -header mach/memory_object_user.h\
481 -user mach/memory_object_user.c\
482 -server /dev/null \
483 ${mach/memory_object.defs:P}
484
485
486 MEMORY_OBJECT_DEFAULT_FILES = mach/memory_object_default.h \
487 mach/memory_object_default_user.c
488
489 ${MEMORY_OBJECT_DEFAULT_FILES}: memory_object_default_stamp
490 memory_object_default_stamp: mach/memory_object_default.defs
491 @echo ""
492 @touch memory_object_default_stamp
493 ${MIG} ${_MIGKUFLAGS_} -DSEQNOS \
494 -header mach/memory_object_default.h\
495 -user mach/memory_object_default_user.c\
496 -server /dev/null \
497 ${mach/memory_object_default.defs:P}
498
499 PROXY_FILES = mach/proxy.h mach/proxy_user.c mach/proxy_server.c
500
501 $(PROXY_FILES): xmm_proxy_stamp
502 xmm_proxy_stamp: norma/xmm_proxy.defs
503 @touch xmm_proxy_stamp
504 @echo ""
505 $(MIG) $(_MIGKUFLAGS_) \
506 -header mach/proxy.h \
507 -user mach/proxy_user.c \
508 -server /dev/null \
509 ${norma/xmm_proxy.defs:P}
510 $(MIG) $(_MIGKSFLAGS_) \
511 -header /dev/null \
512 -user /dev/null \
513 -server mach/proxy_server.c \
514 ${norma/xmm_proxy.defs:P}
515
516 DEVKUSER_FILES = mach/dev_forward.c mach/dev_forward.h
517
518 ${DEVKUSER_FILES}: dev_forward_stamp
519 dev_forward_stamp: device/dev_forward.defs
520 @touch dev_forward_stamp
521 @echo ""
522 ${MIG} ${_MIGKUFLAGS_}\
523 -header mach/dev_forward.h\
524 -user mach/dev_forward.c\
525 -server /dev/null\
526 ${device/dev_forward.defs:P}
527
528
529 DEVICE_REPLY_FILES = device/device_reply.h device/device_reply_user.c
530
531 ${DEVICE_REPLY_FILES}: device_reply_stamp
532 device_reply_stamp: device/device_reply.defs
533 @touch device_reply_stamp
534 @echo ""
535 ${MIG} ${_MIGKUFLAGS_}\
536 -header device/device_reply.h\
537 -user device/device_reply_user.c\
538 -server /dev/null\
539 ${device/device_reply.defs:P}
540
541 MACH_NORMA_USER_FILES = mach/mach_norma.h mach/mach_norma_user.c
542
543 ${MACH_NORMA_USER_FILES}: mach_norma_user_stamp
544 mach_norma_user_stamp: mach/mach_norma.defs
545 @touch mach_norma_user_stamp
546 @echo ""
547 $(MIG) $(_MIGKUFLAGS_) \
548 -header mach/mach_norma.h \
549 -user mach/mach_norma_user.c \
550 -server /dev/null \
551 ${mach/mach_norma.defs:P}
552
553 NORMA_INTERNAL_USER_FILES = mach/norma_internal.h mach/norma_internal_user.c
554
555 $(NORMA_INTERNAL_USER_FILES): norma_internal_stamp
556 norma_internal_stamp: norma/norma_internal.defs
557 @touch norma_internal_stamp
558 @echo ""
559 $(MIG) $(_MIGKUFLAGS_) \
560 -header mach/norma_internal.h \
561 -user mach/norma_internal_user.c \
562 -server /dev/null \
563 ${norma/norma_internal.defs:P}
564
565 MACH_USER_FILES = mach/mach_user.h mach/mach_user.c
566
567 ${MACH_USER_FILES}: mach_user_stamp
568 mach_user_stamp: mach/mach.defs
569 @touch mach_user_stamp
570 @echo ""
571 ${MIG} ${_MIGKUFLAGS_} \
572 -header mach/mach_user.h \
573 -user mach/mach_user.c \
574 -server /dev/null \
575 ${mach/mach.defs:P}
576
577
Cache object: 45673fb6b5565605596d89de4bb90919
|