Makefile revision 157308
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 157308 2006-03-30 20:15:53Z ume $
3#
4# Doing a "make install" builds /usr/include.
5
6.include <bsd.own.mk>
7
8CLEANFILES= osreldate.h version vers.c
9SUBDIR= arpa gssapi protocols rpcsvc rpc
10INCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
11	db.h \
12	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
13	fts.h ftw.h getopt.h glob.h grp.h gssapi.h \
14	histedit.h ieeefp.h ifaddrs.h \
15	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
16	locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \
17	ndbm.h netconfig.h \
18	netdb.h nl_types.h nlist.h nss.h nsswitch.h objformat.h paths.h \
19	printf.h proc_service.h pthread.h \
20	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
21	res_update.h resolv.h runetype.h search.h setjmp.h sgtty.h \
22	signal.h stab.h \
23	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
24	strings.h sysexits.h tar.h tgmath.h \
25	time.h timeconv.h timers.h ttyent.h \
26	ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \
27	wctype.h wordexp.h
28
29MHDRS=	float.h floatingpoint.h stdarg.h
30
31PHDRS=	sched.h semaphore.h _semaphore.h
32
33LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
34	termios.h ucontext.h
35
36LDIRS=	bsm cam geom net net80211 netatalk netatm netgraph netinet netinet6 \
37	netipsec ${_netipx} netkey netnatm ${_netncp} netsmb \
38	nfs nfsclient nfsserver \
39	pccard posix4 sys vm
40
41LSUBDIRS=	cam/scsi \
42	dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \
43	dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/ofw \
44	dev/pbio dev/ppbus dev/smbus dev/speaker dev/usb dev/wi dev/utopia \
45	fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs \
46	${_fs_nwfs} fs/portalfs fs/procfs fs/smbfs fs/udf fs/umapfs \
47	fs/unionfs \
48	geom/concat geom/eli geom/gate geom/label geom/mirror geom/nop \
49	geom/raid3 geom/shsec geom/stripe \
50	isofs/cd9660 \
51	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
52	netgraph/atm netgraph/netflow \
53	security/audit \
54	security/mac_biba security/mac_bsdextended security/mac_lomac \
55	security/mac_mls security/mac_partition \
56	ufs/ffs ufs/ufs
57
58.if ${MK_GPIB} != "no"
59_dev_ieee488=	dev/ieee488
60.endif
61
62.if ${MK_HESIOD} != "no"
63INCS+=	hesiod.h
64.endif
65
66.if ${MK_BLUETOOTH} != "no"
67LSUBSUBDIRS=	netgraph/bluetooth/include
68.endif
69
70# XXX unconditionally needed by <netsmb/netbios.h>
71#.if ${MK_IPX} != "no"
72_netipx=	netipx
73#.endif
74
75.if ${MK_NCP} != "no"
76_netncp=	netncp
77_fs_nwfs=	fs/nwfs
78.endif
79
80# Define SHARED to indicate whether you want symbolic links to the system
81# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
82# probably only useful for developers and should be avoided if you do not
83# wish to tie your /usr/include and /usr/src together.
84#SHARED=	symlinks
85SHARED?=	copies
86
87INCS+=	osreldate.h
88
89osreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
90    ${.CURDIR}/Makefile
91	@${ECHO} creating osreldate.h from newvers.sh
92	@MAKE=${MAKE}; \
93	PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
94	. ${.CURDIR}/../sys/conf/newvers.sh; \
95	echo "$$COPYRIGHT" > osreldate.h; \
96	echo "#ifdef _KERNEL" >> osreldate.h; \
97	echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \
98	echo "#else" >> osreldate.h; \
99	echo "#undef __FreeBSD_version" >> osreldate.h; \
100	echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \
101	echo "#endif" >> osreldate.h
102
103.for i in ${LHDRS}
104INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
105.endfor
106.for i in ${MHDRS}
107INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
108.endfor
109.for i in ${PHDRS}
110INCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
111.endfor
112
113.if ${MACHINE} != ${MACHINE_ARCH}
114_MARCH=${MACHINE_ARCH}
115.endif
116
117.include <bsd.prog.mk>
118
119installincludes: ${SHARED}
120${SHARED}: compat
121
122# Take care of stale directory-level symlinks.
123compat:
124.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCH} crypto
125	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
126		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
127	fi
128.endfor
129	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
130	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
131	    -p ${DESTDIR}${INCLUDEDIR}
132.if ${MK_BIND_LIBS} != "no"
133	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
134	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
135	    -p ${DESTDIR}${INCLUDEDIR}
136.endif
137
138copies:
139.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
140	${_MARCH}
141.if exists(${DESTDIR}${INCLUDEDIR}/$i)
142	cd ${DESTDIR}${INCLUDEDIR}/$i; \
143	for h in *.h; do \
144		if [ -L $$h ]; then rm -f $$h; fi; \
145	done
146.endif
147.endfor
148.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr} ${LSUBSUBDIRS}
149	cd ${.CURDIR}/../sys; \
150	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
151	    ${DESTDIR}${INCLUDEDIR}/$i
152.endfor
153	cd ${.CURDIR}/../sys/dev/acpica; \
154	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
155	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
156	cd ${.CURDIR}/../sys/dev/bktr; \
157	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
158	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
159	cd ${.CURDIR}/../sys/contrib/altq/altq; \
160	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
161	    ${DESTDIR}${INCLUDEDIR}/altq
162.if ${MK_IPFILTER} != "no"
163	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
164	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
165	    ${DESTDIR}${INCLUDEDIR}/netinet
166.endif
167	cd ${.CURDIR}/../sys/contrib/pf/net; \
168	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
169	    ${DESTDIR}${INCLUDEDIR}/net
170	cd ${.CURDIR}/../sys/crypto; \
171	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
172	    ${DESTDIR}${INCLUDEDIR}/crypto
173	cd ${.CURDIR}/../sys/opencrypto; \
174	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
175	    ${DESTDIR}${INCLUDEDIR}/crypto
176	cd ${.CURDIR}/../sys/${MACHINE}/include; \
177	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
178	    ${DESTDIR}${INCLUDEDIR}/machine
179.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
180	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
181	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
182	    ${DESTDIR}${INCLUDEDIR}/machine/pc
183.endif
184.if defined(_MARCH)
185	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
186	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
187	cd ${.CURDIR}/../sys/${_MARCH}/include; \
188	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
189	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
190.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
191	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
192	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
193	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
194	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
195	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
196.endif
197.endif
198
199symlinks:
200	@${ECHO} "Setting up symlinks to kernel source tree..."
201.for i in ${LDIRS}
202	cd ${.CURDIR}/../sys/$i; \
203	for h in *.h; do \
204		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
205	done
206.endfor
207.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr}
208	cd ${.CURDIR}/../sys/$i; \
209	for h in *.h; do \
210		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
211	done
212.endfor
213	cd ${.CURDIR}/../sys/dev/acpica; \
214	for h in acpiio.h; do \
215		ln -fs ../../../../sys/dev/acpica/$$h \
216		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
217	done
218	cd ${.CURDIR}/../sys/dev/bktr; \
219	for h in ioctl_*.h; do \
220		ln -fs ../../../../sys/dev/bktr/$$h \
221		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
222	done
223.for i in ${LSUBSUBDIRS}
224	cd ${.CURDIR}/../sys/$i; \
225	for h in *.h; do \
226		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
227	done
228.endfor
229	cd ${.CURDIR}/../sys/contrib/altq/altq; \
230	for h in *.h; do \
231		ln -fs ../../../sys/contrib/altq/altq/$$h \
232		    ${DESTDIR}${INCLUDEDIR}/altq; \
233	done
234.if ${MK_IPFILTER} != "no"
235	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
236	for h in *.h; do \
237		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
238		    ${DESTDIR}${INCLUDEDIR}/netinet; \
239	done
240.endif
241	cd ${.CURDIR}/../sys/contrib/pf/net; \
242	for h in *.h; do \
243		ln -fs ../../../sys/contrib/pf/net/$$h \
244		    ${DESTDIR}${INCLUDEDIR}/net; \
245	done
246	cd ${.CURDIR}/../sys/crypto; \
247	for h in rijndael/rijndael.h; do \
248		ln -fs ../../../sys/crypto/$$h \
249		    ${DESTDIR}${INCLUDEDIR}/crypto; \
250	done
251	cd ${.CURDIR}/../sys/opencrypto; \
252	for h in *.h; do \
253		ln -fs ../../../sys/opencrypto/$$h \
254		    ${DESTDIR}${INCLUDEDIR}/crypto; \
255	done
256	cd ${.CURDIR}/../sys/${MACHINE}/include; \
257	for h in *.h; do \
258		ln -fs ../../../sys/${MACHINE}/include/$$h \
259		    ${DESTDIR}${INCLUDEDIR}/machine; \
260	done
261.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
262	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
263	for h in *.h; do \
264		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
265		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
266	done
267.endif
268.if defined(_MARCH)
269	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
270	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
271	cd ${.CURDIR}/../sys/${_MARCH}/include; \
272	for h in *.h; do \
273		ln -fs ../../../sys/${_MARCH}/include/$$h \
274		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
275	done
276.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
277	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
278	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
279	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
280	for h in *.h; do \
281		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
282		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
283	done
284.endif
285.endif
286