]> git.saurik.com Git - apple/libc.git/blobdiff - Makefile.xbs
Libc-498.tar.gz
[apple/libc.git] / Makefile.xbs
index efbfdac9519429bef525413ad69654da385e6286..b19c831a85baf83172e4b62f9eee78911f0d40e0 100644 (file)
@@ -25,12 +25,13 @@ BSDMAKE = bsdmake -f Makefile
 .MAIN: all
 all: libc.a libc_static.a libc_debug.a libc_profile.a
 install: installhdrs install_libc.a install_libc_static.a \
-        install_libc_profile.a install_libc_debug.a autopatchman maninstall
+        install_libc_profile.a install_libc_debug.a \
+        autopatchman maninstall
 
 .SUFFIXES:
 .SUFFIXES: .o .po .So .do
 .SUFFIXES: .S .s .c .cc .cpp .cxx .m .C
-.SUFFIXES: -fbsd.c -nbsd.c -obsd.c -uuid.c .3-uuid.in .3
+.SUFFIXES: -fbsd.c -nbsd.c -obsd.c -uuid.c
 .SUFFIXES: .f .y .l .defs .h
 .SUFFIXES: User.c User.o User.po User.So User.do
 .SUFFIXES: Server.c Server.o Server.po Server.So Server.do
@@ -40,30 +41,6 @@ DOBJS+= ${OBJS:.o=.do}
 POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po}
 SOBJS+= ${OBJS:.o=.So}
 
-#### 128-bit Long Double libc-ldbl128 for Panther  ####################
-.if (${MACHINE_ARCH} == ppc)
-LIB128= ${LIB}-ldbl128
-LDBL_128_SRCS= _hdtoa.c _ldbl_util.c _ldtoa.c asprintf.c err.c fprintf.c \
-       fscanf.c fwprintf.c fwscanf.c gdtoa-strtopdd.c machdep_ldisdd.c \
-       printf.c scanf.c snprintf.c sprintf.c sscanf.c swprintf.c swscanf.c \
-       vasprintf.c vfprintf.c vfscanf.c vfwprintf.c vfwscanf.c vprintf.c \
-       vscanf.c vsnprintf.c vsprintf.c vsscanf.c vswprintf.c vswscanf.c \
-       vwprintf.c vwscanf.c wcstold.c wprintf.c wscanf.c \
-       oldldbl64.s oldsyslog.c LDBL/oldsyslog-LDBL.c \
-       LDBL/err-LDBL.c LDBL/vfprintf-LDBL.c LDBL/vfwprintf-LDBL.c
-LDBL_128_OBJS= ${LDBL_128_SRCS:R:S/$/.o/g}
-LDBL_128_DOBJS= ${LDBL_128_OBJS:.o=.do}
-LDBL_128_POBJS= ${LDBL_128_OBJS:.o=.po}
-LDBL_128_SOBJS= ${LDBL_128_OBJS:.o=.So}
-
-LDBLSRCS2+= oldsyslog.c
-SRCS2+= oldldbl64.s oldsyslog.c
-OBJS2+=  ${SRCS2:N*.h:R:S/$/.o/g}
-DOBJS2+= ${OBJS2:.o=.do}
-POBJS2+= ${OBJS2:.o=.po}
-SOBJS2+= ${OBJS2:.o=.So}
-.endif
-
 #### Variant Rules ####################################################
 # The following magic is used for variants to avoid the exponental explosion
 # of suffix rules.  To add a variant, select a name (typically all-caps).
@@ -80,20 +57,23 @@ SOBJS2+= ${OBJS2:.o=.So}
 # specify sources that will build with both the CFLAGS_XXX and CFLAGS_YYY
 # flags set.  The variants are always in alphabetic order.
 #
-VARIANTS=
+VARIANTS= DARWINEXTSN INODE32 CANCELABLE PRE1050
 # Append the 64-bit long double sources (ppc only)
 .if (${MACHINE_ARCH} == ppc)
 VARIANTS+= LDBL
 MDSRCS += ldbl64.s
 .endif
