Makefile revision 1.45
1#	from: @(#)Makefile	5.45.1.1 (Berkeley) 5/6/91
2#	$Id: Makefile,v 1.45 1994/07/21 07:33:11 cgd 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
9# Missing: mp.h
10
11FILES=	a.out.h ar.h assert.h bitstring.h bm.h ctype.h db.h dirent.h disktab.h \
12	err.h fnmatch.h fstab.h fts.h glob.h grp.h kvm.h langinfo.h limits.h \
13	locale.h math.h memory.h mpool.h ndbm.h netdb.h nlist.h nl_types.h \
14	paths.h pwd.h ranlib.h regex.h regexp.h resolv.h \
15	search.h setjmp.h sgtty.h signal.h stab.h stdarg.h stddef.h \
16	stdio.h stdlib.h string.h strings.h struct.h sysexits.h time.h \
17	ttyent.h tzfile.h unistd.h utime.h utmp.h vis.h malloc.h \
18	link.h
19
20MFILES=	float.h frame.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# the following only used when making copies
26LSUBDIRS= ufs/ffs ufs/lfs ufs/mfs ufs/ufs
27
28NOOBJ=	noobj
29
30# Change SYS_INCLUDE in bsd.own.mk to "symlinks" if you don't want copies
31.include <bsd.own.mk>
32SYS_INCLUDE?=	copies
33
34realinstall:
35	@echo installing ${FILES}
36	@-for i in ${FILES}; do \
37		cmp -s $$i ${DESTDIR}/usr/include/$$i || \
38		    install -c -m 444 $$i ${DESTDIR}/usr/include/$$i; \
39	done
40	@echo installing ${DIRS}
41	@-for i in ${DIRS}; do \
42		install -d -o bin -g bin -m 755 ${DESTDIR}/usr/include/$$i; \
43		(cd $$i; for j in *.[ih]; do \
44			cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j || \
45			install -c -m 444 $$j ${DESTDIR}/usr/include/$$i/$$j; \
46		done); \
47	done
48	@echo installing ${LFILES}
49	@-for i in ${LFILES}; do \
50		rm -f ${DESTDIR}/usr/include/$$i; \
51		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
52	done
53	@echo installing ${MFILES}
54	@-for i in ${MFILES}; do \
55		rm -f ${DESTDIR}/usr/include/$$i; \
56		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
57	done
58	chown -R ${BINOWN}:${BINGRP} ${DESTDIR}/usr/include
59	find ${DESTDIR}/usr/include -type f | \
60		xargs chmod a=r
61	find ${DESTDIR}/usr/include -type d | \
62		xargs chmod u=rwx,go=rx
63
64beforeinstall:
65	install -d -o bin -g bin -m 755 ${DESTDIR}/usr/include
66
67copies:
68	@echo copies: ${LDIRS}
69	@-for i in ${LDIRS}; do \
70		rm -rf ${DESTDIR}/usr/include/$$i; \
71		install -d -o bin -g bin -m 755 ${DESTDIR}/usr/include/$$i ; \
72	done
73# This would be simpler if we didn't care whether netiso/xebec gets installed.
74	cd ../sys; \
75	pax -rw -pa -L `find ${LDIRS} '(' -type d -path '*/*' -prune ')' -o \
76	    '(' -type f -name '*.h' -print ')'; \
77	    find ${LSUBDIRS} -type f -name '*.h' -print` ${DESTDIR}/usr/include
78	rm -rf ${DESTDIR}/usr/include/machine
79	install -d -o bin -g bin -m 755 ${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 bin -g bin -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