Makefile revision 17900
1#	From: @(#)Makefile	8.2 (Berkeley) 1/4/94
2#	$Id: Makefile,v 1.40 1996/08/20 08:19:33 julian 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#
9all depend lint tags:
10
11CLEANFILES=version vers.c
12SUBDIR= rpcsvc
13FILES=	a.out.h ar.h assert.h bitstring.h ctype.h db.h dirent.h disktab.h \
14	err.h f2c.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 ndbm.h \
16	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=  net netatalk netinet netipx netkey nfs pccard sys vm #netccitt netiso netns
36
37LUDIR=	ufs
38UDIRS=	ufs/ffs ufs/lfs ufs/mfs ufs/ufs
39
40# Define SHARED to indicate whether you want symbolic links to the system
41# source (``symlinks''), or a separate copy (``copies''); (latter useful
42# in environments where it's not possible to keep /sys publicly readable)
43# SHARED=	copies
44SHARED?=	symlinks
45
46beforeinstall: ${SHARED}
47	cd ${.CURDIR}; \
48		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
49		${FILES} ${DESTDIR}/usr/include
50	cd ${.CURDIR}/arpa; \
51		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
52		${ARPAFILES} ${DESTDIR}/usr/include/arpa
53	cd ${.CURDIR}/protocols; \
54		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
55		${PROTOFILES} ${DESTDIR}/usr/include/protocols
56	@rm -f osreldate.h
57.if exists (${.CURDIR}/../sys/conf/newvers.sh)
58	@${ECHO} creating osreldate.h from newvers.sh
59	. ${.CURDIR}/../sys/conf/newvers.sh;			\
60	echo "$$COPYRIGHT" > osreldate.h;			\
61	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
62	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h
63.else
64	@${ECHO} creating osreldate.h from sysctl info
65	@echo \#'undef __FreeBSD_version' > osreldate.h
66	@echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
67		>> osreldate.h
68.endif
69	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 osreldate.h \
70		${DESTDIR}/usr/include
71.for i in ${LFILES}
72	ln -sf sys/$i ${DESTDIR}/usr/include/$i
73.endfor
74.for i in ${MFILES}
75	ln -sf machine/$i ${DESTDIR}/usr/include/$i
76.endfor
77
78copies:
79.for i in ${LDIRS} ${UDIRS} ${LUDIR} machine
80	if [ -h ${DESTDIR}/usr/include/$i ]; then \
81		rm -f ${DESTDIR}/usr/include/$i; \
82	fi
83.endfor
84.for i in ${LDIRS} ${UDIRS} ${LUDIR} machine
85	if [ ! -d ${DESTDIR}/usr/include/$i ]; then \
86		mkdir ${DESTDIR}/usr/include/$i; \
87		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$i; \
88		chmod 755 ${DESTDIR}/usr/include/$i; \
89	fi
90.endfor
91.for i in ${LDIRS} ${UDIRS}
92	cd ${.CURDIR}/../sys; \
93		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
94		${DESTDIR}/usr/include/$i
95.endfor
96.if exists(${.CURDIR}/../sys/${MACHINE}/include)
97	cd ${.CURDIR}/../sys/${MACHINE}/include; \
98		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
99		${DESTDIR}/usr/include/machine
100.endif
101
102symlinks:
103	@echo "Setting up symlinks to kernel source tree..."
104.for i in ${LDIRS} ${LUDIR}
105	rm -rf ${DESTDIR}/usr/include/$i && \
106		ln -s /sys/$i ${DESTDIR}/usr/include/$i
107.endfor
108	rm -rf ${DESTDIR}/usr/include/machine && \
109		ln -s /sys/${MACHINE}/include ${DESTDIR}/usr/include/machine
110
111.include <bsd.prog.mk>
112