Makefile revision 25984
1#	From: @(#)Makefile	8.2 (Berkeley) 1/4/94
2#	$Id: Makefile,v 1.55 1997/05/12 09:50:19 peter Exp $
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#
9depend lint tags:
10
11CLEANFILES= osreldate.h version vers.c
12SUBDIR= rpcsvc
13FILES=	a.out.h ar.h assert.h bitstring.h ctype.h db.h dirent.h disktab.h \
14	elf.h err.h fnmatch.h fstab.h fts.h glob.h grp.h strhash.h histedit.h \
15	kvm.h limits.h link.h locale.h malloc.h memory.h mpool.h \
16	ndbm.h netdb.h nl_types.h nlist.h paths.h pthread.h pthread_np.h pwd.h \
17	ranlib.h regex.h regexp.h resolv.h rune.h runetype.h setjmp.h sgtty.h \
18	signal.h stab.h stddef.h stdio.h stdlib.h string.h strings.h \
19	struct.h sysexits.h tar.h time.h timers.h ttyent.h unistd.h utime.h \
20	utmp.h vis.h
21.if defined(WANT_CSRG_LIBM)
22FILES+=	math.h
23.endif
24
25ARPAFILES=	ftp.h inet.h nameser.h telnet.h tftp.h
26
27PROTOFILES=	dumprestore.h routed.h rwhod.h talkd.h timed.h
28
29RPCFILES=	auth.h auth_unix.h clnt.h pmap_clnt.h pmap_prot.h pmap_rmt.h \
30		rpc.h rpc_msg.h svc.h svc_auth.h types.h xdr.h
31
32MFILES=	float.h floatingpoint.h stdarg.h varargs.h
33LFILES=	errno.h fcntl.h syslog.h termios.h
34
35LDIRS=	msdosfs net netns netatalk netinet netipx netkey nfs pccard sys vm \
36		# netccitt netiso
37
38LNOHEADERDIRS=	isofs ufs
39LSUBDIRS=	isofs/cd9660 ufs/ffs ufs/lfs ufs/mfs ufs/ufs
40
41# Define SHARED to indicate whether you want symbolic links to the system
42# source (``symlinks''), or a separate copy (``copies''); (latter useful
43# in environments where it's not possible to keep /sys publicly readable)
44# SHARED=	copies
45SHARED?=	symlinks
46
47
48.if exists (${.CURDIR}/../sys/conf/newvers.sh)
49all:	osreldate.h
50
51osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh
52	@${ECHO} creating osreldate.h from newvers.sh
53	. ${.CURDIR}/../sys/conf/newvers.sh;			\
54	echo "$$COPYRIGHT" > osreldate.h;			\
55	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
56	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h
57.else
58all:
59	@${ECHO} creating osreldate.h from sysctl info
60	echo \#'undef __FreeBSD_version' > osreldate.h
61	echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
62		>> osreldate.h
63.endif
64
65beforeinstall: ${SHARED}
66	cd ${.CURDIR}; \
67		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
68		${FILES} ${DESTDIR}/usr/include
69	cd ${.CURDIR}/arpa; \
70		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
71		${ARPAFILES} ${DESTDIR}/usr/include/arpa
72	cd ${.CURDIR}/protocols; \
73		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
74		${PROTOFILES} ${DESTDIR}/usr/include/protocols
75	cd ${.CURDIR}/rpc; \
76		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
77		${RPCFILES} ${DESTDIR}/usr/include/rpc
78	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 osreldate.h \
79		${DESTDIR}/usr/include
80.for i in ${LFILES}
81	ln -sf sys/$i ${DESTDIR}/usr/include/$i
82.endfor
83.for i in ${MFILES}
84	ln -sf machine/$i ${DESTDIR}/usr/include/$i
85.endfor
86
87copies:
88.for i in ${LDIRS} ${LNOHEADERDIRS} machine
89	if [ -h ${DESTDIR}/usr/include/$i ]; then \
90		rm -f ${DESTDIR}/usr/include/$i; \
91	fi
92.endfor
93	mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
94		-p ${DESTDIR}/usr/include
95.for i in ${LDIRS} ${LSUBDIRS}
96	cd ${.CURDIR}/../sys; \
97		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
98		${DESTDIR}/usr/include/$i
99.endfor
100.if exists(${.CURDIR}/../sys/${MACHINE}/include)
101	cd ${.CURDIR}/../sys/${MACHINE}/include; \
102		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
103		${DESTDIR}/usr/include/machine
104.endif
105
106symlinks:
107	@${ECHO} "Setting up symlinks to kernel source tree..."
108.for i in ${LDIRS} ${LNOHEADERDIRS}
109	rm -rf ${DESTDIR}/usr/include/$i
110	ln -s /sys/$i ${DESTDIR}/usr/include/$i
111.endfor
112	rm -rf ${DESTDIR}/usr/include/machine
113	ln -s /sys/${MACHINE}/include ${DESTDIR}/usr/include/machine
114
115.include <bsd.prog.mk>
116