jcs's openbsd hax
openbsd
1# $OpenBSD: Makefile,v 1.233 2025/10/23 19:06:10 miod 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 \
13 bitstring.h blf.h bsd_auth.h \
14 complex.h cpio.h ctype.h curses.h \
15 db.h dirent.h dlfcn.h \
16 elf.h elf_abi.h err.h errno.h \
17 fenv.h float.h fnmatch.h fstab.h fts.h ftw.h \
18 getopt.h glob.h grp.h \
19 icdb.h ieeefp.h ifaddrs.h inttypes.h iso646.h \
20 kvm.h \
21 langinfo.h libgen.h limits.h link.h link_elf.h locale.h login_cap.h \
22 math.h md5.h memory.h \
23 ndbm.h netdb.h netgroup.h nlist.h nl_types.h \
24 paths.h poll.h pthread.h pthread_np.h pwd.h \
25 ranlib.h readpassphrase.h regex.h resolv.h rmd160.h \
26 sched.h search.h setjmp.h semaphore.h sha1.h sha2.h \
27 signal.h siphash.h sndio.h spawn.h stdbool.h stddef.h \
28 stdio.h stdio_ext.h stdlib.h string.h strings.h sysexits.h \
29 tar.h tgmath.h tib.h time.h ttyent.h \
30 uchar.h unistd.h utime.h utmp.h uuid.h \
31 vis.h \
32 wchar.h wctype.h
33
34MFILES= frame.h
35LFILES= endian.h fcntl.h syslog.h termios.h stdarg.h stdint.h varargs.h
36
37DIRS= arpa protocols rpc rpcsvc
38LDIRS= crypto ddb dev isofs miscfs msdosfs net netinet netinet6 \
39 netmpls net80211 nfs ntfs scsi sys ufs uvm
40
41# Places that need a prerequisite target met before includes
42PRDIRS= ../lib/libcrypto ../lib/librpcsvc
43
44# Directories with an includes target
45RDIRS= ../lib/libagentx ../lib/libcbor ../lib/libcurses ../lib/libedit \
46 ../lib/libelf ../lib/libevent ../lib/libexpat ../lib/libfido2 \
47 ../lib/libform ../lib/libfuse ../lib/libkeynote ../lib/libmenu \
48 ../lib/libossaudio ../lib/libpanel ../lib/libpcap \
49 ../lib/libradius \
50 ../lib/libskey ../lib/libssl ../lib/libtls \
51 ../lib/libusbhid ../lib/libutil ../lib/libz \
52 ../usr.bin/lex ../gnu/lib/libexecinfo ../gnu/lib/libreadline \
53 ../sys/arch/${MACHINE}
54
55.if ${BUILD_GCC4:L} == "yes"
56PRDIRS+= ../gnu/lib/libstdc++-v3 ../gnu/usr.bin/cc/include
57.endif
58.if ${BUILD_CLANG:L} == "yes"
59RDIRS+= ../gnu/lib/libcxxabi ../gnu/lib/libcxx \
60 ../gnu/usr.bin/clang/libLLVM
61.endif
62
63# prereq implies includes
64RDIRS += ${PRDIRS}
65
66NOOBJ= noobj
67
68# Change SYS_INCLUDE in bsd.own.mk to "symlinks" if you don't want copies
69SYS_INCLUDE?= copies
70
71RUN_MAKE = if test -f Makefile.bsd-wrapper; then ${MAKE} -f Makefile.bsd-wrapper $@; else ${MAKE} $@; fi
72
73prereq:
74 @for i in ${PRDIRS}; do \
75 echo preparing in ${.CURDIR}/$$i; \
76 cd ${.CURDIR}/$$i && ${RUN_MAKE}; \
77 done
78
79includes:
80 @echo installing ${FILES}
81 @for i in ${FILES}; do \
82 cmp -s $$i ${DESTDIR}/usr/include/$$i || \
83 ${INSTALL} ${INSTALL_COPY} -m 444 $$i ${DESTDIR}/usr/include/$$i; \
84 done
85 @echo installing ${DIRS}
86 @for i in ${DIRS}; do \
87 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
88 ${DESTDIR}/usr/include/$$i; \
89 cd ${.CURDIR}/$$i && for j in *.[ih]; do \
90 cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j || \
91 ${INSTALL} ${INSTALL_COPY} -m 444 $$j ${DESTDIR}/usr/include/$$i/$$j; \
92 done; \
93 done
94 @echo installing ${LFILES}
95 @for i in ${LFILES}; do \
96 rm -f ${DESTDIR}/usr/include/$$i && \
97 ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
98 done
99 @echo installing ${MFILES}
100 @for i in ${MFILES}; do \
101 rm -f ${DESTDIR}/usr/include/$$i && \
102 ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
103 done
104 @for i in ${RDIRS}; do \
105 echo installing in ${.CURDIR}/$$i; \
106 cd ${.CURDIR}/$$i && ${RUN_MAKE}; \
107 done
108 chown -RP ${BINOWN}:${BINGRP} ${DESTDIR}/usr/include
109 find ${DESTDIR}/usr/include \
110 -type f -exec chmod a=r {} + -o \
111 \( -type d -o -type l \) -exec chmod -h u=rwx,go=rx {} +
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>