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