Makefile revision 7495
1#	From: @(#)Makefile	8.2 (Berkeley) 1/4/94
2#	$Id: Makefile,v 1.24 1995/03/26 10:12:51 jkh 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
11SUBDIR= rpcsvc
12# XXX MISSING:	mp.h
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 pwd.h ranlib.h regex.h regexp.h \
17	resolv.h rune.h runetype.h setjmp.h sgtty.h signal.h \
18	stab.h stddef.h stdio.h stdlib.h string.h strings.h struct.h \
19	sysexits.h tar.h time.h ttyent.h tzfile.h unistd.h utime.h \
20	utmp.h vis.h
21.if defined(WANT_CSRG_LIBM)
22FILES+=	math.h
23.endif
24
25MFILES=	float.h floatingpoint.h stdarg.h varargs.h
26LFILES=	errno.h fcntl.h syslog.h termios.h
27
28DIRS=	arpa protocols rpc
29LDIRS=	net netccitt netinet netiso netns nfs sys vm
30LUDIR=	ufs
31UDIRS=	ufs/ffs ufs/lfs ufs/mfs ufs/ufs
32
33NOOBJ=	noobj
34
35# Define SHARED to indicate whether you want symbolic links to the system
36# source (``symlinks''), or a separate copy (``copies''); (latter useful
37# in environments where it's not possible to keep /sys publicly readable)
38# SHARED=	copies
39SHARED?=	symlinks
40
41OSREL	= ${DESTDIR}/usr/include/osreldate.h
42beforeinstall: ${SHARED}
43	@${ECHO} installing ${FILES}
44	@-for i in ${FILES}; do \
45		cmp -s $$i ${DESTDIR}/usr/include/$$i || \
46		    install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$i \
47		    ${DESTDIR}/usr/include/$$i; \
48	done
49.if exists (${.CURDIR}/../sys/conf/newvers.sh)
50	@${ECHO} creating osreldate.h from newvers.sh
51	@echo \#'undef __FreeBSD_version' > ${OSREL}.new
52	JUST_TELL_ME=please ;						\
53	. ${.CURDIR}/../sys/conf/newvers.sh ;				\
54	echo \#'define __FreeBSD_version' $$RELDATE >> ${OSREL}.new
55.else
56	@${ECHO} creating osreldate.h from sysctl info
57	@echo \#'undef __FreeBSD_version' > ${OSREL}.new
58	@echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
59		>> ${OSREL}.new
60.endif
61	@if cmp -s ${OSREL} ${OSREL}.new ; then \
62		rm -f ${OSREL}.new ; else \
63		mv -f ${OSREL}.new ${OSREL} ; fi
64	@chown ${BINOWN}.${BINGRP} ${OSREL}
65	@chmod 444 ${OSREL}
66	@${ECHO} installing ${DIRS}
67	@-for i in ${DIRS}; do \
68		if [ ! -d ${DESTDIR}/usr/include/$$i ]; \
69		then \
70			mkdir ${DESTDIR}/usr/include/$$i; \
71		fi; \
72		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
73		chmod 755 ${DESTDIR}/usr/include/$$i; \
74		(cd $$i; for j in *.[ih]; do \
75			cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j || \
76			    install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \
77			    ${DESTDIR}/usr/include/$$i/$$j; \
78		done); \
79	done
80	@${ECHO} installing ${LFILES}
81	@-for i in ${LFILES}; do \
82		rm -f ${DESTDIR}/usr/include/$$i; \
83		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
84		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
85	done
86	@${ECHO} installing ${MFILES}
87	@-for i in ${MFILES}; do \
88		rm -f ${DESTDIR}/usr/include/$$i; \
89		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
90		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
91	done
92
93copies:
94	rm -rf ${DESTDIR}/usr/include/${LUDIR}
95	mkdir ${DESTDIR}/usr/include/${LUDIR}
96	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/${LUDIR}
97	@-for i in ${LDIRS} ${UDIRS}; do				\
98		${ECHO} ${SHARED} $$i;					\
99		rm -rf ${DESTDIR}/usr/include/$$i;			\
100		cd ../sys;						\
101		tar cf - $$i/*.h |					\
102			(cd ${DESTDIR}/usr/include; tar xpfB -);	\
103		chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i;\
104		chmod -R 444 ${DESTDIR}/usr/include/$$i;		\
105		chmod 755 ${DESTDIR}/usr/include/$$i;			\
106	done
107	rm -rf ${DESTDIR}/usr/include/machine
108	mkdir ${DESTDIR}/usr/include/machine
109	cd ../sys/${MACHINE}/include && \
110	    tar cf - *.h | (cd ${DESTDIR}/usr/include/machine; tar xpfB -);
111	chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/machine;
112	chmod -R 444 ${DESTDIR}/usr/include/machine;
113	chmod 755 ${DESTDIR}/usr/include/machine;
114
115symlinks:
116	@for i in ${LDIRS} ${LUDIR}; do					\
117		${ECHO} ${SHARED} $$i;					\
118		rm -rf ${DESTDIR}/usr/include/$$i;			\
119		ln -s /sys/$$i ${DESTDIR}/usr/include/$$i;		\
120		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i;	\
121	done
122	rm -rf ${DESTDIR}/usr/include/machine
123	ln -s /sys/${MACHINE}/include ${DESTDIR}/usr/include/machine
124
125.include <bsd.prog.mk>
126