Annotation of kernel/conf/Makefile.template, revision 1.1.1.1

1.1       root        1: ##
                      2: # Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3: #
                      4: # @APPLE_LICENSE_HEADER_START@
                      5: # 
                      6: # Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7: # Reserved.  This file contains Original Code and/or Modifications of
                      8: # Original Code as defined in and that are subject to the Apple Public
                      9: # Source License Version 1.1 (the "License").  You may not use this file
                     10: # except in compliance with the License.  Please obtain a copy of the
                     11: # License at http://www.apple.com/publicsource and read it before using
                     12: # this file.
                     13: # 
                     14: # The Original Code and all software distributed under the License are
                     15: # distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16: # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17: # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18: # FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19: # License for the specific language governing rights and limitations
                     20: # under the License.
                     21: # 
                     22: # @APPLE_LICENSE_HEADER_END@
                     23: ##
                     24: 
                     25: #
                     26: # Mach Operating System
                     27: # Copyright (c) 1986 Carnegie-Mellon University
                     28: # All rights reserved.  The CMU software License Agreement specifies
                     29: # the terms and conditions for use and redistribution.
                     30: #
                     31: ######################################################################
                     32: 
                     33: ifneq "" "$(wildcard /bin/mkdirs)"
                     34:   MKDIRS = /bin/mkdirs
                     35: else
                     36:   MKDIRS = /bin/mkdir -p
                     37: endif
                     38: 
                     39: #
                     40: #  This must be here before any rules are possibly defined by the
                     41: #  machine dependent makefile fragment so that a plain "make" command
                     42: #  always works.  The config program will emit an appropriate rule to
                     43: #  cause "all" to depend on every kernel configuration it generates.
                     44: #
                     45: 
                     46: default: all
                     47: 
                     48: #
                     49: #  In order to move the link commands out of config and back into the
                     50: #  template makefile, config has been changed to emit a dependency rule
                     51: #  of the form *mach.sys: *mach.swap for each configuration so that
                     52: #  the common commands for building each configuration can be placed
                     53: #  directly in the template in the default rule for the .sys.swap
                     54: #  dependency.
                     55: #
                     56: .SUFFIXES: .sys
                     57: 
                     58: #
                     59: #  Make sure we don't remove this by accident if interrupted at the wrong
                     60: #  time.
                     61: #
                     62: .PRECIOUS: Makefile
                     63: 
                     64: #
                     65: # Make depend hackery 
                     66: #
                     67: MD=    md
                     68: MD_SUFFIX=d
                     69: EXIT_RULE=${MD} -u Makedep -f -d `ls *.${MD_SUFFIX}`
                     70: 
                     71: #
                     72: # This defines the kernel used for "target" object modules (ones that
                     73: # will run on the target architecture).
                     74: #
                     75: KCC=   ${CC} -static
                     76: KCPP=  ${KCC} -E
                     77: 
                     78: #
                     79: # Headers files that defines stuff used by both libc and kernel
                     80: #
                     81: EXPORT_LIB= . arpa protocols
                     82: 
                     83: #
                     84: #  Pre-processor environment
                     85: #
                     86: INCLUDES = -I. -I$(SOURCE_DIR) -I$(SOURCE_DIR)/bsd \
                     87:        -I$(SOURCE_DIR)/bsd/include -I$(SOURCE_DIR)/machdep \
                     88:        -I$(SOURCE_DIR)/bsd/netat \
                     89:        -I$(SOURCE_DIR)/bsd/netat/h -I$(SOURCE_DIR)/bsd/netat/at \
                     90:        -I$(NEXT_ROOT)/System/Library/Frameworks/System.framework/PrivateHeaders \
                     91:        -I$(NEXT_ROOT)/System/Library/Frameworks/System.framework/Headers \
                     92:        -I$(NEXT_ROOT)/System/Library/Frameworks/System.framework/Headers/bsd
                     93: 
                     94: # -- Compatible paths --
                     95: #INCLUDES = -I. -I$(SOURCE_DIR) -I$(SOURCE_DIR)/bsd \
                     96: #         -I$(SOURCE_DIR)/bsd/include -I$(SOURCE_DIR)/machdep \
                     97: #         -I$(SOURCE_DIR)/bsd/netat \
                     98: #         -I$(SOURCE_DIR)/bsd/netat/h -I$(SOURCE_DIR)/bsd/netat/at \
                     99: #         -I$(NEXT_ROOT)/NextLibrary/Frameworks/System.framework/PrivateHeaders \
                    100: #         -I$(NEXT_ROOT)/NextLibrary/Frameworks/System.framework/Headers \
                    101: #         -I$(NEXT_ROOT)/NextLibrary/Frameworks/System.framework/Headers/bsd
                    102: 
                    103: DEFINES = $(IDENT) -DARCH_PRIVATE -D_KERNEL -DKERNEL -DKERNEL_PRIVATE \
                    104:                -DDRIVER_PRIVATE  -DKERNEL_BUILD -D__APPLE__ -DNeXT -D_NEXT_SOURCE \
                    105:                $(MACHINE_DEFINES)
                    106: 
                    107: CPP_FLAGS = -MD -imacros meta_features.h $(INCLUDES) $(DEFINES)
                    108: 
                    109: #
                    110: #  Profiling hackery
                    111: #
                    112: COPTS_P = $(CPP_FLAGS) -pg
                    113: COPTS= $(CPP_FLAGS)
                    114: 
                    115: #
                    116: # CFLAGS --
                    117: #      CCONFIGFLAGS -- flags to be set via "makeoptions" in the
                    118: #              appropriate MASTER.* config file
                    119: #      MACHINE_CFLAGS -- flags to be set in the Makefile.* file
                    120: #
                    121: CFLAGS=         $(CCONFIGFLAGS) $(COPTS) $(MACHINE_CFLAGS)
                    122: 
                    123: #
                    124: #  Common assembly flags
                    125: #
                    126: # SFLAGS --
                    127: #      SCONFIGFLAGS -- flags to be set via "makeoptions" in the
                    128: #              appropriate MASTER.* config file
                    129: #      MACHINE_SFLAGS -- flags to be set in the Makefile.* file
                    130: #
                    131: SFLAGS=        $(CPP_FLAGS) -D__ASSEMBLER__ $(SCONFIGFLAGS) $(MACHINE_SFLAGS)
                    132: 
                    133: #
                    134: # Macros that control installation of kernel and it's header files
                    135: #
                    136: # install flags for header files
                    137: #
                    138: INSTALL_FLAGS = -c -m 444
                    139: 
                    140: #
                    141: # Commands that massage header files to remove KERNEL_PRIVATE and 
                    142: # DRIVER_PRIVATE stuff
                    143: #
                    144: UNIFDEF   = /usr/bin/unifdef
                    145: DECOMMENT = /usr/local/bin/decomment
                    146: 
                    147: #
                    148: # Header files that are unifdef'ed and installed in INCDIR
                    149: #
                    150: EXPORT= mach mach/machine kernserv kernserv/machine                    \
                    151:        bsd/machine bsd/sys bsd/net bsd/netinet bsd/netiso bsd/netns    \
                    152:        bsd/nfs bsd/dev bsd/dev/machine                                 \
                    153:        bsd/ufs/ffs bsd/ufs/ufs bsd/miscfs/union bsd/miscfs/specfs      \
                    154:        bsd/vfs bsd/libkern driverkit
                    155: 
                    156: #
                    157: # Header files that are installed into LCLDIR
                    158: #
                    159: LCLEXPORT= mach mach_debug kern ipc kernserv vm bsd/sys bsd/dev bsd/net        \
                    160:        bsd/netiso bsd/netccitt bsd/netns bsd/dev/machine mach/machine  \
                    161:        machdep/machine driverkit                                       \
                    162:        bsd/ufs/mfs bsd/ufs/lfs bsd/isofs/cd9660                        \
                    163:        bsd/netat/h bsd/netat/at                                        \
                    164:        bsd/hfs/hfscommon/headers bsd/hfs/hfscommon/headers/system
                    165: 
                    166: #
                    167: # Header file destinations
                    168: #
                    169: INCDIR=        /System/Library/Frameworks/System.framework/Versions/B/Headers
                    170: LCLDIR= /System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders
                    171: 
                    172: # -- Compatible paths --
                    173: #INCDIR= /NextLibrary/Frameworks/System.framework/Versions/B/Headers
                    174: #LCLDIR= /NextLibrary/Frameworks/System.framework/Versions/B/PrivateHeaders
                    175: 
                    176: 
                    177: #
                    178: # Kernel is installed in / and TFTPDIR (actually, hard linked together)
                    179: #
                    180: TFTPDIR= /private/tftpboot
                    181: 
                    182: #
                    183: # driverkit library source.
                    184: #
                    185: LIBDRIVER_SOURCE= $(NEXT_ROOT)/usr/local/lib
                    186: 
                    187: #
                    188: # ObjC library.
                    189: #
                    190: LIBOBJC_SOURCE= $(NEXT_ROOT)/usr/local/lib
                    191: 
                    192: #
                    193: # Platform Expert library.
                    194: #
                    195: LIBPEXPERT_SOURCE= $(NEXT_ROOT)/usr/local/lib
                    196: 
                    197: #
                    198: # Directories to be scanned when building tags.
                    199: # Machine-dependent makefile can add directories by defining
                    200: # MACHINE_TAG_DIRS.
                    201: #
                    202: TAGDIRS =                                                              \
                    203:        bsd/dev bsd/if bsd/include bsd/kern bsd/libkern bsd/net         \
                    204:        bsd/netinet bsd/vfs bsd/nfs bsd/sys bsd/ufs/ffs bsd/ufs/lfs     \
                    205:        bsd/ufs/mfs bsd/ufs/ufs ipc kern kernserv       \
                    206:        mach mach_debug vm driverkit uxkern \
                    207:        bsd/miscfs/deadfs bsd/miscfs/fdesc bsd/miscfs/fifofs \
                    208:        bsd/miscfs/kernfs bsd/miscfs/nullfs bsd/miscfs/portal \
                    209:        bsd/miscfs/procfs bsd/miscfs/specfs bsd/miscfs/umapfs \
                    210:        bsd/miscfs/union bsd/hfs bsd/hfs/hfscomman
                    211: 
                    212: 
                    213: #
                    214: # Path to any internal tools.  Currently, just newvers
                    215: #
                    216: TOOLDIR = ..
                    217: 
                    218: #
                    219: #  Path name of the version identification file.
                    220: #
                    221: VERSION_FILES= \
                    222:        $(SOURCE_DIR)/conf/version.major \
                    223:        $(SOURCE_DIR)/conf/version.minor \
                    224:        $(SOURCE_DIR)/conf/version.variant
                    225: 
                    226: #
                    227: #  LDOBJS is the set of object files which comprise the kernel.
                    228: #
                    229: #  LDOBJS_PREFIX and LDOBJS_SUFFIX are defined in the machine
                    230: #  dependent Makefile (if necessary).
                    231: #
                    232: LDOBJS=${LDOBJS_PREFIX} ${OBJS} subr_prof.o ioconf.o ${LDOBJS_SUFFIX}
                    233: 
                    234: #
                    235: #  LDDEPS is the set of extra dependencies associated building
                    236: #  the kernel.
                    237: #
                    238: #  LDDEPS_PREFIX is defined in the machine dependent Makefile
                    239: #  (if necessary).
                    240: #
                    241: LDDEPS=${LDDEPS_PREFIX} ${VERSION_FILES} $(TOOLDIR)/newvers
                    242: 
                    243: #
                    244: #  MACHINEDIR defines the path to the machine-dependent directory
                    245: #  where genassym.c, etc live.
                    246: #
                    247: MACHINEDIR=$(SOURCE_DIR)/machdep/$(MACHINE)
                    248: 
                    249: 
                    250: #
                    251: #  SYSDEPS is the set of extra dependencies associated with each
                    252: #  *vmunix rule (in addition to *vmunix.sys).
                    253: #
                    254: #  SYSDEPS_PREFIX is defined in the machine dependent Makefile
                    255: #  (if necessary).
                    256: #
                    257: SYSDEPS=${SYSDEPS_PREFIX}
                    258: 
                    259: #
                    260: # Name of the features include file and the build directory .h files
                    261: # that are used to build the features.h file.  Machine dependent
                    262: # makefile can add other files to the FEATURES_H list by defining
                    263: # FEATURES_EXTRA.
                    264: #
                    265: FEATURES= features.h
                    266: FEATURES_H= meta_features.h
                    267: 
                    268: #
                    269: #  Compilation rules to generate mach_kernel from mach_kernel.sys.
                    270: #
                    271: SYS_RULE_1=@rm -f $@
                    272: SYS_RULE_2=strip -x -o $@ [email protected]
                    273: SYS_RULE_3=@chmod +w [email protected]
                    274: SYS_RULE_4=
                    275: 
                    276: #
                    277: # Compilation rules to generate .o from .o
                    278: #
                    279: O_RULE_1A=rm -f $*.o; cp 
                    280: O_RULE_1B=$*.o .
                    281: 
                    282: #
                    283: # Compilation rules to generate .o from .s
                    284: #
                    285: S_RULE_1A=${KCC} -c ${SFLAGS} 
                    286: S_RULE_1B=$*.s 
                    287: S_RULE_2=
                    288: S_RULE_3=
                    289: 
                    290: #
                    291: # Compilation rules to generate .o from .c for normal files
                    292: #
                    293: C_RULE_1A=${KCC} -c ${CFLAGS} 
                    294: C_RULE_1B=$*.c
                    295: C_RULE_2=
                    296: C_RULE_3=
                    297: C_RULE_4=
                    298: 
                    299: #
                    300: # Compilation rules to generate .o from .c for driver files
                    301: #
                    302: C_RULE_1A_D=${C_RULE_1A}
                    303: C_RULE_1B_D=${C_RULE_1B}
                    304: C_RULE_2_D=${C_RULE_2}
                    305: C_RULE_3_D=${C_RULE_3}
                    306: C_RULE_4_D=${C_RULE_4}
                    307: 
                    308: #
                    309: # Compilation rules to generate .o from .c for profiling routine files
                    310: #
                    311: C_RULE_1A_P=${KCC} -c -S ${COPTS_P} 
                    312: C_RULE_1B_P=${C_RULE_1B}
                    313: C_RULE_2_P=ex - $*.s < ${GPROF.EX}
                    314: C_RULE_3_P=${AS} -o $*.o $*.s
                    315: C_RULE_4_P=rm -f $*.s
                    316: 
                    317: #
                    318: # Compilation rules to generate .o from .m for normal files
                    319: #
                    320: M_RULE_1A=${KCC} -c ${CFLAGS} 
                    321: M_RULE_1B=$*.m
                    322: M_RULE_2=
                    323: M_RULE_3=
                    324: M_RULE_4=
                    325: 
                    326: #
                    327: # Compilation rules to generate .o from .m for driver files
                    328: #
                    329: M_RULE_1A_D=${M_RULE_1A}
                    330: M_RULE_1B_D=${M_RULE_1B}
                    331: M_RULE_2_D=${M_RULE_2}
                    332: M_RULE_3_D=${M_RULE_3}
                    333: M_RULE_4_D=${M_RULE_4}
                    334: 
                    335: #
                    336: # Compilation rules to generate .o from .m for profiling routine files
                    337: #
                    338: M_RULE_1A_P=${KCC} -c -S ${COPTS_P} 
                    339: M_RULE_1B_P=${M_RULE_1B}
                    340: M_RULE_2_P=ex - $*.s < ${GPROF.EX}
                    341: M_RULE_3_P=${AS} -o $*.o $*.s
                    342: M_RULE_4_P=rm -f $*.s
                    343: 
                    344: #
                    345: #  Theses macros are filled in by the config program depending on the
                    346: #  current configuration.  The MACHDEP macro is replaced by the
                    347: #  contents of the machine dependent makefile template and the others
                    348: #  are replaced by the corresponding symbol definitions for the
                    349: #  configuration.
                    350: #
                    351: 
                    352: %OBJS
                    353: 
                    354: %CFILES
                    355: 
                    356: %MFILES
                    357: 
                    358: %SFILES
                    359: 
                    360: %BFILES
                    361: 
                    362: %ORDERED
                    363: %MACHDEP
                    364: 
                    365: #
                    366: #  OBJSDEPS is the set of files (defined in the machine dependent
                    367: #  template if necessary) which all objects depend on (such as an
                    368: #  in-line assembler expansion filter
                    369: #
                    370: 
                    371: ${OBJS}: ${OBJSDEPS}
                    372: 
                    373: libmig : $(MACH_OFILES)
                    374:        @make $(MACH_OFILES)
                    375: 
                    376: 
                    377: #
                    378: #  Build a kernel.
                    379: #
                    380: mach_kernel.sys:${P} ${PRELDDEPS} ${LDOBJS} $(MACH_OFILES) ${LDDEPS} libmig
                    381:        @rm -f vers.c
                    382:        @/bin/sh $(TOOLDIR)/newvers `cat ${VERSION_FILES}`
                    383:        ${KCC} ${INCLUDES} ${MACHINE_CFLAGS} -c vers.c
                    384:        @rm -f $* $*.sys
                    385:        @echo loading $*.sys
                    386:        @${LD} -static ${LDFLAGS} ${FVMFILE_LDFLAGS} ${LDOBJS} \
                    387:                $(MACH_OFILES) vers.o ${LDFLAGS2} ${LIBS}
                    388:        @size a.out
                    389:        @chmod 755 a.out
                    390:        @-mv a.out $*.sys
                    391:        @make .EXIT
                    392: 
                    393: #
                    394: # Just do a load of the kernel to produce a mach_kernel.sys
                    395: # ... For debugging builds when you want to say:
                    396: #              make foo.o load
                    397: #
                    398: load:
                    399:        @rm -f mach_kernel.sys
                    400:        @echo loading mach_kernel.sys
                    401:        @${LD} -static ${LDFLAGS} ${FVMFILE_LDFLAGS} ${LDOBJS} \
                    402:                $(MACH_OFILES) vers.o  ${LDFLAGS2} ${LIBS}
                    403:        @size a.out
                    404:        @chmod 755 a.out
                    405:        @-mv a.out mach_kernel.sys
                    406:        @make .EXIT
                    407: 
                    408: #
                    409: #  This macro is replaced by three rules per configuration, plus a
                    410: #  final definition for the LOAD symbol consisting of all configuration
                    411: #  names and a dependency of "all" on this symbol (so that the
                    412: #  "default" rule above will build everything).  The three rules in
                    413: #  each configuration are:
                    414: #
                    415: #  - a *mach from *mach.sys dependency using the SYS_RULE_* rules,
                    416: #  - a *mach.swap from LDDEPS, swap*.o, and LDDEPS dependency that
                    417: #    simply copies the swap file to the target name, and
                    418: #  - a swap*.o from swap*.c and SWAPDEPS dependency using the C_RULE_* rules.
                    419: #
                    420: # 19-Feb-92 (dmitch) - I don't think this is used anymore...
                    421: #
                    422: 
                    423: %LOAD
                    424: 
                    425: #
                    426: #  Mach IPC-based interfaces
                    427: #
                    428: 
                    429: #  The Mig-generated files go into subdirectories.
                    430: #  These macros create the subdirectories as they are needed.
                    431: 
                    432: MAKE_MACH = [ -d mach ] || $(MKDIRS) mach
                    433: MAKE_DEVICE = [ -d device ] || $(MKDIRS) device
                    434: MAKE_KERN = [ -d kern ] || $(MKDIRS) kern
                    435: MAKE_MACH_DEBUG = [ -d mach_debug ] || $(MKDIRS) mach_debug
                    436: MAKE_KERNSERV = [ -d kernserv ] || $(MKDIRS) kernserv
                    437: MAKE_DEVSERV = [ -d driverkit ] || $(MKDIRS) driverkit
                    438: SET_SOURCE_DIR = CWD=`pwd`; cd $(SOURCE_DIR); SOURCE_DIR=`pwd`; cd $$CWD
                    439: SET_REL_SOURCE= REL_SOURCE_DIR=`relpath -d $$CWD/../.. . $$SOURCE_DIR`
                    440: 
                    441: #  Rules to create machine-dependent machine and mach/machine symlinks
                    442: 
                    443: MIGFLAGS =  -I. -I.. -I$$REL_SOURCE_DIR -DKERNEL
                    444: MIGKSFLAGS = $(MIGFLAGS) -DKERNEL_SERVER
                    445: MIGKUFLAGS = $(MIGFLAGS) -DKERNEL_USER
                    446: 
                    447: MIG = mig
                    448: 
                    449: MACHDIR = mach
                    450: KERNDIR = kern
                    451: MACHDEBUGDIR = mach_debug
                    452: KERNSERVDIR = kernserv
                    453: DEVSERVDIR = driverkit
                    454: 
                    455: 
                    456: MIGDIRS = $(MACHDIR) $(KERNSERVDIR) $(MACHDIR)/machine
                    457: 
                    458: MACH_FFILES =  $(MACHDIR)/port_allocate.c              \
                    459:                $(MACHDIR)/port_deallocate.c            \
                    460:                $(MACHDIR)/port_set_add.c               \
                    461:                $(MACHDIR)/port_set_remove.c            \
                    462:                $(MACHDIR)/port_set_allocate.c          \
                    463:                $(MACHDIR)/port_set_backlog.c           \
                    464:                $(MACHDIR)/port_status.c                \
                    465:                $(MACHDIR)/vm_allocate.c                \
                    466:                $(MACHDIR)/vm_deallocate.c              \
                    467:                $(MACHDIR)/port_set_deallocate.c        \
                    468:                $(MACHDIR)/task_set_special_port.c      \
                    469:                $(MACHDIR)/task_get_special_port.c      \
                    470:                $(MACHDIR)/thread_abort.c               \
                    471:                $(MACHDIR)/thread_get_special_port.c    \
                    472:                $(MACHDIR)/thread_set_special_port.c    \
                    473:                $(MACHDIR)/thread_suspend.c             \
                    474:                $(MACHDIR)/vm_read.c                    \
                    475:                $(MACHDIR)/vm_write.c                   \
                    476:                $(MACHDIR)/vm_protect.c
                    477: 
                    478: MACH_OFILES =  port_allocate.o                 \
                    479:                port_deallocate.o               \
                    480:                port_set_add.o                  \
                    481:                port_set_remove.o               \
                    482:                port_set_allocate.o             \
                    483:                port_set_backlog.o              \
                    484:                port_status.o                   \
                    485:                vm_allocate.o                   \
                    486:                vm_deallocate.o                 \
                    487:                port_set_deallocate.o           \
                    488:                task_set_special_port.o         \
                    489:                task_get_special_port.o         \
                    490:                thread_abort.o                  \
                    491:                thread_get_special_port.o       \
                    492:                thread_set_special_port.o       \
                    493:                thread_suspend.o                \
                    494:                vm_read.o                       \
                    495:                vm_write.o                      \
                    496:                vm_protect.o
                    497: 
                    498: MACH_HFILE = $(MACHDIR)/mach_interface.h
                    499: MACH_HKLOADERFILE = $(MACHDIR)/mach_kernloader.h
                    500: MACH_INTERNAL = $(MACHDIR)/mach_user_internal.h
                    501: MACH_FILES = $(MACH_HFILE) $(MACH_INTERNAL)                            \
                    502:        $(MACHDIR)/mach_server.c $(MACH_FFILES)
                    503: 
                    504: $(MACH_FILES): $(SOURCE_DIR)/$(MACHDIR)/mach.defs                      \
                    505:                $(SOURCE_DIR)/$(MACHDIR)/mach_types.defs                \
                    506:                $(SOURCE_DIR)/$(MACHDIR)/std_types.defs
                    507:        -$(MAKE_MACH)
                    508:        $(SET_SOURCE_DIR); cd $(MACHDIR); $(SET_REL_SOURCE);            \
                    509:        $(MIG) -typed -MD $(MIGKSFLAGS)                         \
                    510:                -header /dev/null                                       \
                    511:                -user /dev/null                                         \
                    512:                -server mach_server.c                                   \
                    513:                $$REL_SOURCE_DIR/$(MACHDIR)/mach.defs;                  \
                    514:        $(MIG) -typed -MD $(MIGFLAGS)                                   \
                    515:                -header mach_kernloader.h                               \
                    516:                -i                                                      \
                    517:                -server /dev/null                                       \
                    518:                $$REL_SOURCE_DIR/$(MACHDIR)/mach.defs
                    519:        $(SET_SOURCE_DIR); cd $(MACHDIR); $(SET_REL_SOURCE);            \
                    520:        $(MIG) -typed -MD $(MIGKSFLAGS)                         \
                    521:                -header /dev/null                                       \
                    522:                -user /dev/null                                         \
                    523:                -server mach_server.c                                   \
                    524:                $$REL_SOURCE_DIR/$(MACHDIR)/mach.defs;                  \
                    525:        $(MIG) -MD $(MIGFLAGS)                                          \
                    526:                -header mach_interface.h                                \
                    527:                -i                                                      \
                    528:                -server /dev/null                                       \
                    529:                $$REL_SOURCE_DIR/$(MACHDIR)/mach.defs
                    530:        -egrep 'Routine ' < $(MACH_HFILE)                               \
                    531:        | sed -e 's/.*Routine \([a-z_]*\).*/#define \1 \1_EXTERNAL/'    \
                    532:        > $(MACH_INTERNAL)
                    533: 
                    534: MEMORY_OBJECT_HFILE = $(MACHDIR)/memory_object_user.h
                    535: MEMORY_OBJECT_FILES = $(MEMORY_OBJECT_HFILE)                           \
                    536:        $(MACHDIR)/memory_object_user.c $(MACHDIR)/memory_object_server.c
                    537: 
                    538: $(MEMORY_OBJECT_FILES): $(SOURCE_DIR)/$(MACHDIR)/memory_object.defs
                    539:        -$(MAKE_MACH)
                    540:        $(SET_SOURCE_DIR); cd $(MACHDIR); $(SET_REL_SOURCE);            \
                    541:        $(MIG) -typed -MD $(MIGKUFLAGS) -DSEQNOS                        \
                    542:                -header memory_object_user.h                            \
                    543:                -user memory_object_user.c                              \
                    544:                -server /dev/null                                       \
                    545:                $$REL_SOURCE_DIR/$(MACHDIR)/memory_object.defs
                    546: 
                    547: MEMORY_OBJECT_DEFAULT_HFILE = $(MACHDIR)/memory_object_default.h
                    548: MEMORY_OBJECT_DEFAULT_FILES = $(MEMORY_OBJECT_DEFAULT_HFILE)           \
                    549:        $(MACHDIR)/memory_object_default_user.c                         \
                    550:        $(MACHDIR)/memory_object_default_server.c
                    551: 
                    552: $(MEMORY_OBJECT_DEFAULT_FILES): \
                    553:                $(SOURCE_DIR)/$(MACHDIR)/memory_object_default.defs
                    554:        -$(MAKE_MACH)
                    555:        $(SET_SOURCE_DIR); cd $(MACHDIR); $(SET_REL_SOURCE);            \
                    556:        $(MIG) -typed -MD $(MIGKUFLAGS) -DSEQNOS                        \
                    557:                -header memory_object_default.h                         \
                    558:                -user memory_object_default_user.c                      \
                    559:                -server /dev/null                                       \
                    560:                $$REL_SOURCE_DIR/$(MACHDIR)/memory_object_default.defs
                    561: 
                    562: EXC_HFILE = $(MACHDIR)/exc.h
                    563: EXC_FILES = $(EXC_HFILE) $(MACHDIR)/exc_server.c
                    564: 
                    565: $(EXC_FILES): $(SOURCE_DIR)/$(MACHDIR)/exc.defs                                \
                    566:                $(SOURCE_DIR)/$(MACHDIR)/mach_types.defs                \
                    567:                $(SOURCE_DIR)/$(MACHDIR)/std_types.defs
                    568:        -$(MAKE_MACH)
                    569:        $(SET_SOURCE_DIR); cd $(MACHDIR); $(SET_REL_SOURCE);            \
                    570:        $(MIG) -MD $(MIGFLAGS) -header exc.h                            \
                    571:                -user /dev/null                                         \
                    572:                -server exc_server.c                                    \
                    573:                $$REL_SOURCE_DIR/$(MACHDIR)/exc.defs
                    574: 
                    575: MACH_HOST_HFILE = $(MACHDIR)/mach_host.h
                    576: MACH_HOST_FILES = $(MACH_HOST_HFILE) $(MACHDIR)/mach_host_server.c
                    577: 
                    578: $(MACH_HOST_FILES): $(SOURCE_DIR)/$(MACHDIR)/mach_host.defs            \
                    579:                $(SOURCE_DIR)/$(MACHDIR)/mach_types.defs                \
                    580:                $(SOURCE_DIR)/$(MACHDIR)/std_types.defs
                    581:        -$(MAKE_MACH)
                    582:        $(SET_SOURCE_DIR); cd $(MACHDIR); $(SET_REL_SOURCE);            \
                    583:        $(MIG) -typed -MD $(MIGKSFLAGS)                         \
                    584:                -header /dev/null                                       \
                    585:                -user /dev/null                                         \
                    586:                -server mach_host_server.c                              \
                    587:                $$REL_SOURCE_DIR/$(MACHDIR)/mach_host.defs;             \
                    588:        $(MIG) -MD $(MIGFLAGS)                                          \
                    589:                -header mach_host.h                                     \
                    590:                -user /dev/null                                         \
                    591:                -server /dev/null                                       \
                    592:                $$REL_SOURCE_DIR/$(MACHDIR)/mach_host.defs
                    593: 
                    594: MACH_PORT_FILES = $(MACHDIR)/mach_port_server.c
                    595: 
                    596: $(MACH_PORT_FILES): $(SOURCE_DIR)/$(MACHDIR)/mach_port.defs            \
                    597:                $(SOURCE_DIR)/$(MACHDIR)/mach_types.defs                \
                    598:                $(SOURCE_DIR)/$(MACHDIR)/std_types.defs
                    599:        -$(MAKE_MACH)
                    600:        $(SET_SOURCE_DIR); cd $(MACHDIR); $(SET_REL_SOURCE);            \
                    601:        $(MIG) -untyped -MD $(MIGKSFLAGS)                               \
                    602:                -header /dev/null                                       \
                    603:                -user /dev/null                                         \
                    604:                -server mach_port_server.c                              \
                    605:                $$REL_SOURCE_DIR/$(MACHDIR)/mach_port.defs
                    606: 
                    607: MACH_DEBUG_HFILE = $(MACHDEBUGDIR)/mach_debug.h
                    608: MACH_DEBUG_FILES = $(MACH_DEBUG_HFILE) $(MACHDEBUGDIR)/mach_debug_server.c
                    609: 
                    610: $(MACH_DEBUG_FILES): $(SOURCE_DIR)/$(MACHDEBUGDIR)/mach_debug.defs     \
                    611:                $(SOURCE_DIR)/$(MACHDIR)/mach_types.defs                \
                    612:                $(SOURCE_DIR)/$(MACHDIR)/std_types.defs
                    613:        -$(MAKE_MACH_DEBUG)
                    614:        $(SET_SOURCE_DIR); cd $(MACHDEBUGDIR); $(SET_REL_SOURCE);       \
                    615:        $(MIG) -untyped -MD $(MIGKSFLAGS)                               \
                    616:                -header mach_debug.h                                    \
                    617:                -user /dev/null                                         \
                    618:                -server mach_debug_server.c                             \
                    619:                $$REL_SOURCE_DIR/$(MACHDEBUGDIR)/mach_debug.defs
                    620: 
                    621: KERNSERV_HFILE = $(KERNSERVDIR)/kern_server.h
                    622: KERNSERV_FILES = $(KERNSERV_HFILE) $(KERNSERVDIR)/kern_server_handler.h \
                    623:        $(KERNSERVDIR)/kern_server_handler.c
                    624: 
                    625: $(KERNSERV_FILES): $(SOURCE_DIR)/$(KERNSERVDIR)/kern_server.defs       \
                    626:                $(SOURCE_DIR)/$(MACHDIR)/mach_types.defs                \
                    627:                $(SOURCE_DIR)/$(MACHDIR)/std_types.defs
                    628:        -$(MAKE_KERNSERV)
                    629:        $(SET_SOURCE_DIR); cd $(KERNSERVDIR); $(SET_REL_SOURCE);        \
                    630:        $(MIG) -MD $(MIGFLAGS)                                          \
                    631:                -header kern_server.h                                   \
                    632:                -sheader kern_server_handler.h                          \
                    633:                -user /dev/null                                         \
                    634:                -handler kern_server_handler.c                          \
                    635:                $$REL_SOURCE_DIR/$(KERNSERVDIR)/kern_server.defs
                    636: 
                    637: KERNSERV_REPLY_HFILE = $(KERNSERVDIR)/kern_server_reply.h
                    638: KERNSERV_REPLY_FILES = $(KERNSERV_REPLY_HFILE)                         \
                    639:                        $(KERNSERVDIR)/kern_server_reply_user.c
                    640: 
                    641: $(KERNSERV_REPLY_FILES):                                               \
                    642:                $(SOURCE_DIR)/$(KERNSERVDIR)/kern_server_reply.defs     \
                    643:                $(SOURCE_DIR)/$(MACHDIR)/mach_types.defs                \
                    644:                $(SOURCE_DIR)/$(MACHDIR)/std_types.defs
                    645:        -$(MAKE_KERNSERV)
                    646:        $(SET_SOURCE_DIR); cd $(KERNSERVDIR); $(SET_REL_SOURCE);        \
                    647:        $(MIG) -MD $(MIGFLAGS)                                          \
                    648:                -header kern_server_reply.h                             \
                    649:                -user kern_server_reply_user.c                          \
                    650:                -server /dev/null                                       \
                    651:                $$REL_SOURCE_DIR/$(KERNSERVDIR)/kern_server_reply.defs
                    652: 
                    653: #
                    654: # Driverkit device server.
                    655: #
                    656: DEVSERV_NAME  = driverServer
                    657: DEVSERV_FILES = $(DEVSERVDIR)/$(DEVSERV_NAME)Server.c
                    658: DEVSERV_DEFS = $(DEVSERV_NAME).defs
                    659: DEVSERV_SRC_DIR = $(NEXT_ROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
                    660: 
                    661: # -- Compatible path --
                    662: #DEVSERV_SRC_DIR = $(NEXT_ROOT)/NextLibrary/Frameworks/System.framework/PrivateHeaders
                    663: 
                    664: $(DEVSERV_FILES): $(DEVSERVDIR)/$(DEVSERV_DEFS)                                \
                    665:                $(SOURCE_DIR)/$(MACHDIR)/mach_types.defs                \
                    666:                $(SOURCE_DIR)/$(MACHDIR)/std_types.defs
                    667:        -$(MAKE_DEVSERV)
                    668:        $(SET_SOURCE_DIR); cd $(DEVSERVDIR); $(SET_REL_SOURCE);         \
                    669:        $(MIG) -typed -MD -arch $(MACHINE) $(MIGKSFLAGS)                \
                    670:                -header /dev/null                                       \
                    671:                -user /dev/null                                         \
                    672:                -server driverServerServer.c                            \
                    673:                $(DEVSERV_DEFS)
                    674: 
                    675: #
                    676: # driverServer.defs file imported from the driverkit project...
                    677: #
                    678: DEVSERV_SOURCE_DIR=$(DEVSERV_SRC_DIR)/driverkit
                    679: 
                    680: $(DEVSERVDIR)/$(DEVSERV_DEFS): $(DEVSERV_SOURCE_DIR)/$(DEVSERV_DEFS)
                    681:        rm -f $@
                    682:        -$(MAKE_DEVSERV)
                    683:        cp -p $(DEVSERV_SOURCE_DIR)/$(DEVSERV_DEFS) $@
                    684: 
                    685: #
                    686: # These files implement the Mach User Level API used by loadable servers
                    687: # and driverkit-based drivers.
                    688: #
                    689: $(MACH_OFILES): $(MACH_FFILES)
                    690:        $(KCC) -c $(CFLAGS) -DMACH_USER_API \
                    691:                -D$*=$*_EXTERNAL $(MACHDIR)/$*.c
                    692: 
                    693: MIG_HFILES_EXP=        $(MACH_HFILE)           \
                    694:                $(MACH_HKLOADERFILE)    \
                    695:                $(MACH_HOST_HFILE)      \
                    696:                $(MACH_INTERNAL)        \
                    697:                $(KERNSERV_HFILE)       \
                    698:                $(KERNSERV_REPLY_HFILE)
                    699: 
                    700: #  Explicit dependencies on generated files,
                    701: #  to ensure that Mig has been run by the time
                    702: #  these files are compiled.
                    703: 
                    704: vm_object.o: $(MACHDIR)/memory_object_user.h                           \
                    705:                $(MACHDIR)/memory_object_default.h
                    706: 
                    707: exception.o: $(MACHDIR)/exc.h
                    708: 
                    709: mig_support.o: $(MACHDIR)/mach_user_internal.h
                    710: 
                    711: kern_server.o: $(MACHDIR)/mach_user_internal.h                         \
                    712:                $(KERNSERVDIR)/kern_server.h                            \
                    713:                $(KERNSERVDIR)/kern_server_reply.h
                    714: 
                    715: #
                    716: #  Clean up the current build directory.
                    717: #
                    718: clean: ${MACHINE_CLEAN}
                    719:        @for f in ${LOAD};                                              \
                    720:        do                                                              \
                    721:                echo rm -f $$f $$f.* && rm -f $$f $$f.*;                \
                    722:        done
                    723:        @for f in $(MIGDIRS) $(MACHDEBUGDIR) kern;                      \
                    724:        do                                                              \
                    725:                echo rm -f $$f/*.[ch]; rm -f $$f/*.[ch];                \
                    726:        done
                    727:        rm -f eddep tags *.o errs linterrs makelinks *.log *LOG*        \
                    728:                Makedep ${CLEAN_EXTRA}
                    729: 
                    730: 
                    731: 
                    732: #
                    733: # Building the tags files
                    734: #
                    735: tags:  tags_link ALWAYS
                    736:        @cd $(SOURCE_DIR);                                              \
                    737:        rm -f /tmp/tag$$$$;                                             \
                    738:        touch /tmp/tag$$$$;                                             \
                    739:        echo Making file list;                                          \
                    740:        for i in ${TAGDIRS} ${MACHINE_TAG_DIRS};                        \
                    741:        do                                                              \
                    742:                ls $$i/*.[cms] >> /tmp/tag$$$$ 2> /dev/null;            \
                    743:        done;                                                           \
                    744:        for i in ${TAGDIRS} ${MACHINE_TAG_DIRS};                        \
                    745:        do                                                              \
                    746:                ls $$i/*.h >> /tmp/tag$$$$ 2> /dev/null;                \
                    747:        done;                                                           \
                    748:        echo Making ctags;                                              \
                    749:        TAGTYPE=`echo -n $(MACHINE) | tr a-z A-Z`;                      \
                    750:        rm -f tags.$$TAGTYPE;                                           \
                    751:        cat /tmp/tag$$$$ | xargs ctags -w -d -t -T > tags.$$TAGTYPE; \
                    752:        echo Making etags;                                              \
                    753:        rm -f TAGS.$$TAGTYPE;                                           \
                    754:        xargs etags -f TAGS.$$TAGTYPE < /tmp/tag$$$$;           \
                    755:        rm -f /tmp/tag$$$$
                    756: 
                    757: #
                    758: # Building a mkid database file
                    759: #
                    760: id:    id_link ALWAYS
                    761:        @cd $(SOURCE_DIR);                                              \
                    762:        rm -f /tmp/id$$$$;                                              \
                    763:        touch /tmp/id$$$$;                                              \
                    764:        echo Making file list;                                          \
                    765:        for i in ${TAGDIRS} ${MACHINE_TAG_DIRS};                        \
                    766:        do                                                              \
                    767:                ls $$i/*.[cms] >> /tmp/id$$$$ 2> /dev/null;             \
                    768:        done;                                                           \
                    769:        for i in ${TAGDIRS} ${MACHINE_TAG_DIRS};                        \
                    770:        do                                                              \
                    771:                ls $$i/*.h >> /tmp/id$$$$ 2> /dev/null;                 \
                    772:        done;                                                           \
                    773:        echo Making id database;                                        \
                    774:        TAGTYPE=`echo -n $(MACHINE) | tr a-z A-Z`;                      \
                    775:        rm -f ID.$$TAGTYPE;                                             \
                    776:        mkid -a/tmp/id$$$$ -S.m=c -fID.$$TAGTYPE;                       \
                    777:        rm -f /tmp/id$$$$
                    778: 
                    779: #
                    780: # This little bit of magic sets "tags" to point to the current
                    781: # architecture.  It also gets invoked whenever you build a kernel,
                    782: # so tags will point to the architecture of the last build.
                    783: #
                    784: tags_link:
                    785:        @cd $(SOURCE_DIR);                                              \
                    786:        TAGTYPE=`echo -n $(MACHINE) | tr a-z A-Z`;                      \
                    787:        rm -f tags TAGS;                                                \
                    788:        echo ln -s tags.$$TAGTYPE tags;                                 \
                    789:        ln -s tags.$$TAGTYPE tags;                                      \
                    790:        echo ln -s TAGS.$$TAGTYPE TAGS;                                 \
                    791:        ln -s TAGS.$$TAGTYPE TAGS
                    792: 
                    793: id_link:
                    794:        @cd $(SOURCE_DIR);                                              \
                    795:        TAGTYPE=`echo -n $(MACHINE) | tr a-z A-Z`;                      \
                    796:        rm -f ID;                                                       \
                    797:        echo ln -s ID.$$TAGTYPE ID;                                     \
                    798:        ln -s ID.$$TAGTYPE ID;
                    799: 
                    800: #
                    801: # Move tags link after build
                    802: #
                    803: all:   tags_link
                    804: 
                    805: 
                    806: #
                    807: # Profiling targets
                    808: #
                    809: gprof: kgmon_on all kgmon_off
                    810: 
                    811: kgmon_on:
                    812:        kgmon -r -b
                    813: 
                    814: kgmon_off:
                    815:        kgmon -h -p
                    816:        gprof /mach >GPROF
                    817: gprof: kgmon_on all kgmon_off
                    818: 
                    819: kgmon_on:
                    820:        kgmon -r -b
                    821: 
                    822: kgmon_off:
                    823:        kgmon -h -p
                    824:        gprof /mach >GPROF
                    825: 
                    826: #
                    827: # Building the "features" file
                    828: #
                    829: features: ${FEATURES}
                    830: 
                    831: ${FEATURES}: ${FEATURES_H} ${FEATURES_EXTRA} ALWAYS
                    832:        rm -f features.temp
                    833:        cc -traditional-cpp -E -dD -P -I. ${FEATURES_H} ${FEATURES_EXTRA} | \
                    834:                sort -u  > features.temp
                    835:        @-if [ -f $@ ];                                                 \
                    836:        then                                                            \
                    837:                echo diff $@ features.temp;                             \
                    838:                diff $@ features.temp;                                  \
                    839:        fi
                    840:        rm -f $@
                    841:        mv -f features.temp $@
                    842: 
                    843: #
                    844: #  Special rules to install include files in release images
                    845: #
                    846: install: DSTROOT install_kernel installhdrs
                    847: 
                    848: install_kernel:        DSTROOT $(KERNEL_NAME) install_md
                    849:        $(MKDIRS) ${DSTROOT}${TFTPDIR}
                    850:        install -c -m 444 $(KERNEL_NAME) ${DSTROOT}/mach_kernel
                    851:        ln ${DSTROOT}/mach_kernel ${DSTROOT}${TFTPDIR}/mach_kernel
                    852: 
                    853: install_md: DSTROOT ${MACHINE_INSTALL}
                    854: 
                    855: installhdrs: DSTROOT install_mi_hdrs install_md_hdrs
                    856: 
                    857: install_mi_hdrs: DSTROOT install_mi_std_hdrs
                    858: 
                    859: #
                    860: # Note the outer for loop of this operation has to be tolerant of non-zero
                    861: # returns because unifdef returns 1 if it makes a change. I don't think this
                    862: # is a problem, but we might want to modify unifdef instead of having the
                    863: # following "-for" expression...
                    864: #
                    865: install_mi_std_hdrs: DSTROOT $(MIG_HFILES_EXP) $(MACH_DEBUG_HFILE)
                    866:        @-for i in ${EXPORT};                                           \
                    867:        do                                                              \
                    868:            EXPDIR=`pwd`/exports;                                       \
                    869:            [ -d $$EXPDIR ] || $(MKDIRS) $$EXPDIR;                              \
                    870:            rm -f $$EXPDIR/*;                                           \
                    871:            (cd $(SOURCE_DIR)/$$i;                                      \
                    872:                hdrs=`echo *.h`;                                        \
                    873:                if [ "$$hdrs" = '*.h' ]; then                           \
                    874:                    echo No header files in $$i;                        \
                    875:                else                                                    \
                    876:                    for j in $$hdrs;                                    \
                    877:                    do                                                  \
                    878:                        DSTDIR=$(DSTROOT)$(INCDIR)/$$i;                 \
                    879:                        [ -d $$DSTDIR ] || $(MKDIRS) $$DSTDIR;          \
                    880:                        echo garbage > $$EXPDIR/$$j.strip;              \
                    881:                        $(UNIFDEF) -UKERNEL_PRIVATE -UDRIVER_PRIVATE    \
                    882:                                $$j > $$EXPDIR/$$j ||                   \
                    883:                                $(DECOMMENT) $$EXPDIR/$$j  r >          \
                    884:                                $$EXPDIR/$$j.strip;                     \
                    885:                        if [ -s $$EXPDIR/$$j.strip ];                   \
                    886:                        then (                                          \
                    887:                            cd $$EXPDIR;                                \
                    888:                            install $(INSTALL_FLAGS) $$j $$DSTDIR;      \
                    889:                        );                                              \
                    890:                        else                                            \
                    891:                            echo Header file $$i/$$j not exported;      \
                    892:                        fi;                                             \
                    893:                        rm -f $$EXPDIR/$$j.strip;                       \
                    894:                    done;                                               \
                    895:                fi;                                                     \
                    896:            );                                                          \
                    897:        done
                    898:        for i in ${EXPORT_LIB};                                         \
                    899:        do                                                              \
                    900:                $(MKDIRS) ${DSTROOT}${INCDIR}/bsd/$$i;  \
                    901:                (cd $(SOURCE_DIR)/bsd/include/$$i;                                      \
                    902:                install $(INSTALL_FLAGS) *.h ${DSTROOT}${INCDIR}/bsd/$$i;);     \
                    903:        done
                    904:        for i in ${MIGDIRS};                                            \
                    905:        do                                                              \
                    906:                $(MKDIRS) ${DSTROOT}${INCDIR}/$$i;                              \
                    907:                (cd $(SOURCE_DIR)/$$i;                                  \
                    908:                install $(INSTALL_FLAGS) *.defs ${DSTROOT}${INCDIR}/$$i;); \
                    909:        done
                    910:        for i in ${MIG_HFILES_EXP};                                     \
                    911:        do                                                              \
                    912:            install $(INSTALL_FLAGS) $$i ${DSTROOT}${INCDIR}/$$i;       \
                    913:        done
                    914:        :
                    915:        : mach_debug is a special case
                    916:        :
                    917:        $(MKDIRS) ${DSTROOT}${LCLDIR}/${MACHDEBUGDIR}
                    918:        install $(INSTALL_FLAGS) ${MACH_DEBUG_HFILE}                    \
                    919:                                ${DSTROOT}${LCLDIR}/${MACHDEBUGDIR}
                    920:        install $(INSTALL_FLAGS)                                                \
                    921:                        $(SOURCE_DIR)/${MACHDEBUGDIR}/mach_debug.defs   \
                    922:                                ${DSTROOT}${LCLDIR}/${MACHDEBUGDIR}
                    923:        install $(INSTALL_FLAGS)                                                \
                    924:                $(SOURCE_DIR)/${MACHDEBUGDIR}/mach_debug_types.defs     \
                    925:                                ${DSTROOT}${LCLDIR}/${MACHDEBUGDIR}
                    926:        :
                    927:        : Install all headers into local include directory.
                    928:        :
                    929:        @cd ${SOURCE_DIR};                                              \
                    930:        for i in ${LCLEXPORT};                                          \
                    931:        do                                                              \
                    932:            (cd $$i;                                                    \
                    933:            $(MKDIRS) ${DSTROOT}${LCLDIR}/$$i;                          \
                    934:            install $(INSTALL_FLAGS) *.h ${DSTROOT}${LCLDIR}/$$i;);     \
                    935:        done
                    936: 
                    937: install_mi_compat_hdrs: DSTROOT ${SOURCE_DIR}/conf/compat_hdrs
                    938:        @rm -rf compat
                    939:        @for i in `cat ${SOURCE_DIR}/conf/compat_hdrs                   \
                    940:                   | awk '{print $$2}' | sort | uniq`;                  \
                    941:        do                                                              \
                    942:                $(MKDIRS) ${DSTROOT}/${COMPATDIR}/$$i;                  \
                    943:                $(MKDIRS) compat/$$i;                                   \
                    944:        done
                    945:        : creating compatability header files
                    946:        @awk -f ${SOURCE_DIR}/conf/compat_hdrs.awk                      \
                    947:                ${SOURCE_DIR}/conf/compat_hdrs
                    948:        : installing compatability header files
                    949:        @cd compat; for i in *;                                         \
                    950:        do                                                              \
                    951:                (cd $$i;install -c -m 444 *                     \
                    952:                        ${DSTROOT}${COMPATDIR}/$$i);                    \
                    953:        done
                    954: 
                    955: #
                    956: # Install machine-dependent headers only.
                    957: #
                    958: install_md_hdrs: DSTROOT install_md_std_hdrs \
                    959:        $(MACHINE_INSTALLHDRS)
                    960: 
                    961: install_md_std_hdrs: DSTROOT
                    962:        @-for i in `echo ${MACHINE_EXPORT}`;                            \
                    963:        do                                                              \
                    964:            EXPDIR=`pwd`/exports;                                       \
                    965:            [ -d $$EXPDIR ] || $(MKDIRS) $$EXPDIR;                              \
                    966:            rm -f $$EXPDIR/*;                                           \
                    967:            (cd $(SOURCE_DIR)/$$i;                                      \
                    968:                hdrs=`echo *.h`;                                        \
                    969:                if [ "$$hdrs" = '*.h' ]; then                           \
                    970:                    echo No header files in $$i;                        \
                    971:                else                                                    \
                    972:                    for j in $$hdrs;                                    \
                    973:                    do                                                  \
                    974:                        DSTDIR=$(DSTROOT)$(INCDIR)/$$i;                 \
                    975:                        [ -d $$DSTDIR ] || $(MKDIRS) $$DSTDIR;          \
                    976:                        echo garbage > $$EXPDIR/$$j.strip;              \
                    977:                        $(UNIFDEF) -UKERNEL_PRIVATE -UDRIVER_PRIVATE $$j > $$EXPDIR/$$j || \
                    978:                        $(DECOMMENT) $$EXPDIR/$$j  r > $$EXPDIR/$$j.strip; \
                    979:                        if [ -s $$EXPDIR/$$j.strip ];                   \
                    980:                        then (                                          \
                    981:                            cd $$EXPDIR;                                \
                    982:                            install $(INSTALL_FLAGS) $$j $$DSTDIR;      \
                    983:                        );                                              \
                    984:                        else                                            \
                    985:                            echo Header file $$i/$$j not exported;      \
                    986:                        fi;                                             \
                    987:                        rm -f $$EXPDIR/$$j.strip;                       \
                    988:                    done;                                               \
                    989:                fi;                                                     \
                    990:            );                                                          \
                    991:        done
                    992:        for i in ${MACHINE_MIGDIRS};                                    \
                    993:        do                                                              \
                    994:                $(MKDIRS) ${DSTROOT}${INCDIR}/$$i;                              \
                    995:                (cd $(SOURCE_DIR)/$$i;                                  \
                    996:                install $(INSTALL_FLAGS) *.defs ${DSTROOT}${INCDIR}/$$i;); \
                    997:        done
                    998:        -cd ${SOURCE_DIR};                                              \
                    999:        for i in `echo ${MACHINE_LCLEXPORT}`;                           \
                   1000:        do                                                              \
                   1001:            (cd $$i;                                                    \
                   1002:            $(MKDIRS) ${DSTROOT}${LCLDIR}/$$i;                          \
                   1003:            install $(INSTALL_FLAGS) *.h ${DSTROOT}${LCLDIR}/$$i;);     \
                   1004:        done
                   1005: 
                   1006: install_md_compat_hdrs: DSTROOT ${MACHINE_COMPATHDRS}
                   1007:        @if [ "${MACHINE_COMPATHDRS}" ];                                \
                   1008:        then                                                            \
                   1009:                rm -rf compat;                                          \
                   1010:                for i in `cat ${MACHINE_COMPATHDRS}                     \
                   1011:                           | awk '{print $$2}' | sort | uniq`;          \
                   1012:                do                                                      \
                   1013:                        $(MKDIRS) ${DSTROOT}/${COMPATDIR}/$$i;          \
                   1014:                        $(MKDIRS) compat/$$i;                           \
                   1015:                done;                                                   \
                   1016:                awk -f ${SOURCE_DIR}/conf/compat_hdrs.awk               \
                   1017:                        ${MACHINE_COMPATHDRS};                          \
                   1018:                (                                                       \
                   1019:                        cd compat; for i in *;                          \
                   1020:                        do                                              \
                   1021:                                (                                       \
                   1022:                                        cd $$i;                         \
                   1023:                                        install -c -m 444 *     \
                   1024:                                          ${DSTROOT}${COMPATDIR}/$$i;   \
                   1025:                                );                                      \
                   1026:                        done;                                           \
                   1027:                );                                                      \
                   1028:        fi
                   1029:        : installing "conversion compat" files if they exist
                   1030:        @if [ -d ${SOURCE_DIR}/compat/${MACHINE} ];                     \
                   1031:        then                                                            \
                   1032:                cd ${SOURCE_DIR}/compat/${MACHINE};                     \
                   1033:                for i in *;                                             \
                   1034:                do                                                      \
                   1035:                        if [ -d $$i ];                                  \
                   1036:                        then                                            \
                   1037:                                (cd $$i; install -c -m 444 *      \
                   1038:                                        ${DSTROOT}${COMPATDIR}/$$i);    \
                   1039:                        fi;                                             \
                   1040:                done;                                                   \
                   1041:        fi
                   1042: 
                   1043: 
                   1044: #
                   1045: #  Update the Makefile when any dependency files exist rather than only
                   1046: #  when they are newer than the makefile (since it often gets touched
                   1047: #  during reconfigurations when dependency files have yet to be
                   1048: #  integrated).  The makefile is copied before doing any potential
                   1049: #  integration so that the new and old versions can be compared when
                   1050: #  done (by the SYS_RULE_* rules) to prevent re-building things when no
                   1051: #  dependencies change.
                   1052: #
                   1053: #  N.B.  There is always an empty artificial dependency file M.d
                   1054: #  (created by config) which will never be integrated and simply
                   1055: #  prevents the wild-card expansion below from failing.
                   1056: #
                   1057: #  This seems redundant if we're always going to do it on exit.
                   1058: #
                   1059: #Makefile: *.${MD_SUFFIX}
                   1060: #      ${EXIT_RULE}
                   1061: #
                   1062: .EXIT:
                   1063:        ${EXIT_RULE}
                   1064: 
                   1065: #
                   1066: #  Rules for components which are not part of the kernel proper or that
                   1067: #  need to be built in a special manner.
                   1068: #  These need to build without profiling, as it confuses awk script.
                   1069: #
                   1070: genassym.o: $(MACHINEDIR)/genassym.c
                   1071:        ${KCC} -c $(CCONFIGFLAGS) $(CPP_FLAGS) $(MACHINE_CFLAGS) \
                   1072:                ${VOLATILE} ${MACHINE_GENASSYM_FLAGS} \
                   1073:                $(MACHINEDIR)/genassym.c 
                   1074: 
                   1075: genassym.s: $(MACHINEDIR)/genassym.c
                   1076:        ${KCC} -S $(CCONFIGFLAGS) $(CPP_FLAGS) $(MACHINE_CFLAGS) \
                   1077:                ${VOLATILE} ${MACHINE_GENASSYM_FLAGS} -arch ${MACHINE} \
                   1078:                $(MACHINEDIR)/genassym.c
                   1079: 
                   1080: assym.h: genassym.s
                   1081:        @rm -f assym.h
                   1082:        awk -f $(MACHINEDIR)/genassym.awk < genassym.s > assym.h
                   1083: 
                   1084: ioconf.o: ioconf.c
                   1085:        ${C_RULE_1A}${C_RULE_1B}
                   1086:        ${C_RULE_2}
                   1087:        ${C_RULE_3}
                   1088:        ${C_RULE_4}
                   1089: 
                   1090: #
                   1091: # This rule insures that the subr_prof.c does NOT get compiled with 
                   1092: # profiling. It implements mcount() and profiling it leads to recursion.
                   1093: #
                   1094: 
                   1095: subr_prof.o: $(SOURCE_DIR)/bsd/kern/subr_prof.c
                   1096:        $(KCC) -c $(CCONFIGFLAGS) $(CPP_FLAGS) $(MACHINE_CFLAGS) \
                   1097:                $(SOURCE_DIR)/bsd/kern/subr_prof.c
                   1098: 
                   1099: 
                   1100: #
                   1101: #  This macro is replaced by the set of rules which build everything in
                   1102: #  OBJS.  The extra dependencies for each object file are inserted
                   1103: #  following this by md which uses the keys on the sentinel line
                   1104: #  below.
                   1105: #
                   1106: 
                   1107: %RULES
                   1108: 
                   1109: #
                   1110: # Lord only knows what this is for, but config spit's out a reference
                   1111: #
                   1112: includelinks:
                   1113: 
                   1114: DSTROOT:
                   1115:        @if [ -n "${$@}" ]; \
                   1116:        then \
                   1117:                exit 0; \
                   1118:        else \
                   1119:                echo Must define $@; \
                   1120:                exit 1; \
                   1121:        fi
                   1122: 
                   1123: ALWAYS:
                   1124: 
                   1125: -include Makedep

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.