Makefile revision 1.203
1#	$OpenBSD: Makefile,v 1.203 2015/09/09 15:35:24 guenther 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
12FILES=	a.out.h ar.h asr.h assert.h bitstring.h blf.h bsd_auth.h \
13	complex.h cpio.h ctype.h curses.h db.h dbm.h dirent.h disktab.h \
14	dlfcn.h elf_abi.h err.h errno.h fenv.h float.h fnmatch.h fstab.h fts.h \
15	ftw.h getopt.h glob.h grp.h ifaddrs.h inttypes.h iso646.h kvm.h \
16	langinfo.h libgen.h limits.h locale.h login_cap.h malloc.h math.h \
17	md5.h memory.h ndbm.h netdb.h netgroup.h nlist.h nl_types.h \
18	paths.h poll.h pwd.h ranlib.h readpassphrase.h regex.h \
19	resolv.h rmd160.h search.h setjmp.h sha1.h sha2.h signal.h siphash.h \
20	sndio.h \
21	spawn.h stdbool.h stddef.h stdio.h stdlib.h string.h strings.h struct.h \
22	sysexits.h tar.h tgmath.h time.h ttyent.h unistd.h utime.h \
23	utmp.h uuid.h vis.h wchar.h wctype.h
24
25FILES+=	link.h link_elf.h
26
27.if (${MACHINE_ARCH} != "vax")
28FILES+= ieeefp.h
29.endif
30
31MFILES=	frame.h
32LFILES=	endian.h fcntl.h syslog.h termios.h stdarg.h stdint.h varargs.h
33
34DIRS=	arpa protocols rpc rpcsvc
35LDIRS=	crypto ddb dev isofs miscfs msdosfs net netinet netinet6 \
36	netmpls net80211 nfs ntfs scsi sys ufs uvm
37
38# Places that need a prerequisite target met before includes
39PRDIRS=
40
41# Directories with an includes target
42RDIRS=	../lib/libcrypto ../lib/libcurses ../lib/libedit \
43	../lib/libevent ../lib/libexpat ../lib/libform \
44	../lib/libfuse ../lib/libkeynote ../lib/libmenu \
45	../lib/libocurses ../lib/libossaudio ../lib/libpanel \
46	../lib/libpcap ../lib/libradius ../lib/librpcsvc ../lib/librthread \
47	../lib/libskey ../lib/libsqlite3 ../lib/libssl  ../lib/libtls \
48	../lib/libusbhid ../lib/libutil ../lib/libz \
49	../usr.bin/lex ../gnu/lib/libreadline \
50	../sys/arch/${MACHINE}
51
52.if ${COMPILER_VERSION:L} == "gcc3"
53RDIRS+= ../gnu/usr.bin/gcc ../gnu/lib/libobjc
54PRDIRS+= ../gnu/lib/libstdc++
55.else
56RDIRS+= ../gnu/usr.bin/cc/libobjc
57PRDIRS+= ../gnu/lib/libstdc++-v3
58RDIRS+= ../gnu/usr.bin/cc/include
59.endif
60
61# prereq implies includes
62RDIRS += ${PRDIRS}
63
64NOOBJ=	noobj
65
66# Change SYS_INCLUDE in bsd.own.mk to "symlinks" if you don't want copies
67SYS_INCLUDE?=	copies
68
69RUN_MAKE = if test -f Makefile.bsd-wrapper; then ${MAKE} -f Makefile.bsd-wrapper $@; else ${MAKE} $@; fi
70
71prereq:
72	@for i in ${PRDIRS}; do \
73		echo preparing in ${.CURDIR}/$$i; \
74		cd ${.CURDIR}/$$i && ${RUN_MAKE}; \
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	@ln -sfh openssl ${DESTDIR}/usr/include/ssl
93	@echo installing ${LFILES}
94	@for i in ${LFILES}; do \
95		rm -f ${DESTDIR}/usr/include/$$i && \
96		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
97	done
98	@echo installing ${MFILES}
99	@for i in ${MFILES}; do \
100		rm -f ${DESTDIR}/usr/include/$$i && \
101		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
102	done
103	chown -R ${BINOWN}:${BINGRP} ${DESTDIR}/usr/include
104	find ${DESTDIR}/usr/include -type f -print0 | \
105		xargs -0r chmod a=r
106	find ${DESTDIR}/usr/include -type d -print0 | \
107		xargs -0r chmod u=rwx,go=rx
108	@for i in ${RDIRS}; do \
109		echo installing in ${.CURDIR}/$$i; \
110		cd ${.CURDIR}/$$i && ${RUN_MAKE}; \
111	done
112
113copies:
114	@echo copies: ${LDIRS}
115	@for i in ${LDIRS}; do \
116		rm -rf ${DESTDIR}/usr/include/$$i && \
117		${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
118			${DESTDIR}/usr/include/$$i ; \
119	done
120	cd ../sys; \
121	pax -rw -pa -L \
122	    `find ${LDIRS} -follow -type f -name '*.h' '!' \
123	    '(' -path 'dev/microcode/*' -or -path 'dev/pci/drm/*/*' ')' \
124	    -print` ${DESTDIR}/usr/include
125	cd ${DESTDIR}/usr/include && rm -rf ${MACHINE} ${MACHINE_CPU} machine
126	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
127		${DESTDIR}/usr/include/${MACHINE}
128	pax -rw -pa -s "|\.\./sys/arch/${MACHINE}/include||" \
129	    ../sys/arch/${MACHINE}/include/*.h \
130	    ${DESTDIR}/usr/include/${MACHINE}
131	if test ${MACHINE} != ${MACHINE_CPU} -a \
132	    -d ../sys/arch/${MACHINE_CPU}/include; then \
133		${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
134	    	    ${DESTDIR}/usr/include/${MACHINE_CPU}; \
135		pax -rw -pa -s "|\.\./sys/arch/${MACHINE_CPU}/include||" \
136		    ../sys/arch/${MACHINE_CPU}/include/*.h \
137		    ${DESTDIR}/usr/include/${MACHINE_CPU}; \
138	fi
139	ln -sf ${MACHINE} ${DESTDIR}/usr/include/machine; \
140
141symlinks:
142	@echo symlinks: ${LDIRS}
143	@for i in ${LDIRS}; do \
144		rm -rf ${DESTDIR}/usr/include/$$i && \
145		ln -s /sys/$$i ${DESTDIR}/usr/include/$$i; \
146	done
147	cd ${DESTDIR}/usr/include && rm -rf ${MACHINE} ${MACHINE_CPU} machine
148	ln -s /sys/arch/${MACHINE}/include ${DESTDIR}/usr/include/${MACHINE}
149	if test ${MACHINE} != ${MACHINE_CPU} -a \
150	    -d ../sys/arch/${MACHINE_CPU}/include ; then \
151		ln -s /sys/arch/${MACHINE_CPU}/include \
152		    ${DESTDIR}/usr/include/${MACHINE_CPU} ; \
153	fi
154	ln -sf ${MACHINE} ${DESTDIR}/usr/include/machine
155
156includes: ${SYS_INCLUDE}
157
158.PHONY: prereq includes copies symlink
159.include <bsd.prog.mk>
160