-# build UNIX03 variant except on LP64
+# build LEGACY variant except on LP64
 .ifndef LP64
-VARIANTS+= UNIX03
+VARIANTS+= LEGACY
 .endif
-CFLAGS+= ${VARIANTCFLAGS}
 
-CFLAGS_UNIX03= -U__DARWIN_UNIX03 -D__DARWIN_UNIX03=1
+CFLAGS_LEGACY= -U__DARWIN_UNIX03 -D__DARWIN_UNIX03=0 -U__DARWIN_64_BIT_INO_T -D__DARWIN_64_BIT_INO_T=0 -DVARIANT_LEGACY
 CFLAGS_LDBL= -mlong-double-64 -DLDBL_COMPAT
+CFLAGS_DARWINEXTSN= -DVARIANT_DARWINEXTSN
+CFLAGS_INODE32= -U__DARWIN_64_BIT_INO_T -D__DARWIN_64_BIT_INO_T=0 -DVARIANT_INODE32
+CFLAGS_CANCELABLE= -DVARIANT_CANCELABLE
+CFLAGS_PRE1050= -U__DARWIN_VERS_1050 -D__DARWIN_VERS_1050=0 -DVARIANT_PRE1050
 
 .for _v in ${VARIANTS}
 COMBOARGS+= ${_v}/${CFLAGS_${_v}}
@@ -153,101 +133,170 @@ VARIANTDOBJS+= ${VARIANTOBJS:.o=.do}
 VARIANTPOBJS+= ${VARIANTOBJS:.o=.po}
 VARIANTSOBJS+= ${VARIANTOBJS:.o=.So}
 #### FreeBSD Rules ##################################################
-FBSDFLAGS= -I${.CURDIR}/fbsdcompat -include _fbsd_compat_.h
+PREFBSDFLAGS= -I${.CURDIR}/fbsdcompat
+FBSDFLAGS= -include _fbsd_compat_.h
 
 -fbsd.c.o:
-       ${CC} -static ${FBSDFLAGS} ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} -static \
+           ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \
            -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
 -fbsd.c.po:
-       ${CC} -pg -DPROFILE ${FBSDFLAGS} ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} -pg -DPROFILE \
+           ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \
            -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
 -fbsd.c.So: 
-       ${CC} ${FBSDFLAGS} ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} \
+           ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \
            -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
 -fbsd.c.do:
-       ${CC} -g -DDEBUG ${FBSDFLAGS} ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} -g -DDEBUG \
+           ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \
            -c ${.IMPSRC} -o ${.TARGET}
 
 #### NetBSD Rules ##################################################
-NBSDFLAGS= -I${.CURDIR}/nbsdcompat -include _nbsd_compat_.h
+PRENBSDFLAGS= -I${.CURDIR}/nbsdcompat
+NBSDFLAGS= -include _nbsd_compat_.h
 
 -nbsd.c.o:
-       ${CC} -static ${NBSDFLAGS} ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} -static \
+           ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \
            -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
 -nbsd.c.po:
-       ${CC} -pg -DPROFILE ${NBSDFLAGS} ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} -pg -DPROFILE \
+           ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \
            -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
 -nbsd.c.So: 
-       ${CC} ${NBSDFLAGS} ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} \
+           ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \
            -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
 -nbsd.c.do:
-       ${CC} -g -DDEBUG ${NBSDFLAGS} ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} -g -DDEBUG \
+           ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \
            -c ${.IMPSRC} -o ${.TARGET}
 
 #### OpenBSD Rules ##################################################
+PREOBSDFLAGS=
 OBSDFLAGS=
 
 -obsd.c.o:
-       ${CC} -static ${OBSDFLAGS} ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} -static \
+           ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \
            -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
 -obsd.c.po:
-       ${CC} -pg -DPROFILE ${OBSDFLAGS} ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} -pg -DPROFILE \
+           ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \
            -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
 -obsd.c.So: 
