1# $OpenBSD: Makefile,v 1.231 2023/08/20 15:02:50 schwarze 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 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_GCC3:L} == "yes" 56RDIRS+= ../gnu/usr.bin/gcc 57PRDIRS+= ../gnu/lib/libstdc++ 58.endif 59.if ${BUILD_GCC4:L} == "yes" 60PRDIRS+= ../gnu/lib/libstdc++-v3 ../gnu/usr.bin/cc/include 61.endif 62.if ${BUILD_CLANG:L} == "yes" 63RDIRS+= ../gnu/lib/libcxxabi ../gnu/lib/libcxx \ 64 ../gnu/usr.bin/clang/libLLVM 65.endif 66 67# prereq implies includes 68RDIRS += ${PRDIRS} 69 70NOOBJ= noobj 71 72# Change SYS_INCLUDE in bsd.own.mk to "symlinks" if you don't want copies 73SYS_INCLUDE?= copies 74 75RUN_MAKE = if test -f Makefile.bsd-wrapper; then ${MAKE} -f Makefile.bsd-wrapper $@; else ${MAKE} $@; fi 76 77prereq: 78 @for i in ${PRDIRS}; do \ 79 echo preparing in ${.CURDIR}/$$i; \ 80 cd ${.CURDIR}/$$i && ${RUN_MAKE}; \ 81 done 82 83includes: 84 @echo installing ${FILES} 85 @for i in ${FILES}; do \ 86 cmp -s $$i ${DESTDIR}/usr/include/$$i || \ 87 ${INSTALL} ${INSTALL_COPY} -m 444 $$i ${DESTDIR}/usr/include/$$i; \ 88 done 89 @echo installing ${DIRS} 90 @for i in ${DIRS}; do \ 91 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 92 ${DESTDIR}/usr/include/$$i; \ 93 cd ${.CURDIR}/$$i && for j in *.[ih]; do \ 94 cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j || \ 95 ${INSTALL} ${INSTALL_COPY} -m 444 $$j ${DESTDIR}/usr/include/$$i/$$j; \ 96 done; \ 97 done 98 @echo installing ${LFILES} 99 @for i in ${LFILES}; do \ 100 rm -f ${DESTDIR}/usr/include/$$i && \ 101 ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \ 102 done 103 @echo installing ${MFILES} 104 @for i in ${MFILES}; do \ 105 rm -f ${DESTDIR}/usr/include/$$i && \ 106 ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \ 107 done 108 @for i in ${RDIRS}; do \ 109 echo installing in ${.CURDIR}/$$i; \ 110 cd ${.CURDIR}/$$i && ${RUN_MAKE}; \ 111 done 112 chown -RP ${BINOWN}:${BINGRP} ${DESTDIR}/usr/include 113 find ${DESTDIR}/usr/include \ 114 -type f -exec chmod a=r {} + -o \ 115 \( -type d -o -type l \) -exec chmod -h u=rwx,go=rx {} + 116 117copies: 118 @echo copies: ${LDIRS} 119 @for i in ${LDIRS}; do \ 120 rm -rf ${DESTDIR}/usr/include/$$i && \ 121 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 122 ${DESTDIR}/usr/include/$$i ; \ 123 done 124 cd ../sys; \ 125 pax -rw -pa -L \ 126 `find ${LDIRS} -follow -type f -name '*.h' '!' \ 127 '(' -path 'dev/microcode/*' -or -path 'dev/pci/drm/*' ')' \ 128 -print` ${DESTDIR}/usr/include 129 cd ${DESTDIR}/usr/include && rm -rf ${MACHINE} ${MACHINE_CPU} machine 130 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 131 ${DESTDIR}/usr/include/${MACHINE} 132 pax -rw -pa -s "|\.\./sys/arch/${MACHINE}/include||" \ 133 ../sys/arch/${MACHINE}/include/*.h \ 134 ${DESTDIR}/usr/include/${MACHINE} 135 if test ${MACHINE} != ${MACHINE_CPU} -a \ 136 -d ../sys/arch/${MACHINE_CPU}/include; then \ 137 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 138 ${DESTDIR}/usr/include/${MACHINE_CPU}; \ 139 pax -rw -pa -s "|\.\./sys/arch/${MACHINE_CPU}/include||" \ 140 ../sys/arch/${MACHINE_CPU}/include/*.h \ 141 ${DESTDIR}/usr/include/${MACHINE_CPU}; \ 142 fi 143 ln -sf ${MACHINE} ${DESTDIR}/usr/include/machine; \ 144 145symlinks: 146 @echo symlinks: ${LDIRS} 147 @for i in ${LDIRS}; do \ 148 rm -rf ${DESTDIR}/usr/include/$$i && \ 149 ln -s /sys/$$i ${DESTDIR}/usr/include/$$i; \ 150 done 151 cd ${DESTDIR}/usr/include && rm -rf ${MACHINE} ${MACHINE_CPU} machine 152 ln -s /sys/arch/${MACHINE}/include ${DESTDIR}/usr/include/${MACHINE} 153 if test ${MACHINE} != ${MACHINE_CPU} -a \ 154 -d ../sys/arch/${MACHINE_CPU}/include ; then \ 155 ln -s /sys/arch/${MACHINE_CPU}/include \ 156 ${DESTDIR}/usr/include/${MACHINE_CPU} ; \ 157 fi 158 ln -sf ${MACHINE} ${DESTDIR}/usr/include/machine 159 160includes: ${SYS_INCLUDE} 161 162.PHONY: prereq includes copies symlink 163.include <bsd.prog.mk> 164