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 types.h \ 238 ${SDESTDIR}${INCLUDEDIR}/rpc 239 cd ${SRCTOP}/sys/teken; \ 240 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \ 241 ${SDESTDIR}${INCLUDEDIR}/teken 242.if ${MK_CDDL} != "no" 243 cd ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys; \ 244 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nvpair.h \ 245 ${SDESTDIR}${INCLUDEDIR}/sys 246.endif 247.if ${MK_MLX5TOOL} != "no" 248 cd ${SRCTOP}/sys/dev/mlx5; \ 249 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 mlx5io.h \ 250 ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 251.endif 252 253symlinks: .PHONY .META 254 @${ECHO} "Setting up symlinks to kernel source tree..." 255.for i in ${LDIRS} 256 cd ${SRCTOP}/sys/$i; \ 257 for h in *.h; do \ 258 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ 259 done 260.endfor 261.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hyperv:Ndev/pci:Ndev/veriexec} 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 cd ${SRCTOP}/sys/dev/acpica; \ 268 for h in acpiio.h acpi_hpet.h; do \ 269 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/acpica/$$h \ 270 ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ 271 done 272 cd ${SRCTOP}/sys/dev/agp; \ 273 for h in agpreg.h; do \ 274 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/agp/$$h \ 275 ${SDESTDIR}${INCLUDEDIR}/dev/agp; \ 276 done 277 cd ${SRCTOP}/sys/dev/evdev; \ 278 for h in input.h input-event-codes.h uinput.h; do \ 279 ln -fs ../../../../sys/dev/evdev/$$h \ 280 ${SDESTDIR}${INCLUDEDIR}/dev/evdev; \ 281 done 282 cd ${SRCTOP}/sys/dev/hyperv/include; \ 283 for h in hyperv.h; do \ 284 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/hyperv/include/$$h \ 285 ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ 286 done 287 cd ${SRCTOP}/sys/dev/hyperv/utilities; \ 288 for h in hv_snapshot.h; do \ 289 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/hyperv/utilities/$$h \ 290 ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ 291 done 292 cd ${SRCTOP}/sys/dev/pci; \ 293 for h in pcireg.h; do \ 294 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/pci/$$h \ 295 ${SDESTDIR}${INCLUDEDIR}/dev/pci; \ 296 done 297 cd ${SRCTOP}/sys/dev/veriexec; \ 298 for h in veriexec_ioctl.h; do \ 299 ln -fs ../../../../sys/dev/veriexec/$$h \ 300 ${SDESTDIR}${INCLUDEDIR}/dev/veriexec; \ 301 done 302.for i in ${LSUBSUBDIRS} 303 cd ${SRCTOP}/sys/$i; \ 304 for h in *.h; do \ 305 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ 306 done 307.endfor 308.if ${MK_IPFILTER} != "no" 309 cd ${SRCTOP}/sys/contrib/ipfilter/netinet; \ 310 for h in *.h; do \ 311 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/contrib/ipfilter/netinet/$$h \ 312 ${SDESTDIR}${INCLUDEDIR}/netinet; \ 313 done 314.endif 315.if ${MK_PF} != "no" 316 cd ${SRCTOP}/sys/netpfil/pf; \ 317 for h in *.h; do \ 318 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/netpfil/pf/$$h \ 319 ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; \ 320 done 321.endif 322 cd ${SRCTOP}/sys/crypto; \ 323 for h in rijndael/rijndael.h; do \ 324 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/crypto/$$h \ 325 ${SDESTDIR}${INCLUDEDIR}/crypto; \ 326 done 327 cd ${SRCTOP}/sys/opencrypto; \ 328 for h in *.h; do \ 329 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/opencrypto/$$h \ 330 ${SDESTDIR}${INCLUDEDIR}/crypto; \ 331 done 332 cd ${SRCTOP}/sys/${MACHINE}/include; \ 333 for h in *.h; do \ 334 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/${MACHINE}/include/$$h \ 335 ${SDESTDIR}${INCLUDEDIR}/machine; \ 336 done 337.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) 338 cd ${SRCTOP}/sys/${MACHINE}/include/pc; \ 339 for h in *.h; do \ 340 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/${MACHINE}/include/pc/$$h \ 341 ${SDESTDIR}${INCLUDEDIR}/machine/pc; \ 342 done 343.endif 344.for _MARCH in ${_MARCHS} 345.if exists(${SRCTOP}/sys/${_MARCH}/include) 346 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ 347 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ 348 cd ${SRCTOP}/sys/${_MARCH}/include; \ 349 for h in *.h; do \ 350 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/${_MARCH}/include/$$h \ 351 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ 352 done 353.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) 354 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ 355 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 356 cd ${SRCTOP}/sys/${_MARCH}/include/pc; \ 357 for h in *.h; do \ 358 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/${_MARCH}/include/pc/$$h \ 359 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 360 done 361.endif 362.endif 363.endfor 364 cd ${SRCTOP}/sys/fs/cd9660; \ 365 for h in *.h; do \ 366 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/fs/cd9660/$$h \ 367 ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660; \ 368 done 369 cd ${SRCTOP}/sys/rpc; \ 370 for h in types.h; do \ 371 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/rpc/$$h \ 372 ${SDESTDIR}${INCLUDEDIR}/rpc; \ 373 done 374.if ${MK_CDDL} != "no" 375 ${INSTALL_SYMLINK} ${TAG_ARGS} \ 376 ../../../sys/cddl/contrib/opensolaris/uts/common/sys/nvpair.h \ 377 ${SDESTDIR}${INCLUDEDIR}/sys 378.endif 379.if ${MK_MLX5TOOL} != "no" 380 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/mlx5/mlx5io.h \ 381 ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 382.endif 383 384.include <bsd.prog.mk> 385 386installincludes: ${SHARED} 387${SHARED}: compat 388 389.if ${MACHINE} == "host" && !defined(_SKIP_BUILD) 390# we're here because we are building a sysroot... 391# we need MACHINE et al set correctly 392HOST_MACHINE!= uname -m 393HOST_MACHINE_ARCH!= uname -p 394MACHINE:= ${HOST_MACHINE} 395MACHINE_ARCH:= ${HOST_MACHINE_ARCH} 396.endif 397