Makefile revision 104634
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 104634 2002-10-07 21:18:30Z 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 getopt.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 ulimit.h unistd.h utime.h utmp.h vis.h wchar.h \
25	wctype.h
26
27MHDRS=	float.h floatingpoint.h stdarg.h varargs.h
28
29# posix4/mqueue.h is useless without an implementation and isn't installed:
30PHDRS=	sched.h semaphore.h _semaphore.h # mqueue.h
31
32LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
33	termios.h ucontext.h
34
35LDIRS=	cam net netatalk netatm netgraph netinet netinet6 \
36	netipx netkey netnatm netncp netns netsmb nfs nfsclient nfsserver \
37	pccard posix4 sys vm
38
39LSUBDIRS=	cam/scsi dev/an dev/ic dev/iicbus dev/ppbus dev/smbus \
40	dev/usb dev/wi fs/devfs \
41	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
42	fs/procfs fs/smbfs fs/umapfs fs/unionfs isofs/cd9660 \
43	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
44	security/lomac security/mac_biba security/mac_bsdextended \
45	security/mac_mls ufs/ffs ufs/ufs
46
47# For SHARED=symlinks, cam and netatm are symlinks, so cam/scsi and netatm/*
48# are taken care of
49LSYMSUBDIRS=	${LSUBDIRS:Ncam/scsi:Nnetatm/*}
50
51# Define SHARED to indicate whether you want symbolic links to the system
52# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
53# probably only useful for developers and should be avoided if you do not
54# wish to tie your /usr/include and /usr/src together.
55#SHARED=	symlinks
56SHARED?=	copies
57
58INCS+=	osreldate.h
59
60osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
61		${.CURDIR}/../sys/sys/param.h \
62		${.CURDIR}/Makefile
63	@${ECHO} creating osreldate.h from newvers.sh
64	setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
65	. ${.CURDIR}/../sys/conf/newvers.sh;			\
66	echo "$$COPYRIGHT" > osreldate.h;			\
67	echo "#ifdef _KERNEL" >> osreldate.h;			\
68	echo '#error "/usr/include/osreldate.h cannot be used in the kernel, use sys/param.h"' >> osreldate.h; \
69	echo "#else" >> osreldate.h;				\
70	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
71	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
72	echo "#endif" >> osreldate.h
73
74.for i in ${LHDRS}
75INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
76.endfor
77.for i in ${MHDRS}
78INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
79.endfor
80.for i in ${PHDRS}
81INCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
82.endfor
83
84copies:
85.for i in ${LDIRS} ${LSYMSUBDIRS} machine crypto
86	if [ -L ${DESTDIR}/usr/include/$i ]; then \
87		rm -f ${DESTDIR}/usr/include/$i; \
88	fi
89.endfor
90	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
91		-p ${DESTDIR}/usr/include
92.for i in ${LDIRS} ${LSUBDIRS}
93	cd ${.CURDIR}/../sys; \
94		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
95		${DESTDIR}/usr/include/$i
96.endfor
97	cd ${.CURDIR}/../sys; \
98		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 opencrypto/*.h \
99		${DESTDIR}/usr/include/crypto
100.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
101	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
102		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
103		${DESTDIR}/usr/include/machine
104.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
105	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
106		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
107		${DESTDIR}/usr/include/machine/pc
108.endif
109.endif
110
111symlinks:
112	@${ECHO} "Setting up symlinks to kernel source tree..."
113.for i in ${LDIRS}
114	rm -rf ${DESTDIR}/usr/include/$i
115	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
116.endfor
117	rm -rf ${DESTDIR}/usr/include/crypto
118	ln -s ../../sys/opencrypto ${DESTDIR}/usr/include/crypto
119.for i in ${LSYMSUBDIRS}
120	rm -rf ${DESTDIR}/usr/include/$i
121	ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
122.endfor
123	rm -rf ${DESTDIR}/usr/include/machine
124	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
125
126.include <bsd.prog.mk>
127
128installincludes: ${SHARED}
129