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