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