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 8CLEANFILES= osreldate.h version vers.c 9SUBDIR= arpa protocols rpcsvc rpc xlocale 10INCS= a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \ 11 db.h \ 12 dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \ 13 fts.h ftw.h getopt.h glob.h grp.h \ 14 ieeefp.h ifaddrs.h \ 15 inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \ 16 locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \ 17 ndbm.h netconfig.h \ 18 netdb.h nl_types.h nlist.h nss.h nsswitch.h paths.h \ 19 printf.h proc_service.h pthread.h \ 20 pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h \ 21 res_update.h resolv.h runetype.h search.h semaphore.h setjmp.h \ 22 signal.h spawn.h stab.h stdalign.h stdbool.h stddef.h \ 23 stdnoreturn.h stdio.h stdlib.h string.h stringlist.h \ 24 strings.h sysexits.h tar.h termios.h tgmath.h \ 25 time.h timeconv.h timers.h ttyent.h \ 26 uchar.h ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h \ 27 wchar.h wctype.h wordexp.h xlocale.h 28 29.PATH: ${.CURDIR}/../contrib/libc-vis 30INCS+= vis.h 31 32MHDRS= float.h floatingpoint.h stdarg.h 33 34PHDRS= sched.h _semaphore.h 35 36LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ 37 syslog.h ucontext.h 38 39LDIRS= bsm cam geom net net80211 netgraph netinet netinet6 \ 40 netipsec netnatm netsmb nfs nfsclient nfsserver sys vm 41 42LSUBDIRS= cam/ata cam/scsi \ 43 dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \ 44 dev/hwpmc \ 45 dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/nvme \ 46 dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ 47 dev/speaker dev/utopia dev/vkbd dev/wi \ 48 fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ 49 fs/procfs fs/smbfs fs/udf fs/unionfs \ 50 geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ 51 geom/mirror geom/mountver geom/multipath geom/nop \ 52 geom/raid geom/raid3 geom/shsec geom/stripe geom/virstor \ 53 net/altq \ 54 netgraph/atm netgraph/netflow \ 55 security/audit \ 56 security/mac_biba security/mac_bsdextended security/mac_lomac \ 57 security/mac_mls security/mac_partition \ 58 ufs/ffs ufs/ufs 59 60LSUBSUBDIRS= dev/mpt/mpilib 61 62.if ${MK_BLUETOOTH} != "no" 63LSUBSUBDIRS+= netgraph/bluetooth/include 64.endif 65 66.if ${MK_CUSE} != "no" 67LSUBDIRS+= fs/cuse 68.endif 69 70.if ${MK_GSSAPI} != "no" 71SUBDIR+= gssapi 72INCS+= gssapi.h 73.endif 74 75.if ${MK_HESIOD} != "no" 76INCS+= hesiod.h 77.endif 78 79# Handle the #define aliases for libiconv 80.if ${MK_ICONV} == "yes" 81INCS+= iconv.h 82.endif 83 84.if ${MK_USB} != "no" 85LSUBDIRS+= dev/usb 86.endif 87 88.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64" 89_dev_powermac_nvram= dev/powermac_nvram 90.endif 91 92# Define SHARED to indicate whether you want symbolic links to the system 93# source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is 94# probably only useful for developers and should be avoided if you do not 95# wish to tie your /usr/include and /usr/src together. 96#SHARED= symlinks 97SHARED?= copies 98 99INCS+= osreldate.h 100 101SYSDIR= ${.CURDIR}/../sys 102NEWVERS_SH= ${SYSDIR}/conf/newvers.sh 103PARAM_H= ${SYSDIR}/sys/param.h 104MK_OSRELDATE_SH= ${.CURDIR}/mk-osreldate.sh 105 106osreldate.h vers.c: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH} 107 env ECHO="${ECHO}" \ 108 MAKE="${MAKE}" \ 109 NEWVERS_SH=${NEWVERS_SH} \ 110 PARAM_H=${PARAM_H} \ 111 SYSDIR=${SYSDIR} \ 112 sh ${MK_OSRELDATE_SH} 113 114.for i in ${LHDRS} 115INCSLINKS+= sys/$i ${INCLUDEDIR}/$i 116.endfor 117.for i in ${MHDRS} 118INCSLINKS+= machine/$i ${INCLUDEDIR}/$i 119.endfor 120.for i in ${PHDRS} 121INCSLINKS+= sys/$i ${INCLUDEDIR}/$i 122.endfor 123 124.if ${MACHINE} != ${MACHINE_CPUARCH} 125_MARCHS= ${MACHINE_CPUARCH} 126.endif 127.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" 128_MARCHS+= x86 129.endif 130 131.if ${MK_STAGING} == "yes" 132# tell bsd.incs.mk that we have it covered 133NO_STAGE_INCLUDES= 134.endif 135 136.include <bsd.prog.mk> 137 138.if ${MK_STAGING} != "no" && !defined(_SKIP_BUILD) 139.if make(all) 140DESTDIR= ${STAGE_OBJTOP} 141 142all: stage_include 143installincludes: buildincludes 144buildincludes: stage_prep 145 146stage_prep: 147 @mkdir -p ${DESTDIR}${INCLUDEDIR} 148 @touch $@ 149 150stage_include: .dirdep installincludes 151 @touch $@ 152.endif 153.endif 154 155installincludes: ${SHARED} 156${SHARED}: compat 157 158# Take care of stale directory-level symlinks. 159compat: 160.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto 161 if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \ 162 rm -f ${DESTDIR}${INCLUDEDIR}/$i; \ 163 fi 164.endfor 165 mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \ 166 -f ${.CURDIR}/../etc/mtree/BSD.include.dist \ 167 -p ${DESTDIR}${INCLUDEDIR} > /dev/null 168.if ${MK_META_MODE} == "yes" 169 touch ${.TARGET} 170.endif 171 172copies: 173.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto machine machine/pc \ 174 ${_MARCHS} 175 if [ -d ${DESTDIR}${INCLUDEDIR}/$i ]; then \ 176 cd ${DESTDIR}${INCLUDEDIR}/$i; \ 177 for h in *.h; do \ 178 if [ -L $$h ]; then rm -f $$h; fi; \ 179 done; \ 180 fi 181.endfor 182.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS} 183 cd ${.CURDIR}/../sys; \ 184 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ 185 ${DESTDIR}${INCLUDEDIR}/$i 186.endfor 187 cd ${.CURDIR}/../sys/dev/acpica; \ 188 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \ 189 ${DESTDIR}${INCLUDEDIR}/dev/acpica; \ 190 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \ 191 ${DESTDIR}${INCLUDEDIR}/dev/acpica 192 cd ${.CURDIR}/../sys/dev/agp; \ 193 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \ 194 ${DESTDIR}${INCLUDEDIR}/dev/agp 195 cd ${.CURDIR}/../sys/dev/bktr; \ 196 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \ 197 ${DESTDIR}${INCLUDEDIR}/dev/bktr 198.if ${MK_NAND} != "no" 199 cd ${.CURDIR}/../sys/dev/nand; \ 200 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \ 201 ${DESTDIR}${INCLUDEDIR}/dev/nand; \ 202 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \ 203 ${DESTDIR}${INCLUDEDIR}/dev/nand 204.endif 205 cd ${.CURDIR}/../sys/dev/pci; \ 206 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \ 207 ${DESTDIR}${INCLUDEDIR}/dev/pci 208 cd ${.CURDIR}/../sys/fs/cd9660/; \ 209 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 210 ${DESTDIR}${INCLUDEDIR}/isofs/cd9660 211.if ${MK_IPFILTER} != "no" 212 cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \ 213 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 214 ${DESTDIR}${INCLUDEDIR}/netinet 215.endif 216.if ${MK_PF} != "no" 217 cd ${.CURDIR}/../sys/netpfil/pf; \ 218 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 219 ${DESTDIR}${INCLUDEDIR}/netpfil/pf 220.endif 221 cd ${.CURDIR}/../sys/crypto; \ 222 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \ 223 ${DESTDIR}${INCLUDEDIR}/crypto 224 cd ${.CURDIR}/../sys/opencrypto; \ 225 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 226 ${DESTDIR}${INCLUDEDIR}/crypto 227 cd ${.CURDIR}/../sys/${MACHINE}/include; \ 228 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 229 ${DESTDIR}${INCLUDEDIR}/machine 230.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc) 231 cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \ 232 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 233 ${DESTDIR}${INCLUDEDIR}/machine/pc 234.endif 235.for _MARCH in ${_MARCHS} 236.if exists(${.CURDIR}/../sys/${_MARCH}/include) 237 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 238 ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ 239 cd ${.CURDIR}/../sys/${_MARCH}/include; \ 240 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 241 ${DESTDIR}${INCLUDEDIR}/${_MARCH} 242.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc) 243 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 244 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 245 cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \ 246 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 247 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc 248.endif 249.endif 250.endfor 251 cd ${.CURDIR}/../sys/rpc; \ 252 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \ 253 ${DESTDIR}${INCLUDEDIR}/rpc 254 cd ${.CURDIR}/../sys/teken; \ 255 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \ 256 ${DESTDIR}${INCLUDEDIR}/teken 257.if ${MK_META_MODE} == "yes" 258 cd ${.OBJDIR} 259 touch ${.TARGET} 260.endif 261 262symlinks: 263 @${ECHO} "Setting up symlinks to kernel source tree..." 264.for i in ${LDIRS} 265 cd ${.CURDIR}/../sys/$i; \ 266 for h in *.h; do \ 267 ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ 268 done 269.endfor 270.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} 271 cd ${.CURDIR}/../sys/$i; \ 272 for h in *.h; do \ 273 ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ 274 done 275.endfor 276 cd ${.CURDIR}/../sys/dev/acpica; \ 277 for h in acpiio.h acpi_hpet.h; do \ 278 ln -fs ../../../../sys/dev/acpica/$$h \ 279 ${DESTDIR}${INCLUDEDIR}/dev/acpica; \ 280 done 281 cd ${.CURDIR}/../sys/dev/agp; \ 282 for h in agpreg.h; do \ 283 ln -fs ../../../../sys/dev/agp/$$h \ 284 ${DESTDIR}${INCLUDEDIR}/dev/agp; \ 285 done 286 cd ${.CURDIR}/../sys/dev/bktr; \ 287 for h in ioctl_*.h; do \ 288 ln -fs ../../../../sys/dev/bktr/$$h \ 289 ${DESTDIR}${INCLUDEDIR}/dev/bktr; \ 290 done 291.if ${MK_NAND} != "no" 292 cd ${.CURDIR}/../sys/dev/nand; \ 293 for h in nandsim.h nand_dev.h; do \ 294 ln -fs ../../../../sys/dev/nand/$$h \ 295 ${DESTDIR}${INCLUDEDIR}/dev/nand; \ 296 done 297.endif 298 cd ${.CURDIR}/../sys/dev/pci; \ 299 for h in pcireg.h; do \ 300 ln -fs ../../../../sys/dev/pci/$$h \ 301 ${DESTDIR}${INCLUDEDIR}/dev/pci; \ 302 done 303.for i in ${LSUBSUBDIRS} 304 cd ${.CURDIR}/../sys/$i; \ 305 for h in *.h; do \ 306 ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ 307 done 308.endfor 309.if ${MK_IPFILTER} != "no" 310 cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \ 311 for h in *.h; do \ 312 ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \ 313 ${DESTDIR}${INCLUDEDIR}/netinet; \ 314 done 315.endif 316.if ${MK_PF} != "no" 317 cd ${.CURDIR}/../sys/netpfil/pf; \ 318 for h in *.h; do \ 319 ln -fs ../../../../sys/netpfil/pf/$$h \ 320 ${DESTDIR}${INCLUDEDIR}/netpfil/pf; \ 321 done 322.endif 323 cd ${.CURDIR}/../sys/crypto; \ 324 for h in rijndael/rijndael.h; do \ 325 ln -fs ../../../sys/crypto/$$h \ 326 ${DESTDIR}${INCLUDEDIR}/crypto; \ 327 done 328 cd ${.CURDIR}/../sys/opencrypto; \ 329 for h in *.h; do \ 330 ln -fs ../../../sys/opencrypto/$$h \ 331 ${DESTDIR}${INCLUDEDIR}/crypto; \ 332 done 333 cd ${.CURDIR}/../sys/${MACHINE}/include; \ 334 for h in *.h; do \ 335 ln -fs ../../../sys/${MACHINE}/include/$$h \ 336 ${DESTDIR}${INCLUDEDIR}/machine; \ 337 done 338.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc) 339 cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \ 340 for h in *.h; do \ 341 ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \ 342 ${DESTDIR}${INCLUDEDIR}/machine/pc; \ 343 done 344.endif 345.for _MARCH in ${_MARCHS} 346.if exists(${.CURDIR}/../sys/${_MARCH}/include) 347 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 348 ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ 349 cd ${.CURDIR}/../sys/${_MARCH}/include; \ 350 for h in *.h; do \ 351 ln -fs ../../../sys/${_MARCH}/include/$$h \ 352 ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ 353 done 354.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc) 355 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 356 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 357 cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \ 358 for h in *.h; do \ 359 ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \ 360 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 361 done 362.endif 363.endif 364.endfor 365 cd ${.CURDIR}/../sys/fs/cd9660; \ 366 for h in *.h; do \ 367 ln -fs ../../../../sys/fs/cd9660/$$h \ 368 ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \ 369 done 370 cd ${.CURDIR}/../sys/rpc; \ 371 for h in types.h; do \ 372 ln -fs ../../../sys/rpc/$$h \ 373 ${DESTDIR}${INCLUDEDIR}/rpc; \ 374 done 375.if ${MK_META_MODE} == "yes" 376 cd ${.OBJDIR} 377 touch ${.TARGET} 378.endif 379 380.if ${MACHINE} == "host" 381# we're here because we are building a sysroot... 382# we need MACHINE et al set correctly 383HOST_MACHINE!= uname -m 384HOST_MACHINE_ARCH!= uname -p 385MACHINE:= ${HOST_MACHINE} 386MACHINE_ARCH:= ${HOST_MACHINE_ARCH} 387.endif 388