Makefile revision 132173
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 132173 2004-07-15 03:43:18Z davidxu $
3#
4# Doing a "make install" builds /usr/include.
5
6CLEANFILES= osreldate.h version vers.c
7SUBDIR= arpa protocols rpcsvc rpc
8INCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h ctype.h db.h \
9	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
10	fts.h ftw.h getopt.h glob.h grp.h \
11	hesiod.h histedit.h ieeefp.h ifaddrs.h \
12	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
13	locale.h malloc.h memory.h monetary.h mpool.h ndbm.h netconfig.h \
14	netdb.h nl_types.h nlist.h nss.h nsswitch.h objformat.h paths.h \
15	proc_service.h pthread.h \
16	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
17	resolv.h rune.h runetype.h search.h setjmp.h sgtty.h signal.h stab.h \
18	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
19	strings.h sysexits.h tar.h time.h timeconv.h timers.h ttyent.h \
20	ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \
21	wctype.h wordexp.h
22
23MHDRS=	float.h floatingpoint.h stdarg.h
24
25# posix4/mqueue.h is useless without an implementation and isn't installed:
26PHDRS=	sched.h semaphore.h _semaphore.h # mqueue.h
27
28LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
29	termios.h ucontext.h
30
31LDIRS=	cam geom net net80211 netatalk netatm netgraph netinet netinet6 \
32	netipsec netipx netkey netnatm netncp netsmb nfs nfsclient nfsserver \
33	pccard posix4 sys vm
34
35LSUBDIRS=	cam/scsi dev/an dev/bktr dev/firewire dev/ic dev/iicbus \
36	dev/ofw dev/ppbus dev/smbus dev/usb dev/wi dev/utopia fs/devfs \
37	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
38	fs/procfs fs/smbfs fs/udf fs/umapfs fs/unionfs \
39	geom/concat geom/gate geom/label geom/nop geom/stripe \
40	isofs/cd9660 netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
41	netgraph/atm security/mac_biba security/mac_bsdextended \
42	security/mac_lomac security/mac_mls security/mac_partition \
43	ufs/ffs ufs/ufs
44
45.if !defined(NO_BLUETOOTH)
46LSUBSUBDIRS=	netgraph/bluetooth/include
47.endif
48
49# Define SHARED to indicate whether you want symbolic links to the system
50# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
51# probably only useful for developers and should be avoided if you do not
52# wish to tie your /usr/include and /usr/src together.
53#SHARED=	symlinks
54SHARED?=	copies
55
56INCS+=	osreldate.h
57
58osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
59		${.CURDIR}/../sys/sys/param.h \
60		${.CURDIR}/Makefile
61	@${ECHO} creating osreldate.h from newvers.sh
62	@setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
63	. ${.CURDIR}/../sys/conf/newvers.sh;			\
64	echo "$$COPYRIGHT" > osreldate.h;			\
65	echo "#ifdef _KERNEL" >> osreldate.h;			\
66	echo '#error "<osreldate.h> cannot be used in the kernel, use <sys/param.h>"' >> osreldate.h; \
67	echo "#else" >> osreldate.h;				\
68	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
69	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
70	echo "#endif" >> osreldate.h
71
72.for i in ${LHDRS}
73INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
74.endfor
75.for i in ${MHDRS}
76INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
77.endfor
78.for i in ${PHDRS}
79INCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
80.endfor
81
82.include <bsd.prog.mk>
83
84installincludes: ${SHARED}
85${SHARED}: compat
86
87# Take care of stale directory-level symlinks.
88compat:
89.for i in ${LDIRS} ${LSUBDIRS} machine crypto
90	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
91		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
92	fi
93.endfor
94	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
95	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
96	    -p ${DESTDIR}${INCLUDEDIR}
97
98copies:
99.for i in ${LDIRS} ${LSUBDIRS} crypto machine machine/pc
100.if exists(${DESTDIR}${INCLUDEDIR}/$i)
101	cd ${DESTDIR}${INCLUDEDIR}/$i; \
102	for h in *.h; do \
103		if [ -L $$h ]; then rm -f $$h; fi; \
104	done
105.endif
106.endfor
107.for i in ${LDIRS} ${LSUBDIRS:Ndev/bktr} ${LSUBSUBDIRS}
108	cd ${.CURDIR}/../sys; \
109	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
110	    ${DESTDIR}${INCLUDEDIR}/$i
111.endfor
112	cd ${.CURDIR}/../sys/dev/bktr; \
113	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
114	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
115	cd ${.CURDIR}/../sys/contrib/altq/altq; \
116	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
117	    ${DESTDIR}${INCLUDEDIR}/altq
118	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
119	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
120	    ${DESTDIR}${INCLUDEDIR}/netinet
121	cd ${.CURDIR}/../sys/contrib/pf/net; \
122	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
123	    ${DESTDIR}${INCLUDEDIR}/net
124	cd ${.CURDIR}/../sys/opencrypto; \
125	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
126	    ${DESTDIR}${INCLUDEDIR}/crypto
127	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
128	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
129	    ${DESTDIR}${INCLUDEDIR}/machine
130.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
131	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
132	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
133	    ${DESTDIR}${INCLUDEDIR}/machine/pc
134.endif
135
136symlinks:
137	@${ECHO} "Setting up symlinks to kernel source tree..."
138.for i in ${LDIRS}
139	cd ${.CURDIR}/../sys/$i; \
140	for h in *.h; do \
141		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
142	done
143.endfor
144.for i in ${LSUBDIRS}
145	cd ${.CURDIR}/../sys/$i; \
146	for h in *.h; do \
147		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
148	done
149.endfor
150.for i in ${LSUBSUBDIRS}
151	cd ${.CURDIR}/../sys/$i; \
152	for h in *.h; do \
153		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
154	done
155.endfor
156	cd ${.CURDIR}/../sys/contrib/altq/altq; \
157	for h in *.h; do \
158		ln -fs ../../../sys/contrib/altq/altq/$$h \
159		    ${DESTDIR}${INCLUDEDIR}/altq; \
160	done
161	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
162	for h in *.h; do \
163		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
164		    ${DESTDIR}${INCLUDEDIR}/netinet; \
165	done
166	cd ${.CURDIR}/../sys/contrib/pf/net; \
167	for h in *.h; do \
168		ln -fs ../../../sys/contrib/pf/net/$$h \
169		    ${DESTDIR}${INCLUDEDIR}/net; \
170	done
171	cd ${.CURDIR}/../sys/opencrypto; \
172	for h in *.h; do \
173		ln -fs ../../../sys/opencrypto/$$h \
174		    ${DESTDIR}${INCLUDEDIR}/crypto; \
175	done
176	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
177	for h in *.h; do \
178		ln -fs ../../../sys/${MACHINE_ARCH}/include/$$h \
179		    ${DESTDIR}${INCLUDEDIR}/machine; \
180	done
181.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
182	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
183	for h in *.h; do \
184		ln -fs ../../../../sys/${MACHINE_ARCH}/include/pc/$$h \
185		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
186	done
187.endif
188