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