Makefile revision 1.86
1#	$OpenBSD: Makefile,v 1.86 2000/10/10 12:12:28 hugh Exp $
2#	$NetBSD: Makefile,v 1.59 1996/05/15 21:36:43 jtc Exp $
3
4#	@(#)Makefile	5.45.1.1 (Berkeley) 5/6/91
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 blf.h bm.h cast.h cpio.h \
12	ctype.h curses.h db.h dbm.h des.h dirent.h disktab.h elf_abi.h err.h \
13	fnmatch.h fstab.h fts.h glob.h grp.h ifaddrs.h inttypes.h \
14	iso646.h kvm.h langinfo.h libgen.h limits.h locale.h login_cap.h \
15	malloc.h math.h md4.h md5.h memory.h mpool.h ndbm.h netdb.h netgroup.h \
16	nlist.h nl_types.h olf_abi.h paths.h poll.h pwd.h ranlib.h re_comp.h \
17	regex.h resolv.h rmd160.h search.h setjmp.h sgtty.h sha1.h skipjack.h \
18	signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h string.h strings.h \
19	struct.h sysexits.h tar.h time.h ttyent.h tzfile.h unistd.h utime.h \
20	utmp.h vis.h
21
22.if (${MACHINE_ARCH} != "alpha") && (${MACHINE_ARCH} != "mips") && \
23	(${MACHINE_ARCH} != "powerpc")
24FILES+=	dlfcn.h link.h
25.endif
26
27.if (${MACHINE_ARCH} != "vax")
28FILES+= ieeefp.h
29.endif
30
31MFILES=	float.h frame.h stdarg.h varargs.h
32LFILES=	errno.h fcntl.h syslog.h termios.h
33
34.if (${MACHINE_ARCH} == "mips" || ${MACHINE_ARCH} == "powerpc")
35MFILES+= link.h dlfcn.h
36.endif
37
38DIRS=	arpa protocols rpc rpcsvc
39LDIRS=	crypto ddb dev isofs miscfs net netatalk netccitt netinet \
40	netinet6 netipx netiso netnatm netns nfs scsi sys ufs uvm vm xfs
41
42# Directories with an includes target
43RDIRS=	../lib/libc_r ../lib/libcom_err ../lib/libcompat ../lib/libcurses \
44	../lib/libcurses++ ../lib/libform ../lib/libmenu ../lib/libocurses \
45	../lib/libossaudio ../lib/libpanel ../lib/librpcsvc ../lib/libskey \
46	../lib/libedit ../lib/libpcap ../lib/libutil ../lib/libwrap \
47	../lib/libz ../lib/libkeynote ../sys/arch/${MACHINE}
48
49# Places using Makefile that needs a prerequisite target met before includes
50PRDIRS=
51
52# Directories with an includes target that use Makefile.bsd-wrapper
53WDIRS=	../lib/libssl ../gnu/lib/libgmp ../usr.sbin/httpd
54WDIRS+= ../gnu/egcs/libio ../gnu/egcs/libstdc++ ../gnu/egcs/libf2c \
55	../gnu/egcs/libobjc ../gnu/egcs/gcc
56
57# Places using Makefile.bsd-wrapper that needs a prerequisite target met
58# before includes
59PWDIRS=	../lib/libssl ../usr.sbin/httpd ../gnu/egcs/libf2c
60
61NOOBJ=	noobj
62
63# Change SYS_INCLUDE in bsd.own.mk to "symlinks" if you don't want copies
64.include <bsd.own.mk>
65SYS_INCLUDE?=	copies
66.if (${KERBEROS:L} == "yes")
67RDIRS+=	../kerberosIV/lib
68PRDIRS+=../kerberosIV/lib/kadm ../kerberosIV/lib/krb
69.endif
70
71prereq:
72	@-for i in ${PRDIRS}; do \
73		echo preparing in ${.CURDIR}/$$i; \
74		(cd ${.CURDIR}/$$i; ${MAKE} prereq) \
75	done
76	@-for i in ${PWDIRS}; do \
77		echo preparing in ${.CURDIR}/$$i; \
78		(cd ${.CURDIR}/$$i; ${MAKE} -f Makefile.bsd-wrapper prereq) \
79	done
80
81includes:
82	@echo installing ${FILES}
83	@-for i in ${FILES}; do \
84		cmp -s $$i ${DESTDIR}/usr/include/$$i || \
85		    ${INSTALL} ${INSTALL_COPY} -m 444 $$i ${DESTDIR}/usr/include/$$i; \
86	done
87	@echo installing ${DIRS}
88	@-for i in ${DIRS}; do \
89		${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
90			${DESTDIR}/usr/include/$$i; \
91		(cd $$i; for j in *.[ih]; do \
92			cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j || \
93			${INSTALL} ${INSTALL_COPY} -m 444 $$j ${DESTDIR}/usr/include/$$i/$$j; \
94		done); \
95	done
96	@rm -f ${DESTDIR}/usr/include/openssl
97	@ln -sf ssl ${DESTDIR}/usr/include/openssl
98	@echo installing ${LFILES}
99	@-for i in ${LFILES}; do \
100		rm -f ${DESTDIR}/usr/include/$$i; \
101		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
102	done
103	@echo installing ${MFILES}
104	@-for i in ${MFILES}; do \
105		rm -f ${DESTDIR}/usr/include/$$i; \
106		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
107	done
108	chown -R ${BINOWN}:${BINGRP} ${DESTDIR}/usr/include
109	find ${DESTDIR}/usr/include -type f | \
110		xargs chmod a=r
111	find ${DESTDIR}/usr/include -type d | \
112		xargs chmod u=rwx,go=rx
113	@-for i in ${RDIRS}; do \
114		echo installing in ${.CURDIR}/$$i; \
115		(cd ${.CURDIR}/$$i; ${MAKE} includes) \
116	done
117	@-for i in ${WDIRS}; do \
118		echo installing in ${.CURDIR}/$$i; \
119		(cd ${.CURDIR}/$$i; ${MAKE} -f Makefile.bsd-wrapper includes) \
120	done
121
122copies:
123	@echo copies: ${LDIRS}
124	@-for i in ${LDIRS}; do \
125		rm -rf ${DESTDIR}/usr/include/$$i; \
126		${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
127			${DESTDIR}/usr/include/$$i ; \
128	done
129	cd ../sys; \
130	pax -rw -pa -L \
131	    `find ${LDIRS} -follow -type f -name '*.h' '!' -path \
132	    'netiso/xebec/*' '!' -path 'dev/microcode/*' \
133	    -print` ${DESTDIR}/usr/include
134	cd ${DESTDIR}/usr/include && rm -rf ${MACHINE} ${MACHINE_ARCH} machine
135	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
136		${DESTDIR}/usr/include/${MACHINE}
137	pax -rw -pa -s "|\.\./sys/arch/${MACHINE}/include||" \
138	    ../sys/arch/${MACHINE}/include/*.h \
139	    ${DESTDIR}/usr/include/${MACHINE}
140	if test ${MACHINE} != ${MACHINE_ARCH} -a \
141	    -d ../sys/arch/${MACHINE_ARCH}/include; then \
142		${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
143    	    	    ${DESTDIR}/usr/include/${MACHINE_ARCH}; \
144		pax -rw -pa -s "|\.\./sys/arch/${MACHINE_ARCH}/include||" \
145		    ../sys/arch/${MACHINE_ARCH}/include/*.h \
146		    ${DESTDIR}/usr/include/${MACHINE_ARCH}; \
147	fi
148	ln -sf ${MACHINE} ${DESTDIR}/usr/include/machine; \
149
150symlinks:
151	@echo symlinks: ${LDIRS}
152	@for i in ${LDIRS}; do \
153		rm -rf ${DESTDIR}/usr/include/$$i; \
154		ln -s /sys/$$i ${DESTDIR}/usr/include/$$i; \
155	done
156	cd ${DESTDIR}/usr/include && rm -rf ${MACHINE} ${MACHINE_ARCH} machine
157	ln -s /sys/arch/${MACHINE}/include ${DESTDIR}/usr/include/${MACHINE}
158	if test ${MACHINE} != ${MACHINE_ARCH} -a \
159	    -d ../sys/arch/${MACHINE_ARCH}/include ; then \
160		ln -s /sys/arch/${MACHINE_ARCH}/include \
161		    ${DESTDIR}/usr/include/${MACHINE_ARCH} ; \
162	fi
163	ln -sf ${MACHINE} ${DESTDIR}/usr/include/machine ; \
164
165includes: ${SYS_INCLUDE}
166
167.include <bsd.prog.mk>
168