xref: /openbsd/include/Makefile (revision b39c5158)
1#	$OpenBSD: Makefile,v 1.155 2010/05/25 00:24:58 espie 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>
11
12# Missing: mp.h
13FILES=	a.out.h ar.h assert.h bitstring.h blf.h bm.h bsd_auth.h cast.h \
14	complex.h cpio.h ctype.h curses.h db.h dbm.h des.h dirent.h disktab.h \
15	dlfcn.h elf_abi.h err.h errno.h fnmatch.h fstab.h fts.h ftw.h getopt.h \
16	glob.h grp.h ifaddrs.h inttypes.h iso646.h kvm.h langinfo.h \
17	libgen.h limits.h locale.h login_cap.h malloc.h math.h md4.h \
18	md5.h memory.h mpool.h ndbm.h netdb.h netgroup.h nlist.h nl_types.h \
19	ohash.h paths.h poll.h pwd.h ranlib.h re_comp.h \
20	readpassphrase.h regex.h resolv.h rmd160.h search.h setjmp.h \
21	sgtty.h sha1.h sha2.h skipjack.h signal.h sndio.h stab.h \
22	stdbool.h stddef.h stdio.h stdlib.h \
23	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 stdint.h varargs.h
35
36DIRS=	arpa protocols rpc rpcsvc
37LDIRS=	altq crypto ddb dev isofs miscfs msdosfs net netatalk netinet netinet6 \
38	netmpls netnatm net80211 netbt nfs nnpfs ntfs scsi sys ufs uvm
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/libexpat \
45	../lib/libpcap ../lib/libutil ../lib/libusbhid ../lib/libwrap \
46	../lib/libz ../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
55
56# Places using Makefile.bsd-wrapper that needs a prerequisite target met
57# before includes
58PWDIRS=
59
60.if ${COMPILER_VERSION:L} == "gcc3"
61WDIRS+= ../gnu/lib/libstdc++ ../gnu/usr.bin/gcc ../gnu/lib/libobjc
62PWDIRS+= ../gnu/lib/libstdc++
63.elif ${COMPILER_VERSION:L} == "gcc4"
64RDIRS+= ../gnu/lib/libstdc++-v3 ../gnu/usr.bin/cc/libobjc
65PRDIRS+= ../gnu/lib/libstdc++-v3
66RDIRS+= ../gnu/usr.bin/cc/include
67.else
68WDIRS+= ../gnu/egcs/libio ../gnu/egcs/libstdc++ \
69	../gnu/lib/libobjc ../gnu/egcs/gcc
70.endif
71
72NOOBJ=	noobj
73
74# Change SYS_INCLUDE in bsd.own.mk to "symlinks" if you don't want copies
75SYS_INCLUDE?=	copies
76.if ${KERBEROS5:L} == "yes"
77RDIRS+= ../lib/libkrb5 ../lib/libgssapi ../lib/libkadm5srv
78.endif
79
80prereq:
81	@for i in ${PRDIRS}; do \
82		echo preparing in ${.CURDIR}/$$i; \
83		cd ${.CURDIR}/$$i && ${MAKE} prereq; \
84	done
85	@for i in ${PWDIRS}; do \
86		echo preparing in ${.CURDIR}/$$i; \
87		cd ${.CURDIR}/$$i && ${MAKE} -f Makefile.bsd-wrapper prereq; \
88	done
89
90includes:
91	@echo installing ${FILES}
92	@for i in ${FILES}; do \
93		cmp -s $$i ${DESTDIR}/usr/include/$$i || \
94		    ${INSTALL} ${INSTALL_COPY} -m 444 $$i ${DESTDIR}/usr/include/$$i; \
95	done
96	@echo installing ${DIRS}
97	@for i in ${DIRS}; do \
98		${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
99			${DESTDIR}/usr/include/$$i; \
100		cd ${.CURDIR}/$$i && for j in *.[ih]; do \
101			cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j || \
102			${INSTALL} ${INSTALL_COPY} -m 444 $$j ${DESTDIR}/usr/include/$$i/$$j; \
103		done; \
104	done
105	@rm -rf ${DESTDIR}/usr/include/openssl ${DESTDIR}/usr/include/ssl \
106		${DESTDIR}/usr/libdata/perl5/site_perl/${MACHINE_CPU}-openbsd/ssl \
107		${DESTDIR}/usr/libdata/perl5/site_perl/${MACHINE_CPU}-openbsd/openssl
108	@mkdir ${DESTDIR}/usr/include/openssl
109	@ln -sf openssl ${DESTDIR}/usr/include/ssl
110	@echo installing ${LFILES}
111	@for i in ${LFILES}; do \
112		rm -f ${DESTDIR}/usr/include/$$i && \
113		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
114	done
115	@echo installing ${MFILES}
116	@for i in ${MFILES}; do \
117		rm -f ${DESTDIR}/usr/include/$$i && \
118		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
119	done
120	chown -R ${BINOWN}:${BINGRP} ${DESTDIR}/usr/include
121	find ${DESTDIR}/usr/include -type f -print0 | \
122		xargs -0r chmod a=r
123	find ${DESTDIR}/usr/include -type d -print0 | \
124		xargs -0r chmod u=rwx,go=rx
125	@for i in ${RDIRS}; do \
126		echo installing in ${.CURDIR}/$$i; \
127		cd ${.CURDIR}/$$i && ${MAKE} includes; \
128	done
129	@for i in ${WDIRS}; do \
130		echo installing in ${.CURDIR}/$$i; \
131		cd ${.CURDIR}/$$i && ${MAKE} -f Makefile.bsd-wrapper includes; \
132	done
133
134copies:
135	@echo copies: ${LDIRS}
136	@for i in ${LDIRS}; do \
137		rm -rf ${DESTDIR}/usr/include/$$i && \
138		${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
139			${DESTDIR}/usr/include/$$i ; \
140	done
141	cd ../sys; \
142	pax -rw -pa -L \
143	    `find ${LDIRS} -follow -type f -name '*.h' \
144	    '!' -path 'dev/microcode/*' -print` ${DESTDIR}/usr/include
145	cd ${DESTDIR}/usr/include && rm -rf ${MACHINE} ${MACHINE_CPU} machine
146	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
147		${DESTDIR}/usr/include/${MACHINE}
148	pax -rw -pa -s "|\.\./sys/arch/${MACHINE}/include||" \
149	    ../sys/arch/${MACHINE}/include/*.h \
150	    ${DESTDIR}/usr/include/${MACHINE}
151	if test ${MACHINE} != ${MACHINE_CPU} -a \
152	    -d ../sys/arch/${MACHINE_CPU}/include; then \
153		${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
154	    	    ${DESTDIR}/usr/include/${MACHINE_CPU}; \
155		pax -rw -pa -s "|\.\./sys/arch/${MACHINE_CPU}/include||" \
156		    ../sys/arch/${MACHINE_CPU}/include/*.h \
157		    ${DESTDIR}/usr/include/${MACHINE_CPU}; \
158	fi
159	ln -sf ${MACHINE} ${DESTDIR}/usr/include/machine; \
160
161symlinks:
162	@echo symlinks: ${LDIRS}
163	@for i in ${LDIRS}; do \
164		rm -rf ${DESTDIR}/usr/include/$$i && \
165		ln -s /sys/$$i ${DESTDIR}/usr/include/$$i; \
166	done
167	cd ${DESTDIR}/usr/include && rm -rf ${MACHINE} ${MACHINE_CPU} machine
168	ln -s /sys/arch/${MACHINE}/include ${DESTDIR}/usr/include/${MACHINE}
169	if test ${MACHINE} != ${MACHINE_CPU} -a \
170	    -d ../sys/arch/${MACHINE_CPU}/include ; then \
171		ln -s /sys/arch/${MACHINE_CPU}/include \
172		    ${DESTDIR}/usr/include/${MACHINE_CPU} ; \
173	fi
174	ln -sf ${MACHINE} ${DESTDIR}/usr/include/machine
175
176includes: ${SYS_INCLUDE}
177
178.PHONY: prereq includes copies symlink
179.include <bsd.prog.mk>
180