1# @(#)Makefile 8.2 (Berkeley) 1/4/94 2# $FreeBSD$ 3# 4# Doing a make install builds /usr/include 5# 6# The ``rm -rf''s used below are safe because rm doesn't follow symbolic 7# links. 8 9CLEANFILES= osreldate.h version vers.c 10SUBDIR= rpcsvc rpc 11HDRS= a.out.h ar.h assert.h bitstring.h complex.h ctype.h db.h \ 12 dirent.h disktab.h \ 13 dlfcn.h elf.h elf-hints.h err.h fnmatch.h fstab.h \ 14 fts.h glob.h grp.h \ 15 hesiod.h histedit.h ieeefp.h ifaddrs.h inttypes.h iso646.h langinfo.h \ 16 libgen.h limits.h link.h locale.h malloc.h memory.h monetary.h mpool.h \ 17 ndbm.h netconfig.h netdb.h nl_types.h nlist.h nsswitch.h objformat.h \ 18 paths.h pthread.h pthread_np.h pwd.h \ 19 ranlib.h readpassphrase.h regex.h regexp.h resolv.h rune.h runetype.h \ 20 search.h setjmp.h sgtty.h \ 21 signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h strhash.h \ 22 string.h stringlist.h strings.h sysexits.h tar.h time.h timers.h \ 23 ttyent.h unistd.h utime.h utmp.h vis.h wchar.h wctype.h 24 25ARPAHDRS= ftp.h inet.h nameser.h nameser_compat.h telnet.h tftp.h 26 27PROTOHDRS= dumprestore.h routed.h rwhod.h talkd.h timed.h 28 29NETSMBHDRS= nb_lib.h smb_lib.h smb_rap.h 30 31MHDRS= float.h floatingpoint.h stdarg.h varargs.h 32 33# posix4/aio.h conflicts with dysons and isn't installed: 34PHDRS= mqueue.h sched.h semaphore.h # aio.h 35 36# Only for default SHARED=copies case 37SHDRS= soundcard.h joystick.h 38 39LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \ 40 termios.h ucontext.h 41 42LDIRS= cam net netatalk netatm netgraph netinet netinet6 \ 43 netipx netkey netnatm netncp netns netsmb nfs nfsclient nfsserver \ 44 pccard posix4 sys vm 45 46LNOHEADERDIRS= fs isofs ufs dev 47 48LSUBDIRS= cam/scsi dev/ic dev/ppbus dev/usb dev/wi dev/an fs/devfs \ 49 fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \ 50 fs/procfs fs/smbfs fs/umapfs fs/unionfs isofs/cd9660 \ 51 ufs/ffs ufs/ufs 52 53# For SHARED=symlinks, cam is a symlink, so cam/scsi is taken care of 54LSYMSUBDIRS= ${LSUBDIRS:Ncam/scsi} 55 56# Define SHARED to indicate whether you want symbolic links to the system 57# source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is 58# probably only useful for developers and should be avoided if you do not 59# wish to tie your /usr/include and /usr/src together. 60#SHARED= symlinks 61SHARED?= copies 62 63all: osreldate.h 64 65osreldate.h: ${.CURDIR}/../sys/conf/newvers.sh \ 66 ${.CURDIR}/../sys/sys/param.h \ 67 ${.CURDIR}/Makefile 68 @${ECHO} creating osreldate.h from newvers.sh 69 setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \ 70 . ${.CURDIR}/../sys/conf/newvers.sh; \ 71 echo "$$COPYRIGHT" > osreldate.h; \ 72 echo "#ifdef _KERNEL" >> osreldate.h; \ 73 echo '#error "/usr/include/osreldate.h cannot be used in the kernel, use sys/param.h"' >> osreldate.h; \ 74 echo "#else" >> osreldate.h; \ 75 echo \#'undef __FreeBSD_version' >> osreldate.h; \ 76 echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \ 77 echo "#endif" >> osreldate.h 78 79beforeinstall: ${SHARED} 80 @rm -f ${DESTDIR}/usr/include/timepps.h 81 cd ${.CURDIR}; \ 82 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ 83 ${HDRS} ${DESTDIR}/usr/include 84 cd ${.CURDIR}/arpa; \ 85 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ 86 ${ARPAHDRS} ${DESTDIR}/usr/include/arpa 87 cd ${.CURDIR}/protocols; \ 88 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ 89 ${PROTOHDRS} ${DESTDIR}/usr/include/protocols 90 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \ 91 ${.OBJDIR}/osreldate.h \ 92 ${DESTDIR}/usr/include 93.for i in ${LHDRS} 94 ln -sf sys/$i ${DESTDIR}/usr/include/$i 95.endfor 96.for i in ${MHDRS} 97 ln -sf machine/$i ${DESTDIR}/usr/include/$i 98.endfor 99.for i in ${PHDRS} 100 ln -sf posix4/$i ${DESTDIR}/usr/include/$i 101.endfor 102 103copies: 104.for i in ${LDIRS} ${LSYMSUBDIRS} machine 105 if [ -h ${DESTDIR}/usr/include/$i ]; then \ 106 rm -f ${DESTDIR}/usr/include/$i; \ 107 fi 108.endfor 109 mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \ 110 -p ${DESTDIR}/usr/include 111.for i in ${LDIRS} ${LSUBDIRS} 112 cd ${.CURDIR}/../sys; \ 113 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ 114 ${DESTDIR}/usr/include/$i 115.endfor 116.if exists(${.CURDIR}/../sys/contrib/ipfilter/netinet) 117 cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \ 118 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 119 ${DESTDIR}/usr/include/netinet 120.endif 121.if exists(${.CURDIR}/../sys/contrib/netsmb/include/netsmb) 122 cd ${.CURDIR}/../sys/contrib/netsmb/include/netsmb; \ 123 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ${NETSMBHDRS} \ 124 ${DESTDIR}/usr/include/netsmb 125.endif 126.if exists(${.CURDIR}/../sys/security/lomac) 127 cd ${.CURDIR}/../sys/security/lomac; \ 128 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 lomac.h \ 129 lomacio.h ${DESTDIR}/usr/include/sys 130.endif 131.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include) 132 cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \ 133 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 134 ${DESTDIR}/usr/include/machine 135.endif 136.for i in ${SHDRS} 137 ln -sf ../sys/$i ${DESTDIR}/usr/include/machine/$i 138.endfor 139 140symlinks: 141 @${ECHO} "Setting up symlinks to kernel source tree..." 142.for i in ${LDIRS} 143 rm -rf ${DESTDIR}/usr/include/$i 144 ln -s ../../sys/$i ${DESTDIR}/usr/include/$i 145.endfor 146.for i in ${LNOHEADERDIRS} 147 rm -rf ${DESTDIR}/usr/include/$i 148 mkdir ${DESTDIR}/usr/include/$i 149.endfor 150.for i in ${LSYMSUBDIRS} 151 ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i 152.endfor 153 rm -rf ${DESTDIR}/usr/include/machine 154 ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine 155 156.include <bsd.prog.mk> 157