Makefile revision 107046
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 107046 2002-11-18 07:34:56Z marcel $
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	security/lomac security/mac_biba security/mac_bsdextended \
41	security/mac_mls security/mac_partition ufs/ffs ufs/ufs
42
43# For SHARED=symlinks, cam and netatm are symlinks, so cam/scsi and netatm/*
44# are taken care of
45LSYMSUBDIRS=	${LSUBDIRS:Ncam/scsi:Nnetatm/*}
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 "/usr/include/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
80copies:
81.for i in ${LDIRS} ${LSYMSUBDIRS} machine crypto
82	if [ -L ${DESTDIR}/usr/include/$i ]; then \
83		rm -f ${DESTDIR}/usr/include/$i; \
84	fi
85.endfor
86	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
87		-p ${DESTDIR}/usr/include
88.for i in ${LDIRS} ${LSUBDIRS}
89	cd ${.CURDIR}/../sys; \
90		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
91		${DESTDIR}/usr/include/$i
92.endfor
93	cd ${.CURDIR}/../sys; \
94		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 opencrypto/*.h \
95		${DESTDIR}/usr/include/crypto
96.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
97	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
98		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
99		${DESTDIR}/usr/include/machine
100.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
101	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
102		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
103		${DESTDIR}/usr/include/machine/pc
104.endif
105.endif
106
107symlinks:
108	@${ECHO} "Setting up symlinks to kernel source tree..."
109.for i in ${LDIRS}
110	rm -rf ${DESTDIR}/usr/include/$i
111	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
112.endfor
113	rm -rf ${DESTDIR}/usr/include/crypto
114	ln -s ../../sys/opencrypto ${DESTDIR}/usr/include/crypto
115.for i in ${LSYMSUBDIRS}
116	rm -rf ${DESTDIR}/usr/include/$i
117	ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
118.endfor
119	rm -rf ${DESTDIR}/usr/include/machine
120	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
121
122.include <bsd.prog.mk>
123
124installincludes: ${SHARED}
125