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 netgraph/atm netgraph/netflow \ 57 netinet/cc \ 58 netinet/netdump \ 59 security/audit \ 60 security/mac_biba security/mac_bsdextended security/mac_lomac \ 61 security/mac_mls security/mac_partition \ 62 security/mac_veriexec \ 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/evdev:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${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/evdev; \ 174 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 input.h \ 175 ${SDESTDIR}${INCLUDEDIR}/dev/evdev; \ 176 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 input-event-codes.h \ 177 ${SDESTDIR}${INCLUDEDIR}/dev/evdev; \ 178 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 uinput.h \ 179 ${SDESTDIR}${INCLUDEDIR}/dev/evdev 180 cd ${SRCTOP}/sys/dev/hyperv/include; \ 181 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 hyperv.h \ 182 ${SDESTDIR}${INCLUDEDIR}/dev/hyperv 183 cd ${SRCTOP}/sys/dev/hyperv/utilities; \ 184 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 hv_snapshot.h \ 185 ${SDESTDIR}${INCLUDEDIR}/dev/hyperv 186 cd ${SRCTOP}/sys/dev/pci; \ 187 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \ 188 ${SDESTDIR}${INCLUDEDIR}/dev/pci 189 cd ${SRCTOP}/sys/dev/veriexec; \ 190 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 veriexec_ioctl.h \ 191 ${SDESTDIR}${INCLUDEDIR}/dev/veriexec 192 cd ${SRCTOP}/sys/fs/cd9660/; \ 193 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 194 ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660 195.if ${MK_IPFILTER} != "no" 196 cd ${SRCTOP}/sys/contrib/ipfilter/netinet; \ 197 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 198 ${SDESTDIR}${INCLUDEDIR}/netinet 199.endif 200.if ${MK_PF} != "no" 201 cd ${SRCTOP}/sys/netpfil/pf; \ 202 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 203 ${SDESTDIR}${INCLUDEDIR}/netpfil/pf 204.endif 205 cd ${SRCTOP}/sys/crypto; \ 206 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \ 207 ${SDESTDIR}${INCLUDEDIR}/crypto 208 cd ${SRCTOP}/sys/opencrypto; \ 209 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 210 ${SDESTDIR}${INCLUDEDIR}/crypto 211 cd ${SRCTOP}/sys/${MACHINE}/include; \ 212 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 213 ${SDESTDIR}${INCLUDEDIR}/machine 214.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) 215 cd ${SRCTOP}/sys/${MACHINE}/include/pc; \ 216 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 217 ${SDESTDIR}${INCLUDEDIR}/machine/pc 218.endif 219.for _MARCH in ${_MARCHS} 220.if exists(${SRCTOP}/sys/${_MARCH}/include) 221 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ 222 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ 223 cd ${SRCTOP}/sys/${_MARCH}/include; \ 224 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 225 ${SDESTDIR}${INCLUDEDIR}/${_MARCH} 226.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) 227 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ 228 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 229 cd ${SRCTOP}/sys/${_MARCH}/include/pc; \ 230 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 231 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc 232.endif 233.endif 234.endfor 235 cd ${SRCTOP}/sys/rpc; \ 236 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 types.h \ 237 ${SDESTDIR}${INCLUDEDIR}/rpc 238 cd ${SRCTOP}/sys/teken; \ 239 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \ 240 ${SDESTDIR}${INCLUDEDIR}/teken 241.if ${MK_CDDL} != "no" 242 cd ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys; \ 243 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nvpair.h \ 244 ${SDESTDIR}${INCLUDEDIR}/sys 245.endif 246.if ${MK_MLX5TOOL} != "no" 247 cd ${SRCTOP}/sys/dev/mlx5; \ 248 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 mlx5io.h \ 249 ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 250.endif 251 252symlinks: .PHONY .META 253 @${ECHO} "Setting up symlinks to kernel source tree..." 254.for i in ${LDIRS} 255 cd ${SRCTOP}/sys/$i; \ 256 for h in *.h; do \ 257 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ 258 done 259.endfor 260.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hyperv:Ndev/pci:Ndev/veriexec} 261 cd ${SRCTOP}/sys/$i; \ 262 for h in *.h; do \ 263 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ 264 done 265.endfor 266 cd ${SRCTOP}/sys/dev/acpica; \ 267 for h in acpiio.h acpi_hpet.h; do \ 268 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/acpica/$$h \ 269 ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ 270 done 271 cd ${SRCTOP}/sys/dev/agp; \ 272 for h in agpreg.h; do \ 273 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/agp/$$h \ 274 ${SDESTDIR}${INCLUDEDIR}/dev/agp; \ 275 done 276 cd ${SRCTOP}/sys/dev/evdev; \ 277 for h in input.h input-event-codes.h uinput.h; do \ 278 ln -fs ../../../../sys/dev/evdev/$$h \ 279 ${SDESTDIR}${INCLUDEDIR}/dev/evdev; \ 280 done 281 cd ${SRCTOP}/sys/dev/hyperv/include; \ 282 for h in hyperv.h; do \ 283 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/hyperv/include/$$h \ 284 ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ 285 done 286 cd ${SRCTOP}/sys/dev/hyperv/utilities; \ 287 for h in hv_snapshot.h; do \ 288 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/hyperv/utilities/$$h \ 289 ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ 290 done 291 cd ${SRCTOP}/sys/dev/pci; \ 292 for h in pcireg.h; do \ 293 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/pci/$$h \ 294 ${SDESTDIR}${INCLUDEDIR}/dev/pci; \ 295 done 296 cd ${SRCTOP}/sys/dev/veriexec; \ 297 for h in veriexec_ioctl.h; do \ 298 ln -fs ../../../../sys/dev/veriexec/$$h \ 299 ${SDESTDIR}${INCLUDEDIR}/dev/veriexec; \ 300 done 301.for i in ${LSUBSUBDIRS} 302 cd ${SRCTOP}/sys/$i; \ 303 for h in *.h; do \ 304 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ 305 done 306.endfor 307.if ${MK_IPFILTER} != "no" 308 cd ${SRCTOP}/sys/contrib/ipfilter/netinet; \ 309 for h in *.h; do \ 310 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/contrib/ipfilter/netinet/$$h \ 311 ${SDESTDIR}${INCLUDEDIR}/netinet; \ 312 done 313.endif 314.if ${MK_PF} != "no" 315 cd ${SRCTOP}/sys/netpfil/pf; \ 316 for h in *.h; do \ 317 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/netpfil/pf/$$h \ 318 ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; \ 319 done 320.endif 321 cd ${SRCTOP}/sys/crypto; \ 322 for h in rijndael/rijndael.h; do \ 323 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/crypto/$$h \ 324 ${SDESTDIR}${INCLUDEDIR}/crypto; \ 325 done 326 cd ${SRCTOP}/sys/opencrypto; \ 327 for h in *.h; do \ 328 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/opencrypto/$$h \ 329 ${SDESTDIR}${INCLUDEDIR}/crypto; \ 330 done 331 cd ${SRCTOP}/sys/${MACHINE}/include; \ 332 for h in *.h; do \ 333 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/${MACHINE}/include/$$h \ 334 ${SDESTDIR}${INCLUDEDIR}/machine; \ 335 done 336.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) 337 cd ${SRCTOP}/sys/${MACHINE}/include/pc; \ 338 for h in *.h; do \ 339 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/${MACHINE}/include/pc/$$h \ 340 ${SDESTDIR}${INCLUDEDIR}/machine/pc; \ 341 done 342.endif 343.for _MARCH in ${_MARCHS} 344.if exists(${SRCTOP}/sys/${_MARCH}/include) 345 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ 346 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ 347 cd ${SRCTOP}/sys/${_MARCH}/include; \ 348 for h in *.h; do \ 349 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/${_MARCH}/include/$$h \ 350 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ 351 done 352.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) 353 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ 354 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 355 cd ${SRCTOP}/sys/${_MARCH}/include/pc; \ 356 for h in *.h; do \ 357 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/${_MARCH}/include/pc/$$h \ 358 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 359 done 360.endif 361.endif 362.endfor 363 cd ${SRCTOP}/sys/fs/cd9660; \ 364 for h in *.h; do \ 365 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/fs/cd9660/$$h \ 366 ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660; \ 367 done 368 cd ${SRCTOP}/sys/rpc; \ 369 for h in types.h; do \ 370 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/rpc/$$h \ 371 ${SDESTDIR}${INCLUDEDIR}/rpc; \ 372 done 373.if ${MK_CDDL} != "no" 374 ${INSTALL_SYMLINK} ${TAG_ARGS} \ 375 ../../../sys/cddl/contrib/opensolaris/uts/common/sys/nvpair.h \ 376 ${SDESTDIR}${INCLUDEDIR}/sys 377.endif 378.if ${MK_MLX5TOOL} != "no" 379 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/mlx5/mlx5io.h \ 380 ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 381.endif 382 383.include <bsd.prog.mk> 384 385installincludes: ${SHARED} 386${SHARED}: compat 387 388.if ${MACHINE} == "host" && !defined(_SKIP_BUILD) 389# we're here because we are building a sysroot... 390# we need MACHINE et al set correctly 391HOST_MACHINE!= uname -m 392HOST_MACHINE_ARCH!= uname -p 393MACHINE:= ${HOST_MACHINE} 394MACHINE_ARCH:= ${HOST_MACHINE_ARCH} 395.endif 396