-       ${CC} ${OBSDFLAGS} ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} \
+           ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \
            -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
 -obsd.c.do:
-       ${CC} -g -DDEBUG ${OBSDFLAGS} ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} -g -DDEBUG \
+           ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \
            -c ${.IMPSRC} -o ${.TARGET}
 
 #### UUID Rules ######################################################
-UUIDFLAGS= -I${.CURDIR}/uuid -include uuid-config.h
+PREUUIDFLAGS= -I${.CURDIR}/uuid
+UUIDFLAGS= -include uuid-config.h
 
 -uuid.c.o:
-       ${CC} -static ${UUIDFLAGS} ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} -static \
+           ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \
            -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
 -uuid.c.po:
-       ${CC} -pg -DPROFILE ${UUIDFLAGS} ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} -pg -DPROFILE \
+           ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \
            -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
 -uuid.c.So: 
-       ${CC} ${UUIDFLAGS} ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} \
+           ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \
            -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
 -uuid.c.do:
-       ${CC} -g -DDEBUG ${UUIDFLAGS} ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} -g -DDEBUG \
+           ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \
            -c ${.IMPSRC} -o ${.TARGET}
-.3-uuid.in.3:
-       sed -f ${.CURDIR}/uuid/uuidman.sed ${.IMPSRC} > ${.TARGET}
 
 #### Standard C Rules #################################################
+# If you change any of these standard rule, make corresponding changes
+# to the _STANDARD_* macros in Makefile.inc
+#######################################################################
 .c.o User.cUser.o Server.cServer.o:
-       ${CC} -static ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} -static \
+           ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${LIBCFLAGS} \
            -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
 .c.po User.cUser.po Server.cServer.po:
-       ${CC} -pg -DPROFILE ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} -pg -DPROFILE \
+           ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${LIBCFLAGS} \
            -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
 .c.So User.cUser.So Server.cServer.So: 
-       ${CC} ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} \
+           ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${LIBCFLAGS} \
            -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
 .c.do User.cUser.do Server.cServer.do:
-       ${CC} -g -DDEBUG ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+       ${CC} -g -DDEBUG \
+           ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
+           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
+           ${VARIANTCFLAGS} ${LIBCFLAGS} \
            -c ${.IMPSRC} -o ${.TARGET}
 
 #### Standard Assembler Rules #########################################
-.s.o:
-       ${CC} -static -x assembler-with-cpp ${CFLAGS:M-[BIDF]*} \
-           ${CFLAGS-${.IMPSRC:T}:M-[BIDF]*} ${AINC} \
+.s.o .S.o:
+       ${CC} -static -x assembler-with-cpp \
+           ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \
+           ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \
            -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
-.s.po:
-       ${CC} -pg -DPROFILE -x assembler-with-cpp ${CFLAGS:M-[BIDF]*} \
-           ${CFLAGS-${.IMPSRC:T}:M-[BIDF]*} ${AINC} \
+.s.po .S.po:
+       ${CC} -pg -x assembler-with-cpp -DPROFILE \
+           ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \
+           ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \
            -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
-.s.So:
-       ${CC} -x assembler-with-cpp ${CFLAGS:M-[BIDF]*} \
-           ${CFLAGS-${.IMPSRC:T}:M-[BIDF]*} ${AINC} \
+.s.So .S.So:
+       ${CC} -x assembler-with-cpp \
+           ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \
+           ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \
            -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
-.s.do:
-       ${CC} -g -DDEBUG -x assembler-with-cpp ${CFLAGS:M-[BIDF]*} \
-           ${CFLAGS-${.IMPSRC:T}:M-[BIDF]*} ${AINC} \
+.s.do .S.do:
+       ${CC} -g -x assembler-with-cpp -DDEBUG \
+           ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \
+           ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \
            -c ${.IMPSRC} -o ${.TARGET}
 
 #### mig Rules ########################################################
