kernel tree reorganization stage 1: Major cvs repository work (not logged as
[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.2 2003/06/17 04:25:56 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=  cam msdosfs net netatalk netatm netgraph netinet netinet6 netipsec \
37         netipx netkey netnatm netncp netns netsmb nfs ntfs nwfs pccard posix4 \
38         sys vm
39
40 LSUBDIRS=       cam/scsi dev/an dev/firewire dev/ppbus dev/usb dev/wi \
41         fs/smbfs isofs/cd9660 \
42         netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
43         ufs/ffs ufs/mfs ufs/ufs
44
45 # For SHARED=symlinks, cam and netatm are symlinks, so cam/scsi and netatm/*
46 # are taken care of
47 LSYMSUBDIRS=    ${LSUBDIRS:Ncam/scsi:Nnetatm/*}
48
49 # Define SHARED to indicate whether you want symbolic links to the system
50 # source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
51 # probably only useful for developers and should be avoided if you do not
52 # wish to tie your /usr/include and /usr/src together.
53 #SHARED=        symlinks
54 SHARED?=        copies
55
56 INCS+=  osreldate.h
57
58 osreldate.h:    ${.CURDIR}/../sys/conf/newvers.sh \
59                 ${.CURDIR}/../sys/sys/param.h
60         @${ECHO} creating osreldate.h from newvers.sh
61         setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
62         . ${.CURDIR}/../sys/conf/newvers.sh;                    \
63         echo "$$COPYRIGHT" > osreldate.h;                       \
64         echo "#ifdef _KERNEL" >> osreldate.h;                   \
65         echo '#error "osreldate.h must not be used in the kernel, use sys/param.h"' >> osreldate.h; \
66         echo "#else" >> osreldate.h;                            \
67         echo \#'undef __FreeBSD_version' >> osreldate.h;        \
68         echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
69         echo "#endif" >> osreldate.h
70
71 .for i in ${LHDRS}
72 INCSLINKS+=     sys/$i ${INCLUDEDIR}/$i
73 .endfor
74 .for i in ${MHDRS}
75 INCSLINKS+=     machine/$i ${INCLUDEDIR}/$i
76 .endfor
77 .for i in ${PHDRS}
78 INCSLINKS+=     posix4/$i ${INCLUDEDIR}/$i
79 .endfor
80
81 copies:
82 .for i in ${LDIRS} ${LSYMSUBDIRS} machine crypto
83         if [ -h ${DESTDIR}/usr/include/$i ]; then \
84                 rm -f ${DESTDIR}/usr/include/$i; \
85         fi
86 .endfor
87         mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
88                 -p ${DESTDIR}/usr/include
89 .for i in ${LDIRS} ${LSUBDIRS}
90         cd ${.CURDIR}/../sys; \
91                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
92                 ${DESTDIR}/usr/include/$i
93 .endfor
94         cd ${.CURDIR}/../sys; \
95                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 opencrypto/*.h \
96                 ${DESTDIR}/usr/include/crypto
97 .if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
98         cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
99                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
100                 ${DESTDIR}/usr/include/machine
101 .if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
102         cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
103                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
104                 ${DESTDIR}/usr/include/machine/pc
105 .endif
106 .endif
107 .for i in ${SHDRS}
108         ln -sf ../sys/$i ${DESTDIR}/usr/include/machine/$i
109 .endfor
110
111 symlinks:
112         @${ECHO} "Setting up symlinks to kernel source tree..."
113 .for i in ${LDIRS}
114         rm -rf ${DESTDIR}/usr/include/$i
115         ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
116 .endfor
117         rm -rf ${DESTDIR}/usr/include/crypto
118         ln -s ../../sys/opencrypto ${DESTDIR}/usr/include/crypto
119 .for i in ${LSYMSUBDIRS}
120         rm -rf ${DESTDIR}/usr/include/$i
121         ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
122 .endfor
123         rm -rf ${DESTDIR}/usr/include/machine
124         ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
125
126 .include <bsd.prog.mk>
127
128 installincludes: ${SHARED}