Makefile revision 291310
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 291310 2015-11-25 19:10:59Z bdrewery $
3#
4# Doing a "make install" builds /usr/include.
5
6.include <src.opts.mk>
7
8CLEANFILES= osreldate.h version
9SUBDIR= arpa protocols rpcsvc rpc xlocale
10SUBDIR_PARALLEL=
11INCS=	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
31INCS+=	vis.h
32
33MHDRS=	float.h floatingpoint.h stdarg.h
34
35PHDRS=	sched.h _semaphore.h
36
37LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \
38	syslog.h ucontext.h
39
40LDIRS=	bsm cam geom net net80211 netgraph netinet netinet6 \
41	netipsec netnatm netsmb nfs nfsclient nfsserver sys vm
42
43LSUBDIRS=	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	security/audit \
57	security/mac_biba security/mac_bsdextended security/mac_lomac \
58	security/mac_mls security/mac_partition \
59	ufs/ffs ufs/ufs
60
61LSUBSUBDIRS=	dev/mpt/mpilib
62
63.if ${MK_BLUETOOTH} != "no"
64LSUBSUBDIRS+=	netgraph/bluetooth/include
65.endif
66
67.if ${MK_CUSE} != "no"
68LSUBDIRS+=	fs/cuse
69.endif
70
71.if ${MK_GSSAPI} != "no"
72SUBDIR+=	gssapi
73INCS+=		gssapi.h
74.endif
75
76.if ${MK_HESIOD} != "no"
77INCS+=	hesiod.h
78.endif
79
80# Handle the #define aliases for libiconv
81.if ${MK_ICONV} == "yes"
82INCS+=		iconv.h
83.endif
84
85.if ${MK_USB} != "no"
86LSUBDIRS+=	dev/usb
87.endif
88
89.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
90_dev_powermac_nvram=	dev/powermac_nvram
91.endif
92
93# Define SHARED to indicate whether you want symbolic links to the system
94# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
95# probably only useful for developers and should be avoided if you do not
96# wish to tie your /usr/include and /usr/src together.
97#SHARED=	symlinks
98SHARED?=	copies
99
100INCS+=	osreldate.h
101
102SYSDIR=			${.CURDIR}/../sys
103NEWVERS_SH=		${SYSDIR}/conf/newvers.sh
104PARAM_H=		${SYSDIR}/sys/param.h
105MK_OSRELDATE_SH=	${.CURDIR}/mk-osreldate.sh
106
107osreldate.h: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH}
108	env NEWVERS_SH=${NEWVERS_SH} PARAMFILE=${PARAM_H} SYSDIR=${SYSDIR} \
109	    sh ${MK_OSRELDATE_SH}
110
111.for i in ${LHDRS}
112INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
113.endfor
114.for i in ${MHDRS}
115INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
116.endfor
117.for i in ${PHDRS}
118INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
119.endfor
120
121.if ${MACHINE} != ${MACHINE_CPUARCH}
122_MARCHS=	${MACHINE_CPUARCH}
123.endif
124.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
125_MARCHS+=	x86
126.endif
127
128.if ${MK_STAGING} == "yes"
129# tell bsd.incs.mk that we have it covered
130NO_STAGE_INCLUDES=
131.endif
132
133.include <bsd.prog.mk>
134
135.if ${MK_STAGING} != "no" && !defined(_SKIP_BUILD)
136.if make(all)
137DESTDIR= ${STAGE_OBJTOP}
138
139all:	stage_include
140installincludes: buildincludes
141buildincludes: stage_prep
142
143stage_prep:
144	@mkdir -p ${DESTDIR}${INCLUDEDIR}
145	@touch $@
146
147stage_include: .dirdep installincludes
148	@touch $@
149.endif
150.endif
151
152installincludes: ${SHARED}
153${SHARED}: compat
154
155# Take care of stale directory-level symlinks.
156compat:
157.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
158	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
159		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
160	fi
161.endfor
162	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
163	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
164	    -p ${DESTDIR}${INCLUDEDIR} > /dev/null
165.if ${MK_DIRDEPS_BUILD} == "yes"
166	@touch ${.TARGET}
167.endif
168
169copies:
170.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto machine machine/pc \
171	${_MARCHS}
172	if [ -d ${DESTDIR}${INCLUDEDIR}/$i ]; then \
173		cd ${DESTDIR}${INCLUDEDIR}/$i; \
174		for h in *.h; do \
175			if [ -L $$h ]; then rm -f $$h; fi; \
176		done; \
177	fi
178.endfor
179.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS}
180	cd ${.CURDIR}/../sys; \
181	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
182	    ${DESTDIR}${INCLUDEDIR}/$i
183.endfor
184	cd ${.CURDIR}/../sys/dev/acpica; \
185	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
186	    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
187	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \
188	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
189	cd ${.CURDIR}/../sys/dev/agp; \
190	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \
191	    ${DESTDIR}${INCLUDEDIR}/dev/agp
192	cd ${.CURDIR}/../sys/dev/bktr; \
193	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
194	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
195.if ${MK_NAND} != "no"
196	cd ${.CURDIR}/../sys/dev/nand; \
197	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
198	    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
199	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
200	    ${DESTDIR}${INCLUDEDIR}/dev/nand
201.endif
202	cd ${.CURDIR}/../sys/dev/pci; \
203	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
204	    ${DESTDIR}${INCLUDEDIR}/dev/pci
205	cd ${.CURDIR}/../sys/fs/cd9660/; \
206	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
207	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
208.if ${MK_IPFILTER} != "no"
209	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
210	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
211	    ${DESTDIR}${INCLUDEDIR}/netinet
212.endif
213.if ${MK_PF} != "no"
214	cd ${.CURDIR}/../sys/netpfil/pf; \
215	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
216	    ${DESTDIR}${INCLUDEDIR}/netpfil/pf
217.endif
218	cd ${.CURDIR}/../sys/crypto; \
219	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
220	    ${DESTDIR}${INCLUDEDIR}/crypto
221	cd ${.CURDIR}/../sys/opencrypto; \
222	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
223	    ${DESTDIR}${INCLUDEDIR}/crypto
224	cd ${.CURDIR}/../sys/${MACHINE}/include; \
225	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
226	    ${DESTDIR}${INCLUDEDIR}/machine
227.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
228	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
229	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
230	    ${DESTDIR}${INCLUDEDIR}/machine/pc
231.endif
232.for _MARCH in ${_MARCHS}
233.if exists(${.CURDIR}/../sys/${_MARCH}/include)
234	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
235	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
236	cd ${.CURDIR}/../sys/${_MARCH}/include; \
237	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
238	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
239.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
240	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
241	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
242	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
243	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
244	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
245.endif
246.endif
247.endfor
248	cd ${.CURDIR}/../sys/rpc; \
249	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
250	    ${DESTDIR}${INCLUDEDIR}/rpc
251	cd ${.CURDIR}/../sys/teken; \
252	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \
253	    ${DESTDIR}${INCLUDEDIR}/teken
254.if ${MK_DIRDEPS_BUILD} == "yes"
255	@touch ${.OBJDIR}/${.TARGET}
256.endif
257
258symlinks:
259	@${ECHO} "Setting up symlinks to kernel source tree..."
260.for i in ${LDIRS}
261	cd ${.CURDIR}/../sys/$i; \
262	for h in *.h; do \
263		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
264	done
265.endfor
266.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci}
267	cd ${.CURDIR}/../sys/$i; \
268	for h in *.h; do \
269		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
270	done
271.endfor
272	cd ${.CURDIR}/../sys/dev/acpica; \
273	for h in acpiio.h acpi_hpet.h; do \
274		ln -fs ../../../../sys/dev/acpica/$$h \
275		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
276	done
277	cd ${.CURDIR}/../sys/dev/agp; \
278	for h in agpreg.h; do \
279		ln -fs ../../../../sys/dev/agp/$$h \
280		    ${DESTDIR}${INCLUDEDIR}/dev/agp; \
281	done
282	cd ${.CURDIR}/../sys/dev/bktr; \
283	for h in ioctl_*.h; do \
284		ln -fs ../../../../sys/dev/bktr/$$h \
285		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
286	done
287.if ${MK_NAND} != "no"
288	cd ${.CURDIR}/../sys/dev/nand; \
289	for h in nandsim.h nand_dev.h; do \
290		ln -fs ../../../../sys/dev/nand/$$h \
291		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
292	done
293.endif
294	cd ${.CURDIR}/../sys/dev/pci; \
295	for h in pcireg.h; do \
296		ln -fs ../../../../sys/dev/pci/$$h \
297		    ${DESTDIR}${INCLUDEDIR}/dev/pci; \
298	done
299.for i in ${LSUBSUBDIRS}
300	cd ${.CURDIR}/../sys/$i; \
301	for h in *.h; do \
302		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
303	done
304.endfor
305.if ${MK_IPFILTER} != "no"
306	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
307	for h in *.h; do \
308		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
309		    ${DESTDIR}${INCLUDEDIR}/netinet; \
310	done
311.endif
312.if ${MK_PF} != "no"
313	cd ${.CURDIR}/../sys/netpfil/pf; \
314	for h in *.h; do \
315		ln -fs ../../../../sys/netpfil/pf/$$h \
316		    ${DESTDIR}${INCLUDEDIR}/netpfil/pf; \
317	done
318.endif
319	cd ${.CURDIR}/../sys/crypto; \
320	for h in rijndael/rijndael.h; do \
321		ln -fs ../../../sys/crypto/$$h \
322		    ${DESTDIR}${INCLUDEDIR}/crypto; \
323	done
324	cd ${.CURDIR}/../sys/opencrypto; \
325	for h in *.h; do \
326		ln -fs ../../../sys/opencrypto/$$h \
327		    ${DESTDIR}${INCLUDEDIR}/crypto; \
328	done
329	cd ${.CURDIR}/../sys/${MACHINE}/include; \
330	for h in *.h; do \
331		ln -fs ../../../sys/${MACHINE}/include/$$h \
332		    ${DESTDIR}${INCLUDEDIR}/machine; \
333	done
334.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
335	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
336	for h in *.h; do \
337		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
338		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
339	done
340.endif
341.for _MARCH in ${_MARCHS}
342.if exists(${.CURDIR}/../sys/${_MARCH}/include)
343	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
344	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
345	cd ${.CURDIR}/../sys/${_MARCH}/include; \
346	for h in *.h; do \
347		ln -fs ../../../sys/${_MARCH}/include/$$h \
348		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
349	done
350.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
351	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
352	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
353	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
354	for h in *.h; do \
355		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
356		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
357	done
358.endif
359.endif
360.endfor
361	cd ${.CURDIR}/../sys/fs/cd9660; \
362	for h in *.h; do \
363		ln -fs ../../../../sys/fs/cd9660/$$h \
364		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
365	done
366	cd ${.CURDIR}/../sys/rpc; \
367	for h in types.h; do \
368		ln -fs ../../../sys/rpc/$$h \
369		    ${DESTDIR}${INCLUDEDIR}/rpc; \
370	done
371.if ${MK_DIRDEPS_BUILD} == "yes"
372	@touch ${.OBJDIR}/${.TARGET}
373.endif
374
375.if ${MACHINE} == "host" && !defined(_SKIP_BUILD)
376# we're here because we are building a sysroot...
377# we need MACHINE et al set correctly
378HOST_MACHINE!= uname -m
379HOST_MACHINE_ARCH!= uname -p
380MACHINE:= ${HOST_MACHINE}
381MACHINE_ARCH:= ${HOST_MACHINE_ARCH}
382.endif
383