Makefile revision 1.55
1#	$NetBSD: Makefile,v 1.55 1995/06/05 00:24:55 pk Exp $
2
3#	@(#)Makefile	5.45.1.1 (Berkeley) 5/6/91
4
5# Doing a make install builds /usr/include
6#
7# The ``rm -rf''s used below are safe because rm doesn't follow symbolic
8# links.
9
10# Missing: mp.h
11
12FILES=	a.out.h ar.h assert.h bitstring.h bm.h ctype.h db.h dirent.h disktab.h \
13	dlfcn.h err.h fnmatch.h fstab.h fts.h glob.h grp.h ieeefp.h iso646.h \
14	kvm.h langinfo.h limits.h link.h locale.h malloc.h math.h memory.h \
15	mpool.h ndbm.h netdb.h netgroup.h nlist.h nl_types.h paths.h pwd.h \
16	ranlib.h regex.h regexp.h resolv.h search.h setjmp.h sgtty.h signal.h \
17	stab.h stddef.h stdio.h stdlib.h string.h strings.h struct.h \
18	sysexits.h time.h ttyent.h tzfile.h unistd.h utime.h utmp.h vis.h
19
20MFILES=	float.h frame.h stdarg.h varargs.h
21LFILES=	errno.h fcntl.h syslog.h termios.h
22
23DIRS=	arpa protocols rpc rpcsvc
24LDIRS=	dev net netinet netccitt netiso netns nfs sys ufs vm 
25
26NOOBJ=	noobj
27
28# Change SYS_INCLUDE in bsd.own.mk to "symlinks" if you don't want copies
29.include <bsd.own.mk>
30SYS_INCLUDE?=	copies
31
32realinstall:
33	@echo installing ${FILES}
34	@-for i in ${FILES}; do \
35		cmp -s $$i ${DESTDIR}/usr/include/$$i || \
36		    install -c -m 444 $$i ${DESTDIR}/usr/include/$$i; \
37	done
38	@echo installing ${DIRS}
39	@-for i in ${DIRS}; do \
40		install -d -o ${BINOWN} -g ${BINGRP} -m 755 \
41			${DESTDIR}/usr/include/$$i; \
42		(cd $$i; for j in *.[ih]; do \
43			cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j || \
44			install -c -m 444 $$j ${DESTDIR}/usr/include/$$i/$$j; \
45		done); \
46	done
47	@echo installing ${LFILES}
48	@-for i in ${LFILES}; do \
49		rm -f ${DESTDIR}/usr/include/$$i; \
50		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
51	done
52	@echo installing ${MFILES}
53	@-for i in ${MFILES}; do \
54		rm -f ${DESTDIR}/usr/include/$$i; \
55		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
56	done
57	chown -R ${BINOWN}:${BINGRP} ${DESTDIR}/usr/include
58	find ${DESTDIR}/usr/include -type f | \
59		xargs chmod a=r
60	find ${DESTDIR}/usr/include -type d | \
61		xargs chmod u=rwx,go=rx
62
63beforeinstall:
64	install -d -o ${BINOWN} -g ${BINGRP} -m 755 ${DESTDIR}/usr/include
65
66copies:
67	@echo copies: ${LDIRS}
68	@-for i in ${LDIRS}; do \
69		rm -rf ${DESTDIR}/usr/include/$$i; \
70		install -d -o ${BINOWN} -g ${BINGRP} -m 755 \
71			${DESTDIR}/usr/include/$$i ; \
72	done
73	cd ../sys; \
74	pax -rw -pa -L \
75	    `find ${LDIRS} -follow -type f -name '*.h' '!' -path \
76	    'netiso/xebec/*' -print` ${DESTDIR}/usr/include
77	rm -rf ${DESTDIR}/usr/include/machine
78	install -d -o ${BINOWN} -g ${BINGRP} -m 755 \
79		${DESTDIR}/usr/include/machine
80	pax -rw -pa -s "|../sys/arch/${MACHINE}/include||" \
81	    ../sys/arch/${MACHINE}/include/*.h \
82	    ${DESTDIR}/usr/include/machine   
83	rm -rf ${DESTDIR}/usr/include/${MACHINE_ARCH}
84	if test ${MACHINE} != ${MACHINE_ARCH} -a \
85	    -d ../sys/arch/${MACHINE_ARCH}/include; then \
86		install -d -o ${BINOWN} -g ${BINGRP} -m 755 \
87    	    	    ${DESTDIR}/usr/include/${MACHINE_ARCH}; \
88		pax -rw -pa -s "|../sys/arch/${MACHINE_ARCH}/include||" \
89		    ../sys/arch/${MACHINE_ARCH}/include/*.h \
90		    ${DESTDIR}/usr/include/${MACHINE_ARCH}; \
91	else \
92		ln -s machine ${DESTDIR}/usr/include/${MACHINE_ARCH}; \
93	fi
94
95symlinks:
96	@echo symlinks: ${LDIRS}
97	@for i in ${LDIRS}; do \
98		rm -rf ${DESTDIR}/usr/include/$$i; \
99		ln -s /sys/$$i ${DESTDIR}/usr/include/$$i; \
100	done
101	rm -rf ${DESTDIR}/usr/include/machine
102	ln -s /sys/arch/${MACHINE}/include ${DESTDIR}/usr/include/machine
103	rm -rf ${DESTDIR}/usr/include/${MACHINE_ARCH}
104	if test ${MACHINE} != ${MACHINE_ARCH} -a \
105	    -d ../sys/arch/${MACHINE_ARCH}/include ; then \
106		ln -s /sys/arch/${MACHINE_ARCH}/include \
107		    ${DESTDIR}/usr/include/${MACHINE_ARCH} ; \
108	else \
109		ln -s machine ${DESTDIR}/usr/include/${MACHINE_ARCH} ; \
110	fi
111
112.include <bsd.prog.mk>
113
114realinstall: ${SYS_INCLUDE}
115