Makefile revision 116948
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 116948 2003-06-28 06:08:27Z sam $
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 strhash.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 vis.h wchar.h wctype.h \
20	wordexp.h
21
22MHDRS=	float.h floatingpoint.h stdarg.h varargs.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/ic dev/iicbus dev/firewire dev/ofw \
35	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/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
43LSUBSUBDIRS=	netgraph/bluetooth/include
44
45# Define SHARED to indicate whether you want symbolic links to the system
46# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
47# probably only useful for developers and should be avoided if you do not
48# wish to tie your /usr/include and /usr/src together.
49#SHARED=	symlinks
50SHARED?=	copies
51
52INCS+=	osreldate.h
53
54osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
55		${.CURDIR}/../sys/sys/param.h \
56		${.CURDIR}/Makefile
57	@${ECHO} creating osreldate.h from newvers.sh
58	setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
59	. ${.CURDIR}/../sys/conf/newvers.sh;			\
60	echo "$$COPYRIGHT" > osreldate.h;			\
61	echo "#ifdef _KERNEL" >> osreldate.h;			\
62	echo '#error "<osreldate.h> cannot be used in the kernel, use <sys/param.h>"' >> osreldate.h; \
63	echo "#else" >> osreldate.h;				\
64	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
65	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
66	echo "#endif" >> osreldate.h
67
68.for i in ${LHDRS}
69INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
70.endfor
71.for i in ${MHDRS}
72INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
73.endfor
74.for i in ${PHDRS}
75INCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
76.endfor
77
78.include <bsd.prog.mk>
79
80installincludes: ${SHARED}
81${SHARED}: compat
82
83# Take care of stale directory-level symlinks.
84compat:
85.for i in ${LDIRS} ${LSUBDIRS} machine crypto
86	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
87		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
88	fi
89.endfor
90	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
91	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
92	    -p ${DESTDIR}${INCLUDEDIR}
93
94copies:
95.for i in ${LDIRS} ${LSUBDIRS} crypto machine machine/pc
96.if exists(${DESTDIR}${INCLUDEDIR}/$i)
97	cd ${DESTDIR}${INCLUDEDIR}/$i; \
98	for h in *.h; do \
99		if [ -L $$h ]; then rm -f $$h; fi; \
100	done
101.endif
102.endfor
103.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS}
104	cd ${.CURDIR}/../sys; \
105	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
106	    ${DESTDIR}${INCLUDEDIR}/$i
107.endfor
108	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
109	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
110	    ${DESTDIR}${INCLUDEDIR}/netinet
111	cd ${.CURDIR}/../sys/opencrypto; \
112	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
113	    ${DESTDIR}${INCLUDEDIR}/crypto
114	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
115	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
116	    ${DESTDIR}${INCLUDEDIR}/machine
117.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
118	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
119	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
120	    ${DESTDIR}${INCLUDEDIR}/machine/pc
121.endif
122
123symlinks:
124	@${ECHO} "Setting up symlinks to kernel source tree..."
125.for i in ${LDIRS}
126	cd ${.CURDIR}/../sys/$i; \
127	for h in *.h; do \
128		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
129	done
130.endfor
131.for i in ${LSUBDIRS}
132	cd ${.CURDIR}/../sys/$i; \
133	for h in *.h; do \
134		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
135	done
136.endfor
137.for i in ${LSUBSUBDIRS}
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	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
144	for h in *.h; do \
145		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
146		    ${DESTDIR}${INCLUDEDIR}/netinet; \
147	done
148	cd ${.CURDIR}/../sys/opencrypto; \
149	for h in *.h; do \
150		ln -fs ../../../sys/opencrypto/$$h \
151		    ${DESTDIR}${INCLUDEDIR}/crypto; \
152	done
153	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
154	for h in *.h; do \
155		ln -fs ../../../sys/${MACHINE_ARCH}/include/$$h \
156		    ${DESTDIR}${INCLUDEDIR}/machine; \
157	done
158.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
159	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
160	for h in *.h; do \
161		ln -fs ../../../../sys/${MACHINE_ARCH}/include/pc/$$h \
162		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
163	done
164.endif
165