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