Makefile revision 126385
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 126385 2004-02-28 21:50:50Z mlaier $
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 isofs/cd9660 \
38	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
39	netgraph/atm security/mac_biba security/mac_bsdextended \
40	security/mac_lomac security/mac_mls security/mac_partition \
41	ufs/ffs ufs/ufs
42
43.if !defined(NO_BLUETOOTH)
44LSUBSUBDIRS=	netgraph/bluetooth/include
45.endif
46
47# Define SHARED to indicate whether you want symbolic links to the system
48# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
49# probably only useful for developers and should be avoided if you do not
50# wish to tie your /usr/include and /usr/src together.
51#SHARED=	symlinks
52SHARED?=	copies
53
54INCS+=	osreldate.h
55
56osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
57		${.CURDIR}/../sys/sys/param.h \
58		${.CURDIR}/Makefile
59	@${ECHO} creating osreldate.h from newvers.sh
60	@setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
61	. ${.CURDIR}/../sys/conf/newvers.sh;			\
62	echo "$$COPYRIGHT" > osreldate.h;			\
63	echo "#ifdef _KERNEL" >> osreldate.h;			\
64	echo '#error "<osreldate.h> cannot be used in the kernel, use <sys/param.h>"' >> osreldate.h; \
65	echo "#else" >> osreldate.h;				\
66	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
67	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
68	echo "#endif" >> osreldate.h
69
70.for i in ${LHDRS}
71INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
72.endfor
73.for i in ${MHDRS}
74INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
75.endfor
76.for i in ${PHDRS}
77INCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
78.endfor
79
80.include <bsd.prog.mk>
81
82installincludes: ${SHARED}
83${SHARED}: compat
84
85# Take care of stale directory-level symlinks.
86compat:
87.for i in ${LDIRS} ${LSUBDIRS} machine crypto
88	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
89		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
90	fi
91.endfor
92	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
93	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
94	    -p ${DESTDIR}${INCLUDEDIR}
95
96copies:
97.for i in ${LDIRS} ${LSUBDIRS} crypto machine machine/pc
98.if exists(${DESTDIR}${INCLUDEDIR}/$i)
99	cd ${DESTDIR}${INCLUDEDIR}/$i; \
100	for h in *.h; do \
101		if [ -L $$h ]; then rm -f $$h; fi; \
102	done
103.endif
104.endfor
105.for i in ${LDIRS} ${LSUBDIRS:Ndev/bktr} ${LSUBSUBDIRS}
106	cd ${.CURDIR}/../sys; \
107	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
108	    ${DESTDIR}${INCLUDEDIR}/$i
109.endfor
110	cd ${.CURDIR}/../sys/dev/bktr; \
111	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
112	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
113	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
114	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
115	    ${DESTDIR}${INCLUDEDIR}/netinet
116	cd ${.CURDIR}/../sys/contrib/pf/net; \
117	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
118	    ${DESTDIR}${INCLUDEDIR}/net
119	cd ${.CURDIR}/../sys/opencrypto; \
120	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
121	    ${DESTDIR}${INCLUDEDIR}/crypto
122	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
123	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
124	    ${DESTDIR}${INCLUDEDIR}/machine
125.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
126	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
127	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
128	    ${DESTDIR}${INCLUDEDIR}/machine/pc
129.endif
130
131symlinks:
132	@${ECHO} "Setting up symlinks to kernel source tree..."
133.for i in ${LDIRS}
134	cd ${.CURDIR}/../sys/$i; \
135	for h in *.h; do \
136		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
137	done
138.endfor
139.for i in ${LSUBDIRS}
140	cd ${.CURDIR}/../sys/$i; \
141	for h in *.h; do \
142		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
143	done
144.endfor
145.for i in ${LSUBSUBDIRS}
146	cd ${.CURDIR}/../sys/$i; \
147	for h in *.h; do \
148		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
149	done
150.endfor
151	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
152	for h in *.h; do \
153		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
154		    ${DESTDIR}${INCLUDEDIR}/netinet; \
155	done
156	cd ${.CURDIR}/../sys/contrib/pf/net; \
157	for h in *.h; do \
158		ln -fs ../../../sys/contrib/pf/net/$$h \
159		    ${DESTDIR}${INCLUDEDIR}/net; \
160	done
161	cd ${.CURDIR}/../sys/opencrypto; \
162	for h in *.h; do \
163		ln -fs ../../../sys/opencrypto/$$h \
164		    ${DESTDIR}${INCLUDEDIR}/crypto; \
165	done
166	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
167	for h in *.h; do \
168		ln -fs ../../../sys/${MACHINE_ARCH}/include/$$h \
169		    ${DESTDIR}${INCLUDEDIR}/machine; \
170	done
171.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
172	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
173	for h in *.h; do \
174		ln -fs ../../../../sys/${MACHINE_ARCH}/include/pc/$$h \
175		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
176	done
177.endif
178