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 security/audit \ 61 security/mac_biba security/mac_bsdextended security/mac_lomac \ 62 security/mac_mls security/mac_partition \ 63 security/mac_veriexec \ 64 sys/disk \ 65 ufs/ffs ufs/ufs 66 67LSUBSUBDIRS= dev/mpt/mpilib 68 69.if ${MK_BLUETOOTH} != "no" 70LSUBSUBDIRS+= netgraph/bluetooth/include 71.endif 72 73.if ${MK_CUSE} != "no" 74LSUBDIRS+= fs/cuse 75.endif 76 77.if ${MK_GSSAPI} != "no" 78SUBDIR+= gssapi 79INCS+= gssapi.h 80.endif 81 82.if ${MK_HESIOD} != "no" 83INCS+= hesiod.h 84.endif 85 86# Handle the #define aliases for libiconv 87.if ${MK_ICONV} == "yes" 88INCS+= iconv.h 89.endif 90 91.if ${MK_USB} != "no" 92LSUBDIRS+= dev/usb 93.endif 94 95.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64" 96_dev_powermac_nvram= dev/powermac_nvram 97.endif 98 99# Define SHARED to indicate whether you want symbolic links to the system 100# source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is 101# probably only useful for developers and should be avoided if you do not 102# wish to tie your /usr/include and /usr/src together. 103#SHARED= symlinks 104SHARED?= copies 105 106INCS+= osreldate.h 107 108SYSDIR= ${SRCTOP}/sys 109NEWVERS_SH= ${SYSDIR}/conf/newvers.sh 110PARAM_H= ${SYSDIR}/sys/param.h 111MK_OSRELDATE_SH= ${.CURDIR}/mk-osreldate.sh 112 113SYMLINKS+= ${LIBDIR:C,[^/]+,..,g:C,^/,,}${INCLUDEDIR} ${LIBDIR}/include 114 115osreldate.h: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH} 116 env NEWVERS_SH=${NEWVERS_SH} PARAMFILE=${PARAM_H} SYSDIR=${SYSDIR} \ 117 sh ${MK_OSRELDATE_SH} 118 119.for i in ${LHDRS} 120INCSLINKS+= sys/$i ${INCLUDEDIR}/$i 121.endfor 122.for i in ${MHDRS} 123INCSLINKS+= machine/$i ${INCLUDEDIR}/$i 124.endfor 125.for i in ${PHDRS} 126INCSLINKS+= sys/$i ${INCLUDEDIR}/$i 127.endfor 128 129.if ${MACHINE} != ${MACHINE_CPUARCH} 130_MARCHS= ${MACHINE_CPUARCH} 131.endif 132.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" 133_MARCHS+= x86 134.endif 135 136META_TARGETS+= compat 137stage_includes: ${SHARED} 138SDESTDIR= ${SYSROOT:U${DESTDIR}} 139 140# Take care of stale directory-level symlinks. 141compat: 142.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto 143 if [ -L ${SDESTDIR}${INCLUDEDIR}/$i ]; then \ 144 rm -f ${SDESTDIR}${INCLUDEDIR}/$i; \ 145 fi 146.endfor 147 mtree -deU ${NO_ROOT:D-W} ${MTREE_FOLLOWS_SYMLINKS} \ 148 -f ${SRCTOP}/etc/mtree/BSD.include.dist \ 149 -p ${SDESTDIR}${INCLUDEDIR} > /dev/null 150 151copies: .PHONY .META 152.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto machine machine/pc \ 153 ${_MARCHS} 154 if [ -d ${SDESTDIR}${INCLUDEDIR}/$i ]; then \ 155 cd ${SDESTDIR}${INCLUDEDIR}/$i; \ 156 for h in *.h; do \ 157 if [ -L $$h ]; then rm -f $$h; fi; \ 158 done; \ 159 fi 160.endfor 161.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} 162 cd ${SRCTOP}/sys; \ 163 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ 164 ${SDESTDIR}${INCLUDEDIR}/$i 165.endfor 166 cd ${SRCTOP}/sys/dev/acpica; \ 167 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \ 168 ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ 169 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \ 170 ${SDESTDIR}${INCLUDEDIR}/dev/acpica 171 cd ${SRCTOP}/sys/dev/agp; \ 172 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \ 173 ${SDESTDIR}${INCLUDEDIR}/dev/agp 174 cd ${SRCTOP}/sys/dev/evdev; \ 175 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 input.h \ 176 ${SDESTDIR}${INCLUDEDIR}/dev/evdev; \ 177 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 input-event-codes.h \ 178 ${SDESTDIR}${INCLUDEDIR}/dev/evdev; \ 179 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 uinput.h \ 180 ${SDESTDIR}${INCLUDEDIR}/dev/evdev 181 cd ${SRCTOP}/sys/dev/hyperv/include; \ 182 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 hyperv.h \ 183 ${SDESTDIR}${INCLUDEDIR}/dev/hyperv 184 cd ${SRCTOP}/sys/dev/hyperv/utilities; \ 185 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 hv_snapshot.h \ 186 ${SDESTDIR}${INCLUDEDIR}/dev/hyperv 187 cd ${SRCTOP}/sys/dev/pci; \ 188 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \ 189 ${SDESTDIR}${INCLUDEDIR}/dev/pci 190 cd ${SRCTOP}/sys/dev/veriexec; \ 191 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 veriexec_ioctl.h \ 192 ${SDESTDIR}${INCLUDEDIR}/dev/veriexec 193 cd ${SRCTOP}/sys/fs/cd9660/; \ 194 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 195 ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660 196.if ${MK_IPFILTER} != "no" 197 cd ${SRCTOP}/sys/contrib/ipfilter/netinet; \ 198 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 199 ${SDESTDIR}${INCLUDEDIR}/netinet 200.endif 201.if ${MK_PF} != "no" 202 cd ${SRCTOP}/sys/netpfil/pf; \ 203 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 204 ${SDESTDIR}${INCLUDEDIR}/netpfil/pf 205.endif 206 cd ${SRCTOP}/sys/crypto; \ 207 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \ 208 ${SDESTDIR}${INCLUDEDIR}/crypto 209 cd ${SRCTOP}/sys/opencrypto; \ 210 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 211 ${SDESTDIR}${INCLUDEDIR}/crypto 212 cd ${SRCTOP}/sys/${MACHINE}/include; \ 213 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 214 ${SDESTDIR}${INCLUDEDIR}/machine 215.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) 216 cd ${SRCTOP}/sys/${MACHINE}/include/pc; \ 217 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 218 ${SDESTDIR}${INCLUDEDIR}/machine/pc 219.endif 220.for _MARCH in ${_MARCHS} 221.if exists(${SRCTOP}/sys/${_MARCH}/include) 222 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ 223 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ 224 cd ${SRCTOP}/sys/${_MARCH}/include; \ 225 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 226 ${SDESTDIR}${INCLUDEDIR}/${_MARCH} 227.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) 228 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ 229 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 230 cd ${SRCTOP}/sys/${_MARCH}/include/pc; \ 231 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 232 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc 233.endif 234.endif 235.endfor 236 cd ${SRCTOP}/sys/rpc; \ 237 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 rpcsec_tls.h \ 238 ${SDESTDIR}${INCLUDEDIR}/rpc 239 cd ${SRCTOP}/sys/rpc; \ 240 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 types.h \ 241 ${SDESTDIR}${INCLUDEDIR}/rpc 242 cd ${SRCTOP}/sys/teken; \ 243 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \ 244 ${SDESTDIR}${INCLUDEDIR}/teken 245.if ${MK_CDDL} != "no" 246 cd ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys; \ 247 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nvpair.h \ 248 ${SDESTDIR}${INCLUDEDIR}/sys 249.endif 250.if ${MK_MLX5TOOL} != "no" 251 cd ${SRCTOP}/sys/dev/mlx5; \ 252 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 mlx5io.h \ 253 ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 254.endif 255 256symlinks: .PHONY .META 257 @${ECHO} "Setting up symlinks to kernel source tree..." 258.for i in ${LDIRS} 259 cd ${SRCTOP}/sys/$i; \ 260 for h in *.h; do \ 261 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ 262 done 263.endfor 264.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hyperv:Ndev/pci:Ndev/veriexec} 265 cd ${SRCTOP}/sys/$i; \ 266 for h in *.h; do \ 267 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ 268 done 269.endfor 270 cd ${SRCTOP}/sys/dev/acpica; \ 271 for h in acpiio.h acpi_hpet.h; do \ 272 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/acpica/$$h \ 273 ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ 274 done 275 cd ${SRCTOP}/sys/dev/agp; \ 276 for h in agpreg.h; do \ 277 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/agp/$$h \ 278 ${SDESTDIR}${INCLUDEDIR}/dev/agp; \ 279 done 280 cd ${SRCTOP}/sys/dev/evdev; \ 281 for h in input.h input-event-codes.h uinput.h; do \ 282 ln -fs ../../../../sys/dev/evdev/$$h \ 283 ${SDESTDIR}${INCLUDEDIR}/dev/evdev; \ 284 done 285 cd ${SRCTOP}/sys/dev/hyperv/include; \ 286 for h in hyperv.h; do \ 287 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/hyperv/include/$$h \ 288 ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ 289 done 290 cd ${SRCTOP}/sys/dev/hyperv/utilities; \ 291 for h in hv_snapshot.h; do \ 292 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/hyperv/utilities/$$h \ 293 ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ 294 done 295 cd ${SRCTOP}/sys/dev/pci; \ 296 for h in pcireg.h; do \ 297 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/pci/$$h \ 298 ${SDESTDIR}${INCLUDEDIR}/dev/pci; \ 299 done 300 cd ${SRCTOP}/sys/dev/veriexec; \ 301 for h in veriexec_ioctl.h; do \ 302 ln -fs ../../../../sys/dev/veriexec/$$h \ 303 ${SDESTDIR}${INCLUDEDIR}/dev/veriexec; \ 304 done 305.for i in ${LSUBSUBDIRS} 306 cd ${SRCTOP}/sys/$i; \ 307 for h in *.h; do \ 308 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ 309 done 310.endfor 311.if ${MK_IPFILTER} != "no" 312 cd ${SRCTOP}/sys/contrib/ipfilter/netinet; \ 313 for h in *.h; do \ 314 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/contrib/ipfilter/netinet/$$h \ 315 ${SDESTDIR}${INCLUDEDIR}/netinet; \ 316 done 317.endif 318.if ${MK_PF} != "no" 319 cd ${SRCTOP}/sys/netpfil/pf; \ 320 for h in *.h; do \ 321 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/netpfil/pf/$$h \ 322 ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; \ 323 done 324.endif 325 cd ${SRCTOP}/sys/crypto; \ 326 for h in rijndael/rijndael.h; do \ 327 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/crypto/$$h \ 328 ${SDESTDIR}${INCLUDEDIR}/crypto; \ 329 done 330 cd ${SRCTOP}/sys/opencrypto; \ 331 for h in *.h; do \ 332 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/opencrypto/$$h \ 333 ${SDESTDIR}${INCLUDEDIR}/crypto; \ 334 done 335 cd ${SRCTOP}/sys/${MACHINE}/include; \ 336 for h in *.h; do \ 337 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/${MACHINE}/include/$$h \ 338 ${SDESTDIR}${INCLUDEDIR}/machine; \ 339 done 340.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) 341 cd ${SRCTOP}/sys/${MACHINE}/include/pc; \ 342 for h in *.h; do \ 343 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/${MACHINE}/include/pc/$$h \ 344 ${SDESTDIR}${INCLUDEDIR}/machine/pc; \ 345 done 346.endif 347.for _MARCH in ${_MARCHS} 348.if exists(${SRCTOP}/sys/${_MARCH}/include) 349 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ 350 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ 351 cd ${SRCTOP}/sys/${_MARCH}/include; \ 352 for h in *.h; do \ 353 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/${_MARCH}/include/$$h \ 354 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ 355 done 356.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) 357 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ 358 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 359 cd ${SRCTOP}/sys/${_MARCH}/include/pc; \ 360 for h in *.h; do \ 361 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/${_MARCH}/include/pc/$$h \ 362 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 363 done 364.endif 365.endif 366.endfor 367 cd ${SRCTOP}/sys/fs/cd9660; \ 368 for h in *.h; do \ 369 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/fs/cd9660/$$h \ 370 ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660; \ 371 done 372 cd ${SRCTOP}/sys/rpc; \ 373 for h in rpcsec_tls.h types.h; do \ 374 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/rpc/$$h \ 375 ${SDESTDIR}${INCLUDEDIR}/rpc; \ 376 done 377.if ${MK_CDDL} != "no" 378 ${INSTALL_SYMLINK} ${TAG_ARGS} \ 379 ../../../sys/cddl/contrib/opensolaris/uts/common/sys/nvpair.h \ 380 ${SDESTDIR}${INCLUDEDIR}/sys 381.endif 382.if ${MK_MLX5TOOL} != "no" 383 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/mlx5/mlx5io.h \ 384 ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 385.endif 386 387.include <bsd.prog.mk> 388 389installincludes: ${SHARED} 390${SHARED}: compat 391 392.if ${MACHINE} == "host" && !defined(_SKIP_BUILD) 393# we're here because we are building a sysroot... 394# we need MACHINE et al set correctly 395HOST_MACHINE!= uname -m 396HOST_MACHINE_ARCH!= uname -p 397MACHINE:= ${HOST_MACHINE} 398MACHINE_ARCH:= ${HOST_MACHINE_ARCH} 399.endif 400