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