1# @(#)Makefile 8.2 (Berkeley) 1/4/94 2# $FreeBSD$ 3# 4# Doing a "make install" builds /usr/include. 5 6.include <bsd.own.mk> 7 8CLEANFILES= osreldate.h version vers.c 9SUBDIR= arpa gssapi 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 gssapi.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 stdatomic.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 ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h vis.h \ 27 wchar.h wctype.h wordexp.h xlocale.h 28 29MHDRS= float.h floatingpoint.h stdarg.h 30 31PHDRS= sched.h _semaphore.h 32 33LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \ 34 ucontext.h 35 36LDIRS= bsm cam geom net net80211 netatalk netgraph netinet netinet6 \ 37 netipsec ${_netipx} netnatm ${_netncp} netsmb \ 38 nfs nfsclient nfsserver \ 39 sys vm 40 41LSUBDIRS= cam/ata cam/scsi \ 42 dev/acpica dev/an dev/bktr dev/ciss dev/filemon dev/firewire dev/hwpmc \ 43 dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/ofw \ 44 dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \ 45 dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \ 46 fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/ntfs fs/nullfs \ 47 ${_fs_nwfs} fs/portalfs fs/procfs fs/smbfs fs/udf fs/unionfs \ 48 geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ 49 geom/mirror geom/mountver geom/multipath geom/nop \ 50 geom/raid geom/raid3 geom/shsec geom/stripe geom/virstor \ 51 netgraph/atm netgraph/netflow \ 52 security/audit \ 53 security/mac_biba security/mac_bsdextended security/mac_lomac \ 54 security/mac_mls security/mac_partition \ 55 ufs/ffs ufs/ufs 56 57LSUBSUBDIRS= dev/mpt/mpilib 58 59.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64" 60_dev_powermac_nvram= dev/powermac_nvram 61.endif 62 63.if ${MK_GPIB} != "no" 64_dev_ieee488= dev/ieee488 65.endif 66 67.if ${MK_HESIOD} != "no" 68INCS+= hesiod.h 69.endif 70 71.if ${MK_ICONV} != "no" 72INCS+= iconv.h 73.endif 74 75.if ${MK_BLUETOOTH} != "no" 76LSUBSUBDIRS+= netgraph/bluetooth/include 77.endif 78 79# XXX unconditionally needed by <netsmb/netbios.h> 80#.if ${MK_IPX} != "no" 81_netipx= netipx 82#.endif 83 84.if ${MK_NCP} != "no" 85_netncp= netncp 86_fs_nwfs= fs/nwfs 87.endif 88 89# Define SHARED to indicate whether you want symbolic links to the system 90# source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is 91# probably only useful for developers and should be avoided if you do not 92# wish to tie your /usr/include and /usr/src together. 93#SHARED= symlinks 94SHARED?= copies 95 96INCS+= osreldate.h 97 98osreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \ 99 ${.CURDIR}/Makefile 100 @${ECHO} creating osreldate.h from newvers.sh 101 @MAKE=${MAKE}; \ 102 PARAMFILE=${.CURDIR}/../sys/sys/param.h; \ 103 . ${.CURDIR}/../sys/conf/newvers.sh; \ 104 echo "$$COPYRIGHT" > osreldate.h; \ 105 echo "#ifdef _KERNEL" >> osreldate.h; \ 106 echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \ 107 echo "#else" >> osreldate.h; \ 108 echo "#undef __FreeBSD_version" >> osreldate.h; \ 109 echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \ 110 echo "#endif" >> osreldate.h 111 112.for i in ${LHDRS} 113INCSLINKS+= sys/$i ${INCLUDEDIR}/$i 114.endfor 115.for i in ${MHDRS} 116INCSLINKS+= machine/$i ${INCLUDEDIR}/$i 117.endfor 118.for i in ${PHDRS} 119INCSLINKS+= sys/$i ${INCLUDEDIR}/$i 120.endfor 121 122.if ${MACHINE} != ${MACHINE_CPUARCH} 123_MARCHS= ${MACHINE_CPUARCH} 124.endif 125.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" 126_MARCHS+= x86 127.endif 128 129.if ${MK_STAGING} != "no" 130# tell bsd.incs.mk that we have it covered 131stage_includes: 132.endif 133 134.include <bsd.prog.mk> 135 136.if ${MK_STAGING} != "no" && !defined(_SKIP_BUILD) 137.if make(all) 138DESTDIR= ${STAGE_OBJTOP} 139# we want to keep this separate from the folk who 140# do staging "normally" 141INCLUDEDIR= /include 142 143all: stage_includes 144installincludes: buildincludes 145buildincludes: stage_prep 146 147stage_prep: 148 @mkdir -p ${DESTDIR}${INCLUDEDIR} 149 @touch $@ 150 151stage_includes: .dirdep installincludes 152 @find ${DESTDIR}${INCLUDEDIR} -type d | while read d; do \ 153 rm -f $$d/.dirdep; \ 154 { ln .dirdep $$d/.dirdep 2> /dev/null || \ 155 cp -p .dirdep $$d/.dirdep; }; \ 156 done 157 @touch $@ 158.endif 159.endif 160 161installincludes: ${SHARED} 162${SHARED}: compat 163 164# Take care of stale directory-level symlinks. 165compat: 166.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto 167 if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \ 168 rm -f ${DESTDIR}${INCLUDEDIR}/$i; \ 169 fi 170.endfor 171 mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \ 172 -f ${.CURDIR}/../etc/mtree/BSD.include.dist \ 173 -p ${DESTDIR}${INCLUDEDIR} > /dev/null 174.if ${MK_BIND_LIBS} != "no" 175 mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \ 176 -f ${.CURDIR}/../etc/mtree/BIND.include.dist \ 177 -p ${DESTDIR}${INCLUDEDIR} > /dev/null 178.endif 179 180copies: 181.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \ 182 ${_MARCHS} 183.if exists(${DESTDIR}${INCLUDEDIR}/$i) 184 cd ${DESTDIR}${INCLUDEDIR}/$i; \ 185 for h in *.h; do \ 186 if [ -L $$h ]; then rm -f $$h; fi; \ 187 done 188.endif 189.endfor 190.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr:Ndev/nand} ${LSUBSUBDIRS} 191 cd ${.CURDIR}/../sys; \ 192 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ 193 ${DESTDIR}${INCLUDEDIR}/$i 194.endfor 195 cd ${.CURDIR}/../sys/dev/acpica; \ 196 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \ 197 ${DESTDIR}${INCLUDEDIR}/dev/acpica 198 cd ${.CURDIR}/../sys/dev/bktr; \ 199 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \ 200 ${DESTDIR}${INCLUDEDIR}/dev/bktr 201.if ${MK_NAND} != "no" 202 cd ${.CURDIR}/../sys/dev/nand; \ 203 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \ 204 ${DESTDIR}${INCLUDEDIR}/dev/nand; \ 205 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \ 206 ${DESTDIR}${INCLUDEDIR}/dev/nand 207.endif 208 cd ${.CURDIR}/../sys/contrib/altq/altq; \ 209 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 210 ${DESTDIR}${INCLUDEDIR}/altq 211 cd ${.CURDIR}/../sys/fs/cd9660/; \ 212 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 213 ${DESTDIR}${INCLUDEDIR}/isofs/cd9660 214.if ${MK_IPFILTER} != "no" 215 cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \ 216 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 217 ${DESTDIR}${INCLUDEDIR}/netinet 218.endif 219 cd ${.CURDIR}/../sys/contrib/pf/net; \ 220 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 221 ${DESTDIR}${INCLUDEDIR}/net 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 256symlinks: 257 @${ECHO} "Setting up symlinks to kernel source tree..." 258.for i in ${LDIRS} 259 cd ${.CURDIR}/../sys/$i; \ 260 for h in *.h; do \ 261 ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ 262 done 263.endfor 264.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr:Ndev/nand} 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 cd ${.CURDIR}/../sys/dev/acpica; \ 271 for h in acpiio.h; do \ 272 ln -fs ../../../../sys/dev/acpica/$$h \ 273 ${DESTDIR}${INCLUDEDIR}/dev/acpica; \ 274 done 275 cd ${.CURDIR}/../sys/dev/bktr; \ 276 for h in ioctl_*.h; do \ 277 ln -fs ../../../../sys/dev/bktr/$$h \ 278 ${DESTDIR}${INCLUDEDIR}/dev/bktr; \ 279 done 280.if ${MK_NAND} != "no" 281 cd ${.CURDIR}/../sys/dev/nand; \ 282 for h in nandsim.h nand_dev.h; do \ 283 ln -fs ../../../../sys/dev/nand/$$h \ 284 ${DESTDIR}${INCLUDEDIR}/dev/nand; \ 285 done 286.endif 287.for i in ${LSUBSUBDIRS} 288 cd ${.CURDIR}/../sys/$i; \ 289 for h in *.h; do \ 290 ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ 291 done 292.endfor 293 cd ${.CURDIR}/../sys/contrib/altq/altq; \ 294 for h in *.h; do \ 295 ln -fs ../../../sys/contrib/altq/altq/$$h \ 296 ${DESTDIR}${INCLUDEDIR}/altq; \ 297 done 298.if ${MK_IPFILTER} != "no" 299 cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \ 300 for h in *.h; do \ 301 ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \ 302 ${DESTDIR}${INCLUDEDIR}/netinet; \ 303 done 304.endif 305 cd ${.CURDIR}/../sys/contrib/pf/net; \ 306 for h in *.h; do \ 307 ln -fs ../../../sys/contrib/pf/net/$$h \ 308 ${DESTDIR}${INCLUDEDIR}/net; \ 309 done 310 cd ${.CURDIR}/../sys/crypto; \ 311 for h in rijndael/rijndael.h; do \ 312 ln -fs ../../../sys/crypto/$$h \ 313 ${DESTDIR}${INCLUDEDIR}/crypto; \ 314 done 315 cd ${.CURDIR}/../sys/opencrypto; \ 316 for h in *.h; do \ 317 ln -fs ../../../sys/opencrypto/$$h \ 318 ${DESTDIR}${INCLUDEDIR}/crypto; \ 319 done 320 cd ${.CURDIR}/../sys/${MACHINE}/include; \ 321 for h in *.h; do \ 322 ln -fs ../../../sys/${MACHINE}/include/$$h \ 323 ${DESTDIR}${INCLUDEDIR}/machine; \ 324 done 325.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc) 326 cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \ 327 for h in *.h; do \ 328 ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \ 329 ${DESTDIR}${INCLUDEDIR}/machine/pc; \ 330 done 331.endif 332.for _MARCH in ${_MARCHS} 333.if exists(${.CURDIR}/../sys/${_MARCH}/include) 334 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 335 ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ 336 cd ${.CURDIR}/../sys/${_MARCH}/include; \ 337 for h in *.h; do \ 338 ln -fs ../../../sys/${_MARCH}/include/$$h \ 339 ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ 340 done 341.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc) 342 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 343 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 344 cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \ 345 for h in *.h; do \ 346 ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \ 347 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 348 done 349.endif 350.endif 351.endfor 352 cd ${.CURDIR}/../sys/fs/cd9660; \ 353 for h in *.h; do \ 354 ln -fs ../../../../sys/fs/cd9660/$$h \ 355 ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \ 356 done 357 cd ${.CURDIR}/../sys/rpc; \ 358 for h in types.h; do \ 359 ln -fs ../../../sys/rpc/$$h \ 360 ${DESTDIR}${INCLUDEDIR}/rpc; \ 361 done 362