1# @(#)Makefile 8.2 (Berkeley) 1/4/94 2# $FreeBSD$ 3# 4# Doing a "make install" builds /usr/include. 5 6.include <src.opts.mk> 7 8CLEANFILES= osreldate.h version 9SUBDIR= arpa protocols rpcsvc rpc xlocale 10SUBDIR_PARALLEL= 11INCS= a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \ 12 db.h \ 13 dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \ 14 fts.h ftw.h getopt.h glob.h grp.h \ 15 ieeefp.h ifaddrs.h \ 16 inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \ 17 locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \ 18 ndbm.h netconfig.h \ 19 netdb.h nl_types.h nlist.h nss.h nsswitch.h paths.h \ 20 printf.h proc_service.h pthread.h \ 21 pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h \ 22 res_update.h resolv.h runetype.h search.h semaphore.h setjmp.h \ 23 signal.h spawn.h stab.h stdalign.h stdbool.h stddef.h \ 24 stdnoreturn.h stdio.h stdlib.h string.h stringlist.h \ 25 strings.h sysexits.h tar.h termios.h tgmath.h \ 26 time.h timeconv.h timers.h ttyent.h \ 27 uchar.h ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h \ 28 wchar.h wctype.h wordexp.h xlocale.h 29 30.PATH: ${.CURDIR}/../contrib/libc-vis 31INCS+= vis.h 32 33MHDRS= float.h floatingpoint.h stdarg.h 34 35PHDRS= sched.h _semaphore.h 36 37LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ 38 syslog.h ucontext.h 39 40LDIRS= bsm cam geom net net80211 netgraph netinet netinet6 \ 41 netipsec netnatm netsmb nfs nfsclient nfsserver sys vm 42 43LSUBDIRS= cam/ata cam/scsi \ 44 dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \ 45 dev/hwpmc \ 46 dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/nvme \ 47 dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ 48 dev/speaker dev/utopia dev/vkbd dev/wi \ 49 fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ 50 fs/procfs fs/smbfs fs/udf fs/unionfs \ 51 geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ 52 geom/mirror geom/mountver geom/multipath geom/nop \ 53 geom/raid geom/raid3 geom/shsec geom/stripe geom/virstor \ 54 net/altq \ 55 netgraph/atm netgraph/netflow \ 56 netinet/cc \ 57 security/audit \ 58 security/mac_biba security/mac_bsdextended security/mac_lomac \ 59 security/mac_mls security/mac_partition \ 60 ufs/ffs ufs/ufs 61 62LSUBSUBDIRS= dev/mpt/mpilib 63 64.if ${MK_BLUETOOTH} != "no" 65LSUBSUBDIRS+= netgraph/bluetooth/include 66.endif 67 68.if ${MK_CUSE} != "no" 69LSUBDIRS+= fs/cuse 70.endif 71 72.if ${MK_GSSAPI} != "no" 73SUBDIR+= gssapi 74INCS+= gssapi.h 75.endif 76 77.if ${MK_HESIOD} != "no" 78INCS+= hesiod.h 79.endif 80 81# Handle the #define aliases for libiconv 82.if ${MK_ICONV} == "yes" 83INCS+= iconv.h 84.endif 85 86.if ${MK_USB} != "no" 87LSUBDIRS+= dev/usb 88.endif 89 90.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64" 91_dev_powermac_nvram= dev/powermac_nvram 92.endif 93 94# Define SHARED to indicate whether you want symbolic links to the system 95# source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is 96# probably only useful for developers and should be avoided if you do not 97# wish to tie your /usr/include and /usr/src together. 98#SHARED= symlinks 99SHARED?= copies 100 101INCS+= osreldate.h 102 103SYSDIR= ${.CURDIR}/../sys 104NEWVERS_SH= ${SYSDIR}/conf/newvers.sh 105PARAM_H= ${SYSDIR}/sys/param.h 106MK_OSRELDATE_SH= ${.CURDIR}/mk-osreldate.sh 107 108SYMLINKS+= ${INCLUDEDIR} ${LIBDIR}/include 109 110osreldate.h: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH} 111 env NEWVERS_SH=${NEWVERS_SH} PARAMFILE=${PARAM_H} SYSDIR=${SYSDIR} \ 112 sh ${MK_OSRELDATE_SH} 113 114.for i in ${LHDRS} 115INCSLINKS+= sys/$i ${INCLUDEDIR}/$i 116.endfor 117.for i in ${MHDRS} 118INCSLINKS+= machine/$i ${INCLUDEDIR}/$i 119.endfor 120.for i in ${PHDRS} 121INCSLINKS+= sys/$i ${INCLUDEDIR}/$i 122.endfor 123 124.if ${MACHINE} != ${MACHINE_CPUARCH} 125_MARCHS= ${MACHINE_CPUARCH} 126.endif 127.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" 128_MARCHS+= x86 129.endif 130 131META_COOKIES+= compat copies symlinks 132stage_includes: ${SHARED} 133 134.include <bsd.prog.mk> 135 136installincludes: ${SHARED} 137${SHARED}: compat 138 139# Take care of stale directory-level symlinks. 140compat: 141 ${META_COOKIE_RM} 142.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto 143 if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \ 144 rm -f ${DESTDIR}${INCLUDEDIR}/$i; \ 145 fi 146.endfor 147 mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \ 148 -f ${.CURDIR}/../etc/mtree/BSD.include.dist \ 149 -p ${DESTDIR}${INCLUDEDIR} > /dev/null 150 ${META_COOKIE_TOUCH} 151 152copies: 153 ${META_COOKIE_RM} 154.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto machine machine/pc \ 155 ${_MARCHS} 156 if [ -d ${DESTDIR}${INCLUDEDIR}/$i ]; then \ 157 cd ${DESTDIR}${INCLUDEDIR}/$i; \ 158 for h in *.h; do \ 159 if [ -L $$h ]; then rm -f $$h; fi; \ 160 done; \ 161 fi 162.endfor 163.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS} 164 cd ${.CURDIR}/../sys; \ 165 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ 166 ${DESTDIR}${INCLUDEDIR}/$i 167.endfor 168 cd ${.CURDIR}/../sys/dev/acpica; \ 169 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \ 170 ${DESTDIR}${INCLUDEDIR}/dev/acpica; \ 171 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \ 172 ${DESTDIR}${INCLUDEDIR}/dev/acpica 173 cd ${.CURDIR}/../sys/dev/agp; \ 174 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \ 175 ${DESTDIR}${INCLUDEDIR}/dev/agp 176 cd ${.CURDIR}/../sys/dev/bktr; \ 177 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \ 178 ${DESTDIR}${INCLUDEDIR}/dev/bktr 179.if ${MK_NAND} != "no" 180 cd ${.CURDIR}/../sys/dev/nand; \ 181 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \ 182 ${DESTDIR}${INCLUDEDIR}/dev/nand; \ 183 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \ 184 ${DESTDIR}${INCLUDEDIR}/dev/nand 185.endif 186 cd ${.CURDIR}/../sys/dev/pci; \ 187 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \ 188 ${DESTDIR}${INCLUDEDIR}/dev/pci 189 cd ${.CURDIR}/../sys/fs/cd9660/; \ 190 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 191 ${DESTDIR}${INCLUDEDIR}/isofs/cd9660 192.if ${MK_IPFILTER} != "no" 193 cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \ 194 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 195 ${DESTDIR}${INCLUDEDIR}/netinet 196.endif 197.if ${MK_PF} != "no" 198 cd ${.CURDIR}/../sys/netpfil/pf; \ 199 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 200 ${DESTDIR}${INCLUDEDIR}/netpfil/pf 201.endif 202 cd ${.CURDIR}/../sys/crypto; \ 203 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \ 204 ${DESTDIR}${INCLUDEDIR}/crypto 205 cd ${.CURDIR}/../sys/opencrypto; \ 206 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 207 ${DESTDIR}${INCLUDEDIR}/crypto 208 cd ${.CURDIR}/../sys/${MACHINE}/include; \ 209 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 210 ${DESTDIR}${INCLUDEDIR}/machine 211.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc) 212 cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \ 213 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 214 ${DESTDIR}${INCLUDEDIR}/machine/pc 215.endif 216.for _MARCH in ${_MARCHS} 217.if exists(${.CURDIR}/../sys/${_MARCH}/include) 218 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 219 ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ 220 cd ${.CURDIR}/../sys/${_MARCH}/include; \ 221 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 222 ${DESTDIR}${INCLUDEDIR}/${_MARCH} 223.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc) 224 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 225 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 226 cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \ 227 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 228 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc 229.endif 230.endif 231.endfor 232 cd ${.CURDIR}/../sys/rpc; \ 233 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \ 234 ${DESTDIR}${INCLUDEDIR}/rpc 235 cd ${.CURDIR}/../sys/teken; \ 236 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \ 237 ${DESTDIR}${INCLUDEDIR}/teken 238 ${META_COOKIE_TOUCH} 239 240symlinks: 241 ${META_COOKIE_RM} 242 @${ECHO} "Setting up symlinks to kernel source tree..." 243.for i in ${LDIRS} 244 cd ${.CURDIR}/../sys/$i; \ 245 for h in *.h; do \ 246 ${INSTALL_SYMLINK} ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ 247 done 248.endfor 249.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} 250 cd ${.CURDIR}/../sys/$i; \ 251 for h in *.h; do \ 252 ${INSTALL_SYMLINK} ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ 253 done 254.endfor 255 cd ${.CURDIR}/../sys/dev/acpica; \ 256 for h in acpiio.h acpi_hpet.h; do \ 257 ${INSTALL_SYMLINK} ../../../../sys/dev/acpica/$$h \ 258 ${DESTDIR}${INCLUDEDIR}/dev/acpica; \ 259 done 260 cd ${.CURDIR}/../sys/dev/agp; \ 261 for h in agpreg.h; do \ 262 ${INSTALL_SYMLINK} ../../../../sys/dev/agp/$$h \ 263 ${DESTDIR}${INCLUDEDIR}/dev/agp; \ 264 done 265 cd ${.CURDIR}/../sys/dev/bktr; \ 266 for h in ioctl_*.h; do \ 267 ${INSTALL_SYMLINK} ../../../../sys/dev/bktr/$$h \ 268 ${DESTDIR}${INCLUDEDIR}/dev/bktr; \ 269 done 270.if ${MK_NAND} != "no" 271 cd ${.CURDIR}/../sys/dev/nand; \ 272 for h in nandsim.h nand_dev.h; do \ 273 ${INSTALL_SYMLINK} ../../../../sys/dev/nand/$$h \ 274 ${DESTDIR}${INCLUDEDIR}/dev/nand; \ 275 done 276.endif 277 cd ${.CURDIR}/../sys/dev/pci; \ 278 for h in pcireg.h; do \ 279 ${INSTALL_SYMLINK} ../../../../sys/dev/pci/$$h \ 280 ${DESTDIR}${INCLUDEDIR}/dev/pci; \ 281 done 282.for i in ${LSUBSUBDIRS} 283 cd ${.CURDIR}/../sys/$i; \ 284 for h in *.h; do \ 285 ${INSTALL_SYMLINK} ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ 286 done 287.endfor 288.if ${MK_IPFILTER} != "no" 289 cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \ 290 for h in *.h; do \ 291 ${INSTALL_SYMLINK} ../../../sys/contrib/ipfilter/netinet/$$h \ 292 ${DESTDIR}${INCLUDEDIR}/netinet; \ 293 done 294.endif 295.if ${MK_PF} != "no" 296 cd ${.CURDIR}/../sys/netpfil/pf; \ 297 for h in *.h; do \ 298 ${INSTALL_SYMLINK} ../../../../sys/netpfil/pf/$$h \ 299 ${DESTDIR}${INCLUDEDIR}/netpfil/pf; \ 300 done 301.endif 302 cd ${.CURDIR}/../sys/crypto; \ 303 for h in rijndael/rijndael.h; do \ 304 ${INSTALL_SYMLINK} ../../../sys/crypto/$$h \ 305 ${DESTDIR}${INCLUDEDIR}/crypto; \ 306 done 307 cd ${.CURDIR}/../sys/opencrypto; \ 308 for h in *.h; do \ 309 ${INSTALL_SYMLINK} ../../../sys/opencrypto/$$h \ 310 ${DESTDIR}${INCLUDEDIR}/crypto; \ 311 done 312 cd ${.CURDIR}/../sys/${MACHINE}/include; \ 313 for h in *.h; do \ 314 ${INSTALL_SYMLINK} ../../../sys/${MACHINE}/include/$$h \ 315 ${DESTDIR}${INCLUDEDIR}/machine; \ 316 done 317.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc) 318 cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \ 319 for h in *.h; do \ 320 ${INSTALL_SYMLINK} ../../../../sys/${MACHINE}/include/pc/$$h \ 321 ${DESTDIR}${INCLUDEDIR}/machine/pc; \ 322 done 323.endif 324.for _MARCH in ${_MARCHS} 325.if exists(${.CURDIR}/../sys/${_MARCH}/include) 326 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 327 ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ 328 cd ${.CURDIR}/../sys/${_MARCH}/include; \ 329 for h in *.h; do \ 330 ${INSTALL_SYMLINK} ../../../sys/${_MARCH}/include/$$h \ 331 ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ 332 done 333.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc) 334 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 335 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 336 cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \ 337 for h in *.h; do \ 338 ${INSTALL_SYMLINK} ../../../../sys/${_MARCH}/include/pc/$$h \ 339 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 340 done 341.endif 342.endif 343.endfor 344 cd ${.CURDIR}/../sys/fs/cd9660; \ 345 for h in *.h; do \ 346 ${INSTALL_SYMLINK} ../../../../sys/fs/cd9660/$$h \ 347 ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \ 348 done 349 cd ${.CURDIR}/../sys/rpc; \ 350 for h in types.h; do \ 351 ${INSTALL_SYMLINK} ../../../sys/rpc/$$h \ 352 ${DESTDIR}${INCLUDEDIR}/rpc; \ 353 done 354 ${META_COOKIE_TOUCH} 355 356.if ${MACHINE} == "host" && !defined(_SKIP_BUILD) 357# we're here because we are building a sysroot... 358# we need MACHINE et al set correctly 359HOST_MACHINE!= uname -m 360HOST_MACHINE_ARCH!= uname -p 361MACHINE:= ${HOST_MACHINE} 362MACHINE_ARCH:= ${HOST_MACHINE_ARCH} 363.endif 364