@@ -269,33 +318,18 @@ lib${LIB}_profile.a:: ${VARIANTCOMBOS:S/$/_P/g} ${POBJS} ${POBJS2}
        @rm -f lib${LIB}_profile.a
        @${AR} cq lib${LIB}_profile.a `lorder ${POBJS} ${VARIANTPOBJS} | tsort -q` ${ARADD}
        ${RANLIB} lib${LIB}_profile.a
-.if (${MACHINE_ARCH} == ppc)
-       @${ECHO} building profiled ${LIB128} library
-       @rm -f lib${LIB128}_profile.a
-       @${AR} cq lib${LIB128}_profile.a ${LDBL_128_POBJS}
-.endif
 
 lib${LIB}_debug.a:: ${VARIANTCOMBOS:S/$/_D/g} ${DOBJS} ${DOBJS2}
        @${ECHO} building debug ${LIB} library
        @rm -f lib${LIB}_debug.a
        @${AR} cq lib${LIB}_debug.a `lorder ${DOBJS} ${VARIANTDOBJS} | tsort -q` ${ARADD}
        ${RANLIB} lib${LIB}_debug.a
-.if (${MACHINE_ARCH} == ppc)
-       @${ECHO} building debug ${LIB128} library
-       @rm -f lib${LIB128}_debug.a
-       @${AR} cq lib${LIB128}_debug.a ${LDBL_128_DOBJS}
-.endif
 
 lib${LIB}.a:: ${VARIANTCOMBOS:S/$/_S/g} ${SOBJS} ${SOBJS2}
        @${ECHO} building standard ${LIB} library
        @rm -f lib${LIB}.a
        @${AR} cq lib${LIB}.a `lorder ${SOBJS} ${VARIANTSOBJS} | tsort -q` ${ARADD}
        ${RANLIB} lib${LIB}.a
-.if (${MACHINE_ARCH} == ppc)
-       @${ECHO} building standard ${LIB128} library
-       @rm -f lib${LIB128}.a
-       @${AR} cq lib${LIB128}.a ${LDBL_128_SOBJS}
-.endif
 
 CLEANFILES += ${DOBJS} libc_static.a libc_profile.a libc_debug.a
 
@@ -305,79 +339,73 @@ SYSTEMFRAMEWORK = ${DESTDIR}/System/Library/Frameworks/System.framework
 PRIVHDRS = ${SYSTEMFRAMEWORK}/Versions/B/PrivateHeaders
 KERNELFRAMEWORK = ${DESTDIR}/System/Library/Frameworks/Kernel.framework
 PRIVKERNELHDRS = ${KERNELFRAMEWORK}/Versions/A/PrivateHeaders
+INSTALLMODE != test `id -u` -eq 0 && echo 444 || echo 644
 
 installhdrs-md: gen_md_mig_defs
-       mkdir -p ${INCDIR}/mach/${MACHINE_ARCH}
-       ${INSTALL} -c -m 444 ${MD_MIGHDRS} ${INCDIR}/mach/${MACHINE_ARCH}
 
-installhdrs: autopatchhdrs gen_mig_defs
+installhdrs: gen_mig_defs
        mkdir -p ${INCDIR}/arpa
        mkdir -p ${INCDIR}/libkern
-       mkdir -p ${INCDIR}/mach
        mkdir -p ${INCDIR}/machine
        mkdir -p ${INCDIR}/malloc
        mkdir -p ${INCDIR}/objc
        mkdir -p ${INCDIR}/protocols
-       mkdir -p ${INCDIR}/servers
+       mkdir -p ${INCDIR}/secure
        mkdir -p ${INCDIR}/sys
        mkdir -p ${INCDIR}/xlocale
