]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/Makefile
MFH
[FreeBSD/FreeBSD.git] / include / Makefile
1 #       @(#)Makefile    8.2 (Berkeley) 1/4/94
2 # $FreeBSD$
3 #
4 # Doing a "make install" builds /usr/include.
5
6 .include <src.opts.mk>
7
8 PACKAGE=runtime
9 TAGS+=  development
10 CLEANFILES= osreldate.h version
11 SUBDIR= arpa protocols rpcsvc rpc xlocale
12 SUBDIR_PARALLEL=
13 INCS=   a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
14         db.h \
15         dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
16         fts.h ftw.h getopt.h glob.h grp.h \
17         ieeefp.h ifaddrs.h \
18         inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
19         locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \
20         ndbm.h netconfig.h \
21         netdb.h nl_types.h nlist.h nss.h nsswitch.h paths.h \
22         printf.h proc_service.h pthread.h \
23         pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h \
24         res_update.h resolv.h runetype.h search.h semaphore.h setjmp.h \
25         signal.h spawn.h stab.h stdalign.h stdbool.h stddef.h \
26         stdnoreturn.h stdio.h stdlib.h string.h stringlist.h \
27         strings.h sysexits.h tar.h termios.h tgmath.h \
28         time.h timeconv.h timers.h ttyent.h \
29         uchar.h ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h \
30         wchar.h wctype.h wordexp.h xlocale.h
31
32 .PATH: ${.CURDIR}/../contrib/libc-vis
33 INCS+=  vis.h
34
35 MHDRS=  float.h floatingpoint.h stdarg.h
36
37 PHDRS=  sched.h _semaphore.h
38
39 LHDRS=  aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \
40         syslog.h ucontext.h
41
42 LDIRS=  bsm cam geom net net80211 netgraph netinet netinet6 \
43         netipsec netnatm netsmb nfs nfsclient nfsserver sys vm
44
45 LSUBDIRS=       cam/ata cam/scsi \
46         dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \
47         dev/hwpmc \
48         dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/nvme \
49         dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \
50         dev/speaker dev/utopia dev/vkbd dev/wi \
51         fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \
52         fs/procfs fs/smbfs fs/udf fs/unionfs \
53         geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \
54         geom/mirror geom/mountver geom/multipath geom/nop \
55         geom/raid geom/raid3 geom/shsec geom/stripe geom/virstor \
56         net/altq \
57         netgraph/atm netgraph/netflow \
58         netinet/cc \
59         security/audit \
60         security/mac_biba security/mac_bsdextended security/mac_lomac \
61         security/mac_mls security/mac_partition \
62         ufs/ffs ufs/ufs
63
64 LSUBSUBDIRS=    dev/mpt/mpilib
65
66 .if ${MK_BLUETOOTH} != "no"
67 LSUBSUBDIRS+=   netgraph/bluetooth/include
68 .endif
69
70 .if ${MK_CUSE} != "no"
71 LSUBDIRS+=      fs/cuse
72 .endif
73
74 .if ${MK_GSSAPI} != "no"
75 SUBDIR+=        gssapi
76 INCS+=          gssapi.h
77 .endif
78
79 .if ${MK_HESIOD} != "no"
80 INCS+=  hesiod.h
81 .endif
82
83 # Handle the #define aliases for libiconv
84 .if ${MK_ICONV} == "yes"
85 INCS+=          iconv.h
86 .endif
87
88 .if ${MK_USB} != "no"
89 LSUBDIRS+=      dev/usb
90 .endif
91
92 .if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
93 _dev_powermac_nvram=    dev/powermac_nvram
94 .endif
95
96 # Define SHARED to indicate whether you want symbolic links to the system
97 # source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
98 # probably only useful for developers and should be avoided if you do not
99 # wish to tie your /usr/include and /usr/src together.
100 #SHARED=        symlinks
101 SHARED?=        copies
102
103 INCS+=  osreldate.h
104
105 SYSDIR=                 ${.CURDIR}/../sys
106 NEWVERS_SH=             ${SYSDIR}/conf/newvers.sh
107 PARAM_H=                ${SYSDIR}/sys/param.h
108 MK_OSRELDATE_SH=        ${.CURDIR}/mk-osreldate.sh
109
110 SYMLINKS+= ${INCLUDEDIR} ${LIBDIR}/include
111
112 osreldate.h: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH}
113         env NEWVERS_SH=${NEWVERS_SH} PARAMFILE=${PARAM_H} SYSDIR=${SYSDIR} \
114             sh ${MK_OSRELDATE_SH}
115
116 .for i in ${LHDRS}
117 INCSLINKS+=     sys/$i ${INCLUDEDIR}/$i
118 .endfor
119 .for i in ${MHDRS}
120 INCSLINKS+=     machine/$i ${INCLUDEDIR}/$i
121 .endfor
122 .for i in ${PHDRS}
123 INCSLINKS+=     sys/$i ${INCLUDEDIR}/$i
124 .endfor
125
126 .if ${MACHINE} != ${MACHINE_CPUARCH}
127 _MARCHS=        ${MACHINE_CPUARCH}
128 .endif
129 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
130 _MARCHS+=       x86
131 .endif
132
133 .if ${MK_STAGING} == "yes"
134 # tell bsd.incs.mk that we have it covered
135 NO_STAGE_INCLUDES=
136 .endif
137
138 .include <bsd.prog.mk>
139
140 .if ${MK_STAGING} != "no" && !defined(_SKIP_BUILD)
141 .if make(all)
142 DESTDIR= ${STAGE_OBJTOP}
143
144 all:    stage_include
145 installincludes: buildincludes
146 buildincludes: stage_prep
147
148 stage_prep:
149         @mkdir -p ${DESTDIR}${INCLUDEDIR}
150         @touch $@
151
152 stage_include: .dirdep installincludes
153         @touch $@
154 .endif
155 .endif
156
157 installincludes: ${SHARED}
158 ${SHARED}: compat
159
160 # Take care of stale directory-level symlinks.
161 compat:
162 .for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
163         if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
164                 rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
165         fi
166 .endfor
167         mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
168             -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
169             -p ${DESTDIR}${INCLUDEDIR} > /dev/null
170 .if ${MK_DIRDEPS_BUILD} == "yes"
171         @touch ${.TARGET}
172 .endif
173
174 copies:
175 .for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto machine machine/pc \
176         ${_MARCHS}
177         if [ -d ${DESTDIR}${INCLUDEDIR}/$i ]; then \
178                 cd ${DESTDIR}${INCLUDEDIR}/$i; \
179                 for h in *.h; do \
180                         if [ -L $$h ]; then rm -f $$h; fi; \
181                 done; \
182         fi
183 .endfor
184 .for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS}
185         cd ${.CURDIR}/../sys; \
186         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
187             ${DESTDIR}${INCLUDEDIR}/$i
188 .endfor
189         cd ${.CURDIR}/../sys/dev/acpica; \
190         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
191             ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
192         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \
193             ${DESTDIR}${INCLUDEDIR}/dev/acpica
194         cd ${.CURDIR}/../sys/dev/agp; \
195         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \
196             ${DESTDIR}${INCLUDEDIR}/dev/agp
197         cd ${.CURDIR}/../sys/dev/bktr; \
198         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
199             ${DESTDIR}${INCLUDEDIR}/dev/bktr
200 .if ${MK_NAND} != "no"
201         cd ${.CURDIR}/../sys/dev/nand; \
202         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
203             ${DESTDIR}${INCLUDEDIR}/dev/nand; \
204         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
205             ${DESTDIR}${INCLUDEDIR}/dev/nand
206 .endif
207         cd ${.CURDIR}/../sys/dev/pci; \
208         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
209             ${DESTDIR}${INCLUDEDIR}/dev/pci
210         cd ${.CURDIR}/../sys/fs/cd9660/; \
211         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
212             ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
213 .if ${MK_IPFILTER} != "no"
214         cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
215         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
216             ${DESTDIR}${INCLUDEDIR}/netinet
217 .endif
218 .if ${MK_PF} != "no"
219         cd ${.CURDIR}/../sys/netpfil/pf; \
220         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
221             ${DESTDIR}${INCLUDEDIR}/netpfil/pf
222 .endif
223         cd ${.CURDIR}/../sys/crypto; \
224         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
225             ${DESTDIR}${INCLUDEDIR}/crypto
226         cd ${.CURDIR}/../sys/opencrypto; \
227         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
228             ${DESTDIR}${INCLUDEDIR}/crypto
229         cd ${.CURDIR}/../sys/${MACHINE}/include; \
230         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
231             ${DESTDIR}${INCLUDEDIR}/machine
232 .if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
233         cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
234         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
235             ${DESTDIR}${INCLUDEDIR}/machine/pc
236 .endif
237 .for _MARCH in ${_MARCHS}
238 .if exists(${.CURDIR}/../sys/${_MARCH}/include)
239         ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \
240             ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
241         cd ${.CURDIR}/../sys/${_MARCH}/include; \
242         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
243             ${DESTDIR}${INCLUDEDIR}/${_MARCH}
244 .if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
245         ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \
246             ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
247         cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
248         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
249             ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
250 .endif
251 .endif
252 .endfor
253         cd ${.CURDIR}/../sys/rpc; \
254         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
255             ${DESTDIR}${INCLUDEDIR}/rpc
256         cd ${.CURDIR}/../sys/teken; \
257         ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \
258             ${DESTDIR}${INCLUDEDIR}/teken
259 .if ${MK_DIRDEPS_BUILD} == "yes"
260         @touch ${.OBJDIR}/${.TARGET}
261 .endif
262
263 symlinks:
264         @${ECHO} "Setting up symlinks to kernel source tree..."
265 .for i in ${LDIRS}
266         cd ${.CURDIR}/../sys/$i; \
267         for h in *.h; do \
268                 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
269         done
270 .endfor
271 .for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci}
272         cd ${.CURDIR}/../sys/$i; \
273         for h in *.h; do \
274                 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
275         done
276 .endfor
277         cd ${.CURDIR}/../sys/dev/acpica; \
278         for h in acpiio.h acpi_hpet.h; do \
279                 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/acpica/$$h \
280                     ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
281         done
282         cd ${.CURDIR}/../sys/dev/agp; \
283         for h in agpreg.h; do \
284                 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/agp/$$h \
285                     ${DESTDIR}${INCLUDEDIR}/dev/agp; \
286         done
287         cd ${.CURDIR}/../sys/dev/bktr; \
288         for h in ioctl_*.h; do \
289                 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/bktr/$$h \
290                     ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
291         done
292 .if ${MK_NAND} != "no"
293         cd ${.CURDIR}/../sys/dev/nand; \
294         for h in nandsim.h nand_dev.h; do \
295                 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/nand/$$h \
296                     ${DESTDIR}${INCLUDEDIR}/dev/nand; \
297         done
298 .endif
299         cd ${.CURDIR}/../sys/dev/pci; \
300         for h in pcireg.h; do \
301                 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/pci/$$h \
302                     ${DESTDIR}${INCLUDEDIR}/dev/pci; \
303         done
304 .for i in ${LSUBSUBDIRS}
305         cd ${.CURDIR}/../sys/$i; \
306         for h in *.h; do \
307                 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
308         done
309 .endfor
310 .if ${MK_IPFILTER} != "no"
311         cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
312         for h in *.h; do \
313                 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/contrib/ipfilter/netinet/$$h \
314                     ${DESTDIR}${INCLUDEDIR}/netinet; \
315         done
316 .endif
317 .if ${MK_PF} != "no"
318         cd ${.CURDIR}/../sys/netpfil/pf; \
319         for h in *.h; do \
320                 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/netpfil/pf/$$h \
321                     ${DESTDIR}${INCLUDEDIR}/netpfil/pf; \
322         done
323 .endif
324         cd ${.CURDIR}/../sys/crypto; \
325         for h in rijndael/rijndael.h; do \
326                 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/crypto/$$h \
327                     ${DESTDIR}${INCLUDEDIR}/crypto; \
328         done
329         cd ${.CURDIR}/../sys/opencrypto; \
330         for h in *.h; do \
331                 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/opencrypto/$$h \
332                     ${DESTDIR}${INCLUDEDIR}/crypto; \
333         done
334         cd ${.CURDIR}/../sys/${MACHINE}/include; \
335         for h in *.h; do \
336                 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/${MACHINE}/include/$$h \
337                     ${DESTDIR}${INCLUDEDIR}/machine; \
338         done
339 .if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
340         cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
341         for h in *.h; do \
342                 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/${MACHINE}/include/pc/$$h \
343                     ${DESTDIR}${INCLUDEDIR}/machine/pc; \
344         done
345 .endif
346 .for _MARCH in ${_MARCHS}
347 .if exists(${.CURDIR}/../sys/${_MARCH}/include)
348         ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \
349             ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
350         cd ${.CURDIR}/../sys/${_MARCH}/include; \
351         for h in *.h; do \
352                 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/${_MARCH}/include/$$h \
353                     ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
354         done
355 .if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
356         ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \
357             ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
358         cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
359         for h in *.h; do \
360                 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/${_MARCH}/include/pc/$$h \
361                     ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
362         done
363 .endif
364 .endif
365 .endfor
366         cd ${.CURDIR}/../sys/fs/cd9660; \
367         for h in *.h; do \
368                 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/fs/cd9660/$$h \
369                     ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
370         done
371         cd ${.CURDIR}/../sys/rpc; \
372         for h in types.h; do \
373                 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/rpc/$$h \
374                     ${DESTDIR}${INCLUDEDIR}/rpc; \
375         done
376 .if ${MK_DIRDEPS_BUILD} == "yes"
377         @touch ${.OBJDIR}/${.TARGET}
378 .endif
379
380 .if ${MACHINE} == "host" && !defined(_SKIP_BUILD)
381 # we're here because we are building a sysroot...
382 # we need MACHINE et al set correctly
383 HOST_MACHINE!= uname -m
384 HOST_MACHINE_ARCH!= uname -p
385 MACHINE:= ${HOST_MACHINE}
386 MACHINE_ARCH:= ${HOST_MACHINE_ARCH}
387 .endif