900897f18eae48952ef2f407416c7072f62a7dbc
[dragonfly.git] / include / Makefile
1 #       @(#)Makefile    8.2 (Berkeley) 1/4/94
2 # $FreeBSD: src/include/Makefile,v 1.109.2.27 2003/01/24 05:12:29 sam Exp $
3 # $DragonFly: src/include/Makefile,v 1.3 2003/08/07 21:26:08 dillon Exp $
4 #
5 # Doing a make install builds /usr/include
6 #
7 # The ``rm -rf''s used below are safe because rm doesn't follow symbolic
8 # links.
9
10 CLEANFILES= osreldate.h version vers.c
11 SUBDIR= arpa protocols rpc rpcsvc
12 INCS=   a.out.h ar.h assert.h bitstring.h complex.h ctype.h db.h \
13         dirent.h disktab.h \
14         dlfcn.h elf.h elf-hints.h err.h fnmatch.h fstab.h \
15         fts.h glob.h grp.h strhash.h histedit.h ieeefp.h ifaddrs.h iso646.h \
16         langinfo.h libgen.h limits.h link.h locale.h malloc.h memory.h mpool.h \
17         ndbm.h netdb.h nl_types.h nlist.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 \
22         string.h stringlist.h strings.h struct.h sysexits.h tar.h time.h \
23         timers.h ttyent.h unistd.h utime.h utmp.h vis.h wchar.h wctype.h
24
25 MHDRS=  float.h floatingpoint.h stdarg.h varargs.h
26
27 # posix4/aio.h conflicts with dysons and isn't installed:
28 PHDRS=  mqueue.h sched.h semaphore.h # aio.h
29
30 # Only for default SHARED=copies case
31 SHDRS=  soundcard.h joystick.h
32
33 LHDRS=  aio.h errno.h fcntl.h inttypes.h linker_set.h poll.h syslog.h \
34         termios.h ucontext.h
35
36 LDIRS=  net netgraph netinet netinet6 sys vm
37
38 LSUBDIRS=       bus/cam bus/cam/scsi \
39         emulation/posix4 \
40         vfs/msdosfs vfs/nfs vfs/ntfs vfs/nwfs \
41         vfs/ufs \
42         bus/cam bus/pccard \
43         netproto/atalk netproto/atm netproto/ipsec netproto/ipx \
44         netproto/key netproto/natm netproto/ncp netproto/ns netproto/smb \
45         netproto/atm/ipatm netproto/atm/sigpvc netproto/atm/spans \
46         netproto/atm/uni \
47 #       dev/an dev/firewire dev/ppbus dev/usb dev/wi \
48
49 # For SHARED=symlinks, cam and netatm are symlinks, so cam/scsi and netatm/*
50 # are taken care of
51 LSYMSUBDIRS=    ${LSUBDIRS:Ncam/scsi:Nnetatm/*}
52
53 # Define SHARED to indicate whether you want symbolic links to the system
54 # source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
55 # probably only useful for developers and should be avoided if you do not
56 # wish to tie your /usr/include and /usr/src together.
57 #SHARED=        symlinks
58 SHARED?=        copies
59
60 INCS+=  osreldate.h
61
62 osreldate.h:    ${.CURDIR}/../sys/conf/newvers.sh \
63                 ${.CURDIR}/../sys/sys/param.h
64         @${ECHO} creating osreldate.h from newvers.sh
65         setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
66         . ${.CURDIR}/../sys/conf/newvers.sh;                    \
67         echo "$$COPYRIGHT" > osreldate.h;                       \
68         echo "#ifdef _KERNEL" >> osreldate.h;                   \
69         echo '#error "osreldate.h must not be used in the kernel, use sys/param.h"' >> osreldate.h; \
70         echo "#else" >> osreldate.h;                            \
71         echo \#'undef __FreeBSD_version' >> osreldate.h;        \
72         echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
73         echo "#endif" >> osreldate.h
74
75 .for i in ${LHDRS}
76 INCSLINKS+=     sys/$i ${INCLUDEDIR}/$i
77 .endfor
78 .for i in ${MHDRS}
79 INCSLINKS+=     machine/$i ${INCLUDEDIR}/$i
80 .endfor
81 .for i in ${PHDRS}
82 INCSLINKS+=     emulation/posix4/$i ${INCLUDEDIR}/$i
83 .endfor
84 INCSLINKS+=     bus/cam ${INCLUDEDIR}/cam
85 INCSLINKS+=     vfs/msdosfs ${INCLUDEDIR}/msdosfs
86 INCSLINKS+=     vfs/nfs ${INCLUDEDIR}/nfs
87 INCSLINKS+=     vfs/ntfs ${INCLUDEDIR}/ntfs
88 INCSLINKS+=     vfs/nwfs ${INCLUDEDIR}/nwfs
89 INCSLINKS+=     vfs ${INCLUDEDIR}/fs
90 INCSLINKS+=     netproto/atalk ${INCLUDEDIR}/netatalk
91 INCSLINKS+=     netproto/atm ${INCLUDEDIR}/netatm
92 INCSLINKS+=     netproto/ipsec ${INCLUDEDIR}/netipsec
93 INCSLINKS+=     netproto/ipx ${INCLUDEDIR}/netipx
94 INCSLINKS+=     netproto/key ${INCLUDEDIR}/netkey
95 INCSLINKS+=     netproto/natm ${INCLUDEDIR}/netnatm
96 INCSLINKS+=     netproto/ncp ${INCLUDEDIR}/netncp
97 INCSLINKS+=     netproto/ns ${INCLUDEDIR}/netns
98 INCSLINKS+=     netproto/smb ${INCLUDEDIR}/netsmb
99 INCSLINKS+=     bus/pccard ${INCLUDEDIR}/pccard
100
101 copies:
102 .for i in ${LDIRS} ${LSYMSUBDIRS} machine crypto
103         if [ -h ${DESTDIR}/usr/include/$i ]; then \
104                 rm -f ${DESTDIR}/usr/include/$i; \
105         fi
106 .endfor
107         mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
108                 -p ${DESTDIR}/usr/include
109 .for i in ${LDIRS} ${LSUBDIRS}
110         cd ${.CURDIR}/../sys; \
111                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
112                 ${DESTDIR}/usr/include/$i
113 .endfor
114         cd ${.CURDIR}/../sys; \
115                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 opencrypto/*.h \
116                 ${DESTDIR}/usr/include/crypto
117 .if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
118         cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
119                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
120                 ${DESTDIR}/usr/include/machine
121 .if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
122         cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
123                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
124                 ${DESTDIR}/usr/include/machine/pc
125 .endif
126 .endif
127 .for i in ${SHDRS}
128         ln -sf ../sys/$i ${DESTDIR}/usr/include/machine/$i
129 .endfor
130
131 symlinks:
132         @${ECHO} "Setting up symlinks to kernel source tree..."
133 .for i in ${LDIRS}
134         rm -rf ${DESTDIR}/usr/include/$i
135         ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
136 .endfor
137         rm -rf ${DESTDIR}/usr/include/crypto
138         ln -s ../../sys/opencrypto ${DESTDIR}/usr/include/crypto
139 .for i in ${LSYMSUBDIRS}
140         rm -rf ${DESTDIR}/usr/include/$i
141         ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
142 .endfor
143         rm -rf ${DESTDIR}/usr/include/machine
144         ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
145
146 .include <bsd.prog.mk>
147
148 installincludes: ${SHARED}