Makefile revision 39877
1#	From: @(#)Makefile	8.2 (Berkeley) 1/4/94
2#	$Id: Makefile,v 1.84 1998/09/15 11:44:40 phk 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	dlfcn.h elf.h err.h fnmatch.h fstab.h \
15	fts.h glob.h grp.h strhash.h histedit.h iso646.h \
16	kvm.h limits.h link.h locale.h malloc.h memory.h mpool.h \
17	ndbm.h netdb.h nl_types.h nlist.h objformat.h \
18	paths.h pthread.h pthread_np.h pwd.h \
19	ranlib.h regex.h regexp.h resolv.h rune.h runetype.h setjmp.h sgtty.h \
20	signal.h stab.h stddef.h stdio.h stdlib.h string.h stringlist.h \
21	strings.h struct.h sysexits.h tar.h time.h timepps.h timers.h \
22	ttyent.h unistd.h utime.h utmp.h vis.h
23.if defined(WANT_CSRG_LIBM)
24FILES+=	math.h
25.endif
26
27ARPAFILES=	ftp.h inet.h nameser.h nameser_compat.h telnet.h tftp.h
28
29PROTOFILES=	dumprestore.h routed.h rwhod.h talkd.h timed.h
30
31RPCFILES=	auth.h auth_unix.h clnt.h pmap_clnt.h pmap_prot.h pmap_rmt.h \
32		rpc.h rpc_com.h rpc_msg.h svc.h svc_auth.h types.h xdr.h \
33		auth_des.h des.h des_crypt.h
34
35MFILES=	float.h floatingpoint.h stdarg.h varargs.h
36
37# posix4/aio.h conflicts with dysons and isn't installed:
38PFILES=	mqueue.h sched.h semaphore.h \
39		# aio.h
40
41LFILES=	errno.h fcntl.h poll.h syslog.h termios.h
42
43LDIRS=	msdosfs net netns netatalk netatm netinet netipx netkey nfs \
44		pccard posix4 sys vm cam \
45		# netccitt netiso
46
47LNOHEADERDIRS=	isofs ufs
48LSUBDIRS=	isofs/cd9660 ufs/ffs ufs/mfs ufs/ufs cam/scsi
49
50# Define SHARED to indicate whether you want symbolic links to the system
51# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
52# probably only useful for developers and should be avoided if you do not
53# wish to tie your /usr/include and /usr/src together.
54#SHARED=	symlinks
55SHARED?=	copies
56
57
58.if exists (${.CURDIR}/../sys/conf/newvers.sh)
59all:	osreldate.h
60
61osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
62		${.CURDIR}/../sys/sys/param.h
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 \#'undef __FreeBSD_version' >> osreldate.h;	\
68	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h
69.else
70all:
71	@${ECHO} creating osreldate.h from sysctl info
72	echo \#'undef __FreeBSD_version' > osreldate.h
73	echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
74		>> osreldate.h
75.endif
76
77beforeinstall: ${SHARED}
78	cd ${.CURDIR}; \
79		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
80		${FILES} ${DESTDIR}/usr/include
81	cd ${.CURDIR}/arpa; \
82		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
83		${ARPAFILES} ${DESTDIR}/usr/include/arpa
84	cd ${.CURDIR}/protocols; \
85		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
86		${PROTOFILES} ${DESTDIR}/usr/include/protocols
87	cd ${.CURDIR}/rpc; \
88		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
89		${RPCFILES} ${DESTDIR}/usr/include/rpc
90	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
91		${.OBJDIR}/osreldate.h \
92		${DESTDIR}/usr/include
93.for i in ${LFILES}
94	ln -sf sys/$i ${DESTDIR}/usr/include/$i
95.endfor
96.for i in ${MFILES}
97	ln -sf machine/$i ${DESTDIR}/usr/include/$i
98.endfor
99.for i in ${PFILES}
100	ln -sf posix4/$i ${DESTDIR}/usr/include/$i
101.endfor
102
103afterinstall:
104	-cd ${DESTDIR}/usr/include; \
105		h2ph -d ${DESTDIR}/usr/libdata/perl/5.00502/mach * sys/*
106
107copies:
108.for i in ${LDIRS} ${LNOHEADERDIRS} machine
109	if [ -h ${DESTDIR}/usr/include/$i ]; then \
110		rm -f ${DESTDIR}/usr/include/$i; \
111	fi
112.endfor
113	mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
114		-p ${DESTDIR}/usr/include
115.for i in ${LDIRS} ${LSUBDIRS}
116	cd ${.CURDIR}/../sys; \
117		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
118		${DESTDIR}/usr/include/$i
119.endfor
120.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
121	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
122		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
123		${DESTDIR}/usr/include/machine
124.endif
125
126symlinks:
127	@${ECHO} "Setting up symlinks to kernel source tree..."
128.for i in ${LDIRS} ${LNOHEADERDIRS}
129	rm -rf ${DESTDIR}/usr/include/$i
130	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
131.endfor
132	rm -rf ${DESTDIR}/usr/include/machine
133	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
134
135.include <bsd.prog.mk>
136