Merge from vendor branch AWK:
[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.17 2004/03/24 17:39:51 drhodus 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 cpio.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 getopt.h glob.h grp.h histedit.h ieeefp.h ifaddrs.h \
16         iso646.h inttypes.h \
17         langinfo.h libgen.h limits.h link.h locale.h malloc.h memory.h \
18         mpool.h ndbm.h netdb.h nl_types.h nlist.h objformat.h \
19         paths.h pthread.h pthread_np.h pwd.h \
20         ranlib.h readpassphrase.h regex.h regexp.h resolv.h re_comp.h rmd160.h \
21         rune.h runetype.h search.h setjmp.h sgtty.h \
22         signal.h stab.h stdarg.h stdbool.h stddef.h stdint.h stdio.h stdlib.h \
23         string.h stringlist.h strings.h struct.h sysexits.h tar.h time.h \
24         timers.h ttyent.h unistd.h utime.h utmp.h vis.h wchar.h wctype.h
25
26 MHDRS=  float.h floatingpoint.h varargs.h
27
28 # posix4/aio.h conflicts with dysons and isn't installed:
29 PHDRS=  mqueue.h sched.h semaphore.h # aio.h
30
31 # Only for default SHARED=copies case
32 SHDRS=  soundcard.h joystick.h
33
34 LHDRS=  aio.h errno.h fcntl.h linker_set.h poll.h syslog.h \
35         termios.h ucontext.h
36
37 # directories which also contain header files that need to be coiped.
38 # Other directories, like 'bus' and 'netproto', are created using mtree.
39 #
40 # XXX allow these directories to not contain header files.
41 LDIRS=  net netgraph netinet netinet6 sys vm
42
43 # Subdirectories containing header files to copy.  In symlink mode 
44 # the subdirectory will be symlinked.  Care must be taken to adjust
45 # LSYMSUBDIRS below to remove subdirectories whos parent directories.
46 # If you make a mistake, part of your source tree might get overwritten
47 # when buildworld is run.
48 #
49 LSUBDIRS=       bus/cam bus/cam/scsi \
50         emulation/posix4 \
51         emulation/linux \
52         vfs/msdosfs vfs/nfs vfs/ntfs vfs/nwfs \
53         vfs/smbfs vfs/udf vfs/ufs \
54         net/vlan net/ipfw net/ip6fw net/dummynet net/sppp net/ip_mroute \
55         net/bridge net/tun net/ppp net/ppp_layer net/sl \
56         netgraph/UI netgraph/async netgraph/bpf netgraph/bridge \
57         netgraph/cisco netgraph/echo netgraph/eiface netgraph/etf \
58         netgraph/ether netgraph/fec netgraph/frame_relay netgraph/hole \
59         netgraph/iface netgraph/ksocket netgraph/l2tp netgraph/lmi \
60         netgraph/mppc netgraph/one2many netgraph/ppp \
61         netgraph/pppoe netgraph/pptpgre netgraph/rfc1490 netgraph/socket \
62         netgraph/tee netgraph/tty netgraph/vjc \
63         bus/cam bus/usb bus/pccard bus/pci bus/isa \
64         netproto/atalk netproto/atm netproto/ipsec netproto/ipx \
65         netproto/key netproto/natm netproto/ncp netproto/ns netproto/smb \
66         netproto/atm/ipatm netproto/atm/sigpvc netproto/atm/spans \
67         netproto/atm/uni
68
69 LSUBDIRS3= vfs/isofs/cd9660 net/i4b/include \
70         dev/misc/lpt dev/netif/wi
71
72 # For SHARED=symlinks, bus/cam and netproto/atm are symlinks, so cam/scsi
73 # and netproto/atm/* are taken care of
74 LSYMSUBDIRS=    ${LSUBDIRS:Nbus/cam/scsi:Nnetproto/atm/*:Nnet/*:Nnetgraph/*}
75 LSYMSUBDIRS3=   ${LSUBDIRS3:Nnet/*}
76
77 # For obsolete headers which need to be removed
78 RMHEADERS=      machine/ansi.h sys/inttypes.h
79
80 # Define SHARED to indicate whether you want symbolic links to the system
81 # source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
82 # probably only useful for developers and should be avoided if you do not
83 # wish to tie your /usr/include and /usr/src together.
84 #SHARED=        symlinks
85 SHARED?=        copies
86
87 INCS+=  osreldate.h
88
89 osreldate.h:    ${.CURDIR}/../sys/conf/newvers.sh \
90                 ${.CURDIR}/../sys/sys/param.h
91         @${ECHO} creating osreldate.h from newvers.sh
92         setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
93         . ${.CURDIR}/../sys/conf/newvers.sh;                    \
94         echo "$$COPYRIGHT" > osreldate.h;                       \
95         echo "#ifdef _KERNEL" >> osreldate.h;                   \
96         echo '#error "osreldate.h must not be used in the kernel, use sys/param.h"' >> osreldate.h; \
97         echo "#else" >> osreldate.h;                            \
98         echo "#undef __DragonFly_version" >> osreldate.h;       \
99         echo "#define __DragonFly_version $$RELDATE" >> osreldate.h; \
100         echo "#ifdef __FreeBSD__" >> osreldate.h;               \
101         echo "#undef __FreeBSD_version" >> osreldate.h; \
102         echo "#define __FreeBSD_version 480101" >> osreldate.h; \
103         echo "#endif" >> osreldate.h;                           \
104         echo "#endif" >> osreldate.h
105
106 .for i in ${LHDRS}
107 INCSLINKS+=     sys/$i ${INCLUDEDIR}/$i
108 .endfor
109 .for i in ${MHDRS}
110 INCSLINKS+=     machine/$i ${INCLUDEDIR}/$i
111 .endfor
112 .for i in ${PHDRS}
113 INCSLINKS+=     emulation/posix4/$i ${INCLUDEDIR}/$i
114 .endfor
115 INCSLINKS+=     bus/cam ${INCLUDEDIR}/cam
116 INCSLINKS+=     vfs/msdosfs ${INCLUDEDIR}/msdosfs
117 INCSLINKS+=     vfs/isofs ${INCLUDEDIR}/isofs
118 INCSLINKS+=     vfs/mfs ${INCLUDEDIR}/mfs
119 INCSLINKS+=     vfs/nfs ${INCLUDEDIR}/nfs
120 INCSLINKS+=     vfs/ntfs ${INCLUDEDIR}/ntfs
121 INCSLINKS+=     vfs/nwfs ${INCLUDEDIR}/nwfs
122 INCSLINKS+=     vfs ${INCLUDEDIR}/fs
123 # this is for <ufs/ufs/...> and <ufs/ffs/...> paths used by ports
124 # It is hopefully a temporary hack until we have environments working.
125 INCSLINKS+=     vfs ${INCLUDEDIR}/ufs
126 INCSLINKS+=     ufs ${INCLUDEDIR}/vfs/ffs
127 INCSLINKS+=     emulation ${INCLUDEDIR}/compat
128 INCSLINKS+=     netproto/atalk ${INCLUDEDIR}/netatalk
129 INCSLINKS+=     netproto/atm ${INCLUDEDIR}/netatm
130 INCSLINKS+=     netproto/ipsec ${INCLUDEDIR}/netipsec
131 INCSLINKS+=     netproto/ipx ${INCLUDEDIR}/netipx
132 INCSLINKS+=     netproto/key ${INCLUDEDIR}/netkey
133 INCSLINKS+=     netproto/natm ${INCLUDEDIR}/netnatm
134 INCSLINKS+=     netproto/ncp ${INCLUDEDIR}/netncp
135 INCSLINKS+=     netproto/ns ${INCLUDEDIR}/netns
136 INCSLINKS+=     netproto/smb ${INCLUDEDIR}/netsmb
137 INCSLINKS+=     bus/pccard ${INCLUDEDIR}/pccard
138
139 mtree_setup:
140 .for i in ${LDIRS} ${LSYMSUBDIRS} ${LSYMSUBDIRS3} machine crypto
141         if [ -h ${DESTDIR}/usr/include/$i ]; then \
142                 rm -f ${DESTDIR}/usr/include/$i; \
143         fi
144 .endfor
145         mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
146                 -p ${DESTDIR}/usr/include
147
148 copies:         mtree_setup
149 .for i in ${LDIRS} ${LSUBDIRS} ${LSUBDIRS3}
150         cd ${.CURDIR}/../sys; \
151                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
152                 ${DESTDIR}/usr/include/$i
153 .endfor
154         cd ${.CURDIR}/../sys; \
155                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 opencrypto/*.h \
156                 ${DESTDIR}/usr/include/crypto
157 .if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
158         cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
159                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
160                 ${DESTDIR}/usr/include/machine
161 .if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
162         cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
163                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
164                 ${DESTDIR}/usr/include/machine/pc
165 .endif
166 .endif
167 .if exists(${.CURDIR}/../sys/net/i4b/include/${MACHINE_ARCH})
168         cd ${.CURDIR}/../sys/net/i4b/include/${MACHINE_ARCH}; \
169                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
170                 ${DESTDIR}/usr/include/i4b_machine
171 .endif
172 .for i in ${SHDRS}
173         ln -sf ../sys/$i ${DESTDIR}/usr/include/machine/$i
174 .endfor
175 .for i in ${RMHEADERS}
176         rm -f ${DESTDIR}/usr/include/$i
177 .endfor
178
179 symlinks:       mtree_setup
180         @${ECHO} "Setting up symlinks to kernel source tree..."
181 .for i in ${LDIRS}
182         rm -rf ${DESTDIR}/usr/include/$i
183         ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
184 .endfor
185         rm -rf ${DESTDIR}/usr/include/crypto
186         ln -s ../../sys/opencrypto ${DESTDIR}/usr/include/crypto
187 .for i in ${LSYMSUBDIRS}
188         rm -rf ${DESTDIR}/usr/include/$i
189         ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
190 .endfor
191 .for i in ${LSYMSUBDIRS3}
192         rm -rf ${DESTDIR}/usr/include/$i
193         ln -s ../../../../sys/$i ${DESTDIR}/usr/include/$i
194 .endfor
195         rm -rf ${DESTDIR}/usr/include/machine
196         ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
197         rm -rf ${DESTDIR}/usr/include/i4b_machine
198         ln -s ../../sys/net/i4b/include/${MACHINE_ARCH} ${DESTDIR}/usr/include/i4b_machine
199
200 .include <bsd.prog.mk>
201
202 installincludes: ${SHARED}