-       ${INSTALL} -c -m 444 ${INSTHDRS} ${INCDIR}
-       ${INSTALL} -c -m 444 ${ARPA_INSTHDRS} ${INCDIR}/arpa
-       ${INSTALL} -c -m 444 ${LIBKERN_INSTHDRS} ${INCDIR}/libkern
-       ${INSTALL} -c -m 444 ${MACH_INSTHDRS} ${INCDIR}/mach
-       ${INSTALL} -c -m 444 ${MACHINE_INSTHDRS} ${INCDIR}/machine
-       ${INSTALL} -c -m 444 ${MALLOC_INSTHDRS} ${INCDIR}/malloc
-       ${INSTALL} -c -m 444 ${OBJC_INSTHDRS} ${INCDIR}/objc
-       ${INSTALL} -c -m 444 ${PROTO_INSTHDRS} ${INCDIR}/protocols
-       ${INSTALL} -c -m 444 ${SRVHDRS} ${INCDIR}/servers
-       ${INSTALL} -c -m 444 ${SYS_INSTHDRS} ${INCDIR}/sys
-       ${INSTALL} -c -m 444 ${XLOCALE_INSTHDRS} ${INCDIR}/xlocale
+       ${INSTALL} -c -m ${INSTALLMODE} ${INSTHDRS} ${INCDIR}
+       ${INSTALL} -c -m ${INSTALLMODE} ${ARPA_INSTHDRS} ${INCDIR}/arpa
+       ${INSTALL} -c -m ${INSTALLMODE} ${LIBKERN_INSTHDRS} ${INCDIR}/libkern
+       ${INSTALL} -c -m ${INSTALLMODE} ${MACHINE_INSTHDRS} ${INCDIR}/machine
+       ${INSTALL} -c -m ${INSTALLMODE} ${MALLOC_INSTHDRS} ${INCDIR}/malloc
+       ${INSTALL} -c -m ${INSTALLMODE} ${OBJC_INSTHDRS} ${INCDIR}/objc
+       ${INSTALL} -c -m ${INSTALLMODE} ${PROTO_INSTHDRS} ${INCDIR}/protocols
+       ${INSTALL} -c -m ${INSTALLMODE} ${SECURE_INSTHDRS} ${INCDIR}/secure
+       ${INSTALL} -c -m ${INSTALLMODE} ${SYS_INSTHDRS} ${INCDIR}/sys
+       ${INSTALL} -c -m ${INSTALLMODE} ${XLOCALE_INSTHDRS} ${INCDIR}/xlocale
        mkdir -p ${LOCINCDIR}
-       ${INSTALL} -c -m 444 ${LOCALHDRS} ${LOCINCDIR}
-       mkdir -p ${PRIVHDRS}/architecture/ppc
+       ${INSTALL} -c -m ${INSTALLMODE} ${LOCALHDRS} ${LOCINCDIR}
        mkdir -p ${PRIVHDRS}/btree
        mkdir -p ${PRIVHDRS}/machine
        mkdir -p ${PRIVHDRS}/objc
        mkdir -p ${PRIVHDRS}/uuid
        mkdir -p ${PRIVHDRS}/sys
        mkdir -p ${PRIVKERNELHDRS}/uuid
-       ${INSTALL} -c -m 444 ${PRIV_INSTHDRS} ${PRIVHDRS}
-       ${INSTALL} -c -m 444 ${SRCROOT}/ppc/sys/processor_facilities.h ${PRIVHDRS}/architecture/ppc
-       ${INSTALL} -c -m 444 ${SYMROOT}/btree.h ${PRIVHDRS}/btree
-       ${INSTALL} -c -m 444 ${SYMROOT}/bt_extern.h ${PRIVHDRS}/btree
-       ${INSTALL} -c -m 444 ${SRCROOT}/internat/NXCType.h ${PRIVHDRS}/objc
+       ${INSTALL} -c -m ${INSTALLMODE} ${PRIV_INSTHDRS} ${PRIVHDRS}
+       ${INSTALL} -c -m ${INSTALLMODE} ${INSTBTREEPRIVHDRS_AUTOPATCH} ${PRIVHDRS}/btree
+       ${INSTALL} -c -m ${INSTALLMODE} ${SRCROOT}/internat/NXCType.h ${PRIVHDRS}/objc
        mv ${DESTDIR}/usr/include/asm.h ${PRIVHDRS}/machine
