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