Makefile revision 108287
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 108287 2002-12-26 14:30:55Z tjr $
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	wordexp.h
23
24MHDRS=	float.h floatingpoint.h stdarg.h varargs.h
25
26# posix4/mqueue.h is useless without an implementation and isn't installed:
27PHDRS=	sched.h semaphore.h _semaphore.h # mqueue.h
28
29LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
30	termios.h ucontext.h
31
32LDIRS=	cam net netatalk netatm netgraph netinet netinet6 netipsec \
33	netipx netkey netnatm netncp netns netsmb nfs nfsclient nfsserver \
34	pccard posix4 sys vm
35
36LSUBDIRS=	cam/scsi dev/an dev/ic dev/iicbus dev/ofw dev/ppbus dev/smbus \
37	dev/usb dev/wi fs/devfs \
38	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
39	fs/procfs fs/smbfs fs/umapfs fs/unionfs isofs/cd9660 \
40	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
41	netgraph/bluetooth/include \
42	security/mac_biba security/mac_bsdextended security/mac_lomac\
43	security/mac_mls security/mac_partition ufs/ffs ufs/ufs
44
45# For SHARED=symlinks, cam, netatm, and netgraph are symlinks, so cam/scsi,
46# netatm/*, and netgraph/* are taken care of
47LSYMSUBDIRS=	${LSUBDIRS:Ncam/scsi:Nnetatm/*:Nnetgraph/*}
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 crypto
84	if [ -L ${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	cd ${.CURDIR}/../sys; \
96		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 opencrypto/*.h \
97		${DESTDIR}/usr/include/crypto
98.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
99	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
100		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
101		${DESTDIR}/usr/include/machine
102.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
103	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
104		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
105		${DESTDIR}/usr/include/machine/pc
106.endif
107.endif
108
109symlinks:
110	@${ECHO} "Setting up symlinks to kernel source tree..."
111.for i in ${LDIRS}
112	rm -rf ${DESTDIR}/usr/include/$i
113	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
114.endfor
115	rm -rf ${DESTDIR}/usr/include/crypto
116	ln -s ../../sys/opencrypto ${DESTDIR}/usr/include/crypto
117.for i in ${LSYMSUBDIRS}
118	rm -rf ${DESTDIR}/usr/include/$i
119	ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
120.endfor
121	rm -rf ${DESTDIR}/usr/include/machine
122	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
123
124.include <bsd.prog.mk>
125
126installincludes: ${SHARED}
127