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