Makefile revision 107223
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 107223 2002-11-25 08:55:50Z ru $
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 dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
13	fts.h getopt.h glob.h grp.h hesiod.h histedit.h ieeefp.h ifaddrs.h \
14	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
15	locale.h malloc.h memory.h monetary.h mpool.h ndbm.h netconfig.h \
16	netdb.h nl_types.h nlist.h nsswitch.h objformat.h paths.h pthread.h \
17	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
18	resolv.h rune.h runetype.h search.h setjmp.h sgtty.h signal.h stab.h \
19	stdbool.h stddef.h stdio.h stdlib.h strhash.h string.h stringlist.h \
20	strings.h sysexits.h tar.h time.h timeconv.h timers.h ttyent.h \
21	ulimit.h unistd.h utime.h utmp.h uuid.h vis.h wchar.h wctype.h
22
23MHDRS=	float.h floatingpoint.h stdarg.h varargs.h
24
25# posix4/mqueue.h is useless without an implementation and isn't installed:
26PHDRS=	sched.h semaphore.h _semaphore.h # mqueue.h
27
28LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
29	termios.h ucontext.h
30
31LDIRS=	cam net netatalk netatm netgraph netinet netinet6 netipsec \
32	netipx netkey netnatm netncp netns netsmb nfs nfsclient nfsserver \
33	pccard posix4 sys vm
34
35LSUBDIRS=	cam/scsi dev/an dev/ic dev/iicbus dev/ofw dev/ppbus dev/smbus \
36	dev/usb dev/wi fs/devfs \
37	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
38	fs/procfs fs/smbfs fs/umapfs fs/unionfs isofs/cd9660 \
39	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
40	netgraph/bluetooth/include \
41	security/lomac security/mac_biba security/mac_bsdextended \
42	security/mac_mls security/mac_partition ufs/ffs ufs/ufs
43
44# For SHARED=symlinks, cam, netatm, and netgraph are symlinks, so cam/scsi,
45# netatm/*, and netgraph/* are taken care of
46LSYMSUBDIRS=	${LSUBDIRS:Ncam/scsi:Nnetatm/*:Nnetgraph/*}
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 "/usr/include/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
81copies:
82.for i in ${LDIRS} ${LSYMSUBDIRS} machine crypto
83	if [ -L ${DESTDIR}/usr/include/$i ]; then \
84		rm -f ${DESTDIR}/usr/include/$i; \
85	fi
86.endfor
87	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
88		-p ${DESTDIR}/usr/include
89.for i in ${LDIRS} ${LSUBDIRS}
90	cd ${.CURDIR}/../sys; \
91		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
92		${DESTDIR}/usr/include/$i
93.endfor
94	cd ${.CURDIR}/../sys; \
95		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 opencrypto/*.h \
96		${DESTDIR}/usr/include/crypto
97.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
98	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
99		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
100		${DESTDIR}/usr/include/machine
101.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
102	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
103		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
104		${DESTDIR}/usr/include/machine/pc
105.endif
106.endif
107
108symlinks:
109	@${ECHO} "Setting up symlinks to kernel source tree..."
110.for i in ${LDIRS}
111	rm -rf ${DESTDIR}/usr/include/$i
112	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
113.endfor
114	rm -rf ${DESTDIR}/usr/include/crypto
115	ln -s ../../sys/opencrypto ${DESTDIR}/usr/include/crypto
116.for i in ${LSYMSUBDIRS}
117	rm -rf ${DESTDIR}/usr/include/$i
118	ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
119.endfor
120	rm -rf ${DESTDIR}/usr/include/machine
121	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
122
123.include <bsd.prog.mk>
124
125installincludes: ${SHARED}
126