Makefile revision 16113
1#	From: @(#)Makefile	8.2 (Berkeley) 1/4/94
2#	$Id: Makefile,v 1.35 1996/02/14 15:17:53 wollman 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 netinet netipx 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	@echo \#'undef __FreeBSD_version' > ${OSREL}.new
51	. ${.CURDIR}/../sys/conf/newvers.sh ;				\
52	echo \#'define __FreeBSD_version' $$RELDATE >> ${OSREL}.new
53.else
54	@${ECHO} creating osreldate.h from sysctl info
55	@echo \#'undef __FreeBSD_version' > ${OSREL}.new
56	@echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
57		>> ${OSREL}.new
58.endif
59	@if cmp -s ${OSREL} ${OSREL}.new ; then \
60		rm -f ${OSREL}.new ; else \
61		mv -f ${OSREL}.new ${OSREL} ; fi
62	@chown ${BINOWN}.${BINGRP} ${OSREL}
63	@chmod 444 ${OSREL}
64	@${ECHO} installing ${DIRS}
65	@-for i in ${DIRS}; do \
66		if [ ! -d ${DESTDIR}/usr/include/$$i ]; \
67		then \
68			mkdir ${DESTDIR}/usr/include/$$i; \
69		fi; \
70		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
71		chmod 755 ${DESTDIR}/usr/include/$$i; \
72		(cd ${.CURDIR}/$$i; for j in *.[ih]; do \
73			cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j || \
74			    ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \
75			    ${DESTDIR}/usr/include/$$i/$$j; \
76		done); \
77	done
78	@${ECHO} installing ${LFILES}
79	@-for i in ${LFILES}; do \
80		rm -f ${DESTDIR}/usr/include/$$i; \
81		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
82		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
83	done
84	@${ECHO} installing ${MFILES}
85	@-for i in ${MFILES}; do \
86		rm -f ${DESTDIR}/usr/include/$$i; \
87		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
88		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
89	done
90
91copies:
92	rm -rf ${DESTDIR}/usr/include/${LUDIR}
93	mkdir ${DESTDIR}/usr/include/${LUDIR}
94	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/${LUDIR}
95	chmod 755 ${DESTDIR}/usr/include/${LUDIR}
96	@-for i in ${LDIRS} ${UDIRS}; do				\
97		${ECHO} ${SHARED} $$i;					\
98		rm -rf ${DESTDIR}/usr/include/$$i;			\
99		cd ${.CURDIR}/../sys;					\
100		tar cf - $$i/*.h |					\
101			(cd ${DESTDIR}/usr/include; tar xpfB -);	\
102		chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i;\
103		chmod -R 444 ${DESTDIR}/usr/include/$$i;		\
104		chmod 755 ${DESTDIR}/usr/include/$$i;			\
105	done
106	rm -rf ${DESTDIR}/usr/include/machine
107	mkdir ${DESTDIR}/usr/include/machine
108	cd ${.CURDIR}/../sys/${MACHINE}/include && \
109	    tar cf - *.h | (cd ${DESTDIR}/usr/include/machine; tar xpfB -);
110	chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/machine;
111	chmod -R 444 ${DESTDIR}/usr/include/machine;
112	chmod 755 ${DESTDIR}/usr/include/machine;
113
114symlinks:
115	@for i in ${LDIRS} ${LUDIR}; do					\
116		${ECHO} ${SHARED} $$i;					\
117		rm -rf ${DESTDIR}/usr/include/$$i;			\
118		ln -s /sys/$$i ${DESTDIR}/usr/include/$$i;		\
119		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i;	\
120	done
121	rm -rf ${DESTDIR}/usr/include/machine
122	ln -s /sys/${MACHINE}/include ${DESTDIR}/usr/include/machine
123
124.include <bsd.prog.mk>
125