-       mv ${INCDIR}/servers/srvbootstrap.h ${INCDIR}/servers/bootstrap.h
-       @for i in `find ${DESTDIR}/usr/include/mach ${DESTDIR}/usr/include/servers -name \*.h`; do \
-           x=`fgrep '<mach/mig.h>' $$i | uniq -d`; \
-           if [ -n "$$x" ]; then \
-               echo patching $$i; \
-               ed - $$i < ${SRCROOT}/fixdups.ed; \
-           fi; \
-       done
-       ${INSTALL} -c -m 444 ${SYS_INSTHDRS} ${PRIVHDRS}/sys
-       ${INSTALL} -c -m 444 ${PRIVUUID_INSTHDRS} ${PRIVHDRS}/uuid
-       ${INSTALL} -c -m 444 ${PRIVUUID_INSTHDRS} ${PRIVKERNELHDRS}/uuid
-       ${INSTALL} -c -m 444 ${INSTHDRS_AUTOPATCH:S,^,${SYMROOT}/,} ${INCDIR}
+       ${INSTALL} -c -m ${INSTALLMODE} ${SYS_INSTHDRS} ${PRIVHDRS}/sys
+       ${INSTALL} -c -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS} ${PRIVHDRS}/uuid
+       ${INSTALL} -c -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS} ${PRIVKERNELHDRS}/uuid
 .for _h in ${STRIP_HDRS}
        chmod u+w ${INCDIR}/${_h}
        ed - ${INCDIR}/${_h} < ${.CURDIR}/strip-header.ed
        chmod u-w ${INCDIR}/${_h}
 .endfor
+       ${INSTALL} -c -m 644 /usr/include/AvailabilityMacros.h ${OBJROOT}/available.h
+       ex - ${OBJROOT}/available.h < ${.CURDIR}/available.ex
+       ${INSTALL} -c -m ${INSTALLMODE} ${OBJROOT}/available.h ${INCDIR}
 
 install_lib${LIB}_static.a:
-       ${INSTALL} -c -m 444 lib${LIB}_static.a ${DESTDIR}/usr/local/lib/system/
+       ${INSTALL} -c -m ${INSTALLMODE} lib${LIB}_static.a ${DESTDIR}/usr/local/lib/system/
 install_lib${LIB}_profile.a:
-       ${INSTALL} -c -m 444 lib${LIB}_profile.a ${DESTDIR}/usr/local/lib/system
+       ${INSTALL} -c -m ${INSTALLMODE} lib${LIB}_profile.a ${DESTDIR}/usr/local/lib/system
 install_lib${LIB}_debug.a:
-       ${INSTALL} -c -m 444 lib${LIB}_debug.a ${DESTDIR}/usr/local/lib/system/
+       ${INSTALL} -c -m ${INSTALLMODE} lib${LIB}_debug.a ${DESTDIR}/usr/local/lib/system/
 install_lib${LIB}.a:
-       ${INSTALL} -c -m 444 lib${LIB}.a ${DESTDIR}/usr/local/lib/system/
+       ${INSTALL} -c -m ${INSTALLMODE} lib${LIB}.a ${DESTDIR}/usr/local/lib/system/
 
-autopatch: autopatchhdrs ${AUTOPATCHSRCS}
-autopatchhdrs: ${AUTOPATCHHDRS}
 autopatchman: ${AUTOPATCHMAN}
 
+copyfiles:
+.if !empty $(COPYFILES)
+       $(INSTALL) -c -m 444 ${COPYFILES} ${DESTDIR}/usr/local/lib/system
+.endif
+.if !empty $(MDCOPYFILES)
+       $(INSTALL) -c -m 444 ${MDCOPYFILES} ${DESTDIR}/usr/local/lib/system
+.endif
+
 clean:
        rm -f ${OBJS} ${POBJS} ${DOBJS} ${SOBJS} ${CLEANFILES}
        rm -f lib${LIB}.a lib${LIB}_static.a lib${LIB}_profile.a \