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