release.sh changes & fixes
[minix3.git] / tools / compat / Makefile
blob182cbdda6d4cf91daff82851604659088ca73ca9
1 # $NetBSD: Makefile,v 1.69 2013/08/06 22:04:25 apb Exp $
3 HOSTLIB= nbcompat
5 .include <bsd.own.mk>
7 SRCS= atoll.c basename.c cdbr.c cdbw.c dirname.c \
8 dprintf.c fgetln.c flock.c fparseln.c fpurge.c \
9 getcap.c getline.c getmode.c getopt_long.c gettemp.c \
10 heapsort.c \
11 issetugid.c lchflags.c lchmod.c lchown.c libyywrap.c \
12 md2.c md2hl.c md4c.c md4hl.c md5c.c md5hl.c \
13 mi_vector_hash.c mkdtemp.c \
14 mkstemp.c pread.c putc_unlocked.c pwcache.c pwrite.c \
15 pw_scan.c \
16 raise_default_signal.c rmd160.c rmd160hl.c \
17 setenv.c setgroupent.c \
18 setpassent.c setprogname.c sha1.c sha1hl.c sha2.c \
19 sha256hl.c sha384hl.c sha512hl.c snprintb.c snprintf.c \
20 stat_flags.c strlcat.c strlcpy.c strmode.c strndup.c \
21 strsep.c strsuftoll.c strtoll.c \
22 unvis.c vis.c err.c errx.c verr.c verrx.c \
23 vwarn.c vwarnx.c warn.c warnx.c fts.c glob.c efun.c
25 BUILD_OSTYPE!= uname -s
27 # Disable use of pre-compiled headers on Darwin.
28 .if ${BUILD_OSTYPE} == "Darwin"
29 CPPFLAGS+= -no-cpp-precomp
30 .endif
32 # -D_FILE_OFFSET_BITS=64 produces a much more amenable `struct stat', and
33 # other file ops, on many systems, without changing function names.
35 CPPFLAGS+= -I. -I./include -I${.CURDIR} -I${.CURDIR}/sys \
36 -DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64
38 .PATH: ${.CURDIR}/../../lib/libc/cdb \
39 ${.CURDIR}/../../lib/libc/gen \
40 ${.CURDIR}/../../lib/libc/hash \
41 ${.CURDIR}/../../lib/libc/hash/md2 \
42 ${.CURDIR}/../../lib/libc/hash/md5 \
43 ${.CURDIR}/../../lib/libc/hash/rmd160 \
44 ${.CURDIR}/../../lib/libc/hash/sha1 \
45 ${.CURDIR}/../../lib/libc/hash/sha2 \
46 ${.CURDIR}/../../lib/libc/md \
47 ${.CURDIR}/../../lib/libc/stdio \
48 ${.CURDIR}/../../lib/libc/stdlib \
49 ${.CURDIR}/../../lib/libc/string \
50 ${.CURDIR}/../../lib/libutil \
51 ${.CURDIR}/../../common/lib/libc/string \
52 ${.CURDIR}/../../common/lib/libc/hash/rmd160 \
53 ${.CURDIR}/../../common/lib/libc/hash/sha1 \
54 ${.CURDIR}/../../common/lib/libc/hash/sha2 \
55 ${.CURDIR}/../../common/lib/libc/md \
56 ${.CURDIR}/../../common/lib/libc/stdlib \
57 ${.CURDIR}/../../common/lib/libutil \
58 ${.CURDIR}/../../external/bsd/flex/dist
60 DPSRCS+= defs.mk
61 CLEANFILES+= config.log config.status configure.lineno *.stamp
62 CLEANDIRFILES+= defs.mk config.cache confdefs.h
64 # Get components of Berkeley DB.
65 _CURDIR:= ${.CURDIR}
66 .CURDIR:= ${_CURDIR}/../../lib/libc
67 .include "${.CURDIR}/db/Makefile.inc"
68 .CURDIR:= ${_CURDIR}
70 SRCS:= ${SRCS:M*.c}
72 config.cache: include/.stamp configure nbtool_config.h.in defs.mk.in
73 rm -f ${.TARGET}
74 CC=${HOST_CC:Q} CFLAGS=${HOST_CFLAGS:Q} LDFLAGS=${HOST_LDFLAGS:Q} \
75 ${HOST_SH} ${.CURDIR}/configure --cache-file=config.cache
77 defs.mk: config.cache
78 @touch ${.TARGET}
80 INCFILES= nbtool_config.h
81 INCSUBDIRS= sys machine rpc arpa
82 CLEANDIRFILES+= ${INCFILES}
84 # CLEANDIRFILES may not contain directory names
85 cleandir: cleandir.include
86 cleandir.include: .PHONY
87 rm -rf include
89 include/.stamp:
90 mkdir -p ${INCSUBDIRS:@d@ include/$d @}
91 @touch ${.TARGET}
93 # Install rules
95 HOST_LIBDIR= ${TOOLDIR}/lib
96 HOST_INCSDIR= ${TOOLDIR}/include
97 HOST_SHAREDIR= ${TOOLDIR}/share
99 install: .PHONY install.lib includes install.defs.mk
101 # Install lib${HOSTLIB}.a in ${TOOLDIR}/lib
102 install.lib: .PHONY ${HOST_LIBDIR}/lib${HOSTLIB}.a
103 ${HOST_LIBDIR}/lib${HOSTLIB}.a: lib${HOSTLIB}.a
104 ${_MKTARGET_INSTALL}
105 ${HOST_INSTALL_DIR} ${HOST_LIBDIR}
106 ${HOST_INSTALL_FILE} -m ${LIBMODE} ${.ALLSRC} ${.TARGET}
108 .for _f in ${INCFILES}
109 HOST_INCINSTFILES+= ${HOST_INCSDIR}/compat/${_f}
110 ${HOST_INCSDIR}/compat/${_f}: ${_f}
111 ${_MKTARGET_INSTALL}
112 ${HOST_INSTALL_FILE} ${.ALLSRC} ${.TARGET}
113 .endfor
115 .for _d in ${INCSUBDIRS}
116 HOST_INCINSTDIRS+= ${HOST_INCSDIR}/compat/${_d}
117 ${HOST_INCSDIR}/compat/${_d}:
118 ${_MKTARGET_INSTALL}
119 ${HOST_INSTALL_DIR} ${.TARGET}
120 .endfor
122 # Install include files in ${TOOLDIR}/include/compat
123 includes: .PHONY ${HOST_INCINSTDIRS} .WAIT ${HOST_INCINSTFILES}
124 @(cd include && find . -name '*.h' -print | while read f ; do \
125 ${HOST_INSTALL_FILE} $$f ${HOST_INCSDIR}/compat/$$f ; \
126 done)
129 # Install defs.mk in ${TOOLDIR}/share/compat
130 install.defs.mk: .PHONY ${HOST_SHAREDIR}/compat/defs.mk
131 ${HOST_SHAREDIR}/compat/defs.mk: defs.mk
132 ${_MKTARGET_INSTALL}
133 ${HOST_INSTALL_DIR} ${HOST_SHAREDIR}
134 ${HOST_INSTALL_DIR} ${HOST_SHAREDIR}/compat
135 ${HOST_INSTALL_FILE} ${.ALLSRC} ${.TARGET}
137 # bsd.hostlib.mk wants HOST_CPPFLAGS, not CPPFLAGS
139 HOST_CPPFLAGS:= ${CPPFLAGS}
140 CPPFLAGS:= # empty
142 .include <bsd.hostlib.mk>
144 # Use uninstalled copy of host-mkdep
145 HOST_MKDEP_OBJ!= cd ${.CURDIR}/../host-mkdep && ${PRINTOBJDIR}
146 HOST_MKDEP= ${HOST_MKDEP_OBJ}/host-mkdep
147 MKDEP= ${HOST_MKDEP}
149 # Use uninstalled copy of the install program
150 INSTALL_OBJ!= cd ${NETBSDSRCDIR}/tools/binstall && ${PRINTOBJDIR}
151 INSTALL= ${INSTALL_OBJ}/xinstall
153 # Run "${TOOLDIR}/bin/nbmake-${MACHINE} regen" by hand after editing
154 # configure.ac. See more detailed instructions in configure.ac.
155 regen:
156 cd ${.CURDIR} && ${TOOLDIR}/bin/${_TOOL_PREFIX}autoconf
157 cd ${.CURDIR} && ${TOOLDIR}/bin/${_TOOL_PREFIX}autoheader