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