1# $MirOS: src/include/Makefile,v 1.28 2013/09/10 21:24:19 tg Exp $
2# $OpenBSD: Makefile,v 1.135 2005/07/10 06:53:44 grange Exp $
3# $NetBSD: Makefile,v 1.59 1996/05/15 21:36:43 jtc Exp $
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.include <bsd.own.mk>
10
11# Missing: mp.h
12FILES=	a.out.h adler32.h ar.h assert.h bitstring.h blf.h bm.h bsd_auth.h \
13	cast.h cpio.h ctype.h curses.h db.h dbm.h des.h dirent.h disktab.h \
14	dlfcn.h elf_abi.h err.h fnmatch.h fstab.h fts.h ftw.h getopt.h glob.h \
15	gnu-versions.h grp.h iconv.h ieeefp.h ifaddrs.h inttypes.h iso646.h \
16	kvm.h langinfo.h libgen.h limits.h link.h link_aout.h link_elf.h \
17	locale.h login_cap.h malloc.h math.h md4.h memory.h \
18	mpool.h ndbm.h netdb.h netgroup.h nl_types.h nlist.h ohash.h \
19	olf_abi.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	sfv.h sgtty.h sha1.h sha2.h signal.h skipjack.h stab.h stdbool.h \
22	stdint.h stdio.h stdlib.h string.h strings.h struct.h \
23	suma.h sysexits.h tar.h tiger.h time.h ttyent.h tzfile.h unistd.h \
24	utf.h utime.h utmp.h vis.h wchar.h wctype.h whirlpool.h
25
26MFILES=	float.h frame.h
27LFILES=	errno.h fcntl.h stddef.h syslog.h termios.h stdarg.h varargs.h
28KFILES=	md5.h
29
30DIRS=	arpa protocols rpc
31LDIRS=	altq crypto ddb dev isofs miscfs net netatalk netinet netinet6 \
32	netipx netisdn netnatm nfs ntfs scsi sys ufs uvm
33
34# Directories with an includes target
35RDIRS=	../lib/libcompat ../lib/libedit ../lib/libevent ../lib/libexpat \
36	../lib/libform ../lib/libkeynote ../lib/libmbfun ../lib/libmenu \
37	../lib/libncurses ../lib/libocurses ../lib/libossaudio \
38	../lib/libpanel ../lib/libpcap ../lib/libpng ../lib/libpthread \
39	../lib/librpcsvc ../lib/libsectok ../lib/libskey ../lib/libssl \
40	../lib/libusbhid ../lib/libutil ../lib/libz ../kern/include \
41	../usr.bin/lex ../gnu/usr.sbin/sendmail
42
43# Places using Makefile that needs a prerequisite target met before includes
44PRDIRS=	../lib/libncurses ../lib/librpcsvc ../lib/libssl/crypto
45
46NOOBJ=	yes
47
48prereq:
49	@for i in ${PRDIRS}; do \
50		echo preparing in ${.CURDIR}/$$i; \
51		cd ${.CURDIR}/$$i && ${MAKE} prereq; \
52	done
53
54includes:
55	@echo installing ${LDIRS}
56	@for i in ${LDIRS}; do \
57		rm -rf ${DESTDIR}/usr/include/$$i && \
58		${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m ${DIRMODE} \
59		    ${DESTDIR}/usr/include/$$i ; \
60	done
61	cd ../sys; \
62	pax -rw -pa -L \
63	    $$(find ${LDIRS} -follow -type f -name '*.h' \
64	    '!' -path 'dev/microcode/*' -print) ${DESTDIR}/usr/include
65	cd ${DESTDIR}/usr/include && rm -rf ${MACHINE} ${MACHINE_ARCH} machine
66	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m ${DIRMODE} \
67	    ${DESTDIR}/usr/include/${MACHINE}
68	pax -rw -pa -s "|\.\./sys/arch/${MACHINE}/include||" \
69	    ../sys/arch/${MACHINE}/include/*.h \
70	    ${DESTDIR}/usr/include/${MACHINE}
71	if test ${MACHINE} != ${MACHINE_ARCH} -a \
72	    -d ../sys/arch/${MACHINE_ARCH}/include; then \
73		${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m ${DIRMODE} \
74    	    	    ${DESTDIR}/usr/include/${MACHINE_ARCH}; \
75		pax -rw -pa -s "|\.\./sys/arch/${MACHINE_ARCH}/include||" \
76		    ../sys/arch/${MACHINE_ARCH}/include/*.h \
77		    ${DESTDIR}/usr/include/${MACHINE_ARCH}; \
78	fi
79	ln -sf ${MACHINE} ${DESTDIR}/usr/include/machine
80	@echo installing ${FILES}
81	@for i in ${FILES}; do \
82		cmp -s $$i ${DESTDIR}/usr/include/$$i || \
83		    ${INSTALL} ${INSTALL_COPY} -m ${NONBINMODE} \
84		    $$i ${DESTDIR}/usr/include/$$i; \
85	done
86	@echo installing ${DIRS}
87	@for i in ${DIRS}; do \
88		${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m ${DIRMODE} \
89		    ${DESTDIR}/usr/include/$$i; \
90		cd ${.CURDIR}/$$i && for j in *.[ih]; do \
91			cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j || \
92			    ${INSTALL} ${INSTALL_COPY} -m ${NONBINMODE} \
93			    $$j ${DESTDIR}/usr/include/$$i/$$j; \
94		done; \
95	done
96	@rm -f ${DESTDIR}/usr/include/ssl && \
97	    ln -sf openssl ${DESTDIR}/usr/include/ssl
98	@echo installing ${KFILES}
99	@for i in ${KFILES}; do \
100		rm -f ${DESTDIR}/usr/include/$$i && \
101		ln -s syskern/$$i ${DESTDIR}/usr/include/$$i; \
102	done
103	@echo installing ${LFILES}
104	@for i in ${LFILES}; do \
105		rm -f ${DESTDIR}/usr/include/$$i && \
106		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
107	done
108	@echo installing ${MFILES}
109	@for i in ${MFILES}; do \
110		rm -f ${DESTDIR}/usr/include/$$i && \
111		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
112	done
113	@for i in ${RDIRS}; do \
114		echo installing in ${.CURDIR}/$$i; \
115		cd ${.CURDIR}/$$i && ${MAKE} includes; \
116	done
117	chown -R ${BINOWN}:${BINGRP} ${DESTDIR}/usr/include
118	find ${DESTDIR}/usr/include -type f | xargs chmod a=r
119	find ${DESTDIR}/usr/include -type d | xargs chmod u=rwx,go=rx
120
121.PHONY: prereq includes
122.include <bsd.prog.mk>
123