Makefile revision 180800
1272343Sngie#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2272343Sngie# $FreeBSD: head/include/Makefile 180800 2008-07-25 12:37:46Z ed $
3272343Sngie#
4272343Sngie# Doing a "make install" builds /usr/include.
5272343Sngie
6272343Sngie.include <bsd.own.mk>
7272343Sngie
8272343SngieCLEANFILES= osreldate.h version vers.c
9272343SngieSUBDIR= arpa gssapi protocols rpcsvc rpc
10272343SngieINCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
11272343Sngie	db.h \
12272343Sngie	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
13272343Sngie	fts.h ftw.h getopt.h glob.h grp.h gssapi.h \
14272343Sngie	histedit.h ieeefp.h ifaddrs.h \
15272343Sngie	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
16272343Sngie	locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \
17272343Sngie	ndbm.h netconfig.h \
18272343Sngie	netdb.h nl_types.h nlist.h nss.h nsswitch.h paths.h \
19272343Sngie	printf.h proc_service.h pthread.h \
20272343Sngie	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
21272343Sngie	res_update.h resolv.h runetype.h search.h setjmp.h \
22272343Sngie	signal.h spawn.h stab.h \
23272343Sngie	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
24272343Sngie	strings.h sysexits.h tar.h tgmath.h \
25272343Sngie	time.h timeconv.h timers.h ttyent.h \
26272343Sngie	ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \
27272343Sngie	wctype.h wordexp.h
28272343Sngie
29272343SngieMHDRS=	float.h floatingpoint.h stdarg.h
30272343Sngie
31272343SngiePHDRS=	sched.h semaphore.h _semaphore.h
32272343Sngie
33272343SngieLHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
34272343Sngie	termios.h ucontext.h
35272343Sngie
36272343SngieLDIRS=	bsm cam geom net net80211 netatalk netgraph netinet netinet6 \
37272343Sngie	netipsec ${_netipx} netnatm ${_netncp} netsmb \
38272343Sngie	nfs nfsclient nfsserver \
39272343Sngie	pccard sys vm
40272343Sngie
41272343SngieLSUBDIRS=	cam/scsi \
42272343Sngie	dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \
43272343Sngie	dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/ofw \
44272343Sngie	dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \
45272343Sngie	dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \
46272343Sngie	fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs \
47272343Sngie	${_fs_nwfs} fs/portalfs fs/procfs fs/smbfs fs/udf fs/unionfs \
48272343Sngie	geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \
49272343Sngie	geom/mirror geom/multipath geom/nop \
50272343Sngie	geom/raid3 geom/shsec geom/stripe geom/virstor \
51272343Sngie	netgraph/atm netgraph/netflow \
52272343Sngie	security/audit \
53272343Sngie	security/mac_biba security/mac_bsdextended security/mac_lomac \
54272343Sngie	security/mac_mls security/mac_partition \
55272343Sngie	ufs/ffs ufs/ufs
56272343Sngie
57272343SngieLSUBSUBDIRS=	dev/mpt/mpilib
58272343Sngie
59272343Sngie.if ${MACHINE_ARCH} == "powerpc"
60272343Sngie_dev_powermac_nvram=	dev/powermac_nvram
61272343Sngie.endif
62272343Sngie
63272343Sngie.if ${MK_GPIB} != "no"
64272343Sngie_dev_ieee488=	dev/ieee488
65272343Sngie.endif
66272343Sngie
67272343Sngie.if ${MK_HESIOD} != "no"
68272343SngieINCS+=	hesiod.h
69272343Sngie.endif
70272343Sngie
71272343Sngie.if ${MK_BLUETOOTH} != "no"
72272343SngieLSUBSUBDIRS+=	netgraph/bluetooth/include
73272343Sngie.endif
74272343Sngie
75272343Sngie# XXX unconditionally needed by <netsmb/netbios.h>
76272343Sngie#.if ${MK_IPX} != "no"
77272343Sngie_netipx=	netipx
78272343Sngie#.endif
79272343Sngie
80272343Sngie.if ${MK_NCP} != "no"
81272343Sngie_netncp=	netncp
82272343Sngie_fs_nwfs=	fs/nwfs
83272343Sngie.endif
84272343Sngie
85272343Sngie# Define SHARED to indicate whether you want symbolic links to the system
86272343Sngie# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
87272343Sngie# probably only useful for developers and should be avoided if you do not
88272343Sngie# wish to tie your /usr/include and /usr/src together.
89272343Sngie#SHARED=	symlinks
90272343SngieSHARED?=	copies
91272343Sngie
92272343SngieINCS+=	osreldate.h
93272343Sngie
94272343Sngieosreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
95272343Sngie    ${.CURDIR}/Makefile
96	@${ECHO} creating osreldate.h from newvers.sh
97	@MAKE=${MAKE}; \
98	PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
99	. ${.CURDIR}/../sys/conf/newvers.sh; \
100	echo "$$COPYRIGHT" > osreldate.h; \
101	echo "#ifdef _KERNEL" >> osreldate.h; \
102	echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \
103	echo "#else" >> osreldate.h; \
104	echo "#undef __FreeBSD_version" >> osreldate.h; \
105	echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \
106	echo "#endif" >> osreldate.h
107
108.for i in ${LHDRS}
109INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
110.endfor
111.for i in ${MHDRS}
112INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
113.endfor
114.for i in ${PHDRS}
115INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
116.endfor
117
118.if ${MACHINE} != ${MACHINE_ARCH}
119_MARCH=${MACHINE_ARCH}
120.endif
121
122.include <bsd.prog.mk>
123
124installincludes: ${SHARED}
125${SHARED}: compat
126
127# Take care of stale directory-level symlinks.
128compat:
129.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCH} crypto
130	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
131		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
132	fi
133.endfor
134	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
135	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
136	    -p ${DESTDIR}${INCLUDEDIR}
137.if ${MK_BIND_LIBS} != "no"
138	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
139	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
140	    -p ${DESTDIR}${INCLUDEDIR}
141.endif
142
143copies:
144.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
145	${_MARCH}
146.if exists(${DESTDIR}${INCLUDEDIR}/$i)
147	cd ${DESTDIR}${INCLUDEDIR}/$i; \
148	for h in *.h; do \
149		if [ -L $$h ]; then rm -f $$h; fi; \
150	done
151.endif
152.endfor
153.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr} ${LSUBSUBDIRS}
154	cd ${.CURDIR}/../sys; \
155	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
156	    ${DESTDIR}${INCLUDEDIR}/$i
157.endfor
158	cd ${.CURDIR}/../sys/dev/acpica; \
159	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
160	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
161	cd ${.CURDIR}/../sys/dev/bktr; \
162	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
163	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
164	cd ${.CURDIR}/../sys/contrib/altq/altq; \
165	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
166	    ${DESTDIR}${INCLUDEDIR}/altq
167	cd ${.CURDIR}/../sys/fs/cd9660/; \
168	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
169	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
170.if ${MK_IPFILTER} != "no"
171	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
172	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
173	    ${DESTDIR}${INCLUDEDIR}/netinet
174.endif
175	cd ${.CURDIR}/../sys/contrib/pf/net; \
176	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
177	    ${DESTDIR}${INCLUDEDIR}/net
178	cd ${.CURDIR}/../sys/crypto; \
179	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
180	    ${DESTDIR}${INCLUDEDIR}/crypto
181	cd ${.CURDIR}/../sys/opencrypto; \
182	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
183	    ${DESTDIR}${INCLUDEDIR}/crypto
184	cd ${.CURDIR}/../sys/${MACHINE}/include; \
185	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
186	    ${DESTDIR}${INCLUDEDIR}/machine
187.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
188	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
189	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
190	    ${DESTDIR}${INCLUDEDIR}/machine/pc
191.endif
192.if defined(_MARCH)
193	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
194	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
195	cd ${.CURDIR}/../sys/${_MARCH}/include; \
196	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
197	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
198.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
199	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
200	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
201	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
202	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
203	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
204.endif
205.endif
206	cd ${.CURDIR}/../sys/rpc; \
207	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
208	    ${DESTDIR}${INCLUDEDIR}/rpc
209
210symlinks:
211	@${ECHO} "Setting up symlinks to kernel source tree..."
212.for i in ${LDIRS}
213	cd ${.CURDIR}/../sys/$i; \
214	for h in *.h; do \
215		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
216	done
217.endfor
218.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr}
219	cd ${.CURDIR}/../sys/$i; \
220	for h in *.h; do \
221		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
222	done
223.endfor
224	cd ${.CURDIR}/../sys/dev/acpica; \
225	for h in acpiio.h; do \
226		ln -fs ../../../../sys/dev/acpica/$$h \
227		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
228	done
229	cd ${.CURDIR}/../sys/dev/bktr; \
230	for h in ioctl_*.h; do \
231		ln -fs ../../../../sys/dev/bktr/$$h \
232		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
233	done
234.for i in ${LSUBSUBDIRS}
235	cd ${.CURDIR}/../sys/$i; \
236	for h in *.h; do \
237		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
238	done
239.endfor
240	cd ${.CURDIR}/../sys/contrib/altq/altq; \
241	for h in *.h; do \
242		ln -fs ../../../sys/contrib/altq/altq/$$h \
243		    ${DESTDIR}${INCLUDEDIR}/altq; \
244	done
245.if ${MK_IPFILTER} != "no"
246	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
247	for h in *.h; do \
248		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
249		    ${DESTDIR}${INCLUDEDIR}/netinet; \
250	done
251.endif
252	cd ${.CURDIR}/../sys/contrib/pf/net; \
253	for h in *.h; do \
254		ln -fs ../../../sys/contrib/pf/net/$$h \
255		    ${DESTDIR}${INCLUDEDIR}/net; \
256	done
257	cd ${.CURDIR}/../sys/crypto; \
258	for h in rijndael/rijndael.h; do \
259		ln -fs ../../../sys/crypto/$$h \
260		    ${DESTDIR}${INCLUDEDIR}/crypto; \
261	done
262	cd ${.CURDIR}/../sys/opencrypto; \
263	for h in *.h; do \
264		ln -fs ../../../sys/opencrypto/$$h \
265		    ${DESTDIR}${INCLUDEDIR}/crypto; \
266	done
267	cd ${.CURDIR}/../sys/${MACHINE}/include; \
268	for h in *.h; do \
269		ln -fs ../../../sys/${MACHINE}/include/$$h \
270		    ${DESTDIR}${INCLUDEDIR}/machine; \
271	done
272.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
273	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
274	for h in *.h; do \
275		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
276		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
277	done
278.endif
279.if defined(_MARCH)
280	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
281	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
282	cd ${.CURDIR}/../sys/${_MARCH}/include; \
283	for h in *.h; do \
284		ln -fs ../../../sys/${_MARCH}/include/$$h \
285		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
286	done
287.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
288	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
289	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
290	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
291	for h in *.h; do \
292		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
293		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
294	done
295.endif
296.endif
297	cd ${.CURDIR}/../sys/fs/cd9660; \
298	for h in *.h; do \
299		ln -fs ../../../../sys/fs/cd9660/$$h \
300		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
301	done
302	cd ${.CURDIR}/../sys/rpc; \
303	for h in types.h; do \
304		ln -fs ../../../sys/rpc/$$h \
305		    ${DESTDIR}${INCLUDEDIR}/rpc; \
306	done
307