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