Makefile revision 17432
1#	From: @(#)Makefile	8.2 (Berkeley) 1/4/94
2#	$Id: Makefile,v 1.38 1996/07/09 15:48:20 ache 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 pwd.h ranlib.h regex.h \
17	regexp.h 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 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
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 netatalk netinet netipx netkey nfs pccard sys vm #netccitt netiso netns
30LUDIR=	ufs
31UDIRS=	ufs/ffs ufs/lfs ufs/mfs ufs/ufs
32
33# Define SHARED to indicate whether you want symbolic links to the system
34# source (``symlinks''), or a separate copy (``copies''); (latter useful
35# in environments where it's not possible to keep /sys publicly readable)
36# SHARED=	copies
37SHARED?=	symlinks
38
39OSREL	= ${DESTDIR}/usr/include/osreldate.h
40beforeinstall: ${SHARED}
41	@${ECHO} installing ${FILES}
42	@cd ${.CURDIR}; \
43	for i in ${FILES}; do \
44		cmp -s $$i ${DESTDIR}/usr/include/$$i || \
45		    ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 $$i \
46		    ${DESTDIR}/usr/include/$$i; \
47	done
48.if exists (${.CURDIR}/../sys/conf/newvers.sh)
49	@${ECHO} creating osreldate.h from newvers.sh
50	. ${.CURDIR}/../sys/conf/newvers.sh;			\
51	echo "$$COPYRIGHT" >> ${OSREL}.new;			\
52	echo \#'undef __FreeBSD_version' >> ${OSREL}.new;	\
53	echo \#'define __FreeBSD_version' $$RELDATE >> ${OSREL}.new
54.else
55	@${ECHO} creating osreldate.h from sysctl info
56	@echo \#'undef __FreeBSD_version' > ${OSREL}.new
57	@echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
58		>> ${OSREL}.new
59.endif
60	@if cmp -s ${OSREL} ${OSREL}.new ; then \
61		rm -f ${OSREL}.new ; else \
62		mv -f ${OSREL}.new ${OSREL} ; fi
63	@chown ${BINOWN}.${BINGRP} ${OSREL}
64	@chmod 444 ${OSREL}
65	@${ECHO} installing ${DIRS}
66	@-for i in ${DIRS}; do \
67		if [ ! -d ${DESTDIR}/usr/include/$$i ]; \
68		then \
69			mkdir ${DESTDIR}/usr/include/$$i; \
70		fi; \
71		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
72		chmod 755 ${DESTDIR}/usr/include/$$i; \
73		(cd ${.CURDIR}/$$i; for j in *.[ih]; do \
74			cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j || \
75			    ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \
76			    ${DESTDIR}/usr/include/$$i/$$j; \
77		done); \
78	done
79	@${ECHO} installing ${LFILES}
80	@-for i in ${LFILES}; do \
81		rm -f ${DESTDIR}/usr/include/$$i; \
82		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
83		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
84	done
85	@${ECHO} installing ${MFILES}
86	@-for i in ${MFILES}; do \
87		rm -f ${DESTDIR}/usr/include/$$i; \
88		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
89		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
90	done
91
92copies:
93	rm -rf ${DESTDIR}/usr/include/${LUDIR}
94	mkdir ${DESTDIR}/usr/include/${LUDIR}
95	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/${LUDIR}
96	chmod 755 ${DESTDIR}/usr/include/${LUDIR}
97	@-for i in ${LDIRS} ${UDIRS}; do				\
98		${ECHO} ${SHARED} $$i;					\
99		rm -rf ${DESTDIR}/usr/include/$$i;			\
100		cd ${.CURDIR}/../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 ${.CURDIR}/../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