1 # @(#)Makefile 8.2 (Berkeley) 1/4/94
4 # Doing a "make install" builds /usr/include.
10 CLEANFILES= osreldate.h version
11 SUBDIR= arpa protocols rpcsvc rpc xlocale
13 INCS= a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.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 \
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 \
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
32 .PATH: ${.CURDIR}/../contrib/libc-vis
35 MHDRS= float.h floatingpoint.h stdarg.h
37 PHDRS= sched.h _semaphore.h
39 LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \
42 LDIRS= bsm cam geom net net80211 netgraph netinet netinet6 \
43 netipsec netnatm netsmb nfs nfsclient nfsserver sys vm
45 LSUBDIRS= cam/ata cam/nvme cam/scsi \
46 dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \
47 dev/hwpmc dev/hyperv \
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 \
57 netgraph/atm netgraph/netflow \
60 security/mac_biba security/mac_bsdextended security/mac_lomac \
61 security/mac_mls security/mac_partition \
65 LSUBSUBDIRS= dev/mpt/mpilib
67 .if ${MK_BLUETOOTH} != "no"
68 LSUBSUBDIRS+= netgraph/bluetooth/include
71 .if ${MK_CUSE} != "no"
75 .if ${MK_GSSAPI} != "no"
80 .if ${MK_HESIOD} != "no"
84 # Handle the #define aliases for libiconv
85 .if ${MK_ICONV} == "yes"
93 .if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
94 _dev_powermac_nvram= dev/powermac_nvram
97 # Define SHARED to indicate whether you want symbolic links to the system
98 # source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is
99 # probably only useful for developers and should be avoided if you do not
100 # wish to tie your /usr/include and /usr/src together.
106 SYSDIR= ${.CURDIR}/../sys
107 NEWVERS_SH= ${SYSDIR}/conf/newvers.sh
108 PARAM_H= ${SYSDIR}/sys/param.h
109 MK_OSRELDATE_SH= ${.CURDIR}/mk-osreldate.sh
111 SYMLINKS+= ${LIBDIR:C,[^/]+,..,g:C,^/,,}${INCLUDEDIR} ${LIBDIR}/include
113 osreldate.h: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH}
114 env NEWVERS_SH=${NEWVERS_SH} PARAMFILE=${PARAM_H} SYSDIR=${SYSDIR} \
115 sh ${MK_OSRELDATE_SH}
118 INCSLINKS+= sys/$i ${INCLUDEDIR}/$i
121 INCSLINKS+= machine/$i ${INCLUDEDIR}/$i
124 INCSLINKS+= sys/$i ${INCLUDEDIR}/$i
127 .if ${MACHINE} != ${MACHINE_CPUARCH}
128 _MARCHS= ${MACHINE_CPUARCH}
130 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
134 META_TARGETS+= compat
135 stage_includes: ${SHARED}
137 # Take care of stale directory-level symlinks.
139 .for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
140 if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
141 rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
144 mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
145 -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
146 -p ${DESTDIR}${INCLUDEDIR} > /dev/null
149 .for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto machine machine/pc \
151 if [ -d ${DESTDIR}${INCLUDEDIR}/$i ]; then \
152 cd ${DESTDIR}${INCLUDEDIR}/$i; \
154 if [ -L $$h ]; then rm -f $$h; fi; \
158 .for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/hyperv:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS}
159 cd ${.CURDIR}/../sys; \
160 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
161 ${DESTDIR}${INCLUDEDIR}/$i
163 cd ${.CURDIR}/../sys/dev/acpica; \
164 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
165 ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
166 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \
167 ${DESTDIR}${INCLUDEDIR}/dev/acpica
168 cd ${.CURDIR}/../sys/dev/agp; \
169 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \
170 ${DESTDIR}${INCLUDEDIR}/dev/agp
171 cd ${.CURDIR}/../sys/dev/bktr; \
172 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
173 ${DESTDIR}${INCLUDEDIR}/dev/bktr
174 .if ${MK_NAND} != "no"
175 cd ${.CURDIR}/../sys/dev/nand; \
176 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
177 ${DESTDIR}${INCLUDEDIR}/dev/nand; \
178 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
179 ${DESTDIR}${INCLUDEDIR}/dev/nand
181 cd ${.CURDIR}/../sys/dev/evdev; \
182 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 input.h \
183 ${DESTDIR}${INCLUDEDIR}/dev/evdev; \
184 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 input-event-codes.h \
185 ${DESTDIR}${INCLUDEDIR}/dev/evdev; \
186 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 uinput.h \
187 ${DESTDIR}${INCLUDEDIR}/dev/evdev
188 cd ${.CURDIR}/../sys/dev/hyperv/utilities; \
189 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 hv_snapshot.h \
190 ${DESTDIR}${INCLUDEDIR}/dev/hyperv
191 cd ${.CURDIR}/../sys/dev/pci; \
192 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
193 ${DESTDIR}${INCLUDEDIR}/dev/pci
194 cd ${.CURDIR}/../sys/fs/cd9660/; \
195 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
196 ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
197 .if ${MK_IPFILTER} != "no"
198 cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
199 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
200 ${DESTDIR}${INCLUDEDIR}/netinet
203 cd ${.CURDIR}/../sys/netpfil/pf; \
204 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
205 ${DESTDIR}${INCLUDEDIR}/netpfil/pf
207 cd ${.CURDIR}/../sys/crypto; \
208 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
209 ${DESTDIR}${INCLUDEDIR}/crypto
210 cd ${.CURDIR}/../sys/opencrypto; \
211 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
212 ${DESTDIR}${INCLUDEDIR}/crypto
213 cd ${.CURDIR}/../sys/${MACHINE}/include; \
214 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
215 ${DESTDIR}${INCLUDEDIR}/machine
216 .if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
217 cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
218 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
219 ${DESTDIR}${INCLUDEDIR}/machine/pc
221 .for _MARCH in ${_MARCHS}
222 .if exists(${.CURDIR}/../sys/${_MARCH}/include)
223 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \
224 ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
225 cd ${.CURDIR}/../sys/${_MARCH}/include; \
226 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
227 ${DESTDIR}${INCLUDEDIR}/${_MARCH}
228 .if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
229 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \
230 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
231 cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
232 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
233 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
237 cd ${.CURDIR}/../sys/rpc; \
238 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
239 ${DESTDIR}${INCLUDEDIR}/rpc
240 cd ${.CURDIR}/../sys/teken; \
241 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \
242 ${DESTDIR}${INCLUDEDIR}/teken
243 .if ${MK_CDDL} != "no"
244 cd ${.CURDIR}/../cddl/contrib/opensolaris/lib/libzfs_core/common; \
245 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 libzfs_core.h \
246 ${DESTDIR}${INCLUDEDIR}
247 cd ${.CURDIR}/../cddl/contrib/opensolaris/lib/libnvpair; \
248 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 libnvpair.h \
249 ${DESTDIR}${INCLUDEDIR}
250 cd ${.CURDIR}/../sys/cddl/contrib/opensolaris/uts/common/sys; \
251 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nvpair.h \
252 ${DESTDIR}${INCLUDEDIR}/sys
255 symlinks: .PHONY .META
256 @${ECHO} "Setting up symlinks to kernel source tree..."
258 cd ${.CURDIR}/../sys/$i; \
260 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
263 .for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/hyperv:Ndev/nand:Ndev/pci}
264 cd ${.CURDIR}/../sys/$i; \
266 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
269 cd ${.CURDIR}/../sys/dev/acpica; \
270 for h in acpiio.h acpi_hpet.h; do \
271 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/acpica/$$h \
272 ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
274 cd ${.CURDIR}/../sys/dev/agp; \
275 for h in agpreg.h; do \
276 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/agp/$$h \
277 ${DESTDIR}${INCLUDEDIR}/dev/agp; \
279 cd ${.CURDIR}/../sys/dev/bktr; \
280 for h in ioctl_*.h; do \
281 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/bktr/$$h \
282 ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
284 .if ${MK_NAND} != "no"
285 cd ${.CURDIR}/../sys/dev/nand; \
286 for h in nandsim.h nand_dev.h; do \
287 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/nand/$$h \
288 ${DESTDIR}${INCLUDEDIR}/dev/nand; \
291 cd ${.CURDIR}/../sys/dev/evdev; \
292 for h in input.h input-event-codes.h uinput.h; do \
293 ln -fs ../../../../sys/dev/evdev/$$h \
294 ${DESTDIR}${INCLUDEDIR}/dev/evdev; \
296 cd ${.CURDIR}/../sys/dev/hyperv/utilities; \
297 for h in hv_snapshot.h; do \
298 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/hyperv/utilities/$$h \
299 ${DESTDIR}${INCLUDEDIR}/dev/hyperv; \
301 cd ${.CURDIR}/../sys/dev/pci; \
302 for h in pcireg.h; do \
303 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/pci/$$h \
304 ${DESTDIR}${INCLUDEDIR}/dev/pci; \
306 .for i in ${LSUBSUBDIRS}
307 cd ${.CURDIR}/../sys/$i; \
309 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
312 .if ${MK_IPFILTER} != "no"
313 cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
315 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/contrib/ipfilter/netinet/$$h \
316 ${DESTDIR}${INCLUDEDIR}/netinet; \
320 cd ${.CURDIR}/../sys/netpfil/pf; \
322 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/netpfil/pf/$$h \
323 ${DESTDIR}${INCLUDEDIR}/netpfil/pf; \
326 cd ${.CURDIR}/../sys/crypto; \
327 for h in rijndael/rijndael.h; do \
328 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/crypto/$$h \
329 ${DESTDIR}${INCLUDEDIR}/crypto; \
331 cd ${.CURDIR}/../sys/opencrypto; \
333 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/opencrypto/$$h \
334 ${DESTDIR}${INCLUDEDIR}/crypto; \
336 cd ${.CURDIR}/../sys/${MACHINE}/include; \
338 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/${MACHINE}/include/$$h \
339 ${DESTDIR}${INCLUDEDIR}/machine; \
341 .if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
342 cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
344 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/${MACHINE}/include/pc/$$h \
345 ${DESTDIR}${INCLUDEDIR}/machine/pc; \
348 .for _MARCH in ${_MARCHS}
349 .if exists(${.CURDIR}/../sys/${_MARCH}/include)
350 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \
351 ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
352 cd ${.CURDIR}/../sys/${_MARCH}/include; \
354 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/${_MARCH}/include/$$h \
355 ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
357 .if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
358 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \
359 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
360 cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
362 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/${_MARCH}/include/pc/$$h \
363 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
368 cd ${.CURDIR}/../sys/fs/cd9660; \
370 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/fs/cd9660/$$h \
371 ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
373 cd ${.CURDIR}/../sys/rpc; \
374 for h in types.h; do \
375 ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/rpc/$$h \
376 ${DESTDIR}${INCLUDEDIR}/rpc; \
379 .include <bsd.prog.mk>
381 installincludes: ${SHARED}
384 .if ${MACHINE} == "host" && !defined(_SKIP_BUILD)
385 # we're here because we are building a sysroot...
386 # we need MACHINE et al set correctly
387 HOST_MACHINE!= uname -m
388 HOST_MACHINE_ARCH!= uname -p
389 MACHINE:= ${HOST_MACHINE}
390 MACHINE_ARCH:= ${HOST_MACHINE_ARCH}