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