Makefile revision 101353
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 101353 2002-08-05 06:49:58Z mike $
3#
4# Doing a make install builds /usr/include
5#
6# The ``rm -rf''s used below are safe because rm doesn't follow symbolic
7# links.
8
9CLEANFILES= osreldate.h version vers.c
10SUBDIR= arpa protocols rpcsvc rpc
11INCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h ctype.h db.h \
12	dirent.h \
13	dlfcn.h elf.h elf-hints.h err.h fnmatch.h fmtmsg.h fstab.h \
14	fts.h glob.h grp.h \
15	hesiod.h histedit.h ieeefp.h ifaddrs.h inttypes.h iso646.h kenv.h \
16	langinfo.h \
17	libgen.h limits.h link.h locale.h malloc.h memory.h monetary.h mpool.h \
18	ndbm.h netconfig.h netdb.h nl_types.h nlist.h nsswitch.h objformat.h \
19	paths.h pthread.h pthread_np.h pwd.h \
20	ranlib.h readpassphrase.h regex.h regexp.h resolv.h rune.h runetype.h \
21	search.h setjmp.h sgtty.h \
22	signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h strhash.h \
23	string.h stringlist.h strings.h sysexits.h tar.h time.h timeconv.h \
24	timers.h ttyent.h unistd.h utime.h utmp.h vis.h wchar.h wctype.h
25
26MHDRS=	float.h floatingpoint.h stdarg.h varargs.h
27
28# posix4/aio.h conflicts with dysons and isn't installed:
29PHDRS=	mqueue.h sched.h semaphore.h # aio.h
30
31LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
32	termios.h ucontext.h
33
34LDIRS=	cam net netatalk netatm netgraph netinet netinet6 \
35	netipx netkey netnatm netncp netns netsmb nfs nfsclient nfsserver \
36	pccard posix4 sys vm
37
38LSUBDIRS=	cam/scsi dev/ic dev/ppbus dev/usb dev/wi dev/an fs/devfs \
39	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
40	fs/procfs fs/smbfs fs/umapfs fs/unionfs isofs/cd9660 \
41	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
42	security/lomac security/mac_biba security/mac_bsdextended \
43	security/mac_mls ufs/ffs ufs/ufs
44
45# For SHARED=symlinks, cam and netatm are symlinks, so cam/scsi and netatm/*
46# are taken care of
47LSYMSUBDIRS=	${LSUBDIRS:Ncam/scsi:Nnetatm/*}
48
49# Define SHARED to indicate whether you want symbolic links to the system
50# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
51# probably only useful for developers and should be avoided if you do not
52# wish to tie your /usr/include and /usr/src together.
53#SHARED=	symlinks
54SHARED?=	copies
55
56INCS+=	osreldate.h
57
58osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
59		${.CURDIR}/../sys/sys/param.h \
60		${.CURDIR}/Makefile
61	@${ECHO} creating osreldate.h from newvers.sh
62	setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
63	. ${.CURDIR}/../sys/conf/newvers.sh;			\
64	echo "$$COPYRIGHT" > osreldate.h;			\
65	echo "#ifdef _KERNEL" >> osreldate.h;			\
66	echo '#error "/usr/include/osreldate.h cannot be used in the kernel, use sys/param.h"' >> osreldate.h; \
67	echo "#else" >> osreldate.h;				\
68	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
69	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
70	echo "#endif" >> osreldate.h
71
72.for i in ${LHDRS}
73INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
74.endfor
75.for i in ${MHDRS}
76INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
77.endfor
78.for i in ${PHDRS}
79INCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
80.endfor
81
82copies:
83.for i in ${LDIRS} ${LSYMSUBDIRS} machine
84	if [ -h ${DESTDIR}/usr/include/$i ]; then \
85		rm -f ${DESTDIR}/usr/include/$i; \
86	fi
87.endfor
88	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
89		-p ${DESTDIR}/usr/include
90.for i in ${LDIRS} ${LSUBDIRS}
91	cd ${.CURDIR}/../sys; \
92		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
93		${DESTDIR}/usr/include/$i
94.endfor
95.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
96	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
97		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
98		${DESTDIR}/usr/include/machine
99.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
100	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
101		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
102		${DESTDIR}/usr/include/machine/pc
103.endif
104.endif
105
106symlinks:
107	@${ECHO} "Setting up symlinks to kernel source tree..."
108.for i in ${LDIRS}
109	rm -rf ${DESTDIR}/usr/include/$i
110	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
111.endfor
112.for i in ${LSYMSUBDIRS}
113	rm -rf ${DESTDIR}/usr/include/$i
114	ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
115.endfor
116	rm -rf ${DESTDIR}/usr/include/machine
117	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
118
119.include <bsd.prog.mk>
120
121installincludes: ${SHARED}
122