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