Makefile revision 137836
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 137836 2004-11-17 23:48:17Z 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 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
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.if defined(WITH_BIND_LIBS) && !defined(NO_BIND)
102	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
103	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
104	    -p ${DESTDIR}${INCLUDEDIR}
105.endif
106
107copies:
108.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc
109.if exists(${DESTDIR}${INCLUDEDIR}/$i)
110	cd ${DESTDIR}${INCLUDEDIR}/$i; \
111	for h in *.h; do \
112		if [ -L $$h ]; then rm -f $$h; fi; \
113	done
114.endif
115.endfor
116.for i in ${LDIRS} ${LSUBDIRS:Ndev/bktr} ${LSUBSUBDIRS}
117	cd ${.CURDIR}/../sys; \
118	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
119	    ${DESTDIR}${INCLUDEDIR}/$i
120.endfor
121	cd ${.CURDIR}/../sys/dev/bktr; \
122	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
123	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
124	cd ${.CURDIR}/../sys/contrib/altq/altq; \
125	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
126	    ${DESTDIR}${INCLUDEDIR}/altq
127	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
128	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
129	    ${DESTDIR}${INCLUDEDIR}/netinet
130	cd ${.CURDIR}/../sys/contrib/pf/net; \
131	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
132	    ${DESTDIR}${INCLUDEDIR}/net
133	cd ${.CURDIR}/../sys/opencrypto; \
134	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
135	    ${DESTDIR}${INCLUDEDIR}/crypto
136	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
137	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
138	    ${DESTDIR}${INCLUDEDIR}/machine
139.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
140	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
141	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
142	    ${DESTDIR}${INCLUDEDIR}/machine/pc
143.endif
144
145symlinks:
146	@${ECHO} "Setting up symlinks to kernel source tree..."
147.for i in ${LDIRS}
148	cd ${.CURDIR}/../sys/$i; \
149	for h in *.h; do \
150		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
151	done
152.endfor
153.for i in ${LSUBDIRS}
154	cd ${.CURDIR}/../sys/$i; \
155	for h in *.h; do \
156		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
157	done
158.endfor
159.for i in ${LSUBSUBDIRS}
160	cd ${.CURDIR}/../sys/$i; \
161	for h in *.h; do \
162		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
163	done
164.endfor
165	cd ${.CURDIR}/../sys/contrib/altq/altq; \
166	for h in *.h; do \
167		ln -fs ../../../sys/contrib/altq/altq/$$h \
168		    ${DESTDIR}${INCLUDEDIR}/altq; \
169	done
170	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
171	for h in *.h; do \
172		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
173		    ${DESTDIR}${INCLUDEDIR}/netinet; \
174	done
175	cd ${.CURDIR}/../sys/contrib/pf/net; \
176	for h in *.h; do \
177		ln -fs ../../../sys/contrib/pf/net/$$h \
178		    ${DESTDIR}${INCLUDEDIR}/net; \
179	done
180	cd ${.CURDIR}/../sys/opencrypto; \
181	for h in *.h; do \
182		ln -fs ../../../sys/opencrypto/$$h \
183		    ${DESTDIR}${INCLUDEDIR}/crypto; \
184	done
185	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
186	for h in *.h; do \
187		ln -fs ../../../sys/${MACHINE_ARCH}/include/$$h \
188		    ${DESTDIR}${INCLUDEDIR}/machine; \
189	done
190.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
191	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
192	for h in *.h; do \
193		ln -fs ../../../../sys/${MACHINE_ARCH}/include/pc/$$h \
194		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
195	done
196.endif
197