Merge branch 'vendor/BMAKE'
[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 #
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
9 CLEANFILES= osreldate.h version vers.c vers.txt
10 SUBDIR= arpa protocols rpc rpcsvc xlocale
11 INCS=   a.out.h ar.h assert.h bitstring.h cpio.h ctype.h db.h \
12         dirent.h disktab.h \
13         dlfcn.h elf.h elf-hints.h err.h float.h fmtmsg.h fnmatch.h fstab.h \
14         fts.h ftw.h getopt.h glob.h grp.h histedit.h \
15         iconv.h ieeefp.h ifaddrs.h iso646.h inttypes.h \
16         langinfo.h libgen.h limits.h link.h locale.h malloc.h memory.h \
17         mntopts.h mpool.h mqueue.h monetary.h ndbm.h netconfig.h \
18         netdb.h nl_types.h nlist.h nss.h nsswitch.h objformat.h \
19         paths.h printf.h pthread.h pthread_np.h pwd.h \
20         ranlib.h readpassphrase.h regex.h \
21         res_update.h resolv.h re_comp.h rmd160.h \
22         runetype.h search.h setjmp.h sgtty.h \
23         signal.h spawn.h stab.h stdarg.h stdbool.h \
24         stddef.h stdint.h stdio.h stdlib.h \
25         string.h stringlist.h strings.h struct.h sysexits.h \
26         tar.h tgmath.h time.h \
27         timeconv.h \
28         timers.h ttyent.h tzfile.h \
29         uchar.h unistd.h ulimit.h utime.h utmp.h utmpx.h \
30         uuid.h vis.h \
31         wchar.h wctype.h wordexp.h xlocale.h
32
33 .if defined(WANT_HESIOD)
34 INCS+=  hesiod.h
35 .endif
36
37 MHDRS=  varargs.h
38
39 # Only for default SHARED=copies case
40 SHDRS=  soundcard.h joystick.h
41
42 LHDRS=  aio.h errno.h fcntl.h linker_set.h poll.h sched.h \
43         semaphore.h syslog.h termios.h ucontext.h
44
45 # directories which also contain header files that need to be copied.
46 # Other directories, like 'bus' and 'netproto', are created using mtree.
47 #
48 # XXX allow these directories to not contain header files.
49 LDIRS=  net netbt netgraph netgraph7 netinet netinet6 sys vm
50
51 # Subdirectories containing header files to copy.  In symlink mode 
52 # the subdirectory will be symlinked.  Care must be taken to adjust
53 # LSYMSUBDIRS below to remove subdirectories whos parent directories.
54 # If you make a mistake, part of your source tree might get overwritten
55 # when buildworld is run.
56 #
57 LSUBDIRS=       bus/cam bus/cam/scsi \
58         emulation/linux \
59         gnu/vfs/ext2fs \
60         vfs/msdosfs vfs/nfs vfs/ntfs vfs/nwfs \
61         vfs/smbfs vfs/udf vfs/ufs vfs/hammer vfs/hammer2 \
62         net/vlan net/ipfw net/ip6fw net/dummynet net/sppp net/ip_mroute \
63         net/bridge net/tap net/tun net/ppp net/ppp_layer net/sl \
64         net/pf net/altq \
65         netgraph/UI netgraph/async netgraph/bpf netgraph/bridge \
66         netgraph/cisco netgraph/echo netgraph/eiface netgraph/etf \
67         netgraph/ether netgraph/fec netgraph/frame_relay netgraph/hole \
68         netgraph/iface netgraph/ksocket netgraph/l2tp netgraph/lmi \
69         netgraph/mppc netgraph/one2many netgraph/ppp \
70         netgraph/pppoe netgraph/pptpgre netgraph/rfc1490 netgraph/socket \
71         netgraph/tee netgraph/tty netgraph/vjc \
72         netgraph7/UI netgraph7/async netgraph7/atmllc netgraph7/bpf \
73         netgraph7/bridge netgraph7/cisco netgraph7/deflate netgraph7/echo \
74         netgraph7/etf netgraph7/ether netgraph7/frame_relay netgraph7/hole \
75         netgraph7/hub \
76         netgraph7/iface netgraph7/ksocket netgraph7/l2tp netgraph7/lmi \
77         netgraph7/mppc netgraph7/one2many netgraph7/ppp netgraph7/pppoe \
78         netgraph7/pptpgre netgraph7/rfc1490 netgraph7/socket \
79         netgraph7/tcpmss netgraph7/tee netgraph7/tty netgraph7/vjc \
80         bus/cam bus/pccard bus/pci bus/isa bus/ppbus bus/smbus \
81         netproto/atm netproto/ipsec netproto/ipx \
82         netproto/key netproto/natm netproto/ncp netproto/smb \
83         netproto/atm/ipatm netproto/atm/sigpvc netproto/atm/spans \
84         netproto/atm/uni netproto/802_11 netproto/mpls \
85         vfs/isofs/cd9660 vfs/puffs \
86         dev/disk/mpt/mpilib \
87         dev/disk/dm \
88         dev/misc/lpt dev/misc/ppi dev/misc/putter \
89         dev/netif/wi \
90         dev/raid/ciss dev/raid/mfi \
91         dev/video/bktr dev/video/meteor libprop
92
93 .if defined(WANT_USB4BSD)
94 LSUBDIRS+=      bus/u4b
95 .else
96 LSUBDIRS+=      bus/usb
97 .endif
98
99 # For SHARED=symlinks, bus/cam and netproto/atm are symlinks, so cam/scsi
100 # and netproto/atm/* are taken care of
101 LSYMSUBDIRS=    ${LSUBDIRS:Nbus/cam/scsi:Nnetproto/atm/*:Nnet/*:Nnetgraph/*:Nnetgraph7/*}
102
103 # For obsolete headers which need to be removed
104 RMHEADERS=      machine/ansi.h sys/inttypes.h
105
106 # Define SHARED to indicate whether you want symbolic links to the system
107 # source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
108 # probably only useful for developers and should be avoided if you do not
109 # wish to tie your /usr/include and /usr/src together.
110 #SHARED=        symlinks
111 SHARED?=        copies
112
113 INCS+=  osreldate.h
114
115 osreldate.h:    ${.CURDIR}/../sys/conf/newvers.sh \
116                 ${.CURDIR}/../sys/sys/param.h
117         @${ECHO} creating osreldate.h from newvers.sh
118         setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
119         . ${.CURDIR}/../sys/conf/newvers.sh;                    \
120         echo "$$COPYRIGHT" > osreldate.h;                       \
121         echo "#ifdef _KERNEL" >> osreldate.h;                   \
122         echo '#error "osreldate.h must not be used in the kernel, use sys/param.h"' >> osreldate.h; \
123         echo "#else" >> osreldate.h;                            \
124         echo "#undef __DragonFly_version" >> osreldate.h;       \
125         echo "#define __DragonFly_version $$RELDATE" >> osreldate.h; \
126         echo "#endif" >> osreldate.h
127
128 .for i in ${LHDRS}
129 INCSLINKS+=     sys/$i ${INCLUDEDIR}/$i
130 .endfor
131 .for i in ${MHDRS}
132 INCSLINKS+=     machine/$i ${INCLUDEDIR}/$i
133 .endfor
134 INCSLINKS+=     bus/cam ${INCLUDEDIR}/cam
135 INCSLINKS+=     vfs/msdosfs ${INCLUDEDIR}/msdosfs
136 INCSLINKS+=     vfs/isofs ${INCLUDEDIR}/isofs
137 INCSLINKS+=     vfs/mfs ${INCLUDEDIR}/mfs
138 INCSLINKS+=     vfs/nfs ${INCLUDEDIR}/nfs
139 INCSLINKS+=     vfs/ntfs ${INCLUDEDIR}/ntfs
140 INCSLINKS+=     vfs/nwfs ${INCLUDEDIR}/nwfs
141 INCSLINKS+=     vfs ${INCLUDEDIR}/fs
142 # this is for <ufs/ufs/...> and <ufs/ffs/...> paths used by ports
143 # It is hopefully a temporary hack until we have environments working.
144 INCSLINKS+=     vfs ${INCLUDEDIR}/ufs
145 INCSLINKS+=     ufs ${INCLUDEDIR}/vfs/ffs
146 INCSLINKS+=     emulation ${INCLUDEDIR}/compat
147 INCSLINKS+=     netproto/atm ${INCLUDEDIR}/netatm
148 INCSLINKS+=     netproto/ipsec ${INCLUDEDIR}/netipsec
149 INCSLINKS+=     netproto/ipx ${INCLUDEDIR}/netipx
150 INCSLINKS+=     netproto/key ${INCLUDEDIR}/netkey
151 INCSLINKS+=     netproto/natm ${INCLUDEDIR}/netnatm
152 INCSLINKS+=     netproto/ncp ${INCLUDEDIR}/netncp
153 INCSLINKS+=     netproto/smb ${INCLUDEDIR}/netsmb
154 INCSLINKS+=     bus/pccard ${INCLUDEDIR}/pccard
155 # Some 3rd party software looks for <floatingpoint.h>
156 INCSLINKS+=     ieeefp.h ${INCLUDEDIR}/floatingpoint.h
157
158 # NOTE!
159 #
160 # machine/ header files come from the platform architecture and
161 # cpu/ header files come from the cpu architecture.  All code outside
162 # of the machine header files ALWAYS #include's <machine/blah.h>.  So
163 # if the platform architecture is missing a header file we have to 
164 # copy it in from the cpu architecture.  This way we do not have to
165 # create dozens of pure forwarding headers for files that platform
166 # architecture does not need to enhance.
167
168 mtree_setup:
169 .for i in ${LDIRS} ${LSYMSUBDIRS} machine cpu crypto dev/acpica
170         if [ -h ${DESTDIR}/usr/include/$i ]; then \
171                 rm -f ${DESTDIR}/usr/include/$i; \
172         fi
173 .endfor
174         mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
175                 -p ${DESTDIR}/usr/include
176
177 copies:         mtree_setup
178 .for i in ${LDIRS} ${LSUBDIRS}
179         cd ${.CURDIR}/../sys; \
180                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
181                 ${DESTDIR}/usr/include/$i
182 .endfor
183         cd ${.CURDIR}/../sys; \
184                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 crypto/rijndael/rijndael.h \
185                 ${DESTDIR}/usr/include/crypto; \
186                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 opencrypto/*.h \
187                 ${DESTDIR}/usr/include/crypto
188         cd ${.CURDIR}/../sys/dev/acpica; \
189                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
190                 ${DESTDIR}/usr/include/dev/acpica
191 .if exists(${.CURDIR}/../sys/cpu/${MACHINE_ARCH}/include)
192         cd ${.CURDIR}/../sys/cpu/${MACHINE_ARCH}/include; \
193                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
194                 ${DESTDIR}/usr/include/cpu
195         # XXX this will cause quickworld to rebuild more junk
196         # then it needs to.
197         cpdup -o ${DESTDIR}/usr/include/cpu ${DESTDIR}/usr/include/machine
198 .endif
199 .if exists(${.CURDIR}/../sys/platform/${MACHINE_PLATFORM}/include)
200         cd ${.CURDIR}/../sys/platform/${MACHINE_PLATFORM}/include; \
201                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
202                 ${DESTDIR}/usr/include/machine
203 .if exists(${.CURDIR}/../sys/platform/${MACHINE_PLATFORM}/include/pc)
204         cd ${.CURDIR}/../sys/platform/${MACHINE_PLATFORM}/include/pc; \
205                 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
206                 ${DESTDIR}/usr/include/machine/pc
207 .endif
208 .endif
209 .for i in ${SHDRS}
210         ${LN} -sf ../sys/$i ${DESTDIR}/usr/include/machine/$i
211 .endfor
212 .for i in ${RMHEADERS}
213         rm -f ${DESTDIR}/usr/include/$i
214 .endfor
215
216 symlinks:       mtree_setup
217         @${ECHO} "Setting up symlinks to kernel source tree..."
218 .for i in ${LDIRS}
219         rm -rf ${DESTDIR}/usr/include/$i
220         ${LN} -s ../../sys/$i ${DESTDIR}/usr/include/$i
221 .endfor
222         rm -rf ${DESTDIR}/usr/include/crypto
223         ${LN} -s ../../sys/opencrypto ${DESTDIR}/usr/include/crypto
224 .for i in ${LSYMSUBDIRS}
225         rm -rf ${DESTDIR}/usr/include/$i
226         ${LN} -s ${i:C;[^/]+/?;../;g}../sys/$i ${DESTDIR}/usr/include/$i
227 .endfor
228         rm -rf ${DESTDIR}/usr/include/cpu
229         ${LN} -s ../../sys/cpu/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/cpu
230         rm -rf ${DESTDIR}/usr/include/machine
231         cpdup ${.CURDIR}/../sys/cpu/${MACHINE_ARCH}/include \
232                 ${DESTDIR}/usr/include/machine
233         cpdup -o ${.CURDIR}/../sys/platform/${MACHINE_PLATFORM}/include \
234                 ${DESTDIR}/usr/include/machine
235
236 .include <bsd.prog.mk>
237
238 installincludes: ${SHARED}