Imported Upstream version 0.28.0
Andrew Shadura
8 years ago
0 | # Copyright (c) 2014 by Aleksey Cheusov | |
1 | # | |
2 | # See LICENSE file in the distribution. | |
3 | ############################################################ | |
4 | ||
0 | 5 | .MAIN: all |
1 | 6 | .DEFAULT: |
2 | 7 | @unset ROOT_GROUP; ${MAKE} ${MAKEFLAGS} -m ${.CURDIR}/mk -m ${.CURDIR}/features -f main.mk ${.TARGET} |
0 | VERSION = 0.27.0 | |
0 | VERSION = 0.28.0 | |
1 | 1 | |
2 | 2 | BIRTHDATE = 2009-02-21 |
3 | 3 | |
4 | 4 | MKFILESDIR ?= ${PREFIX}/share/mkc-mk |
5 | 5 | DOCDIR ?= ${PREFIX}/share/doc/mk-configure |
6 | BUILTINSDIR ?= ${PREFIX}/share/mk-configure/custom | |
6 | BUILTINSDIR ?= ${PREFIX}/share/mk-configure/builtins | |
7 | 7 | FEATURESDIR ?= ${PREFIX}/share/mk-configure/features |
8 | 8 | |
9 | 9 | INTEXTS_REPLS += version ${VERSION} |
10 | INTEXTS_REPLS += AWK ${AWK} | |
10 | INTEXTS_REPLS += AWK ${PROG.awk} | |
11 | 11 | INTEXTS_REPLS += BMAKE ${BMAKE} |
12 | 12 | INTEXTS_REPLS += mkfilesdir ${MKFILESDIR} |
13 | 13 | INTEXTS_REPLS += syscustomdir ${BUILTINSDIR} |
16 | 16 | .if exists(/usr/xpg4/bin/awk) |
17 | 17 | # Solaris' /usr/bin/awk is completely broken, |
18 | 18 | # /usr/xpg4/bin/awk sucks too but sucks less. |
19 | AWK ?= /usr/xpg4/bin/awk | |
20 | .elif exists(/usr/bin/awk) | |
21 | AWK ?= /usr/bin/awk | |
19 | PROG.awk ?= /usr/xpg4/bin/awk | |
22 | 20 | .else |
23 | AWK ?= /bin/awk | |
21 | MKC_REQUIRE_PROGS += awk | |
24 | 22 | .endif |
25 | 23 | |
26 | 24 | BMAKE ?= bmake |
257 | 257 | the samples. |
258 | 258 | |
259 | 259 | - mkc.configure.mk is a replacement for GNU autoconf. Its |
260 | functionality is large enough to describe here. It short, it allows | |
260 | functionality is large enough to describe here. In short, it allows | |
261 | 261 | to check for presence of header files, function or variable |
262 | 262 | declarations, presence of function in a particular library, defines, |
263 | 263 | sizeof of data types and other useful things. Read the documentation |
279 | 279 | examples/ subdirectory. |
280 | 280 | |
281 | 281 | - Documentation for mk include files is in mk-configure(7). |
282 | ||
283 | - doc/NOTES contains a number of useful recipes. | |
282 | 284 | |
283 | 285 | - Most programs (mkc_check_{decl,header,funclib,sizeof,prog,custom}) |
284 | 286 | have -h option and manual pages. |
291 | 293 | - AWK interpreter from NetBSD cvs tree, |
292 | 294 | ported to Darwin, Solaris, Linux and other BSD. |
293 | 295 | http://mova.org/~cheusov/pub/mk-configure/nbawk/ |
294 | - getopt_long(3) like module for Lua programming language (>=0.8.0) | |
295 | http://sourceforge.net/projects/lua-alt-getopt/ | |
296 | 296 | |
297 | 297 | ------------------------------------------------------------------------- |
298 | 298 | IS MK-CONFIGURE STABLE? |
0 | /usr/bin/awk |
0 | SCRIPTS = endianness prog_bison prog_flex prog_gawk prog_gm4 prog_gmake | |
1 | ||
2 | SCRIPTSDIR = ${BUILTINSDIR} | |
3 | ||
4 | .include <mkc.mk> |
0 | #!/bin/sh | |
1 | ||
2 | ############################################################ | |
3 | # Copyright (c) 2009 by Aleksey Cheusov | |
4 | # | |
5 | # See LICENSE file in the distribution. | |
6 | ############################################################ | |
7 | ||
8 | set -e | |
9 | ||
10 | LC_ALL=C | |
11 | export LC_ALL | |
12 | ||
13 | ################################################## | |
14 | ||
15 | pathpart=endianness | |
16 | . mkc_check_common.sh | |
17 | ||
18 | trap "rm -f $tmpc $tmpo" 0 | |
19 | ||
20 | CFLAGS="$CFLAGS -D_GNU_SOURCE -D_ALL_SOURCE" | |
21 | ||
22 | check_me (){ | |
23 | cat > "$tmpc" <<EOF | |
24 | $3 | |
25 | ||
26 | int main (int argc, char **argv) | |
27 | { | |
28 | #if $1 == $2 | |
29 | return 0; | |
30 | #else | |
31 | error | |
32 | #endif | |
33 | } | |
34 | EOF | |
35 | if $CC -o "$tmpo" -c $CFLAGS $CPPFLAGS "$tmpc" 2>/dev/null; then | |
36 | return 0 | |
37 | else | |
38 | return 1 | |
39 | fi | |
40 | } | |
41 | ||
42 | if check_me BYTE_ORDER LITTLE_ENDIAN ' | |
43 | #include <sys/types.h> | |
44 | #include <sys/param.h> | |
45 | '; | |
46 | then | |
47 | echo little | |
48 | exit 0 | |
49 | fi | |
50 | ||
51 | if check_me BYTE_ORDER BIG_ENDIAN ' | |
52 | #include <sys/types.h> | |
53 | #include <sys/param.h> | |
54 | '; | |
55 | then | |
56 | echo big | |
57 | exit 0 | |
58 | fi | |
59 | ||
60 | echo unknown | |
61 | exit 0 |
0 | #!/bin/sh | |
1 | ||
2 | ############################################################ | |
3 | # Copyright (c) 2009 by Aleksey Cheusov | |
4 | # | |
5 | # See LICENSE file in the distribution. | |
6 | ############################################################ | |
7 | ||
8 | LC_ALL=C | |
9 | export LC_ALL | |
10 | ||
11 | pathpart=' ' # fake | |
12 | . mkc_check_common.sh | |
13 | ||
14 | find_n_match bison --version 'bison' | |
15 | ||
16 | echo '' |
0 | #!/bin/sh | |
1 | ||
2 | ############################################################ | |
3 | # Copyright (c) 2009 by Aleksey Cheusov | |
4 | # | |
5 | # See LICENSE file in the distribution. | |
6 | ############################################################ | |
7 | ||
8 | LC_ALL=C | |
9 | export LC_ALL | |
10 | ||
11 | pathpart=' ' # fake | |
12 | . mkc_check_common.sh | |
13 | ||
14 | find_n_match flex --version 'flex' | |
15 | find_n_match lex --version 'flex' | |
16 | ||
17 | echo '' |
0 | #!/bin/sh | |
1 | ||
2 | ############################################################ | |
3 | # Copyright (c) 2009 by Aleksey Cheusov | |
4 | # | |
5 | # See LICENSE file in the distribution. | |
6 | ############################################################ | |
7 | ||
8 | LC_ALL=C | |
9 | export LC_ALL | |
10 | ||
11 | pathpart=' ' # fake | |
12 | . mkc_check_common.sh | |
13 | ||
14 | find_n_match gawk --version 'gnu awk' | |
15 | find_n_match nawk --version 'gnu awk' | |
16 | find_n_match awk --version 'gnu awk' | |
17 | ||
18 | echo '' |
0 | #!/bin/sh | |
1 | ||
2 | ############################################################ | |
3 | # Copyright (c) 2009 by Aleksey Cheusov | |
4 | # | |
5 | # See LICENSE file in the distribution. | |
6 | ############################################################ | |
7 | ||
8 | LC_ALL=C | |
9 | export LC_ALL | |
10 | ||
11 | pathpart=' ' # fake | |
12 | . mkc_check_common.sh | |
13 | ||
14 | find_n_match gm4 --version 'gnu m4' | |
15 | find_n_match m4 --version 'gnu m4' | |
16 | ||
17 | echo '' |
0 | #!/bin/sh | |
1 | ||
2 | ############################################################ | |
3 | # Copyright (c) 2014 by Aleksey Cheusov | |
4 | # | |
5 | # See LICENSE file in the distribution. | |
6 | ############################################################ | |
7 | ||
8 | LC_ALL=C | |
9 | export LC_ALL | |
10 | ||
11 | pathpart=' ' # fake | |
12 | . mkc_check_common.sh | |
13 | ||
14 | find_n_match make --version 'gnu make' | |
15 | find_n_match gmake --version 'gnu make' | |
16 | ||
17 | echo '' |
0 | #!/bin/sh | |
1 | ||
2 | ############################################################ | |
3 | # Copyright (c) 2013 by Aleksey Cheusov | |
4 | # | |
5 | # See LICENSE file in the distribution. | |
6 | ############################################################ | |
7 | ||
8 | LC_ALL=C | |
9 | export LC_ALL | |
10 | ||
11 | extra_args="$*" | |
12 | ||
13 | pathpart='custom_nbmkdep' | |
14 | . mkc_check_common.sh | |
15 | ||
16 | trap "rm -f $tmpc $tmpo" 0 | |
17 | ||
18 | cat > "$tmpc" <<'EOF' | |
19 | #include <stdio.h> | |
20 | EOF | |
21 | ||
22 | if test -n "$MKDEP_CC"; then | |
23 | CC="$MKDEP_CC" | |
24 | export CC | |
25 | fi | |
26 | ||
27 | check_mkdep (){ | |
28 | "$1" -f "$tmpo" $extra_args -I . -I `pwd` "$tmpc" | |
29 | } | |
30 | ||
31 | for i in bmkdep nbmkdep mkdep; do | |
32 | if test -z "`check_mkdep $i 2>&1 > /dev/null`"; then | |
33 | mkc_which $i | |
34 | exit 0 | |
35 | fi | |
36 | done | |
37 | ||
38 | echo '' |
0 | #!/bin/sh | |
1 | ||
2 | ############################################################ | |
3 | # Copyright (c) 2013 by Aleksey Cheusov | |
4 | # | |
5 | # See LICENSE file in the distribution. | |
6 | ############################################################ | |
7 | ||
8 | # workround for crappylaris | |
9 | if test -z "$CRAPPYLIS" -a -x /usr/xpg4/bin/sh; then | |
10 | CRAPPYLIS=1 | |
11 | export CRAPPYLIS | |
12 | exec /usr/xpg4/bin/sh "$0" "$@" | |
13 | fi | |
14 | ||
15 | ${0%%/prog_nbmkdep}/prog_mkdep -- |
0 | SCRIPTS = endianness prog_bison prog_flex prog_gawk prog_gm4 | |
1 | ||
2 | SCRIPTSDIR = ${BUILTINSDIR} | |
3 | ||
4 | .include <mkc.mk> |
0 | #!/bin/sh | |
1 | ||
2 | ############################################################ | |
3 | # Copyright (c) 2009 by Aleksey Cheusov | |
4 | # | |
5 | # See LICENSE file in the distribution. | |
6 | ############################################################ | |
7 | ||
8 | set -e | |
9 | ||
10 | LC_ALL=C | |
11 | export LC_ALL | |
12 | ||
13 | ################################################## | |
14 | ||
15 | pathpart=endianness | |
16 | . mkc_check_common.sh | |
17 | ||
18 | trap "rm -f $tmpc $tmpo" 0 | |
19 | ||
20 | CFLAGS="$CFLAGS -D_GNU_SOURCE -D_ALL_SOURCE" | |
21 | ||
22 | check_me (){ | |
23 | cat > "$tmpc" <<EOF | |
24 | $3 | |
25 | ||
26 | int main (int argc, char **argv) | |
27 | { | |
28 | #if $1 == $2 | |
29 | return 0; | |
30 | #else | |
31 | error | |
32 | #endif | |
33 | } | |
34 | EOF | |
35 | if $CC -o "$tmpo" -c $CFLAGS $CPPFLAGS "$tmpc" 2>/dev/null; then | |
36 | return 0 | |
37 | else | |
38 | return 1 | |
39 | fi | |
40 | } | |
41 | ||
42 | if check_me BYTE_ORDER LITTLE_ENDIAN ' | |
43 | #include <sys/types.h> | |
44 | #include <sys/param.h> | |
45 | '; | |
46 | then | |
47 | echo little | |
48 | exit 0 | |
49 | fi | |
50 | ||
51 | if check_me BYTE_ORDER BIG_ENDIAN ' | |
52 | #include <sys/types.h> | |
53 | #include <sys/param.h> | |
54 | '; | |
55 | then | |
56 | echo big | |
57 | exit 0 | |
58 | fi | |
59 | ||
60 | echo unknown | |
61 | exit 0 |
0 | #!/bin/sh | |
1 | ||
2 | ############################################################ | |
3 | # Copyright (c) 2009 by Aleksey Cheusov | |
4 | # | |
5 | # See LICENSE file in the distribution. | |
6 | ############################################################ | |
7 | ||
8 | LC_ALL=C | |
9 | export LC_ALL | |
10 | ||
11 | pathpart=' ' # fake | |
12 | . mkc_check_common.sh | |
13 | ||
14 | find_n_match bison --version 'bison' | |
15 | ||
16 | echo '' |
0 | #!/bin/sh | |
1 | ||
2 | ############################################################ | |
3 | # Copyright (c) 2009 by Aleksey Cheusov | |
4 | # | |
5 | # See LICENSE file in the distribution. | |
6 | ############################################################ | |
7 | ||
8 | LC_ALL=C | |
9 | export LC_ALL | |
10 | ||
11 | pathpart=' ' # fake | |
12 | . mkc_check_common.sh | |
13 | ||
14 | find_n_match flex --version 'flex' | |
15 | find_n_match lex --version 'flex' | |
16 | ||
17 | echo '' |
0 | #!/bin/sh | |
1 | ||
2 | ############################################################ | |
3 | # Copyright (c) 2009 by Aleksey Cheusov | |
4 | # | |
5 | # See LICENSE file in the distribution. | |
6 | ############################################################ | |
7 | ||
8 | LC_ALL=C | |
9 | export LC_ALL | |
10 | ||
11 | pathpart=' ' # fake | |
12 | . mkc_check_common.sh | |
13 | ||
14 | find_n_match gawk --version 'gnu awk' | |
15 | find_n_match nawk --version 'gnu awk' | |
16 | find_n_match awk --version 'gnu awk' | |
17 | ||
18 | echo '' |
0 | #!/bin/sh | |
1 | ||
2 | ############################################################ | |
3 | # Copyright (c) 2009 by Aleksey Cheusov | |
4 | # | |
5 | # See LICENSE file in the distribution. | |
6 | ############################################################ | |
7 | ||
8 | LC_ALL=C | |
9 | export LC_ALL | |
10 | ||
11 | pathpart=' ' # fake | |
12 | . mkc_check_common.sh | |
13 | ||
14 | find_n_match gm4 --version 'gnu m4' | |
15 | find_n_match m4 --version 'gnu m4' | |
16 | ||
17 | echo '' |
0 | #!/bin/sh | |
1 | ||
2 | ############################################################ | |
3 | # Copyright (c) 2013 by Aleksey Cheusov | |
4 | # | |
5 | # See LICENSE file in the distribution. | |
6 | ############################################################ | |
7 | ||
8 | LC_ALL=C | |
9 | export LC_ALL | |
10 | ||
11 | extra_args="$*" | |
12 | ||
13 | pathpart='custom_nbmkdep' | |
14 | . mkc_check_common.sh | |
15 | ||
16 | trap "rm -f $tmpc $tmpo" 0 | |
17 | ||
18 | cat > "$tmpc" <<'EOF' | |
19 | #include <stdio.h> | |
20 | EOF | |
21 | ||
22 | if test -n "$MKDEP_CC"; then | |
23 | CC="$MKDEP_CC" | |
24 | export CC | |
25 | fi | |
26 | ||
27 | check_mkdep (){ | |
28 | "$1" -f "$tmpo" $extra_args -I . -I `pwd` "$tmpc" | |
29 | } | |
30 | ||
31 | for i in bmkdep nbmkdep mkdep; do | |
32 | if test -z "`check_mkdep $i 2>&1 > /dev/null`"; then | |
33 | mkc_which $i | |
34 | exit 0 | |
35 | fi | |
36 | done | |
37 | ||
38 | echo '' |
0 | #!/bin/sh | |
1 | ||
2 | ############################################################ | |
3 | # Copyright (c) 2013 by Aleksey Cheusov | |
4 | # | |
5 | # See LICENSE file in the distribution. | |
6 | ############################################################ | |
7 | ||
8 | # workround for crappylaris | |
9 | if test -z "$CRAPPYLIS" -a -x /usr/xpg4/bin/sh; then | |
10 | CRAPPYLIS=1 | |
11 | export CRAPPYLIS | |
12 | exec /usr/xpg4/bin/sh "$0" "$@" | |
13 | fi | |
14 | ||
15 | ${0%%/prog_nbmkdep}/prog_mkdep -- |
0 | FILES = ../README NEWS TODO LICENSE FAQ | |
0 | FILES = ../README NEWS TODO LICENSE FAQ NOTES | |
1 | 1 | FILESDIR = ${DOCDIR} |
2 | 2 | |
3 | 3 | .include <mkc.mk> |
0 | ====================================================================== | |
1 | Version 0.28.0, by Aleksey Cheusov, Sun, 14 Sep 2014 14:52:34 +0300 | |
2 | ||
3 | LIBDEPS, STATICLIBS, DPLDADD, DPLIBDIRS and DPINCDIRS variables were | |
4 | introduced. With their help one can specify library dependencies in | |
5 | the top-level Makefile. Users are also able to build some libraries | |
6 | statically even if they were designed to be a dynamic libraries. | |
7 | ||
8 | New variable FOREIGN was introduced. With its help one can embed | |
9 | autotools-based projects (as a subproject) to mk-configure-based once. | |
10 | See mkc_imp.foreign_autotools.mk section in man page for details. | |
11 | ||
12 | Support for Darwin was fixed. Nowadays it uses clang. | |
13 | ||
14 | New features were introduced: | |
15 | - "progname" for setprogname(3) and getprogname(3) BSDisms; | |
16 | - "err" for err(3), errx(3), verr(3) and verrx(3) BSDisms; | |
17 | - "warn" for warn(3), warnx(3), vwarn(3) and vwarnx(3) BSD-isms; | |
18 | - "fgetln" for fgetln(3) BSD-ism; | |
19 | ||
20 | Support for Haiku was fixed. It does not support hard links | |
21 | and uses LIBRARY_PATH. | |
22 | ||
23 | LDCOMPILER variable was removed. | |
24 | Compiler is always used for linking. | |
25 | ||
26 | New builtin "prog_gmake" was introduced which search GNU make. | |
27 | ||
28 | INTERNALLIBS variable was introduced. With its help one can | |
29 | implement libraries common for several subprojects. | |
30 | ||
31 | COMPATLIB variable was introduced. It is ideal solution for | |
32 | portability code. | |
33 | ||
34 | MKC_FEATURES: all objects are removed by target "clean" | |
35 | ||
36 | Target "errorcheck" was added to ALLTARGETS. Therefore it also have | |
37 | pre_, do_, post_ counterparts. | |
38 | ||
39 | VARDIR, SHAREDSTATEDIR, SUBPRJSRCTOP, CPPFLAGS0 variables were introduced. | |
40 | ||
41 | MKC_SOURCE_FUNCSLIBS: .o{s,p} objects are also removed by target "clean" | |
42 | ||
43 | Hardcoded /etc/mk.conf is not included anymore. New mk-configure | |
44 | specific configuration file @sysconfdir@/mk-c.conf was introduced. | |
45 | ||
46 | Additions to doc/NOTES | |
47 | ||
48 | .depends is added to DISTCLEANDIRS only for non-empty SRCS | |
49 | ||
50 | mkc_imp.intexts.mk: new error type for odd tokens in INTEXTS_REPLS | |
51 | ||
52 | MKDEP_CC is shquoted when passed to mkdep(1) as CC. | |
53 | ||
54 | Code clean-ups, more regression tests. | |
55 | ||
56 | This release was sucessfully tested on the following platforms. | |
57 | NetBSD-6.1/x86_64/gcc-4.5, FreeBSD-9.0/i386/gcc-4.2, | |
58 | OpenBSD-4.9/i386/gcc-4.2, DragonFlyBSD-3.4/x86_64/gcc-4.7, | |
59 | Darwin-14.0/x86_64/clang-600.0.53, SunOS-5.11/i86pc/gcc-4.7, | |
60 | SunOS-5.10/sparc/{gcc-4.8,SunStudio-12.3}, diverse | |
61 | Linux-es/{gcc,icc-12.1,SunStudio-12.3}, Haiku/gcc-4.8. | |
62 | ||
0 | 63 | ====================================================================== |
1 | 64 | Version 0.27.0, by Aleksey Cheusov, Sun, 13 Jul 2014 17:03:12 +0300 |
2 | 65 |
0 | BUILD SYSTEM IN GENERAL AND MK-CONFIGURE IN PARTICULAR IS A COMPLEX | |
1 | SYSTEM. THIS FILE CONTAINS UNORDERED NOTES ABOUT HOW TO USE | |
2 | MK-CONFIGURE EFFICIENTLY. I HOPE THESE NOTES WILL BE VALUABLE ADDON TO | |
3 | MK-CONFIGURE(7) REFERENCE AND HELP USERS UNDERSTAND MK-CONFIGURE. | |
4 | TAKE A NOTE THAT THESE NOTES ARE UNSORTED. | |
5 | ||
6 | *** | |
7 | ||
8 | For building projects with /usr prefix, run the following. | |
9 | ||
10 | export PREFIX=/usr SYSCONFDIR=/etc VARDIR=/var | |
11 | mkcmake all | |
12 | mkcmake install | |
13 | ||
14 | Packagers may use the following for creating a package using | |
15 | unprivileged user. | |
16 | ||
17 | mkdir /tmp/destdir | |
18 | mkcmake install DESTDIR=/tmp/destdir | |
19 | ||
20 | *** | |
21 | ||
22 | mk-configure supports out-of-tree builds. Most of functionality is | |
23 | supported by bmake. Examples are below. | |
24 | ||
25 | 1) | |
26 | mkdir /tmp/xxxproj-obj | |
27 | mkcmake MAKEOBJDIR=/tmp/xxxproj-obj | |
28 | ||
29 | In this case all objects and temporary files are created in | |
30 | /tmp/xxxproj-obj. Obviously, this may work if different subprojects | |
31 | doesn't produce files with the same name. This features is supported | |
32 | directly by bmake. | |
33 | ||
34 | 2) | |
35 | mkdir /tmp/xxxproj-obj | |
36 | mkcmake MAKEOBJDIRPREFIX=/tmp/xxxproj-obj | |
37 | ||
38 | Here all objects and temporary files are saved to | |
39 | ${MAKEOBJDIRPREFIX}${.CURDIR} directory. This features is also | |
40 | supported by bmake. | |
41 | ||
42 | 3) | |
43 | mkdir /tmp/xxxproj-obj | |
44 | env MKRELOBJDIR=yes MAKEOBJDIR=/tmp/xxxproj-obj mkcmake | |
45 | ||
46 | Unlike example 2) subdirectories under /tmp/xxxproj-obj for temporary | |
47 | files won't contain ${SRCTOP}. The variable MKRELOBJDIR is provided by mk-c. | |
48 | ||
49 | *** | |
50 | ||
51 | Even if you project is trivial, that is consists of single executable | |
52 | or library, I'd recommend to use mkc.subprj.mk in the top-level Makefile. | |
53 | In provides better flexibility and easier work for packagers. | |
54 | ||
55 | *** | |
56 | ||
57 | It's very important to understand what is a recursive target. | |
58 | See variable TARGETS. | |
59 | ||
60 | *** | |
61 | ||
62 | The variable TARGETS is a way to extend mk-c functionality. | |
63 | See examples/hello_TARGETS. | |
64 | ||
65 | *** | |
66 | ||
67 | Look at examples/hello_superfs/Makefile.inc. | |
68 | There you'll find a cool mk-configure's feature. | |
69 | ||
70 | *** | |
71 | ||
72 | If you want to override values for MKC_CHECK_* checks, run mkcmake | |
73 | with additional parameters, like this | |
74 | ||
75 | mkcmake all HAVE_HEADER.stdio_h=1 HAVE_HEADER.stdlib_h=1 | |
76 | ||
77 | See mkc.configure.mk section in mk-configure.7 for details. | |
78 | ||
79 | *** | |
80 | ||
81 | There are several ways of passing additional information from | |
82 | top-level project to subprojects: | |
83 | - environment variables via .export and .export-env bmake directives. | |
84 | - EXPORT_VARNAMES and NOEXPORT_VARNAMES variables from mkc.subprj.mk. | |
85 | - Makefile.common and Makefile.inc files. | |
86 | ||
87 | *** | |
88 | ||
89 | For prettifying mkcmake output, one can use | |
90 | ||
91 | export SHRTOUT=yes | |
92 | mkcmake all | |
93 | ||
94 | *** | |
95 | ||
96 | If your top-level Makefile looks like this | |
97 | ||
98 | Makefile: | |
99 | SUBPRJ = libA:progA libB:progB | |
100 | .include <mkc.subprj.mk> | |
101 | ||
102 | one can use | |
103 | ||
104 | mkcmake all-progB | |
105 | ||
106 | for building progB subproject without probA and libA. In this case libB | |
107 | will also be built as it is a dependency. The same for | |
108 | ||
109 | mkcmake install-progB | |
110 | mkcmake test-progB | |
111 | ... | |
112 | ||
113 | and others. "all", "install", "test" and others are listed in variable | |
114 | TARGETS. | |
115 | ||
116 | *** | |
117 | ||
118 | In traditional BSD mk files bsd.subdir.mk is allowed in any | |
119 | subdirectory. The same is true for mk-configure. However, for better | |
120 | flexibility it is recomended to have mkc.subprj.mk in the top-level | |
121 | Makefile and specify the whole dependency graph of subpojects in | |
122 | it. This allows, for example, building and testing any subproject | |
123 | separately by running one command from top-level directory, | |
124 | i.e. "mkcmake all-sub/sub/project". In this case all required | |
125 | dependencies (and nothing else) will be built recursively. For running | |
126 | mkcmake in subproject's directory, set the variable SRCTOP. | |
127 | ||
128 | *** | |
129 | ||
130 | SUBPRJ variable (mkc.subprj.mk) may contain subprojects, not | |
131 | associated with any subdirectory. Such subprojects may be used as "the | |
132 | name of subprojects collection". I call them "virtual | |
133 | subprojects". If, for example, you're developing traditional UNIX | |
134 | tools, you may have such projects as POSIX_tools BSD_tools, | |
135 | bin_tools, sbin_tools etc. | |
136 | ||
137 | *** | |
138 | ||
139 | Subprojects from SUBDIR (mkc.subdir.mk) and SUBPRJ (mkc.subprj.mk) may | |
140 | have slashes inside. | |
141 | ||
142 | *** | |
143 | ||
144 | NODEPS variable may be used for stripping unnecessary | |
145 | dependencies. This is especially useful for target "test". In the | |
146 | following example "mkcmake test" tests only programs but not libraries | |
147 | (recursively). That is, it runs targets "test-tools/prog1", | |
148 | "test-tools/prog2", "test-tools/prog3" and "test-tools/prog4" | |
149 | but "test-libs/foo" and others. | |
150 | ||
151 | Example: | |
152 | SUBPRJ = libs/foo:tools/prog1 | |
153 | SUBPRJ += libs/bar:tools/prog2 | |
154 | SUBPRJ += libs/foo:tools/prog3 libs/bar:tools/prog3 | |
155 | SUBPRJ += libs/qux:tools/prog4 | |
156 | ||
157 | NODEPS += test-libs/*:test test-libs/*:test-tools/* | |
158 | ||
159 | .include <mkc.subprj.mk> | |
160 | ||
161 | *** | |
162 | ||
163 | Makefile.common and Makefile.inc included implicitely by subprojects | |
164 | may be used for common code. For examples, in these files one can do | |
165 | something like this. | |
166 | ||
167 | VERSION = 1.2.3 | |
168 | INTEXTS_REPLS += version ${VERSION} | |
169 | ||
170 | for replacing @version@ with real version. | |
171 | ||
172 | *** | |
173 | ||
174 | If your project consists of libraries and executables, use | |
175 | mkc.subprj.mk and its LIBDEPS variable. Even if you prefer shared | |
176 | libraries, users will be able to link them statically with a help | |
177 | STATICLIBS variable specified in environment. For this to work you | |
178 | have to use += for STATICLIBS in Makefiles. |
0 | 0 | ============================================================ |
1 | Plan 0.26.0 | |
1 | Plan 0.28.0 | |
2 | 2 | |
3 | - CLEANFILES: pod2htmd.tmp pod2htmi.tmp only if POD is built | |
3 | - check awk capabilities at build time | |
4 | - Hide regression tests details | |
5 | - "bmake -k regrtest/check" (mkc.minitest.mk?) | |
4 | 6 | |
5 | - DISTCLEANFILES: .depend for C/C++ projects | |
7 | - strndup(SunOS-5.10, -fgetln,_compatlib) | |
8 | - PRId64 | |
9 | - leveldb, strtoll, strtoull | |
10 | - wmemcpy, strnlen | |
11 | - wcsdup | |
12 | - CFLAGS0 | |
6 | 13 | |
7 | - MKC_FEATURES: err(err,warn etc.), fgetln(via getline(3)) | |
8 | 14 | - Special marker for checks that cannot be possible in cross-compiling |
15 | ||
16 | - regression tests without garbage, make it look like paexec\ | |
17 | ||
18 | - MKC_FEATURES: inttypes | |
9 | 19 | |
10 | 20 | Some thoughts inspired by talks with Michael Crogan |
11 | 21 | |
12 | 22 | - MKASNEEDED=yes => ld --as-needed |
13 | 23 | |
14 | - VARIANTS for libraries. | |
15 | ||
16 | 24 | - _mkc_done_<prj>_<trg> |
17 | 25 | |
18 | 26 | - project "roundup" for testing |
19 | 27 | |
20 | - Better explain how "test" target works, maybe as a couple of slides | |
21 | in the PDF presentation. With and without mkc.minitest.mk. | |
22 | - One more example/ for TARGETS, demonstrating such things as | |
23 | "mkcmake all_clang/all_gcc" or "valgrind_test"/"gcov_test" etc. | |
24 | - Additional slides in PDF for virtual subprojects. | |
25 | Notes about "virtual subproject" in examples/. | |
26 | - Notes in examples/hello_dictd and other examples based on | |
27 | mkc.subprj.mk about what mkc.subprj.mk really does. Reference (man page) | |
28 | is not enough for newcomers. Notes about clean-SUBPRJ, all-SUBPRJ etc. | |
29 | - Better explain ../Makefile.inc included automatically. For those who | |
30 | are not familiar with *BSD it is not obvious how to use it. | |
31 | 28 | - "errorcheck/configure" tests should be run in parallel. Something |
32 | 29 | like shlock(1) or flock(1) is needed for this. |
33 | - Example is needed for how to embed autoconf-based subproject into a | |
34 | project based on mk-configure. The sad fact is autoconf/automake is | |
35 | everywhere. So, it would be nice to integrate mk-c into reality. | |
36 | mkc_imp.autotools.mk is needed for this. | |
37 | 30 | - Alternative .depend generation, e.g. like it is described in GNU |
38 | 31 | make info files |
39 | - Higher priority for fixing handling of dependencies between | |
40 | libraries and programs. In addition examples/ is needed for | |
32 | - Additional examples/ is needed for | |
41 | 33 | triggering rebuild of subproject if "something" was rebuild in |
42 | 34 | another subproject (build script for example). |
43 | 35 | - Interdependencies between targetX-subprjA and targetY-subprjB (for |
46 | 38 | <<<depend-project1:errorcheck-autotools_based_project2>>>!!! |
47 | 39 | - Steal cool features from Simon Gerraty's mk files and analyse |
48 | 40 | "meta mode" he invented. |
49 | - Better support for working without installation to /. -rpath, additional | |
50 | directories for objects, binaries and libs. | |
51 | - symlinks in object directories to source files for easier running | |
52 | unitest, for example. lndir(1). | |
53 | 41 | |
54 | 42 | Some "targets" from TARGETS should set MKCHECKS to "no" |
55 | 43 | |
56 | 44 | ronn(1) : markdown to man pages |
57 | ||
58 | Reimplement linkme.mk. It is not flexible enough. | |
59 | - Additional type of dependencies in mkc.subprjs.mk (LIBDEPS = | |
60 | libfoo:bar ...), pass them to subprojects using enironment and | |
61 | include appropriate libfoo/linkme.mk if it is | |
62 | available. Otherwise, use default -l and -I. | |
63 | or | |
64 | - keep linkme.mk and avoid direct use of CPPFLAGS, LDADD and | |
65 | DPLIBDIRS. Instead use special variables XXX.includes, | |
66 | XXX.ldflags, XXX.ldadd, SRCDIR_<lib> and OBJDIR_<lib>. | |
67 | 45 | |
68 | 46 | custom test failed -> exit status of mkcmake should not be zero |
69 | 47 | MKC_CUSTOM_ERR.qqqq -> error message before exiting just like |
78 | 56 | |
79 | 57 | - BINSUBDIR, LIBSUBDIR, LIBEXECSUBDIR etc... |
80 | 58 | - Fix USE_SSP support for clang (-mllvm -stack-protector-buffer-size=1) |
81 | - @sysconfdir@/mkc.conf | |
82 | 59 | - USE_RPATH |
83 | 60 | - OBJCOPTS_<proj> |
84 | 61 | - Regression tests: |
124 | 101 | run generated executables, i.e. not ready |
125 | 102 | for cross-compilation |
126 | 103 | |
127 | = symlinks to executables and libraries in ${OBJDIR}/{bin,lib} | |
128 | ||
129 | 104 | = support for gettext |
130 | ||
131 | = xxxDIR variable for /var | |
132 | 105 | |
133 | 106 | = mkclint? |
134 | 107 | |
144 | 117 | = shared libraries support for nwcc and other compilers. |
145 | 118 | |
146 | 119 | = Comparison with quagmire, kBuild, CMake, scons, waf, framewerk, pmk, |
147 | MagicMakefiles, bjam, pymake, bitmake, pkgconf, | |
120 | MagicMakefiles, bjam, pymake, bitmake, pkgconf, Gradle | |
148 | 121 | http://sourceforge.net/projects/mkbuild etc. |
149 | 122 | |
150 | 123 | = Often compilers need special options to compile pthread code. |
0 | 0 | CLEANDIRS += ${.CURDIR}/usr ${.CURDIR}/opt |
1 | 1 | |
2 | .ifdef SRCDIR_custom | |
2 | .ifdef SRCDIR_builtins | |
3 | 3 | # regression test for mk-configure |
4 | 4 | MKC_CACHEDIR = ${.CURDIR} |
5 | BUILTINSDIR = ${SRCDIR_custom} | |
5 | BUILTINSDIR = ${SRCDIR_builtins} | |
6 | 6 | FEATURESDIR = ${SRCDIR_features} |
7 | 7 | SHRTOUT = no |
8 | 8 | .export MKC_CACHEDIR BUILTINSDIR FEATURESDIR SHRTOUT |
0 | FOREIGN = autotools | |
1 | FSRCDIR = proj | |
2 | ||
3 | AT_USE_AUTOMAKE = no | |
4 | AT_MAKE = ${BUILTIN.prog_gmake} | |
5 | ||
6 | MKC_CHECK_BUILTINS = prog_gmake | |
7 | MKCHECKS = yes # we need path to gmake for target "clean" | |
8 | ||
9 | # The following line is for regression tests. | |
10 | # In real life we don't need this. | |
11 | all: mkgen | |
12 | ||
13 | .include "test.mk" | |
14 | .include <mkc.mk> |
0 | Hello autoconf | |
1 | =========== all ============ | |
2 | /objdir/AUTHORS | |
3 | /objdir/COPYING | |
4 | /objdir/ChangeLog | |
5 | /objdir/Makefile | |
6 | /objdir/Makefile.in | |
7 | /objdir/NEWS | |
8 | /objdir/README | |
9 | /objdir/config.h | |
10 | /objdir/config.h.in | |
11 | /objdir/config.log | |
12 | /objdir/config.status | |
13 | /objdir/configure | |
14 | /objdir/configure.ac | |
15 | /objdir/hello_autoconf | |
16 | /objdir/hello_autoconf.c | |
17 | ========== clean =========== | |
18 | /objdir/AUTHORS | |
19 | /objdir/COPYING | |
20 | /objdir/ChangeLog | |
21 | /objdir/Makefile | |
22 | /objdir/Makefile.in | |
23 | /objdir/NEWS | |
24 | /objdir/README | |
25 | /objdir/config.h | |
26 | /objdir/config.h.in | |
27 | /objdir/config.log | |
28 | /objdir/config.status | |
29 | /objdir/configure | |
30 | /objdir/configure.ac | |
31 | /objdir/hello_autoconf.c | |
32 | ========== all SHRTOUT=yes =========== | |
33 | MKGEN: | |
34 | CONFIGURE: | |
35 | configure: creating ./config.status | |
36 | AUTOTOOLS: | |
37 | ======= cleandir ========== | |
38 | /objdir/AUTHORS | |
39 | /objdir/COPYING | |
40 | /objdir/ChangeLog | |
41 | /objdir/Makefile.in | |
42 | /objdir/NEWS | |
43 | /objdir/README | |
44 | /objdir/configure.ac | |
45 | /objdir/hello_autoconf.c |
0 | Aleksey Cheusov <vle@gmx.net> |
0 | Copyright (c) 2014 by Aleksey Cheusov <vle@gmx.net> | |
1 | ||
2 | Redistribution and use in source and binary forms, with or without | |
3 | modification, are permitted provided that the following conditions | |
4 | are met: | |
5 | ||
6 | 1. Redistributions of source code must retain the above copyright | |
7 | notice, this list of conditions and the following disclaimer. | |
8 | ||
9 | 2. Redistributions in binary form must reproduce the above copyright | |
10 | notice, this list of conditions and the following disclaimer in the | |
11 | documentation and/or other materials provided with the | |
12 | distribution. | |
13 | ||
14 | THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND | |
15 | CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, | |
16 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
17 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
18 | IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY | |
19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | |
21 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | |
23 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
24 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
25 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
0 | Useless ChangeLog |
0 | # GNU Make is required | |
1 | ||
2 | srcdir = @srcdir@ | |
3 | ||
4 | CC ?= @CC@ | |
5 | ||
6 | CFLAGS ?= @CFLAGS@ | |
7 | CPPFLAGS ?= @CPPFLAGS@ | |
8 | LDFLAGS ?= @LDFLAGS@ | |
9 | LIBS ?= @LIBS@ | |
10 | ||
11 | CPPFLAGS += -I. -I${srcdir} | |
12 | CFLAGS += -DMSG='"$(shell echo Hello autoconf)"' | |
13 | ||
14 | .PHONY: all clean distclean | |
15 | ||
16 | all: hello_autoconf | |
17 | ||
18 | %: %.c | |
19 | ${CC} -o $@ ${CPPFLAGS} ${CFLAGS} $< ${LDFLAGS} ${LIBS} | |
20 | ||
21 | clean: | |
22 | -rm -f hello_autoconf | |
23 | ||
24 | distclean: clean # mk-configure removes almost everything | |
25 | -rm -f ${srcdir}/config.h.in config.h |
0 | No news is good news |
0 | This is a trivial autoconf-based project. |
0 | dnl | |
1 | dnl Process this file with autoconf to create configure. | |
2 | ||
3 | # Initialize Autoconf | |
4 | AC_PREREQ([2.60]) | |
5 | AC_INIT([hello_autotools], [0.28.0], | |
6 | [https://github.com/cheusov/mk-configure]) | |
7 | AC_CONFIG_SRCDIR([Makefile.in]) | |
8 | AC_CONFIG_HEADERS([config.h]) | |
9 | ||
10 | dnl Checks for functions | |
11 | AC_CHECK_HEADERS([stdio.h]) | |
12 | ||
13 | AC_OUTPUT([Makefile]) |
0 | #include <config.h> | |
1 | ||
2 | #ifdef HAVE_STDIO_H | |
3 | #include <stdio.h> | |
4 | #endif | |
5 | ||
6 | int main (int argc, char **argv) | |
7 | { | |
8 | puts (MSG); | |
9 | return 0; | |
10 | } |
0 | EXCL_RE='autom4te[.]cache' | |
1 | ||
2 | .PHONY : test_output | |
3 | test_output: | |
4 | @ \ | |
5 | ${.OBJDIR}/hello_autoconf; \ | |
6 | rm -rf ${.OBJDIR}${PREFIX}; \ | |
7 | \ | |
8 | echo =========== all ============; \ | |
9 | find ${.OBJDIR} -type f | grep -Ev '${EXCL_RE}' | \ | |
10 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ | |
11 | \ | |
12 | echo ========== clean ===========; \ | |
13 | ${MAKE} ${MAKEFLAGS} clean > /dev/null; \ | |
14 | find ${.OBJDIR} -type f | grep -vE '${EXCL_RE}' | \ | |
15 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ | |
16 | \ | |
17 | echo ========== all SHRTOUT=yes ===========; \ | |
18 | ${MAKE} ${MAKEFLAGS} all SHRTOUT=yes | \ | |
19 | grep -E '^[[:alpha:]]+:'; \ | |
20 | \ | |
21 | echo ======= cleandir ==========; \ | |
22 | ${MAKE} ${MAKEFLAGS} cleandir > /dev/null; \ | |
23 | find ${.OBJDIR} -type f | grep -vE '${EXCL_RE}' | \ | |
24 | mkc_test_helper "${PREFIX}" "${.OBJDIR}" | |
25 | ||
26 | .include <mkc.minitest.mk> |
0 | FOREIGN = autotools | |
1 | FSRCDIR = proj | |
2 | ||
3 | DISTCLEANFILES += ${.CURDIR}/${FSRCDIR}/hello_autotools-config.h.in | |
4 | ||
5 | ||
6 | # the following is for regression tests. In real life we don't need this. | |
7 | all: mkgen | |
8 | ||
9 | .include "test.mk" | |
10 | .include <mkc.mk> |
0 | Hello AutoShi^H^H^HTools! | |
1 | =========== all ============ | |
2 | /objdir/.deps/main.Po | |
3 | /objdir/AUTHORS | |
4 | /objdir/COPYING | |
5 | /objdir/ChangeLog | |
6 | /objdir/Makefile | |
7 | /objdir/Makefile.am | |
8 | /objdir/Makefile.in | |
9 | /objdir/NEWS | |
10 | /objdir/README | |
11 | /objdir/aclocal.m4 | |
12 | /objdir/config.log | |
13 | /objdir/config.status | |
14 | /objdir/configure | |
15 | /objdir/configure.ac | |
16 | /objdir/hello_autotools | |
17 | /objdir/hello_autotools-config.h | |
18 | /objdir/hello_autotools-config.h.in | |
19 | /objdir/main.c | |
20 | /objdir/main.o | |
21 | /objdir/stamp-h1 | |
22 | ========= install ========== | |
23 | /objdir/prefix | |
24 | /objdir/prefix/bin | |
25 | /objdir/prefix/bin/hello_autotools | |
26 | ======== uninstall ========= | |
27 | /objdir/prefix | |
28 | /objdir/prefix/bin | |
29 | ========== clean =========== | |
30 | /objdir/.deps/main.Po | |
31 | /objdir/AUTHORS | |
32 | /objdir/COPYING | |
33 | /objdir/ChangeLog | |
34 | /objdir/Makefile | |
35 | /objdir/Makefile.am | |
36 | /objdir/Makefile.in | |
37 | /objdir/NEWS | |
38 | /objdir/README | |
39 | /objdir/aclocal.m4 | |
40 | /objdir/config.log | |
41 | /objdir/config.status | |
42 | /objdir/configure | |
43 | /objdir/configure.ac | |
44 | /objdir/hello_autotools-config.h | |
45 | /objdir/hello_autotools-config.h.in | |
46 | /objdir/main.c | |
47 | /objdir/stamp-h1 | |
48 | ========== all SHRTOUT=yes =========== | |
49 | MKGEN: | |
50 | CONFIGURE: | |
51 | configure: creating ./config.status | |
52 | AUTOTOOLS: | |
53 | ======= cleandir ========== | |
54 | /objdir/AUTHORS | |
55 | /objdir/COPYING | |
56 | /objdir/ChangeLog | |
57 | /objdir/Makefile.am | |
58 | /objdir/NEWS | |
59 | /objdir/README | |
60 | /objdir/configure.ac | |
61 | /objdir/main.c |
0 | Aleksey Cheusov <vle@gmx.net> |
0 | Copyright (c) 2014 by Aleksey Cheusov <vle@gmx.net> | |
1 | ||
2 | Redistribution and use in source and binary forms, with or without | |
3 | modification, are permitted provided that the following conditions | |
4 | are met: | |
5 | ||
6 | 1. Redistributions of source code must retain the above copyright | |
7 | notice, this list of conditions and the following disclaimer. | |
8 | ||
9 | 2. Redistributions in binary form must reproduce the above copyright | |
10 | notice, this list of conditions and the following disclaimer in the | |
11 | documentation and/or other materials provided with the | |
12 | distribution. | |
13 | ||
14 | THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND | |
15 | CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, | |
16 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
17 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
18 | IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY | |
19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | |
21 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | |
23 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
24 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
25 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
0 | Useless ChangeLog |
0 | No news is good news |
0 | This is a trivial autotools-based project. |
0 | dnl | |
1 | dnl Process this file with autoconf to create configure. | |
2 | ||
3 | # Initialize Autoconf | |
4 | AC_PREREQ([2.60]) | |
5 | AC_INIT([hello_autotools], [0.28.0], | |
6 | [https://github.com/cheusov/mk-configure]) | |
7 | AC_CONFIG_SRCDIR([Makefile.am]) | |
8 | AC_CONFIG_HEADERS([hello_autotools-config.h]) | |
9 | ||
10 | # Initialize Automake | |
11 | AM_INIT_AUTOMAKE | |
12 | ||
13 | dnl Checks for functions | |
14 | AC_CHECK_HEADERS([stdio.h]) | |
15 | ||
16 | AC_OUTPUT([Makefile]) |
0 | #include <hello_autotools-config.h> | |
1 | ||
2 | #ifdef HAVE_STDIO_H | |
3 | #include <stdio.h> | |
4 | #endif | |
5 | ||
6 | int main (int argc, char **argv) | |
7 | { | |
8 | puts ("Hello AutoShi^H^H^HTools!"); | |
9 | return 0; | |
10 | } |
0 | EXCL_RE='autom4te[.]cache' | |
1 | ||
2 | .PHONY : test_output | |
3 | test_output: | |
4 | @ \ | |
5 | ${.OBJDIR}/hello_autotools; \ | |
6 | rm -rf ${.OBJDIR}${PREFIX}; \ | |
7 | \ | |
8 | echo =========== all ============; \ | |
9 | find ${.OBJDIR} -type f | grep -Ev '${EXCL_RE}' | \ | |
10 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ | |
11 | \ | |
12 | echo ========= install ==========; \ | |
13 | ${MAKE} ${MAKEFLAGS} install -j3 \ | |
14 | DESTDIR=${.OBJDIR} > /dev/null; \ | |
15 | find ${.OBJDIR}${PREFIX} -type f -o -type d | \ | |
16 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ | |
17 | \ | |
18 | echo ======== uninstall =========; \ | |
19 | ${MAKE} ${MAKEFLAGS} -j4 uninstall \ | |
20 | DESTDIR=${.OBJDIR} > /dev/null; \ | |
21 | find ${.OBJDIR}${PREFIX} -type f -o -type d | \ | |
22 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ | |
23 | \ | |
24 | echo ========== clean ===========; \ | |
25 | ${MAKE} ${MAKEFLAGS} clean > /dev/null; \ | |
26 | find ${.OBJDIR} -type f | grep -vE '${EXCL_RE}' | \ | |
27 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ | |
28 | \ | |
29 | echo ========== all SHRTOUT=yes ===========; \ | |
30 | ${MAKE} ${MAKEFLAGS} all SHRTOUT=yes | \ | |
31 | grep -E '^[[:alpha:]]+:'; \ | |
32 | \ | |
33 | echo ======= cleandir ==========; \ | |
34 | ${MAKE} ${MAKEFLAGS} cleandir > /dev/null; \ | |
35 | find ${.OBJDIR} -type f | grep -vE '${EXCL_RE}' | \ | |
36 | mkc_test_helper "${PREFIX}" "${.OBJDIR}" | |
37 | ||
38 | .include <mkc.minitest.mk> |
16 | 16 | |
17 | 17 | YACC = ${"${BUILTIN.prog_bison}" != "":?${BUILTIN.prog_bison} -y:} |
18 | 18 | LEX = ${BUILTIN.prog_flex} |
19 | LEXLIB = -lfl | |
19 | LEXLIB = #-lfl | |
20 | 20 | |
21 | 21 | .if empty(BUILTIN.prog_flex) |
22 | 22 | MKC_ERR_MSG += "Cannot find flex, good bye!" |
0 | LIBDEPS = libcmpt:prog1 libcmpt:prog2 | |
1 | COMPATLIB = libcmpt | |
2 | ||
3 | .include "test.mk" | |
4 | .include <mkc.subprj.mk> |
0 | MKC_FEATURES = strlcpy strlcat getline progname fgetln err |
0 | =========== all ============ | |
1 | /objdir/Makefile | |
2 | /objdir/Makefile.inc | |
3 | /objdir/_mkc_compiler_type.err | |
4 | /objdir/_mkc_compiler_type.res | |
5 | /objdir/_mkc_func0_getexecname_stdlib_h.c | |
6 | /objdir/_mkc_func0_getexecname_stdlib_h.err | |
7 | /objdir/_mkc_func0_getexecname_stdlib_h.res | |
8 | /objdir/_mkc_func0_getprogname_stdlib_h.c | |
9 | /objdir/_mkc_func0_getprogname_stdlib_h.err | |
10 | /objdir/_mkc_func0_getprogname_stdlib_h.res | |
11 | /objdir/_mkc_func1_setprogname_stdlib_h.c | |
12 | /objdir/_mkc_func1_setprogname_stdlib_h.err | |
13 | /objdir/_mkc_func1_setprogname_stdlib_h.res | |
14 | /objdir/_mkc_func3_err_err_h.c | |
15 | /objdir/_mkc_func3_err_err_h.err | |
16 | /objdir/_mkc_func3_err_err_h.res | |
17 | /objdir/_mkc_func3_errx_err_h.c | |
18 | /objdir/_mkc_func3_errx_err_h.err | |
19 | /objdir/_mkc_func3_errx_err_h.res | |
20 | /objdir/_mkc_func3_fgetln_stdio_h.c | |
21 | /objdir/_mkc_func3_fgetln_stdio_h.err | |
22 | /objdir/_mkc_func3_fgetln_stdio_h.res | |
23 | /objdir/_mkc_func3_getline_stdio_h.c | |
24 | /objdir/_mkc_func3_getline_stdio_h.err | |
25 | /objdir/_mkc_func3_getline_stdio_h.res | |
26 | /objdir/_mkc_func3_strlcat_string_h.c | |
27 | /objdir/_mkc_func3_strlcat_string_h.err | |
28 | /objdir/_mkc_func3_strlcat_string_h.res | |
29 | /objdir/_mkc_func3_strlcpy_string_h.c | |
30 | /objdir/_mkc_func3_strlcpy_string_h.err | |
31 | /objdir/_mkc_func3_strlcpy_string_h.res | |
32 | /objdir/_mkc_func3_verr_err_h.c | |
33 | /objdir/_mkc_func3_verr_err_h.err | |
34 | /objdir/_mkc_func3_verr_err_h.res | |
35 | /objdir/_mkc_func3_verrx_err_h.c | |
36 | /objdir/_mkc_func3_verrx_err_h.err | |
37 | /objdir/_mkc_func3_verrx_err_h.res | |
38 | /objdir/_mkc_funclib_err.c | |
39 | /objdir/_mkc_funclib_err.err | |
40 | /objdir/_mkc_funclib_err.res | |
41 | /objdir/_mkc_funclib_errx.c | |
42 | /objdir/_mkc_funclib_errx.err | |
43 | /objdir/_mkc_funclib_errx.res | |
44 | /objdir/_mkc_funclib_fgetln.c | |
45 | /objdir/_mkc_funclib_fgetln.err | |
46 | /objdir/_mkc_funclib_fgetln.res | |
47 | /objdir/_mkc_funclib_getline.c | |
48 | /objdir/_mkc_funclib_getline.err | |
49 | /objdir/_mkc_funclib_getline.res | |
50 | /objdir/_mkc_funclib_getprogname.c | |
51 | /objdir/_mkc_funclib_getprogname.err | |
52 | /objdir/_mkc_funclib_getprogname.res | |
53 | /objdir/_mkc_funclib_setprogname.c | |
54 | /objdir/_mkc_funclib_setprogname.err | |
55 | /objdir/_mkc_funclib_setprogname.res | |
56 | /objdir/_mkc_funclib_strlcat.c | |
57 | /objdir/_mkc_funclib_strlcat.err | |
58 | /objdir/_mkc_funclib_strlcat.res | |
59 | /objdir/_mkc_funclib_strlcpy.c | |
60 | /objdir/_mkc_funclib_strlcpy.err | |
61 | /objdir/_mkc_funclib_strlcpy.res | |
62 | /objdir/_mkc_funclib_verr.c | |
63 | /objdir/_mkc_funclib_verr.err | |
64 | /objdir/_mkc_funclib_verr.res | |
65 | /objdir/_mkc_funclib_verrx.c | |
66 | /objdir/_mkc_funclib_verrx.err | |
67 | /objdir/_mkc_funclib_verrx.res | |
68 | /objdir/_mkc_header_err_h.c | |
69 | /objdir/_mkc_header_err_h.err | |
70 | /objdir/_mkc_header_err_h.res | |
71 | /objdir/_mkc_prog_cc.err | |
72 | /objdir/_mkc_prog_cc.res | |
73 | /objdir/_mkc_variable_program_invocation_short_name_errno_h.c | |
74 | /objdir/_mkc_variable_program_invocation_short_name_errno_h.err | |
75 | /objdir/_mkc_variable_program_invocation_short_name_errno_h.res | |
76 | /objdir/expect.out | |
77 | /objdir/hello_compatlib.test.out.tmp | |
78 | /objdir/libcmpt/Makefile | |
79 | /objdir/libcmpt/libcmpt.a | |
80 | /objdir/libcmpt/libcmpt_pic.a | |
81 | /objdir/prog1/Makefile | |
82 | /objdir/prog1/prog1 | |
83 | /objdir/prog1/prog1.c | |
84 | /objdir/prog1/prog1.o | |
85 | /objdir/prog2/Makefile | |
86 | /objdir/prog2/prog2 | |
87 | /objdir/prog2/prog2.c | |
88 | /objdir/prog2/prog2.o | |
89 | /objdir/test.mk |
0 | #include <stdio.h> | |
1 | #include <string.h> | |
2 | ||
3 | #include <mkc_strlcpy.h> | |
4 | #include <mkc_strlcat.h> | |
5 | #include <mkc_getline.h> | |
6 | #include <mkc_progname.h> | |
7 | ||
8 | static const char message [] = "Theo de Raadt said: \"The strlcpy() and strlcat() functions provide a consistent, unambiguous API to help the programmer write more bullet-proof code.\""; | |
9 | ||
10 | int main (int argc, char ** argv) | |
11 | { | |
12 | char *buf = NULL; | |
13 | size_t size = 0; | |
14 | ssize_t len = 0; | |
15 | char small_buf [15]; | |
16 | char said [19]; | |
17 | ||
18 | setprogname (argv [0]); | |
19 | ||
20 | while (len = getline (&buf, &size, stdin), len != -1){ | |
21 | len = strlen (buf); | |
22 | if (len > 0 && buf [len-1] == '\n') | |
23 | buf [len-1] = 0; | |
24 | ||
25 | strlcpy (small_buf, "foo17", sizeof (small_buf)); | |
26 | strlcat (small_buf, buf, sizeof (small_buf)); | |
27 | puts (small_buf); | |
28 | } | |
29 | ||
30 | strlcpy (said, message, sizeof (said)); | |
31 | puts (said); | |
32 | ||
33 | printf ("short progname=%s\n", getprogname ()); | |
34 | printf ("full progname=%s\n", argv [0]); | |
35 | ||
36 | return 0; | |
37 | } |
0 | #include <stdio.h> | |
1 | #include <string.h> | |
2 | #include <stdlib.h> | |
3 | ||
4 | #include <mkc_fgetln.h> | |
5 | #include <mkc_err.h> | |
6 | ||
7 | int main (int argc, char ** argv) | |
8 | { | |
9 | char *buf, *lbuf; | |
10 | size_t len; | |
11 | ||
12 | while ((lbuf = buf = fgetln (stdin, &len)) != NULL) { | |
13 | if (len > 0 && buf [len - 1] == '\n') | |
14 | buf[len - 1] = '\0'; | |
15 | else if ((lbuf = strndup (buf, len + 1)) == NULL) | |
16 | err (1, NULL); | |
17 | printf ("%s\n", lbuf); | |
18 | ||
19 | if (lbuf != buf) | |
20 | free (lbuf); | |
21 | } | |
22 | return 0; | |
23 | } |
0 | FUNCS_RE=(fgetln|progname|strlcat|strlcpy|getline)[.]o | |
1 | ||
2 | .PHONY : test_output | |
3 | test_output : | |
4 | @set -e; \ | |
5 | echo =========== all ============; \ | |
6 | find ${.OBJDIR} -type f | grep -Ev '${FUNCS_RE}' | \ | |
7 | grep -vE 'libcmpt/.*[.]os?$$' | \ | |
8 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ | |
9 | \ | |
10 | true =========== cleandir ============; \ | |
11 | ${MAKE} ${MAKEFLAGS} distclean > /dev/null | |
12 | ||
13 | .include <mkc.minitest.mk> |
11 | 11 | |
12 | 12 | SRCS = hello_msg1.cpp hello_msg2.cpp |
13 | 13 | |
14 | MKC_SOURCE_FUNCLIBS = dummy # a part of regression test | |
15 | MKC_SOURCE_DIR.dummy.c := ${.PARSEDIR} | |
16 | ||
14 | 17 | .include <mkc.lib.mk> |
0 | /* we do use this function, this is just a part of regression test */ | |
1 | void dummy_func (void); | |
2 | void dummy_func (void) | |
3 | { | |
4 | /* we do nothing here */ | |
5 | } |
0 | PATH.cxxlib := ${.PARSEDIR} | |
0 | PATH.cxxlib := ${.PARSEDIR:tA} | |
1 | 1 | |
2 | CPPFLAGS += -I${PATH.cxxlib}/include | |
2 | DPINCDIRS += ${PATH.cxxlib}/include | |
3 | 3 | DPLIBDIRS += ${PATH.cxxlib} |
4 | LDADD0 += -lcxxlib | |
4 | DPLDADD += cxxlib |
1 | 1 | hello world 2! |
2 | 2 | =========== all ============ |
3 | 3 | /objdir/Makefile |
4 | /objdir/_mkc_compiler_type.err | |
5 | /objdir/_mkc_compiler_type.res | |
4 | 6 | /objdir/_mkc_cxx_type.err |
5 | 7 | /objdir/_mkc_cxx_type.res |
8 | /objdir/_mkc_funclib_dummy.c | |
9 | /objdir/_mkc_funclib_dummy.err | |
10 | /objdir/_mkc_funclib_dummy.res | |
6 | 11 | /objdir/_mkc_prog_cxx.err |
7 | 12 | /objdir/_mkc_prog_cxx.res |
8 | 13 | /objdir/cxxapp/Makefile |
10 | 15 | /objdir/cxxapp/cxxapp.cc |
11 | 16 | /objdir/cxxapp/cxxapp.o |
12 | 17 | /objdir/cxxlib/Makefile |
18 | /objdir/cxxlib/dummy.c | |
19 | /objdir/cxxlib/dummy.o | |
20 | /objdir/cxxlib/dummy.os | |
13 | 21 | /objdir/cxxlib/hello_msg1.cpp |
14 | 22 | /objdir/cxxlib/hello_msg1.o |
15 | 23 | /objdir/cxxlib/hello_msg1.os |
42 | 50 | ======== uninstall ========= |
43 | 51 | ========== clean =========== |
44 | 52 | /objdir/Makefile |
53 | /objdir/_mkc_compiler_type.err | |
54 | /objdir/_mkc_compiler_type.res | |
45 | 55 | /objdir/_mkc_cxx_type.err |
46 | 56 | /objdir/_mkc_cxx_type.res |
57 | /objdir/_mkc_funclib_dummy.c | |
58 | /objdir/_mkc_funclib_dummy.err | |
59 | /objdir/_mkc_funclib_dummy.res | |
47 | 60 | /objdir/_mkc_prog_cxx.err |
48 | 61 | /objdir/_mkc_prog_cxx.res |
49 | 62 | /objdir/cxxapp/Makefile |
50 | 63 | /objdir/cxxapp/cxxapp.cc |
51 | 64 | /objdir/cxxlib/Makefile |
65 | /objdir/cxxlib/dummy.c | |
52 | 66 | /objdir/cxxlib/hello_msg1.cpp |
53 | 67 | /objdir/cxxlib/hello_msg2.cpp |
54 | 68 | /objdir/cxxlib/include/hello_msg.h |
63 | 77 | /objdir/cxxapp/Makefile |
64 | 78 | /objdir/cxxapp/cxxapp.cc |
65 | 79 | /objdir/cxxlib/Makefile |
80 | /objdir/cxxlib/dummy.c | |
66 | 81 | /objdir/cxxlib/hello_msg1.cpp |
67 | 82 | /objdir/cxxlib/hello_msg2.cpp |
68 | 83 | /objdir/cxxlib/include/hello_msg.h |
4 | 4 | rm -rf ${.OBJDIR}${PREFIX}; \ |
5 | 5 | LD_LIBRARY_PATH=${.CURDIR}/cxxlib:$$LD_LIBRARY_PATH; \ |
6 | 6 | DYLD_LIBRARY_PATH=${.CURDIR}/cxxlib:$$LD_LIBRARY_PATH; \ |
7 | export LD_LIBRARY_PATH DYLD_LIBRARY_PATH; \ | |
7 | LIBRARY_PATH=$$LIBRARY_PATH:$$LD_LIBRARY_PATH; \ | |
8 | export LD_LIBRARY_PATH DYLD_LIBRARY_PATH LIBRARY_PATH; \ | |
8 | 9 | ${.CURDIR}/cxxapp/cxxapp; \ |
9 | 10 | \ |
10 | 11 | echo =========== all ============; \ |
0 | SUBPRJ = libcommon:dict | |
1 | SUBPRJ += libcommon:dictd | |
2 | SUBPRJ += libcommon:dictzip | |
3 | SUBPRJ += libcommon:dictfmt | |
4 | SUBPRJ += libmaa:dict | |
5 | SUBPRJ += libmaa:dictd | |
6 | SUBPRJ += libmaa:dictzip | |
7 | SUBPRJ += libmaa:dictfmt | |
8 | SUBPRJ += libdz:dictzip | |
0 | LIBDEPS = libcommon:dict | |
1 | LIBDEPS += libcommon:dictd | |
2 | LIBDEPS += libcommon:dictzip | |
3 | LIBDEPS += libcommon:dictfmt | |
4 | LIBDEPS += libmaa:dict | |
5 | LIBDEPS += libmaa:dictd | |
6 | LIBDEPS += libmaa:dictzip | |
7 | LIBDEPS += libmaa:dictfmt | |
8 | LIBDEPS += libdz:dictzip | |
9 | ||
10 | INTERNALLIBS += libcommon | |
9 | 11 | |
10 | 12 | # Subproject "doc" has no dependencies |
11 | 13 | SUBPRJ += doc |
2 | 2 | |
3 | 3 | WARNS = 4 |
4 | 4 | |
5 | .include "../libcommon/linkme.mk" | |
6 | .include "../libmaa/linkme.mk" | |
7 | ||
8 | 5 | .include <mkc.prog.mk> |
2 | 2 | |
3 | 3 | WARNS = 4 |
4 | 4 | |
5 | .include "../libcommon/linkme.mk" | |
6 | .include "../libmaa/linkme.mk" | |
7 | ||
8 | 5 | .include <mkc.prog.mk> |
2 | 2 | |
3 | 3 | WARNS = 4 |
4 | 4 | |
5 | .include "../libcommon/linkme.mk" | |
6 | .include "../libmaa/linkme.mk" | |
7 | ||
8 | 5 | .include <mkc.prog.mk> |
2 | 2 | |
3 | 3 | WARNS = 4 |
4 | 4 | |
5 | .include "../libcommon/linkme.mk" | |
6 | .include "../libdz/linkme.mk" | |
7 | .include "../libmaa/linkme.mk" | |
8 | ||
9 | 5 | .include <mkc.prog.mk> |
19 | 19 | dictzip: fake5=5 |
20 | 20 | dictzip: fake6=6 |
21 | 21 | =========== nm ============ |
22 | libmaa fake4 | |
23 | libmaa fake5 | |
24 | libmaa fake6 | |
25 | libdz fake3 | |
22 | symbol fake4 | |
23 | symbol fake5 | |
24 | symbol fake6 | |
25 | = | |
26 | symbol fake3 | |
26 | 27 | =========== all ============ |
27 | 28 | /objdir/Makefile |
28 | 29 | /objdir/Makefile.inc |
70 | 71 | /objdir/libcommon/Makefile |
71 | 72 | /objdir/libcommon/iswalnum.c |
72 | 73 | /objdir/libcommon/iswalnum.o |
74 | /objdir/libcommon/iswalnum.os | |
73 | 75 | /objdir/libcommon/libcommon.a |
74 | /objdir/libcommon/linkme.mk | |
76 | /objdir/libcommon/libcommon_pic.a | |
75 | 77 | /objdir/libcommon/str.c |
76 | 78 | /objdir/libcommon/str.o |
79 | /objdir/libcommon/str.os | |
77 | 80 | /objdir/libdz/Makefile |
78 | 81 | /objdir/libdz/dz.c |
79 | 82 | /objdir/libdz/dz.o |
83 | 86 | /objdir/libdz/libdz.so |
84 | 87 | /objdir/libdz/libdz.so.1 |
85 | 88 | /objdir/libdz/libdz.so.1.0 |
86 | /objdir/libdz/linkme.mk | |
87 | 89 | /objdir/libmaa/Makefile |
88 | 90 | /objdir/libmaa/export.sym |
89 | 91 | /objdir/libmaa/libmaa.a |
90 | 92 | /objdir/libmaa/libmaa.so |
91 | 93 | /objdir/libmaa/libmaa.so.1 |
92 | 94 | /objdir/libmaa/libmaa.so.1.2.0 |
93 | /objdir/libmaa/linkme.mk | |
94 | 95 | /objdir/libmaa/log.c |
95 | 96 | /objdir/libmaa/log.o |
96 | 97 | /objdir/libmaa/log.os |
101 | 102 | /objdir/libmaa/set.o |
102 | 103 | /objdir/libmaa/set.os |
103 | 104 | /objdir/test.mk |
105 | ========= INTERNALLIBS ========== | |
106 | installdirs ===> examples/hello_dictd/libmaa | |
107 | installdirs ===> examples/hello_dictd/dict | |
108 | installdirs ===> examples/hello_dictd/dictd | |
109 | installdirs ===> examples/hello_dictd/libdz | |
110 | installdirs ===> examples/hello_dictd/dictzip | |
111 | installdirs ===> examples/hello_dictd/dictfmt | |
112 | install ===> examples/hello_dictd/libmaa | |
113 | install ===> examples/hello_dictd/dict | |
114 | install ===> examples/hello_dictd/dictd | |
115 | install ===> examples/hello_dictd/libdz | |
116 | install ===> examples/hello_dictd/dictzip | |
117 | install ===> examples/hello_dictd/dictfmt | |
118 | uninstall ===> examples/hello_dictd/libmaa | |
119 | uninstall ===> examples/hello_dictd/dict | |
120 | uninstall ===> examples/hello_dictd/dictd | |
121 | uninstall ===> examples/hello_dictd/libdz | |
122 | uninstall ===> examples/hello_dictd/dictzip | |
123 | uninstall ===> examples/hello_dictd/dictfmt | |
104 | 124 | ========= installdirs ========== |
105 | 125 | /objdir/prefix |
106 | 126 | /objdir/prefix/bin |
168 | 188 | /objdir/libcommon/Makefile |
169 | 189 | /objdir/libcommon/iswalnum.c |
170 | 190 | /objdir/libcommon/iswalnum.o |
191 | /objdir/libcommon/iswalnum.os | |
171 | 192 | /objdir/libcommon/libcommon.a |
172 | /objdir/libcommon/linkme.mk | |
193 | /objdir/libcommon/libcommon_pic.a | |
173 | 194 | /objdir/libcommon/str.c |
174 | 195 | /objdir/libcommon/str.o |
196 | /objdir/libcommon/str.os | |
175 | 197 | /objdir/libdz/Makefile |
176 | 198 | /objdir/libdz/dz.c |
177 | 199 | /objdir/libdz/dz.o |
181 | 203 | /objdir/libdz/libdz.so |
182 | 204 | /objdir/libdz/libdz.so.1 |
183 | 205 | /objdir/libdz/libdz.so.1.0 |
184 | /objdir/libdz/linkme.mk | |
185 | 206 | /objdir/libmaa/Makefile |
186 | 207 | /objdir/libmaa/export.sym |
187 | 208 | /objdir/libmaa/libmaa.a |
188 | 209 | /objdir/libmaa/libmaa.so |
189 | 210 | /objdir/libmaa/libmaa.so.1 |
190 | 211 | /objdir/libmaa/libmaa.so.1.2.0 |
191 | /objdir/libmaa/linkme.mk | |
192 | 212 | /objdir/libmaa/log.c |
193 | 213 | /objdir/libmaa/log.o |
194 | 214 | /objdir/libmaa/log.os |
220 | 240 | /objdir/hello_dictd.test.out.tmp |
221 | 241 | /objdir/libcommon/Makefile |
222 | 242 | /objdir/libcommon/iswalnum.c |
223 | /objdir/libcommon/linkme.mk | |
224 | /objdir/libcommon/str.c | |
225 | /objdir/libdz/Makefile | |
226 | /objdir/libdz/dz.c | |
227 | /objdir/libdz/export.sym | |
228 | /objdir/libdz/linkme.mk | |
229 | /objdir/libmaa/Makefile | |
230 | /objdir/libmaa/export.sym | |
231 | /objdir/libmaa/linkme.mk | |
243 | /objdir/libcommon/str.c | |
244 | /objdir/libdz/Makefile | |
245 | /objdir/libdz/dz.c | |
246 | /objdir/libdz/export.sym | |
247 | /objdir/libmaa/Makefile | |
248 | /objdir/libmaa/export.sym | |
232 | 249 | /objdir/libmaa/log.c |
233 | 250 | /objdir/libmaa/prime.c |
234 | 251 | /objdir/libmaa/set.c |
254 | 271 | /objdir/hello_dictd.test.out.tmp |
255 | 272 | /objdir/libcommon/Makefile |
256 | 273 | /objdir/libcommon/iswalnum.c |
257 | /objdir/libcommon/linkme.mk | |
258 | /objdir/libcommon/str.c | |
259 | /objdir/libdz/Makefile | |
260 | /objdir/libdz/dz.c | |
261 | /objdir/libdz/export.sym | |
262 | /objdir/libdz/linkme.mk | |
263 | /objdir/libmaa/Makefile | |
264 | /objdir/libmaa/export.sym | |
265 | /objdir/libmaa/linkme.mk | |
274 | /objdir/libcommon/str.c | |
275 | /objdir/libdz/Makefile | |
276 | /objdir/libdz/dz.c | |
277 | /objdir/libdz/export.sym | |
278 | /objdir/libmaa/Makefile | |
279 | /objdir/libmaa/export.sym | |
266 | 280 | /objdir/libmaa/log.c |
267 | 281 | /objdir/libmaa/prime.c |
268 | 282 | /objdir/libmaa/set.c |
295 | 309 | /objdir/libcommon |
296 | 310 | /objdir/libcommon/Makefile |
297 | 311 | /objdir/libcommon/iswalnum.c |
298 | /objdir/libcommon/linkme.mk | |
299 | 312 | /objdir/libcommon/str.c |
300 | 313 | /objdir/libdz |
301 | 314 | /objdir/libdz/Makefile |
302 | 315 | /objdir/libdz/dz.c |
303 | 316 | /objdir/libdz/export.sym |
304 | /objdir/libdz/linkme.mk | |
305 | 317 | /objdir/libmaa |
306 | 318 | /objdir/libmaa/Makefile |
307 | 319 | /objdir/libmaa/export.sym |
308 | /objdir/libmaa/linkme.mk | |
309 | 320 | /objdir/libmaa/log.c |
310 | 321 | /objdir/libmaa/prime.c |
311 | 322 | /objdir/libmaa/set.c |
349 | 360 | /objdir/libcommon |
350 | 361 | /objdir/libcommon/Makefile |
351 | 362 | /objdir/libcommon/iswalnum.c |
352 | /objdir/libcommon/linkme.mk | |
353 | 363 | /objdir/libcommon/str.c |
354 | 364 | /objdir/libdz |
355 | 365 | /objdir/libdz/Makefile |
356 | 366 | /objdir/libdz/dz.c |
357 | 367 | /objdir/libdz/export.sym |
358 | /objdir/libdz/linkme.mk | |
359 | 368 | /objdir/libmaa |
360 | 369 | /objdir/libmaa/Makefile |
361 | 370 | /objdir/libmaa/export.sym |
362 | /objdir/libmaa/linkme.mk | |
363 | 371 | /objdir/libmaa/log.c |
364 | 372 | /objdir/libmaa/prime.c |
365 | 373 | /objdir/libmaa/set.c |
409 | 417 | /objdir/hello_dictd.test.out.tmp |
410 | 418 | /objdir/libcommon/Makefile |
411 | 419 | /objdir/libcommon/iswalnum.c |
412 | /objdir/libcommon/linkme.mk | |
413 | /objdir/libcommon/str.c | |
414 | /objdir/libdz/Makefile | |
415 | /objdir/libdz/dz.c | |
416 | /objdir/libdz/export.sym | |
417 | /objdir/libdz/linkme.mk | |
418 | /objdir/libmaa/Makefile | |
419 | /objdir/libmaa/export.sym | |
420 | /objdir/libmaa/linkme.mk | |
420 | /objdir/libcommon/str.c | |
421 | /objdir/libdz/Makefile | |
422 | /objdir/libdz/dz.c | |
423 | /objdir/libdz/export.sym | |
424 | /objdir/libmaa/Makefile | |
425 | /objdir/libmaa/export.sym | |
421 | 426 | /objdir/libmaa/log.c |
422 | 427 | /objdir/libmaa/prime.c |
423 | 428 | /objdir/libmaa/set.c |
451 | 456 | /objdir/libcommon/Makefile |
452 | 457 | /objdir/libcommon/iswalnum.c |
453 | 458 | /objdir/libcommon/iswalnum.o |
459 | /objdir/libcommon/iswalnum.os | |
454 | 460 | /objdir/libcommon/libcommon.a |
455 | /objdir/libcommon/linkme.mk | |
461 | /objdir/libcommon/libcommon_pic.a | |
456 | 462 | /objdir/libcommon/str.c |
457 | 463 | /objdir/libcommon/str.o |
458 | /objdir/libdz/Makefile | |
459 | /objdir/libdz/dz.c | |
460 | /objdir/libdz/export.sym | |
461 | /objdir/libdz/linkme.mk | |
464 | /objdir/libcommon/str.os | |
465 | /objdir/libdz/Makefile | |
466 | /objdir/libdz/dz.c | |
467 | /objdir/libdz/export.sym | |
462 | 468 | /objdir/libmaa/Makefile |
463 | 469 | /objdir/libmaa/export.sym |
464 | 470 | /objdir/libmaa/libmaa.a |
465 | 471 | /objdir/libmaa/libmaa.so |
466 | 472 | /objdir/libmaa/libmaa.so.1 |
467 | 473 | /objdir/libmaa/libmaa.so.1.2.0 |
468 | /objdir/libmaa/linkme.mk | |
469 | 474 | /objdir/libmaa/log.c |
470 | 475 | /objdir/libmaa/log.o |
471 | 476 | /objdir/libmaa/log.os |
505 | 510 | /objdir/libcommon/Makefile |
506 | 511 | /objdir/libcommon/iswalnum.c |
507 | 512 | /objdir/libcommon/iswalnum.o |
513 | /objdir/libcommon/iswalnum.os | |
508 | 514 | /objdir/libcommon/libcommon.a |
509 | /objdir/libcommon/linkme.mk | |
515 | /objdir/libcommon/libcommon_pic.a | |
510 | 516 | /objdir/libcommon/str.c |
511 | 517 | /objdir/libcommon/str.o |
512 | /objdir/libdz/Makefile | |
513 | /objdir/libdz/dz.c | |
514 | /objdir/libdz/export.sym | |
515 | /objdir/libdz/linkme.mk | |
518 | /objdir/libcommon/str.os | |
519 | /objdir/libdz/Makefile | |
520 | /objdir/libdz/dz.c | |
521 | /objdir/libdz/export.sym | |
516 | 522 | /objdir/libmaa/Makefile |
517 | 523 | /objdir/libmaa/export.sym |
518 | 524 | /objdir/libmaa/libmaa.a |
519 | 525 | /objdir/libmaa/libmaa.so |
520 | 526 | /objdir/libmaa/libmaa.so.1 |
521 | 527 | /objdir/libmaa/libmaa.so.1.2.0 |
522 | /objdir/libmaa/linkme.mk | |
523 | 528 | /objdir/libmaa/log.c |
524 | 529 | /objdir/libmaa/log.o |
525 | 530 | /objdir/libmaa/log.os |
591 | 596 | /objdir/hello_dictd.test.out.tmp |
592 | 597 | /objdir/libcommon/Makefile |
593 | 598 | /objdir/libcommon/iswalnum.c |
594 | /objdir/libcommon/linkme.mk | |
595 | /objdir/libcommon/str.c | |
596 | /objdir/libdz/Makefile | |
597 | /objdir/libdz/dz.c | |
598 | /objdir/libdz/export.sym | |
599 | /objdir/libdz/linkme.mk | |
600 | /objdir/libmaa/Makefile | |
601 | /objdir/libmaa/export.sym | |
602 | /objdir/libmaa/linkme.mk | |
599 | /objdir/libcommon/str.c | |
600 | /objdir/libdz/Makefile | |
601 | /objdir/libdz/dz.c | |
602 | /objdir/libdz/export.sym | |
603 | /objdir/libmaa/Makefile | |
604 | /objdir/libmaa/export.sym | |
603 | 605 | /objdir/libmaa/log.c |
604 | 606 | /objdir/libmaa/prime.c |
605 | 607 | /objdir/libmaa/set.c |
625 | 627 | /objdir/hello_dictd.test.out.tmp |
626 | 628 | /objdir/libcommon/Makefile |
627 | 629 | /objdir/libcommon/iswalnum.c |
628 | /objdir/libcommon/linkme.mk | |
629 | /objdir/libcommon/str.c | |
630 | /objdir/libdz/Makefile | |
631 | /objdir/libdz/dz.c | |
632 | /objdir/libdz/export.sym | |
633 | /objdir/libdz/linkme.mk | |
634 | /objdir/libmaa/Makefile | |
635 | /objdir/libmaa/export.sym | |
636 | /objdir/libmaa/linkme.mk | |
630 | /objdir/libcommon/str.c | |
631 | /objdir/libdz/Makefile | |
632 | /objdir/libdz/dz.c | |
633 | /objdir/libdz/export.sym | |
634 | /objdir/libmaa/Makefile | |
635 | /objdir/libmaa/export.sym | |
637 | 636 | /objdir/libmaa/log.c |
638 | 637 | /objdir/libmaa/prime.c |
639 | 638 | /objdir/libmaa/set.c |
682 | 681 | /objdir/libcommon/Makefile |
683 | 682 | /objdir/libcommon/iswalnum.c |
684 | 683 | /objdir/libcommon/iswalnum.o |
684 | /objdir/libcommon/iswalnum.os | |
685 | 685 | /objdir/libcommon/libcommon.a |
686 | /objdir/libcommon/linkme.mk | |
686 | /objdir/libcommon/libcommon_pic.a | |
687 | 687 | /objdir/libcommon/str.c |
688 | 688 | /objdir/libcommon/str.o |
689 | /objdir/libdz/Makefile | |
690 | /objdir/libdz/dz.c | |
691 | /objdir/libdz/export.sym | |
692 | /objdir/libdz/linkme.mk | |
689 | /objdir/libcommon/str.os | |
690 | /objdir/libdz/Makefile | |
691 | /objdir/libdz/dz.c | |
692 | /objdir/libdz/export.sym | |
693 | 693 | /objdir/libmaa/Makefile |
694 | 694 | /objdir/libmaa/export.sym |
695 | 695 | /objdir/libmaa/libmaa.a |
696 | 696 | /objdir/libmaa/libmaa.so |
697 | 697 | /objdir/libmaa/libmaa.so.1 |
698 | 698 | /objdir/libmaa/libmaa.so.1.2.0 |
699 | /objdir/libmaa/linkme.mk | |
699 | /objdir/libmaa/log.c | |
700 | /objdir/libmaa/log.o | |
701 | /objdir/libmaa/log.os | |
702 | /objdir/libmaa/prime.c | |
703 | /objdir/libmaa/prime.o | |
704 | /objdir/libmaa/prime.os | |
705 | /objdir/libmaa/set.c | |
706 | /objdir/libmaa/set.o | |
707 | /objdir/libmaa/set.os | |
708 | /objdir/test.mk | |
709 | =========== all with MKPIE=yes ============ | |
710 | /objdir/Makefile | |
711 | /objdir/Makefile.inc | |
712 | /objdir/_mkc_compiler_type.err | |
713 | /objdir/_mkc_compiler_type.res | |
714 | /objdir/_mkc_funclib_deflate.c | |
715 | /objdir/_mkc_funclib_deflate.err | |
716 | /objdir/_mkc_funclib_deflate.res | |
717 | /objdir/_mkc_funclib_deflate_z.c | |
718 | /objdir/_mkc_funclib_deflate_z.err | |
719 | /objdir/_mkc_funclib_deflate_z.res | |
720 | /objdir/_mkc_header_zlib_h.c | |
721 | /objdir/_mkc_header_zlib_h.err | |
722 | /objdir/_mkc_header_zlib_h.res | |
723 | /objdir/_mkc_prog_cc.err | |
724 | /objdir/_mkc_prog_cc.res | |
725 | /objdir/dict/Makefile | |
726 | /objdir/dict/dict | |
727 | /objdir/dict/dict.1 | |
728 | /objdir/dict/dict.c | |
729 | /objdir/dict/dict.cat1 | |
730 | /objdir/dict/dict.o | |
731 | /objdir/dictd/Makefile | |
732 | /objdir/dictd/dictd | |
733 | /objdir/dictd/dictd.8 | |
734 | /objdir/dictd/dictd.c | |
735 | /objdir/dictd/dictd.cat8 | |
736 | /objdir/dictd/dictd.o | |
737 | /objdir/dictfmt/Makefile | |
738 | /objdir/dictfmt/dictfmt | |
739 | /objdir/dictfmt/dictfmt.1 | |
740 | /objdir/dictfmt/dictfmt.c | |
741 | /objdir/dictfmt/dictfmt.cat1 | |
742 | /objdir/dictfmt/dictfmt.o | |
743 | /objdir/dictzip/Makefile | |
744 | /objdir/dictzip/dictzip | |
745 | /objdir/dictzip/dictzip.1 | |
746 | /objdir/dictzip/dictzip.c | |
747 | /objdir/dictzip/dictzip.cat1 | |
748 | /objdir/dictzip/dictzip.o | |
749 | /objdir/doc/Makefile | |
750 | /objdir/doc/doc.txt | |
751 | /objdir/expect.out | |
752 | /objdir/hello_dictd.test.out.tmp | |
753 | /objdir/libcommon/Makefile | |
754 | /objdir/libcommon/iswalnum.c | |
755 | /objdir/libcommon/iswalnum.o | |
756 | /objdir/libcommon/iswalnum.os | |
757 | /objdir/libcommon/libcommon.a | |
758 | /objdir/libcommon/libcommon_pic.a | |
759 | /objdir/libcommon/str.c | |
760 | /objdir/libcommon/str.o | |
761 | /objdir/libcommon/str.os | |
762 | /objdir/libdz/Makefile | |
763 | /objdir/libdz/dz.c | |
764 | /objdir/libdz/dz.o | |
765 | /objdir/libdz/dz.os | |
766 | /objdir/libdz/export.sym | |
767 | /objdir/libdz/libdz.a | |
768 | /objdir/libdz/libdz.so | |
769 | /objdir/libdz/libdz.so.1 | |
770 | /objdir/libdz/libdz.so.1.0 | |
771 | /objdir/libmaa/Makefile | |
772 | /objdir/libmaa/export.sym | |
773 | /objdir/libmaa/libmaa.a | |
774 | /objdir/libmaa/libmaa.so | |
775 | /objdir/libmaa/libmaa.so.1 | |
776 | /objdir/libmaa/libmaa.so.1.2.0 | |
777 | /objdir/libmaa/log.c | |
778 | /objdir/libmaa/log.o | |
779 | /objdir/libmaa/log.os | |
780 | /objdir/libmaa/prime.c | |
781 | /objdir/libmaa/prime.o | |
782 | /objdir/libmaa/prime.os | |
783 | /objdir/libmaa/set.c | |
784 | /objdir/libmaa/set.o | |
785 | /objdir/libmaa/set.os | |
786 | /objdir/test.mk | |
787 | =========== all with STATICLIBS=everything... ============ | |
788 | /objdir/Makefile | |
789 | /objdir/Makefile.inc | |
790 | /objdir/_mkc_compiler_type.err | |
791 | /objdir/_mkc_compiler_type.res | |
792 | /objdir/_mkc_funclib_deflate.c | |
793 | /objdir/_mkc_funclib_deflate.err | |
794 | /objdir/_mkc_funclib_deflate.res | |
795 | /objdir/_mkc_funclib_deflate_z.c | |
796 | /objdir/_mkc_funclib_deflate_z.err | |
797 | /objdir/_mkc_funclib_deflate_z.res | |
798 | /objdir/_mkc_header_zlib_h.c | |
799 | /objdir/_mkc_header_zlib_h.err | |
800 | /objdir/_mkc_header_zlib_h.res | |
801 | /objdir/_mkc_prog_cc.err | |
802 | /objdir/_mkc_prog_cc.res | |
803 | /objdir/dict/Makefile | |
804 | /objdir/dict/dict | |
805 | /objdir/dict/dict.1 | |
806 | /objdir/dict/dict.c | |
807 | /objdir/dict/dict.cat1 | |
808 | /objdir/dict/dict.o | |
809 | /objdir/dictd/Makefile | |
810 | /objdir/dictd/dictd | |
811 | /objdir/dictd/dictd.8 | |
812 | /objdir/dictd/dictd.c | |
813 | /objdir/dictd/dictd.cat8 | |
814 | /objdir/dictd/dictd.o | |
815 | /objdir/dictfmt/Makefile | |
816 | /objdir/dictfmt/dictfmt | |
817 | /objdir/dictfmt/dictfmt.1 | |
818 | /objdir/dictfmt/dictfmt.c | |
819 | /objdir/dictfmt/dictfmt.cat1 | |
820 | /objdir/dictfmt/dictfmt.o | |
821 | /objdir/dictzip/Makefile | |
822 | /objdir/dictzip/dictzip | |
823 | /objdir/dictzip/dictzip.1 | |
824 | /objdir/dictzip/dictzip.c | |
825 | /objdir/dictzip/dictzip.cat1 | |
826 | /objdir/dictzip/dictzip.o | |
827 | /objdir/doc/Makefile | |
828 | /objdir/doc/doc.txt | |
829 | /objdir/expect.out | |
830 | /objdir/hello_dictd.test.out.tmp | |
831 | /objdir/libcommon/Makefile | |
832 | /objdir/libcommon/iswalnum.c | |
833 | /objdir/libcommon/iswalnum.o | |
834 | /objdir/libcommon/iswalnum.os | |
835 | /objdir/libcommon/libcommon.a | |
836 | /objdir/libcommon/libcommon_pic.a | |
837 | /objdir/libcommon/str.c | |
838 | /objdir/libcommon/str.o | |
839 | /objdir/libcommon/str.os | |
840 | /objdir/libdz/Makefile | |
841 | /objdir/libdz/dz.c | |
842 | /objdir/libdz/dz.o | |
843 | /objdir/libdz/dz.os | |
844 | /objdir/libdz/export.sym | |
845 | /objdir/libdz/libdz.a | |
846 | /objdir/libdz/libdz_pic.a | |
847 | /objdir/libmaa/Makefile | |
848 | /objdir/libmaa/export.sym | |
849 | /objdir/libmaa/libmaa.a | |
850 | /objdir/libmaa/libmaa_pic.a | |
700 | 851 | /objdir/libmaa/log.c |
701 | 852 | /objdir/libmaa/log.o |
702 | 853 | /objdir/libmaa/log.os |
0 | PATH.common := ${.PARSEDIR} | |
1 | ||
2 | CPPFLAGS += -I${PATH.common} | |
3 | DPLIBDIRS += ${PATH.common} | |
4 | LDADD0 += -lcommon |
4 | 4 | return 3; |
5 | 5 | } |
6 | 6 | |
7 | /* fake must not be exported */ | |
8 | int fake2 (void); | |
7 | /* fake22 must not be exported */ | |
8 | int fake22 (void); | |
9 | 9 | |
10 | int fake2 (void) | |
10 | int fake22 (void) | |
11 | 11 | { |
12 | return 2; | |
12 | return 22; | |
13 | 13 | } |
0 | PATH.maa := ${.PARSEDIR} | |
1 | ||
2 | CPPFLAGS += -I${PATH.maa} | |
3 | DPLIBDIRS += ${PATH.maa} | |
4 | LDADD0 += -lmaa |
0 | 0 | next_level != expr ${.MAKE.LEVEL} + 1 |
1 | ||
2 | run_nm := env NM=${NM:Q} OPSYS=${OPSTS:Q} mkc_test_nm | |
1 | 3 | |
2 | 4 | .PHONY : test_output |
3 | 5 | test_output : |
8 | 10 | rm -rf ${.OBJDIR}${PREFIX}; \ |
9 | 11 | LD_LIBRARY_PATH=${.CURDIR}/libdz:${.CURDIR}/libmaa:$$LD_LIBRARY_PATH; \ |
10 | 12 | DYLD_LIBRARY_PATH=${.CURDIR}/libdz:${.CURDIR}/libmaa:$$LD_LIBRARY_PATH; \ |
11 | export LD_LIBRARY_PATH DYLD_LIBRARY_PATH; \ | |
13 | LIBRARY_PATH=$$LIBRARY_PATH:$$LD_LIBRARY_PATH; \ | |
14 | export LD_LIBRARY_PATH DYLD_LIBRARY_PATH LIBRARY_PATH; \ | |
12 | 15 | ${.CURDIR}/dict/dict; \ |
13 | 16 | ${.CURDIR}/dictd/dictd; \ |
14 | 17 | ${.CURDIR}/dictfmt/dictfmt; \ |
16 | 19 | \ |
17 | 20 | echo =========== nm ============; \ |
18 | 21 | case ${OPSYS} in \ |
19 | OpenBSD) \ | |
20 | ${NM} ${.CURDIR}/libmaa/libmaa*.so | awk '$$2=="T" {print "libmaa " $$3}'; \ | |
21 | ${NM} ${.CURDIR}/libdz/libdz*.so | awk '$$2=="T" {print "libdz " $$3}';; \ | |
22 | *BSD|SunOS|DragonFly) \ | |
23 | ${NM} -P ${.CURDIR}/libmaa/libmaa*.so | awk 'NF==4 && $$2=="T" {print "libmaa " $$1}'; \ | |
24 | ${NM} -P ${.CURDIR}/libdz/libdz*.so | awk 'NF==4 && $$2=="T" {print "libdz " $$1}';; \ | |
25 | Linux) \ | |
26 | ${NM} -P ${.CURDIR}/libmaa/libmaa*.so | awk 'NF==4 && $$2 ~ /^[DT]$$/ {print "libmaa " $$1}'; \ | |
27 | ${NM} -P ${.CURDIR}/libdz/libdz*.so | awk 'NF==4 && $$2 ~ /^[DT]$$/ {print "libdz " $$1}';; \ | |
22 | *BSD|DragonFly|SunOS|Linux) \ | |
23 | ${run_nm} ${OBJDIR_libmaa}/libmaa*.so; \ | |
24 | echo =; \ | |
25 | ${run_nm} ${OBJDIR_libdz}/libdz*.so;; \ | |
28 | 26 | *) \ |
29 | printf 'libmaa fake4\nlibmaa fake5\nlibmaa fake6\nlibdz fake3\n';; \ | |
27 | printf 'symbol fake4\nsymbol fake5\nsymbol fake6\n=\nsymbol fake3\n';; \ | |
30 | 28 | esac; \ |
31 | 29 | \ |
32 | 30 | echo =========== all ============; \ |
34 | 32 | find ${.OBJDIR} -type f -o -type l | \ |
35 | 33 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ |
36 | 34 | \ |
35 | echo ========= INTERNALLIBS ==========; \ | |
36 | { ${MAKE} ${MAKEFLAGS} installdirs DESTDIR=${.OBJDIR}; \ | |
37 | ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR}; \ | |
38 | ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR}; } 2>&1 | awk '/^(un)?install/'; \ | |
39 | rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/home ${.OBJDIR}/Users; \ | |
37 | 40 | echo ========= installdirs ==========; \ |
38 | 41 | ${MAKE} ${MAKEFLAGS} installdirs DESTDIR=${.OBJDIR} > /dev/null; \ |
39 | 42 | find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \ |
63 | 66 | ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \ |
64 | 67 | find ${.OBJDIR} -type f -o -type l | \ |
65 | 68 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ |
66 | rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/home; \ | |
69 | rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/home ${.OBJDIR}/Users; \ | |
67 | 70 | echo =========== MKOBJDIRS=auto ============; \ |
68 | 71 | env TARGETS=fake ${MAKE} ${MAKEFLAGS} fake \ |
69 | 72 | MKCHECKS=no MAKEOBJDIRPREFIX=${.OBJDIR}/obj1 > /dev/null; \ |
167 | 170 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ |
168 | 171 | unset NOSUBDIR; \ |
169 | 172 | \ |
173 | echo =========== all with MKPIE=yes ============; \ | |
174 | ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \ | |
175 | ${MAKE} ${MAKEFLAGS} -j4 all MKPIE=yes > /dev/null; \ | |
176 | find ${.OBJDIR} -type f -o -type l | \ | |
177 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ | |
178 | \ | |
179 | echo =========== all with STATICLIBS=everything... ============; \ | |
180 | ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \ | |
181 | env STATICLIBS='libmaa libdz' ${MAKE} ${MAKEFLAGS} -j4 all > /dev/null; \ | |
182 | find ${.OBJDIR} -type f -o -type l | \ | |
183 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ | |
184 | \ | |
170 | 185 | echo =========== print_deps ============; \ |
171 | 186 | ${MAKE} ${MAKEFLAGS} print_deps | grep -E '^(all|test)'; \ |
172 | 187 | echo =====; \ |
0 | PROG = hello | |
1 | ||
2 | WARNS = 4 | |
3 | ||
4 | MKC_FEATURES = err warn | |
5 | ||
6 | MKC_REQD = 0.26.0 | |
7 | ||
8 | .include "test.mk" | |
9 | .include <mkc.mk> |
0 | ======= ex ========== | |
1 | hello: warnx test1: Cannot allocate memory | |
2 | hello: errx test1: Cannot allocate memory | |
3 | $?=21 | |
4 | hello: warnx test2, six=6: Cannot allocate memory | |
5 | hello: errx test2, six=6: Cannot allocate memory | |
6 | $?=22 | |
7 | errx(3): invalid argv | |
8 | $?=94 | |
9 | hello: warn test1 | |
10 | hello: err test1 | |
11 | $?=11 | |
12 | hello: warn test2, five=5 | |
13 | hello: err test2, five=5 | |
14 | $?=12 | |
15 | err(3): invalid argv | |
16 | $?=93 | |
17 | ======= CLEANFILES ========== | |
18 | hello.o | |
19 | progname.o | |
20 | err.o | |
21 | warn.o | |
22 | ======= cleandir ========== |
0 | #include <errno.h> | |
1 | #include <string.h> | |
2 | #include <stdio.h> | |
3 | ||
4 | #include <mkc_err.h> | |
5 | #include <mkc_warn.h> | |
6 | ||
7 | int main (int argc, char ** argv) | |
8 | { | |
9 | --argc; | |
10 | ++argv; | |
11 | ||
12 | if (argc != 2) | |
13 | return (90); | |
14 | ||
15 | if (!strcmp (argv [0], "errx")){ | |
16 | switch (argv [1][0]){ | |
17 | case '1': | |
18 | warnx ("warn test1"); | |
19 | errx (11, "err test1"); | |
20 | break; | |
21 | case '2': | |
22 | warnx ("warn test2, five=%d", 5); | |
23 | errx (12, "err test2, five=%d", 5); | |
24 | break; | |
25 | default: | |
26 | fprintf (stderr, "err(3): invalid argv\n"); | |
27 | return 93; | |
28 | } | |
29 | }else if (!strcmp (argv [0], "err")){ | |
30 | switch (argv [1][0]){ | |
31 | case '1': | |
32 | errno = ENOMEM; | |
33 | warn ("warnx test1"); | |
34 | errno = ENOMEM; | |
35 | err (21, "errx test1"); | |
36 | break; | |
37 | case '2': | |
38 | errno = ENOMEM; | |
39 | warn ("warnx test2, six=%d", 6); | |
40 | errno = ENOMEM; | |
41 | err (22, "errx test2, six=%d", 6); | |
42 | break; | |
43 | default: | |
44 | fprintf (stderr, "errx(3): invalid argv\n"); | |
45 | return 94; | |
46 | } | |
47 | }else{ | |
48 | fprintf (stderr, "bad err id '%s'\n", argv [0]); | |
49 | return (91); | |
50 | } | |
51 | ||
52 | return 0; | |
53 | } |
0 | SUBST_CMD=sed -e 's,Not enough space,Cannot allocate memory,' | |
1 | ||
2 | .PHONY : test_output | |
3 | test_output: | |
4 | @\ | |
5 | echo ======= ex ==========; \ | |
6 | { ${.OBJDIR}/hello err 1 2>&1 >/dev/null; echo '$$?='$$?; } | ${SUBST_CMD}; \ | |
7 | { ${.OBJDIR}/hello err 2 2>&1 >/dev/null; echo '$$?='$$?; } | ${SUBST_CMD}; \ | |
8 | { ${.OBJDIR}/hello err 3 2>&1 >/dev/null; echo '$$?='$$?; } | ${SUBST_CMD}; \ | |
9 | ${.OBJDIR}/hello errx 1 2>&1 >/dev/null; echo '$$?='$$?; \ | |
10 | ${.OBJDIR}/hello errx 2 2>&1 >/dev/null; echo '$$?='$$?; \ | |
11 | ${.OBJDIR}/hello errx 3 2>&1 >/dev/null; echo '$$?='$$?; \ | |
12 | echo ======= CLEANFILES ==========; \ | |
13 | ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \ | |
14 | awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}'; \ | |
15 | echo ======= cleandir ==========; \ | |
16 | ${MAKE} ${MAKEFLAGS} cleandir > /dev/null | |
17 | ||
18 | .include <mkc.minitest.mk> |
0 | MKC_FEATURES = fgetln err | |
1 | ||
2 | PROG = hello | |
3 | ||
4 | WARNS = 4 | |
5 | ||
6 | MKC_REQD = 0.26.0 | |
7 | ||
8 | .include "test.mk" | |
9 | .include <mkc.prog.mk> |
0 | # Copyright (c) 2009, Aleksey Cheusov <vle@gmx.net> | |
1 | # All rights reserved. | |
2 | # | |
3 | # Redistribution and use in source and binary forms, with or without | |
4 | # modification, are permitted provided that the following conditions | |
5 | # are met: | |
6 | # 1. Redistributions of source code must retain the above copyright | |
7 | # notice, this list of conditions and the following disclaimer. | |
8 | # 2. Redistributions in binary form must reproduce the above copyright | |
9 | # notice, this list of conditions and the following disclaimer in the | |
10 | # documentation and/or other materials provided with the distribution. | |
11 | # | |
12 | # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
13 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
14 | # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
15 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
16 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
17 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
18 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
19 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
20 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
21 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
22 | # POSSIBILITY OF SUCH DAMAGE. | |
23 | =========== all ============ | |
24 | /objdir/Makefile | |
25 | /objdir/_mkc_compiler_type.err | |
26 | /objdir/_mkc_compiler_type.res | |
27 | /objdir/_mkc_func0_getexecname_stdlib_h.c | |
28 | /objdir/_mkc_func0_getexecname_stdlib_h.err | |
29 | /objdir/_mkc_func0_getexecname_stdlib_h.res | |
30 | /objdir/_mkc_func0_getprogname_stdlib_h.c | |
31 | /objdir/_mkc_func0_getprogname_stdlib_h.err | |
32 | /objdir/_mkc_func0_getprogname_stdlib_h.res | |
33 | /objdir/_mkc_func1_setprogname_stdlib_h.c | |
34 | /objdir/_mkc_func1_setprogname_stdlib_h.err | |
35 | /objdir/_mkc_func1_setprogname_stdlib_h.res | |
36 | /objdir/_mkc_func3_err_err_h.c | |
37 | /objdir/_mkc_func3_err_err_h.err | |
38 | /objdir/_mkc_func3_err_err_h.res | |
39 | /objdir/_mkc_func3_errx_err_h.c | |
40 | /objdir/_mkc_func3_errx_err_h.err | |
41 | /objdir/_mkc_func3_errx_err_h.res | |
42 | /objdir/_mkc_func3_fgetln_stdio_h.c | |
43 | /objdir/_mkc_func3_fgetln_stdio_h.err | |
44 | /objdir/_mkc_func3_fgetln_stdio_h.res | |
45 | /objdir/_mkc_func3_getline_stdio_h.c | |
46 | /objdir/_mkc_func3_getline_stdio_h.err | |
47 | /objdir/_mkc_func3_getline_stdio_h.res | |
48 | /objdir/_mkc_func3_verr_err_h.c | |
49 | /objdir/_mkc_func3_verr_err_h.err | |
50 | /objdir/_mkc_func3_verr_err_h.res | |
51 | /objdir/_mkc_func3_verrx_err_h.c | |
52 | /objdir/_mkc_func3_verrx_err_h.err | |
53 | /objdir/_mkc_func3_verrx_err_h.res | |
54 | /objdir/_mkc_funclib_err.c | |
55 | /objdir/_mkc_funclib_err.err | |
56 | /objdir/_mkc_funclib_err.res | |
57 | /objdir/_mkc_funclib_errx.c | |
58 | /objdir/_mkc_funclib_errx.err | |
59 | /objdir/_mkc_funclib_errx.res | |
60 | /objdir/_mkc_funclib_fgetln.c | |
61 | /objdir/_mkc_funclib_fgetln.err | |
62 | /objdir/_mkc_funclib_fgetln.res | |
63 | /objdir/_mkc_funclib_getline.c | |
64 | /objdir/_mkc_funclib_getline.err | |
65 | /objdir/_mkc_funclib_getline.res | |
66 | /objdir/_mkc_funclib_getprogname.c | |
67 | /objdir/_mkc_funclib_getprogname.err | |
68 | /objdir/_mkc_funclib_getprogname.res | |
69 | /objdir/_mkc_funclib_setprogname.c | |
70 | /objdir/_mkc_funclib_setprogname.err | |
71 | /objdir/_mkc_funclib_setprogname.res | |
72 | /objdir/_mkc_funclib_verr.c | |
73 | /objdir/_mkc_funclib_verr.err | |
74 | /objdir/_mkc_funclib_verr.res | |
75 | /objdir/_mkc_funclib_verrx.c | |
76 | /objdir/_mkc_funclib_verrx.err | |
77 | /objdir/_mkc_funclib_verrx.res | |
78 | /objdir/_mkc_header_err_h.c | |
79 | /objdir/_mkc_header_err_h.err | |
80 | /objdir/_mkc_header_err_h.res | |
81 | /objdir/_mkc_prog_cc.err | |
82 | /objdir/_mkc_prog_cc.res | |
83 | /objdir/_mkc_variable_program_invocation_short_name_errno_h.c | |
84 | /objdir/_mkc_variable_program_invocation_short_name_errno_h.err | |
85 | /objdir/_mkc_variable_program_invocation_short_name_errno_h.res | |
86 | /objdir/expect.out | |
87 | /objdir/hello | |
88 | /objdir/hello.c | |
89 | /objdir/hello.o | |
90 | /objdir/hello_fgetln.test.out.tmp | |
91 | /objdir/test.mk | |
92 | ======= CLEANFILES ========== | |
93 | hello.o | |
94 | getline.o | |
95 | fgetln.o | |
96 | progname.o | |
97 | err.o | |
98 | ======= cleandir ========== |
0 | #include <stdio.h> | |
1 | #include <string.h> | |
2 | #include <stdlib.h> | |
3 | ||
4 | #include <mkc_fgetln.h> | |
5 | #include <mkc_err.h> | |
6 | ||
7 | int main (int argc, char ** argv) | |
8 | { | |
9 | char *buf, *lbuf; | |
10 | size_t len; | |
11 | ||
12 | while ((lbuf = buf = fgetln (stdin, &len)) != NULL) { | |
13 | if (len > 0 && buf [len - 1] == '\n') | |
14 | buf[len - 1] = '\0'; | |
15 | else if ((lbuf = strndup (buf, len + 1)) == NULL) | |
16 | err (1, NULL); | |
17 | printf ("%s\n", lbuf); | |
18 | ||
19 | if (lbuf != buf) | |
20 | free (lbuf); | |
21 | } | |
22 | return 0; | |
23 | } |
0 | FUNCS_RE=(fgetln|getline|err|progname)[.]o | |
1 | ||
2 | .PHONY : test_output | |
3 | test_output: | |
4 | @set -e; \ | |
5 | ${.OBJDIR}/hello < ${.CURDIR}/../hello_strlcpy2/input.in; \ | |
6 | rm -rf ${.OBJDIR}${PREFIX}; \ | |
7 | \ | |
8 | echo =========== all ============; \ | |
9 | find ${.OBJDIR} -type f | grep -Ev '${FUNCS_RE}' | \ | |
10 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ | |
11 | \ | |
12 | echo ======= CLEANFILES ==========; \ | |
13 | ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \ | |
14 | awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}'; \ | |
15 | echo ======= cleandir ==========; \ | |
16 | ${MAKE} ${MAKEFLAGS} cleandir > /dev/null | |
17 | ||
18 | .include <mkc.minitest.mk> |
0 | =========== vars ============ | |
1 | CLEANFILES=/path/to/hello_files.test.out pod2htmd.tmp pod2htmi.tmp shell_func.cat7 shell_func.html7 shell_func.info | |
2 | DISTCLEANFILES=/path/to/_mkc_* | |
0 | 3 | =========== all ============ |
1 | 4 | /objdir/DEBIAN/control |
2 | 5 | /objdir/Makefile |
0 | =========== vars ============ | |
1 | CLEANFILES=/path/to/hello_files.test.out pod2htmd.tmp pod2htmi.tmp shell_func.cat7 shell_func.html7 shell_func.info | |
2 | DISTCLEANFILES=/path/to/_mkc_* | |
0 | 3 | =========== all ============ |
1 | 4 | /objdir/DEBIAN/control |
2 | 5 | /objdir/Makefile |
3 | 3 | MKCATPAGES=yes; export MKCATPAGES; \ |
4 | 4 | rm -rf ${.OBJDIR}${PREFIX}; \ |
5 | 5 | \ |
6 | echo =========== vars ============; \ | |
7 | echo CLEANFILES=${CLEANFILES:Q} | \ | |
8 | mkc_test_helper_paths; \ | |
9 | echo DISTCLEANFILES=${DISTCLEANFILES:Q} | \ | |
10 | mkc_test_helper_paths; \ | |
6 | 11 | echo =========== all ============; \ |
7 | 12 | ${MAKE} ${MAKEFLAGS} -j4 all > /dev/null; \ |
8 | 13 | find ${.OBJDIR} -type f -o -type l | \ |
0 | LIBDEPS += libs/libfoo:libs/libfooqux | |
1 | LIBDEPS += libs/libbar:progs/fooquxfoobar | |
2 | LIBDEPS += libs/libfooqux:progs/fooquxfoobar | |
3 | LIBDEPS += libs/libfoo:progs/foobaz libs/libbaz:progs/foobaz | |
4 | ||
5 | .include "test.mk" | |
6 | .include <mkc.mk> |
0 | =========== fooquxfoobar ============ | |
1 | I am foo | |
2 | and qux | |
3 | I am foo | |
4 | I am bar | |
5 | =========== foobaz ============ | |
6 | I am foo | |
7 | I am baz | |
8 | =========== depends ============ | |
9 | bar.o bar.o bar.o: bar.c bar.h | |
10 | baz.o baz.o baz.o: baz.c include/baz.h | |
11 | foo.o foo.o foo.o: foo.c foo.h | |
12 | foobaz.o foobaz.o foobaz.o: foobaz.c /objdir/libs/libfoo/foo.h /objdir/libs/libbaz/include/baz.h | |
13 | fooqux.o fooqux.o fooqux.o: fooqux.c fooqux.h /objdir/libs/libfoo/foo.h | |
14 | fooquxfoobar.o fooquxfoobar.o fooquxfoobar.o: fooquxfoobar.c /objdir/libs/libfooqux/fooqux.h /objdir/libs/libfoo/foo.h /objdir/libs/libbar/bar.h | |
15 | ======= install ========== | |
16 | /objdir/prefix/bin/foobaz | |
17 | /objdir/prefix/bin/fooquxfoobar | |
18 | /objdir/prefix/include/bar.h | |
19 | /objdir/prefix/include/baz.h | |
20 | /objdir/prefix/include/foo.h | |
21 | /objdir/prefix/include/fooqux.h | |
22 | /objdir/prefix/lib/libbar.a | |
23 | /objdir/prefix/lib/libbar.so | |
24 | /objdir/prefix/lib/libbar.so.0 | |
25 | /objdir/prefix/lib/libbar.so.0.0 | |
26 | /objdir/prefix/lib/libbazbaz.a | |
27 | /objdir/prefix/lib/libfoo.a | |
28 | /objdir/prefix/lib/libfoo.so | |
29 | /objdir/prefix/lib/libfoo.so.0 | |
30 | /objdir/prefix/lib/libfoo.so.0.0 | |
31 | /objdir/prefix/lib/libfooqux.a | |
32 | /objdir/prefix/lib/libfooqux.so | |
33 | /objdir/prefix/lib/libfooqux.so.0 | |
34 | /objdir/prefix/lib/libfooqux.so.0.0 | |
35 | =========== all with STATICLIBS=... ============ | |
36 | /objdir/Makefile | |
37 | /objdir/_mkc_compiler_type.err | |
38 | /objdir/_mkc_compiler_type.res | |
39 | /objdir/_mkc_prog_cc.err | |
40 | /objdir/_mkc_prog_cc.res | |
41 | /objdir/expect.out | |
42 | /objdir/hello_libdeps.test.out.tmp | |
43 | /objdir/libs/libbar/Makefile | |
44 | /objdir/libs/libbar/bar.c | |
45 | /objdir/libs/libbar/bar.h | |
46 | /objdir/libs/libbar/bar.o | |
47 | /objdir/libs/libbar/bar.os | |
48 | /objdir/libs/libbar/libbar.a | |
49 | /objdir/libs/libbar/libbar_pic.a | |
50 | /objdir/libs/libbaz/Makefile | |
51 | /objdir/libs/libbaz/baz.c | |
52 | /objdir/libs/libbaz/baz.o | |
53 | /objdir/libs/libbaz/include/baz.h | |
54 | /objdir/libs/libbaz/libbazbaz.a | |
55 | /objdir/libs/libbaz/linkme.mk | |
56 | /objdir/libs/libfoo/Makefile | |
57 | /objdir/libs/libfoo/foo.c | |
58 | /objdir/libs/libfoo/foo.h | |
59 | /objdir/libs/libfoo/foo.o | |
60 | /objdir/libs/libfoo/foo.os | |
61 | /objdir/libs/libfoo/libfoo.a | |
62 | /objdir/libs/libfoo/libfoo_pic.a | |
63 | /objdir/libs/libfoo/linkme.mk | |
64 | /objdir/libs/libfooqux/Makefile | |
65 | /objdir/libs/libfooqux/fooqux.c | |
66 | /objdir/libs/libfooqux/fooqux.h | |
67 | /objdir/libs/libfooqux/fooqux.o | |
68 | /objdir/libs/libfooqux/fooqux.os | |
69 | /objdir/libs/libfooqux/libfooqux.a | |
70 | /objdir/libs/libfooqux/libfooqux.so | |
71 | /objdir/libs/libfooqux/libfooqux.so.0 | |
72 | /objdir/libs/libfooqux/libfooqux.so.0.0 | |
73 | /objdir/progs/foobaz/Makefile | |
74 | /objdir/progs/foobaz/foobaz | |
75 | /objdir/progs/foobaz/foobaz.c | |
76 | /objdir/progs/foobaz/foobaz.o | |
77 | /objdir/progs/fooquxfoobar/Makefile | |
78 | /objdir/progs/fooquxfoobar/fooquxfoobar | |
79 | /objdir/progs/fooquxfoobar/fooquxfoobar.c | |
80 | /objdir/progs/fooquxfoobar/fooquxfoobar.o | |
81 | /objdir/test.mk | |
82 | ========= install with STATICLIBS=... ========== | |
83 | /objdir/prefix | |
84 | /objdir/prefix/bin | |
85 | /objdir/prefix/bin/foobaz | |
86 | /objdir/prefix/bin/fooquxfoobar | |
87 | /objdir/prefix/include | |
88 | /objdir/prefix/include/bar.h | |
89 | /objdir/prefix/include/baz.h | |
90 | /objdir/prefix/include/foo.h | |
91 | /objdir/prefix/include/fooqux.h | |
92 | /objdir/prefix/lib | |
93 | /objdir/prefix/lib/libbar.a | |
94 | /objdir/prefix/lib/libbar_pic.a | |
95 | /objdir/prefix/lib/libbazbaz.a | |
96 | /objdir/prefix/lib/libfoo.a | |
97 | /objdir/prefix/lib/libfoo_pic.a | |
98 | /objdir/prefix/lib/libfooqux.a | |
99 | /objdir/prefix/lib/libfooqux.so | |
100 | /objdir/prefix/lib/libfooqux.so.0 | |
101 | /objdir/prefix/lib/libfooqux.so.0.0 | |
102 | symbol foo | |
103 | symbol fooqux | |
104 | ======= distclean ========== | |
105 | /objdir/Makefile | |
106 | /objdir/expect.out | |
107 | /objdir/hello_libdeps.test.out.tmp | |
108 | /objdir/libs/libbar/Makefile | |
109 | /objdir/libs/libbar/bar.c | |
110 | /objdir/libs/libbar/bar.h | |
111 | /objdir/libs/libbaz/Makefile | |
112 | /objdir/libs/libbaz/baz.c | |
113 | /objdir/libs/libbaz/include/baz.h | |
114 | /objdir/libs/libbaz/linkme.mk | |
115 | /objdir/libs/libfoo/Makefile | |
116 | /objdir/libs/libfoo/foo.c | |
117 | /objdir/libs/libfoo/foo.h | |
118 | /objdir/libs/libfoo/linkme.mk | |
119 | /objdir/libs/libfooqux/Makefile | |
120 | /objdir/libs/libfooqux/fooqux.c | |
121 | /objdir/libs/libfooqux/fooqux.h | |
122 | /objdir/progs/foobaz/Makefile | |
123 | /objdir/progs/foobaz/foobaz.c | |
124 | /objdir/progs/fooquxfoobar/Makefile | |
125 | /objdir/progs/fooquxfoobar/fooquxfoobar.c | |
126 | /objdir/test.mk |
0 | LIB = bar | |
1 | INCS = bar.h | |
2 | ||
3 | SHLIB_MAJOR = 0 | |
4 | SHLIB_MINOR = 0 | |
5 | ||
6 | WARNS = 4 | |
7 | ||
8 | .include <mkc.mk> |
0 | LIB = bazbaz # LIB name is not equal to ${.CURDIR:T}! | |
1 | SRCS = baz.c | |
2 | INCS = baz.h | |
3 | INCSSRCDIR = include | |
4 | ||
5 | CPPFLAGS += ${INCSSRCDIR} | |
6 | ||
7 | WARNS = 4 | |
8 | ||
9 | .include <mkc.mk> |
0 | PATH.baz := ${.PARSEDIR:tA} | |
1 | ||
2 | DPINCDIRS += ${PATH.baz}/include # non-default dir for headers | |
3 | DPLIBDIRS += ${OBJDIR_libs_libbaz} | |
4 | DPLDADD += bazbaz # non-default library name |
0 | LIB = foo | |
1 | INCS = foo.h | |
2 | ||
3 | SHLIB_MAJOR = 0 | |
4 | SHLIB_MINOR = 0 | |
5 | ||
6 | WARNS = 4 | |
7 | ||
8 | .include <mkc.mk> |
0 | # empty linkme.mk is useless, this is a part of regression tests |
0 | LIB = fooqux | |
1 | INCS = fooqux.h | |
2 | ||
3 | SHLIB_MAJOR = 0 | |
4 | SHLIB_MINOR = 0 | |
5 | ||
6 | WARNS = 4 | |
7 | ||
8 | .include <mkc.mk> |
0 | #include "fooqux.h" | |
1 | ||
2 | #include <stdio.h> | |
3 | ||
4 | void fooqux (void) | |
5 | { | |
6 | foo (); | |
7 | puts (" and qux"); | |
8 | } |
0 | #ifndef _FOOQUX_H_ | |
1 | #define _FOOQUX_H_ | |
2 | ||
3 | #include "foo.h" | |
4 | ||
5 | void fooqux (void); | |
6 | ||
7 | #endif // _FOOQUX_H_ |
0 | #include "foo.h" | |
1 | #include "baz.h" | |
2 | ||
3 | #include <stdio.h> | |
4 | ||
5 | int main (int argc, char **argv) | |
6 | { | |
7 | foo (); | |
8 | baz (); | |
9 | return 0; | |
10 | } |
0 | #include "fooqux.h" | |
1 | #include "bar.h" | |
2 | ||
3 | #include <stdio.h> | |
4 | ||
5 | int main (int argc, char **argv) | |
6 | { | |
7 | fooqux (); | |
8 | foo (); | |
9 | bar (); | |
10 | return 0; | |
11 | } |
0 | run_nm := env NM=${NM:Q} OPSYS=${OPSTS:Q} mkc_test_nm | |
1 | ||
2 | .PHONY : test_output | |
3 | test_output: | |
4 | @set -e; LC_ALL=C; export LC_ALL; \ | |
5 | LD_LIBRARY_PATH=${OBJDIR_libs_libfoo}:${OBJDIR_libs_libfooqux}:${OBJDIR_libs_libbar}:${OBJDIR_libs_libbaz}; \ | |
6 | DYLD_LIBRARY_PATH=$$LD_LIBRARY_PATH; \ | |
7 | LIBRARY_PATH=$$LIBRARY_PATH:$$LD_LIBRARY_PATH; \ | |
8 | export LD_LIBRARY_PATH DYLD_LIBRARY_PATH LIBRARY_PATH; \ | |
9 | echo =========== fooquxfoobar ============; \ | |
10 | ${OBJDIR_progs_fooquxfoobar}/fooquxfoobar; \ | |
11 | echo =========== foobaz ============; \ | |
12 | ${OBJDIR_progs_foobaz}/foobaz; \ | |
13 | rm -rf ${.OBJDIR}${PREFIX}; \ | |
14 | \ | |
15 | echo =========== depends ============; \ | |
16 | ${MAKE} ${MAKEFLAGS} -j4 depend > /dev/null; \ | |
17 | mkc_long_lines `find ${.CURDIR} -type f -name .depend` | \ | |
18 | awk '!/^#/ {for (i=1; i <= NF; ++i) if ($$i ~ /^\// && $$i !~ /mk-configure/) $$i = ""; print $$0; }' | \ | |
19 | awk '{$$1 = $$1; gsub(/[.]o[ps]/, ".o"); print $$0}' | sort | \ | |
20 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ | |
21 | \ | |
22 | echo ======= install ==========; \ | |
23 | ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} > /dev/null; \ | |
24 | find ${.OBJDIR}${PREFIX} -type f -o -type l | \ | |
25 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ | |
26 | rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/Users ${.OBJDIR}/home; \ | |
27 | \ | |
28 | echo =========== all with STATICLIBS=... ============; \ | |
29 | ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \ | |
30 | env STATICLIBS='libfoo libbar' ${MAKE} ${MAKEFLAGS} -j4 all > /dev/null; \ | |
31 | find ${.OBJDIR} -type f -o -type l | \ | |
32 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ | |
33 | \ | |
34 | echo ========= install with STATICLIBS=... ==========; \ | |
35 | env STATICLIBS='libfoo libbar' ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} > /dev/null; \ | |
36 | find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \ | |
37 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ | |
38 | case ${OPSYS} in \ | |
39 | *BSD|DragonFly|SunOS|Linux) \ | |
40 | ${run_nm} ${OBJDIR_libfooqux}/libfooqux.so;; \ | |
41 | *) \ | |
42 | printf 'symbol foo\nsymbol fooqux\n';; \ | |
43 | esac; \ | |
44 | rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/home ${.OBJDIR}/Users; \ | |
45 | \ | |
46 | echo ======= distclean ==========; \ | |
47 | ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \ | |
48 | find ${.OBJDIR} -type f | \ | |
49 | mkc_test_helper "${PREFIX}" "${.OBJDIR}" | |
50 | ||
51 | .include <mkc.minitest.mk> |
6 | 6 | SCRIPTS = ${INSCRIPTS} |
7 | 7 | |
8 | 8 | INTEXTS_REPLS = LUA ${PROG.lua} |
9 | MKC_CHECK_PROGS = lua | |
9 | MKC_REQUIRE_PROGS = lua | |
10 | 10 | |
11 | 11 | .include "test.mk" |
12 | 12 | .include <mkc.lib.mk> |
0 | MKC_REQUIRE_BUILTINS += prog_gawk prog_flex prog_gm4 prog_bison | |
0 | MKC_REQUIRE_BUILTINS += prog_gawk prog_flex prog_gm4 prog_bison prog_gmake | |
1 | 1 | |
2 | 2 | SCRIPTS = fake |
3 | 3 | |
4 | test: error-check | |
5 | @echo ${CUSTOM.prog_gawk} | |
6 | @echo ${CUSTOM.prog_gm4} | |
7 | @echo ${CUSTOM.prog_flex} | |
8 | @echo ${CUSTOM.prog_bison} | |
4 | test: errorcheck | |
5 | @echo GNU awk: ${CUSTOM.prog_gawk} | |
6 | @echo GNU m4: ${CUSTOM.prog_gm4} | |
7 | @echo GNU make: ${CUSTOM.prog_gmake} | |
8 | @echo flex: ${CUSTOM.prog_flex} | |
9 | @echo bison: ${CUSTOM.prog_bison} | |
9 | 10 | |
10 | 11 | .include <mkc.prog.mk> |
2 | 2 | |
3 | 3 | WARNS = 4 |
4 | 4 | |
5 | SCRIPTS = hello_world2 hello_world3 | |
5 | INSCRIPTS = hello_world3 | |
6 | SCRIPTS = hello_world2 ${INSCRIPTS} | |
6 | 7 | SCRIPTS += ${:!echo more_scripts/*!:N*/CVS} |
7 | 8 | |
8 | 9 | SCRIPTSDIR_more_scripts_script1 = ${BINDIR}/subdir1 |
12 | 13 | SCRIPTSDIR_more_scripts_script3 = ${BINDIR}/subdir3 |
13 | 14 | SCRIPTSNAME_more_scripts_script3 = myscript3 |
14 | 15 | |
16 | MKC_REQUIRE_PROGS = awk | |
17 | INTEXTS_REPLS = AWK ${PROG.awk} | |
18 | ||
15 | 19 | MAN = hello_world.1 |
16 | 20 | |
17 | 21 | MKC_REQD = 0.10.0 |
4 | 4 | /objdir/Makefile |
5 | 5 | /objdir/_mkc_compiler_type.err |
6 | 6 | /objdir/_mkc_compiler_type.res |
7 | /objdir/_mkc_prog_awk.err | |
8 | /objdir/_mkc_prog_awk.res | |
7 | 9 | /objdir/_mkc_prog_cc.err |
8 | 10 | /objdir/_mkc_prog_cc.res |
9 | 11 | /objdir/expect.out |
12 | 14 | /objdir/hello_world1 |
13 | 15 | /objdir/hello_world2 |
14 | 16 | /objdir/hello_world3 |
17 | /objdir/hello_world3.in | |
15 | 18 | /objdir/main.c |
16 | 19 | /objdir/main.o |
17 | 20 | /objdir/more_scripts/script1 |
41 | 44 | /objdir/Makefile |
42 | 45 | /objdir/_mkc_compiler_type.err |
43 | 46 | /objdir/_mkc_compiler_type.res |
47 | /objdir/_mkc_prog_awk.err | |
48 | /objdir/_mkc_prog_awk.res | |
44 | 49 | /objdir/_mkc_prog_cc.err |
45 | 50 | /objdir/_mkc_prog_cc.res |
46 | 51 | /objdir/expect.out |
47 | 52 | /objdir/hello_scripts.test.out.tmp |
48 | 53 | /objdir/hello_world.1 |
49 | 54 | /objdir/hello_world2 |
50 | /objdir/hello_world3 | |
55 | /objdir/hello_world3.in | |
51 | 56 | /objdir/main.c |
52 | 57 | /objdir/more_scripts/script1 |
53 | 58 | /objdir/more_scripts/script2 |
60 | 65 | /objdir/hello_scripts.test.out.tmp |
61 | 66 | /objdir/hello_world.1 |
62 | 67 | /objdir/hello_world2 |
63 | /objdir/hello_world3 | |
68 | /objdir/hello_world3.in | |
64 | 69 | /objdir/main.c |
65 | 70 | /objdir/more_scripts/script1 |
66 | 71 | /objdir/more_scripts/script2 |
71 | 76 | /objdir/Makefile |
72 | 77 | /objdir/_mkc_compiler_type.err |
73 | 78 | /objdir/_mkc_compiler_type.res |
79 | /objdir/_mkc_prog_awk.err | |
80 | /objdir/_mkc_prog_awk.res | |
74 | 81 | /objdir/_mkc_prog_cc.err |
75 | 82 | /objdir/_mkc_prog_cc.res |
76 | 83 | /objdir/expect.out |
80 | 87 | /objdir/hello_world1 |
81 | 88 | /objdir/hello_world2 |
82 | 89 | /objdir/hello_world3 |
90 | /objdir/hello_world3.in | |
83 | 91 | /objdir/main.c |
84 | 92 | /objdir/main.o |
85 | 93 | /objdir/more_scripts/script1 |
87 | 87 | /objdir/strlcpy.c |
88 | 88 | /objdir/test.mk |
89 | 89 | ======= CLEANFILES ========== |
90 | hello.o | |
90 | 91 | strlcpy.o |
91 | 92 | getline.o |
92 | hello.o |
31 | 31 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ |
32 | 32 | \ |
33 | 33 | echo ======= CLEANFILES ==========; \ |
34 | ${MAKE} ${MAKEFLAGS} print-values VARS='CLEANFILES' MKCHECKS=no | \ | |
35 | awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o$$/) print $$i}' | |
34 | ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \ | |
35 | awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}' | |
36 | 36 | |
37 | 37 | .include <mkc.minitest.mk> |
87 | 87 | /objdir/missing/strlcpy.c |
88 | 88 | /objdir/test.mk |
89 | 89 | ======= CLEANFILES ========== |
90 | hello.o | |
90 | 91 | strlcpy.o |
91 | 92 | getline.o |
92 | hello.o |
31 | 31 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ |
32 | 32 | \ |
33 | 33 | echo ======= CLEANFILES ==========; \ |
34 | ${MAKE} ${MAKEFLAGS} print-values VARS='CLEANFILES' MKCHECKS=no | \ | |
35 | awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o$$/) print $$i}' | |
34 | ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \ | |
35 | awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}' | |
36 | 36 | |
37 | 37 | .include <mkc.minitest.mk> |
2 | 2 | |
3 | 3 | WARNS = 4 |
4 | 4 | |
5 | MKC_FEATURES = strlcpy strlcat getline | |
5 | MKC_FEATURES = strlcpy strlcat getline progname | |
6 | 6 | |
7 | 7 | MKC_REQD = 0.26.0 |
8 | 8 |
21 | 21 | foo17# ARISING |
22 | 22 | foo17# POSSIBI |
23 | 23 | Theo de Raadt said |
24 | short progname=hello | |
25 | full progname=/path/to/hello | |
24 | 26 | =========== all ============ |
25 | 27 | /objdir/Makefile |
26 | 28 | /objdir/_mkc_compiler_type.err |
27 | 29 | /objdir/_mkc_compiler_type.res |
30 | /objdir/_mkc_func0_getexecname_stdlib_h.c | |
31 | /objdir/_mkc_func0_getexecname_stdlib_h.err | |
32 | /objdir/_mkc_func0_getexecname_stdlib_h.res | |
33 | /objdir/_mkc_func0_getprogname_stdlib_h.c | |
34 | /objdir/_mkc_func0_getprogname_stdlib_h.err | |
35 | /objdir/_mkc_func0_getprogname_stdlib_h.res | |
36 | /objdir/_mkc_func1_setprogname_stdlib_h.c | |
37 | /objdir/_mkc_func1_setprogname_stdlib_h.err | |
38 | /objdir/_mkc_func1_setprogname_stdlib_h.res | |
28 | 39 | /objdir/_mkc_func3_getline_stdio_h.c |
29 | 40 | /objdir/_mkc_func3_getline_stdio_h.err |
30 | 41 | /objdir/_mkc_func3_getline_stdio_h.res |
37 | 48 | /objdir/_mkc_funclib_getline.c |
38 | 49 | /objdir/_mkc_funclib_getline.err |
39 | 50 | /objdir/_mkc_funclib_getline.res |
51 | /objdir/_mkc_funclib_getprogname.c | |
52 | /objdir/_mkc_funclib_getprogname.err | |
53 | /objdir/_mkc_funclib_getprogname.res | |
54 | /objdir/_mkc_funclib_setprogname.c | |
55 | /objdir/_mkc_funclib_setprogname.err | |
56 | /objdir/_mkc_funclib_setprogname.res | |
40 | 57 | /objdir/_mkc_funclib_strlcat.c |
41 | 58 | /objdir/_mkc_funclib_strlcat.err |
42 | 59 | /objdir/_mkc_funclib_strlcat.res |
45 | 62 | /objdir/_mkc_funclib_strlcpy.res |
46 | 63 | /objdir/_mkc_prog_cc.err |
47 | 64 | /objdir/_mkc_prog_cc.res |
65 | /objdir/_mkc_variable_program_invocation_short_name_errno_h.c | |
66 | /objdir/_mkc_variable_program_invocation_short_name_errno_h.err | |
67 | /objdir/_mkc_variable_program_invocation_short_name_errno_h.res | |
48 | 68 | /objdir/expect.out |
49 | 69 | /objdir/hello |
50 | 70 | /objdir/hello.c |
61 | 81 | /objdir/Makefile |
62 | 82 | /objdir/_mkc_compiler_type.err |
63 | 83 | /objdir/_mkc_compiler_type.res |
84 | /objdir/_mkc_func0_getexecname_stdlib_h.c | |
85 | /objdir/_mkc_func0_getexecname_stdlib_h.err | |
86 | /objdir/_mkc_func0_getexecname_stdlib_h.res | |
87 | /objdir/_mkc_func0_getprogname_stdlib_h.c | |
88 | /objdir/_mkc_func0_getprogname_stdlib_h.err | |
89 | /objdir/_mkc_func0_getprogname_stdlib_h.res | |
90 | /objdir/_mkc_func1_setprogname_stdlib_h.c | |
91 | /objdir/_mkc_func1_setprogname_stdlib_h.err | |
92 | /objdir/_mkc_func1_setprogname_stdlib_h.res | |
64 | 93 | /objdir/_mkc_func3_getline_stdio_h.c |
65 | 94 | /objdir/_mkc_func3_getline_stdio_h.err |
66 | 95 | /objdir/_mkc_func3_getline_stdio_h.res |
73 | 102 | /objdir/_mkc_funclib_getline.c |
74 | 103 | /objdir/_mkc_funclib_getline.err |
75 | 104 | /objdir/_mkc_funclib_getline.res |
105 | /objdir/_mkc_funclib_getprogname.c | |
106 | /objdir/_mkc_funclib_getprogname.err | |
107 | /objdir/_mkc_funclib_getprogname.res | |
108 | /objdir/_mkc_funclib_setprogname.c | |
109 | /objdir/_mkc_funclib_setprogname.err | |
110 | /objdir/_mkc_funclib_setprogname.res | |
76 | 111 | /objdir/_mkc_funclib_strlcat.c |
77 | 112 | /objdir/_mkc_funclib_strlcat.err |
78 | 113 | /objdir/_mkc_funclib_strlcat.res |
81 | 116 | /objdir/_mkc_funclib_strlcpy.res |
82 | 117 | /objdir/_mkc_prog_cc.err |
83 | 118 | /objdir/_mkc_prog_cc.res |
119 | /objdir/_mkc_variable_program_invocation_short_name_errno_h.c | |
120 | /objdir/_mkc_variable_program_invocation_short_name_errno_h.err | |
121 | /objdir/_mkc_variable_program_invocation_short_name_errno_h.res | |
84 | 122 | /objdir/expect.out |
85 | 123 | /objdir/hello.c |
86 | 124 | /objdir/hello_strlcpy3.test.out.tmp |
94 | 132 | /objdir/input.in |
95 | 133 | /objdir/test.mk |
96 | 134 | ======= CLEANFILES ========== |
135 | hello.o | |
97 | 136 | strlcpy.o |
98 | 137 | strlcat.o |
99 | 138 | getline.o |
100 | hello.o | |
139 | progname.o |
3 | 3 | #include <mkc_strlcpy.h> |
4 | 4 | #include <mkc_strlcat.h> |
5 | 5 | #include <mkc_getline.h> |
6 | #include <mkc_progname.h> | |
6 | 7 | |
7 | 8 | static const char message [] = "Theo de Raadt said: \"The strlcpy() and strlcat() functions provide a consistent, unambiguous API to help the programmer write more bullet-proof code.\""; |
8 | 9 | |
13 | 14 | ssize_t len = 0; |
14 | 15 | char small_buf [15]; |
15 | 16 | char said [19]; |
17 | ||
18 | setprogname (argv [0]); | |
16 | 19 | |
17 | 20 | while (len = getline (&buf, &size, stdin), len != -1){ |
18 | 21 | len = strlen (buf); |
27 | 30 | strlcpy (said, message, sizeof (said)); |
28 | 31 | puts (said); |
29 | 32 | |
33 | printf ("short progname=%s\n", getprogname ()); | |
34 | printf ("full progname=%s\n", argv [0]); | |
35 | ||
30 | 36 | return 0; |
31 | 37 | } |
0 | FUNCS_RE=(strlcat|strlcpy|getline)[.]o | |
0 | FUNCS_RE=(strlcat|strlcpy|getline|progname)[.]o | |
1 | 1 | |
2 | 2 | .PHONY : test_output |
3 | 3 | test_output: |
4 | 4 | @set -e; \ |
5 | ${.OBJDIR}/hello < ${.CURDIR}/input.in; \ | |
5 | ${.OBJDIR}/hello < ${.CURDIR}/input.in | \ | |
6 | mkc_test_helper_paths; \ | |
6 | 7 | rm -rf ${.OBJDIR}${PREFIX}; \ |
7 | 8 | MKCATPAGES=yes; export MKCATPAGES; \ |
8 | 9 | \ |
33 | 34 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ |
34 | 35 | \ |
35 | 36 | echo ======= CLEANFILES ==========; \ |
36 | ${MAKE} ${MAKEFLAGS} print-values VARS='CLEANFILES' MKCHECKS=no | \ | |
37 | awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o$$/) print $$i}' | |
37 | ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \ | |
38 | awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}' | |
38 | 39 | |
39 | 40 | .include <mkc.minitest.mk> |
0 | 0 | PROG = prog1 |
1 | SCRIPTS = prog1.sh prog1.awk | |
1 | SCRIPTS = prog1.sh ${INSCRIPTS} | |
2 | INSCRIPTS = prog1.awk | |
2 | 3 | |
3 | 4 | WARNS = 4 |
5 | ||
6 | MKC_REQUIRE_PROGS = awk | |
7 | INTEXTS_REPLS = AWK ${PROG.awk} | |
4 | 8 | |
5 | 9 | # Do not set SCRIPTSNAME in project's Makefile! |
6 | 10 | # This is just a regression test. |
9 | 9 | /objdir/expect.out |
10 | 10 | /objdir/prog1 |
11 | 11 | /objdir/prog1.awk |
12 | /objdir/prog1.awk.in | |
12 | 13 | /objdir/prog1.c |
13 | 14 | /objdir/prog1.o |
14 | 15 | /objdir/prog1.sh |
22 | 23 | ========== clean =========== |
23 | 24 | /objdir/Makefile |
24 | 25 | /objdir/expect.out |
25 | /objdir/prog1.awk | |
26 | /objdir/prog1.awk.in | |
26 | 27 | /objdir/prog1.c |
27 | 28 | /objdir/prog1.sh |
28 | 29 | /objdir/prog1.test.out.tmp |
30 | 31 | ======= distclean ========== |
31 | 32 | /objdir/Makefile |
32 | 33 | /objdir/expect.out |
33 | /objdir/prog1.awk | |
34 | /objdir/prog1.awk.in | |
34 | 35 | /objdir/prog1.c |
35 | 36 | /objdir/prog1.sh |
36 | 37 | /objdir/prog1.test.out.tmp |
0 | PATH.hello1 := ${.PARSEDIR} | |
0 | PATH.hello1 := ${.PARSEDIR:tA} | |
1 | 1 | |
2 | CPPFLAGS += -I${PATH.hello1} | |
2 | DPINCDIRS += ${PATH.hello1} | |
3 | 3 | DPLIBDIRS += ${PATH.hello1} |
4 | LDADD0 += -lhello1 | |
4 | DPLDADD += hello1 |
0 | PATH.hello2 := ${.PARSEDIR} | |
0 | PATH.hello2 := ${.PARSEDIR:tA} | |
1 | 1 | |
2 | CPPFLAGS += -I${PATH.hello2}/include | |
2 | DPINCDIRS += ${PATH.hello2}/include | |
3 | 3 | DPLIBDIRS += ${PATH.hello2} |
4 | LDADD0 += -lhello2 | |
4 | DPLDADD += hello2 |
8 | 8 | rm -rf ${.OBJDIR}${PREFIX}; \ |
9 | 9 | LD_LIBRARY_PATH=${.CURDIR}/libhello1:${.CURDIR}/libhello2:$$LD_LIBRARY_PATH; \ |
10 | 10 | DYLD_LIBRARY_PATH=${.CURDIR}/libhello1:${.CURDIR}/libhello2:$$LD_LIBRARY_PATH; \ |
11 | LIBRARY_PATH=$$LIBRARY_PATH:$$LD_LIBRARY_PATH; \ | |
11 | 12 | MKINSTALLDIRS=no; \ |
12 | export LD_LIBRARY_PATH DYLD_LIBRARY_PATH; \ | |
13 | export LD_LIBRARY_PATH DYLD_LIBRARY_PATH LIBRARY_PATH; \ | |
13 | 14 | ${.CURDIR}/hello/hello_subprojects; \ |
14 | 15 | ${.CURDIR}/hello/hello_subprojects2; \ |
15 | 16 | \ |
20 | 21 | echo ===== all SHRTOUT=yes ======; \ |
21 | 22 | ${MAKE} ${MAKEFLAGS} clean > /dev/null; \ |
22 | 23 | ${MAKE} ${MAKEFLAGS} all SHRTOUT=YES 2>&1 | \ |
24 | grep -v warning: | \ | |
23 | 25 | mkc_test_helper_paths; \ |
24 | 26 | \ |
25 | 27 | echo ========= installdirs ==========; \ |
0 | SUBPRJ = libs/foo:tools/prog1 | |
1 | SUBPRJ += libs/bar:tools/prog2 | |
2 | SUBPRJ += libs/foo:tools/prog3 libs/bar:tools/prog3 | |
3 | SUBPRJ += libs/qux:tools/prog4 | |
0 | LIBDEPS = libs/foo:tools/prog1 | |
1 | LIBDEPS += libs/bar:tools/prog2 | |
2 | LIBDEPS += libs/foo:tools/prog3 libs/bar:tools/prog3 | |
3 | LIBDEPS += libs/qux:tools/prog4 | |
4 | 4 | |
5 | 5 | # target "check" is used for testing because "test" is used by mk-configure |
6 | 6 | TARGETS = check |
46 | 46 | /objdir/libs/bar/bar.h |
47 | 47 | /objdir/libs/bar/bar.o |
48 | 48 | /objdir/libs/bar/libbar.a |
49 | /objdir/libs/bar/linkme.mk | |
50 | 49 | /objdir/libs/foo/Makefile |
51 | 50 | /objdir/libs/foo/foo.c |
52 | 51 | /objdir/libs/foo/foo.h |
53 | 52 | /objdir/libs/foo/foo.o |
54 | 53 | /objdir/libs/foo/libfoo.a |
55 | /objdir/libs/foo/linkme.mk | |
56 | 54 | /objdir/libs/qux/Makefile |
57 | 55 | /objdir/libs/qux/libqux.a |
58 | /objdir/libs/qux/linkme.mk | |
59 | 56 | /objdir/libs/qux/qux.c |
60 | 57 | /objdir/libs/qux/qux.h |
61 | 58 | /objdir/libs/qux/qux.h.in |
142 | 139 | /objdir/libs/bar/Makefile |
143 | 140 | /objdir/libs/bar/bar.c |
144 | 141 | /objdir/libs/bar/bar.h |
145 | /objdir/libs/bar/linkme.mk | |
146 | /objdir/libs/foo/Makefile | |
147 | /objdir/libs/foo/foo.c | |
148 | /objdir/libs/foo/foo.h | |
149 | /objdir/libs/foo/linkme.mk | |
150 | /objdir/libs/qux/Makefile | |
151 | /objdir/libs/qux/linkme.mk | |
142 | /objdir/libs/foo/Makefile | |
143 | /objdir/libs/foo/foo.c | |
144 | /objdir/libs/foo/foo.h | |
145 | /objdir/libs/qux/Makefile | |
152 | 146 | /objdir/libs/qux/qux.c |
153 | 147 | /objdir/libs/qux/qux.h.in |
154 | 148 | /objdir/test.mk |
167 | 161 | /objdir/libs/bar/Makefile |
168 | 162 | /objdir/libs/bar/bar.c |
169 | 163 | /objdir/libs/bar/bar.h |
170 | /objdir/libs/bar/linkme.mk | |
171 | /objdir/libs/foo/Makefile | |
172 | /objdir/libs/foo/foo.c | |
173 | /objdir/libs/foo/foo.h | |
174 | /objdir/libs/foo/linkme.mk | |
175 | /objdir/libs/qux/Makefile | |
176 | /objdir/libs/qux/linkme.mk | |
164 | /objdir/libs/foo/Makefile | |
165 | /objdir/libs/foo/foo.c | |
166 | /objdir/libs/foo/foo.h | |
167 | /objdir/libs/qux/Makefile | |
177 | 168 | /objdir/libs/qux/qux.c |
178 | 169 | /objdir/libs/qux/qux.h.in |
179 | 170 | /objdir/test.mk |
196 | 187 | /objdir/libs/bar/Makefile |
197 | 188 | /objdir/libs/bar/bar.c |
198 | 189 | /objdir/libs/bar/bar.h |
199 | /objdir/libs/bar/linkme.mk | |
200 | 190 | /objdir/libs/foo/Makefile |
201 | 191 | /objdir/libs/foo/foo.c |
202 | 192 | /objdir/libs/foo/foo.h |
203 | 193 | /objdir/libs/foo/foo.o |
204 | 194 | /objdir/libs/foo/libfoo.a |
205 | /objdir/libs/foo/linkme.mk | |
206 | /objdir/libs/qux/Makefile | |
207 | /objdir/libs/qux/linkme.mk | |
195 | /objdir/libs/qux/Makefile | |
208 | 196 | /objdir/libs/qux/qux.c |
209 | 197 | /objdir/libs/qux/qux.h.in |
210 | 198 | /objdir/test.mk |
229 | 217 | /objdir/libs/bar/Makefile |
230 | 218 | /objdir/libs/bar/bar.c |
231 | 219 | /objdir/libs/bar/bar.h |
232 | /objdir/libs/bar/linkme.mk | |
233 | 220 | /objdir/libs/foo/Makefile |
234 | 221 | /objdir/libs/foo/foo.c |
235 | 222 | /objdir/libs/foo/foo.h |
236 | 223 | /objdir/libs/foo/foo.o |
237 | 224 | /objdir/libs/foo/libfoo.a |
238 | /objdir/libs/foo/linkme.mk | |
239 | /objdir/libs/qux/Makefile | |
240 | /objdir/libs/qux/linkme.mk | |
225 | /objdir/libs/qux/Makefile | |
241 | 226 | /objdir/libs/qux/qux.c |
242 | 227 | /objdir/libs/qux/qux.h.in |
243 | 228 | /objdir/test.mk |
262 | 247 | /objdir/libs/bar/Makefile |
263 | 248 | /objdir/libs/bar/bar.c |
264 | 249 | /objdir/libs/bar/bar.h |
265 | /objdir/libs/bar/linkme.mk | |
266 | 250 | /objdir/libs/foo/Makefile |
267 | 251 | /objdir/libs/foo/foo.c |
268 | 252 | /objdir/libs/foo/foo.h |
269 | 253 | /objdir/libs/foo/foo.o |
270 | 254 | /objdir/libs/foo/libfoo.a |
271 | /objdir/libs/foo/linkme.mk | |
272 | /objdir/libs/qux/Makefile | |
273 | /objdir/libs/qux/linkme.mk | |
255 | /objdir/libs/qux/Makefile | |
274 | 256 | /objdir/libs/qux/qux.c |
275 | 257 | /objdir/libs/qux/qux.h.in |
276 | 258 | /objdir/test.mk |
297 | 279 | /objdir/libs/bar/bar.h |
298 | 280 | /objdir/libs/bar/bar.o |
299 | 281 | /objdir/libs/bar/libbar.a |
300 | /objdir/libs/bar/linkme.mk | |
301 | /objdir/libs/foo/Makefile | |
302 | /objdir/libs/foo/foo.c | |
303 | /objdir/libs/foo/foo.h | |
304 | /objdir/libs/foo/linkme.mk | |
305 | /objdir/libs/qux/Makefile | |
306 | /objdir/libs/qux/linkme.mk | |
282 | /objdir/libs/foo/Makefile | |
283 | /objdir/libs/foo/foo.c | |
284 | /objdir/libs/foo/foo.h | |
285 | /objdir/libs/qux/Makefile | |
307 | 286 | /objdir/libs/qux/qux.c |
308 | 287 | /objdir/libs/qux/qux.h.in |
309 | 288 | /objdir/test.mk |
330 | 309 | /objdir/libs/bar/bar.h |
331 | 310 | /objdir/libs/bar/bar.o |
332 | 311 | /objdir/libs/bar/libbar.a |
333 | /objdir/libs/bar/linkme.mk | |
334 | /objdir/libs/foo/Makefile | |
335 | /objdir/libs/foo/foo.c | |
336 | /objdir/libs/foo/foo.h | |
337 | /objdir/libs/foo/linkme.mk | |
338 | /objdir/libs/qux/Makefile | |
339 | /objdir/libs/qux/linkme.mk | |
312 | /objdir/libs/foo/Makefile | |
313 | /objdir/libs/foo/foo.c | |
314 | /objdir/libs/foo/foo.h | |
315 | /objdir/libs/qux/Makefile | |
340 | 316 | /objdir/libs/qux/qux.c |
341 | 317 | /objdir/libs/qux/qux.h.in |
342 | 318 | /objdir/test.mk |
363 | 339 | /objdir/libs/bar/bar.h |
364 | 340 | /objdir/libs/bar/bar.o |
365 | 341 | /objdir/libs/bar/libbar.a |
366 | /objdir/libs/bar/linkme.mk | |
367 | 342 | /objdir/libs/foo/Makefile |
368 | 343 | /objdir/libs/foo/foo.c |
369 | 344 | /objdir/libs/foo/foo.h |
370 | 345 | /objdir/libs/foo/foo.o |
371 | 346 | /objdir/libs/foo/libfoo.a |
372 | /objdir/libs/foo/linkme.mk | |
373 | /objdir/libs/qux/Makefile | |
374 | /objdir/libs/qux/linkme.mk | |
347 | /objdir/libs/qux/Makefile | |
375 | 348 | /objdir/libs/qux/qux.c |
376 | 349 | /objdir/libs/qux/qux.h.in |
377 | 350 | /objdir/test.mk |
399 | 372 | /objdir/libs/bar/Makefile |
400 | 373 | /objdir/libs/bar/bar.c |
401 | 374 | /objdir/libs/bar/bar.h |
402 | /objdir/libs/bar/linkme.mk | |
403 | /objdir/libs/foo/Makefile | |
404 | /objdir/libs/foo/foo.c | |
405 | /objdir/libs/foo/foo.h | |
406 | /objdir/libs/foo/linkme.mk | |
375 | /objdir/libs/foo/Makefile | |
376 | /objdir/libs/foo/foo.c | |
377 | /objdir/libs/foo/foo.h | |
407 | 378 | /objdir/libs/qux/Makefile |
408 | 379 | /objdir/libs/qux/libqux.a |
409 | /objdir/libs/qux/linkme.mk | |
410 | 380 | /objdir/libs/qux/qux.c |
411 | 381 | /objdir/libs/qux/qux.h |
412 | 382 | /objdir/libs/qux/qux.h.in |
487 | 457 | filelist |
488 | 458 | install |
489 | 459 | installdirs |
460 | mkgen | |
490 | 461 | obj |
491 | 462 | test |
492 | 463 | uninstall |
0 | PATH.bar := ${.PARSEDIR} | |
1 | ||
2 | CPPFLAGS += -I${PATH.bar} | |
3 | DPLIBDIRS += ${PATH.bar} | |
4 | LDADD0 += -lbar |
0 | PATH.foo := ${.PARSEDIR} | |
1 | ||
2 | CPPFLAGS += -I${PATH.foo} | |
3 | DPLIBDIRS += ${PATH.foo} | |
4 | LDADD0 += -lfoo |
0 | PATH.qux := ${.PARSEDIR} | |
1 | ||
2 | CPPFLAGS += -I${PATH.qux} | |
3 | DPLIBDIRS += ${PATH.qux} | |
4 | LDADD0 += -lqux |
7 | 7 | check: |
8 | 8 | @: do something useful |
9 | 9 | |
10 | .include "../../libs/foo/linkme.mk" | |
11 | 10 | .include <mkc.prog.mk> |
7 | 7 | check: |
8 | 8 | @: do something useful |
9 | 9 | |
10 | .include "../../libs/bar/linkme.mk" | |
11 | 10 | .include <mkc.prog.mk> |
7 | 7 | check: |
8 | 8 | @: do something useful |
9 | 9 | |
10 | .include "../../libs/foo/linkme.mk" | |
11 | .include "../../libs/bar/linkme.mk" | |
12 | ||
13 | 10 | .include <mkc.prog.mk> |
6 | 6 | check: |
7 | 7 | @: do something useful |
8 | 8 | |
9 | .include "../../libs/qux/linkme.mk" | |
10 | 9 | .include <mkc.prog.mk> |
0 | SUBPRJ = libs/foo:tools/prog1 | |
1 | SUBPRJ += libs/bar:tools/prog2 | |
2 | SUBPRJ += libs/foo:tools/prog3 libs/bar:tools/prog3 | |
3 | SUBPRJ += libs/qux:tools/prog4 | |
0 | LIBDEPS = libs/foo:tools/prog1 | |
1 | LIBDEPS += libs/bar:tools/prog2 | |
2 | LIBDEPS += libs/foo:tools/prog3 libs/bar:tools/prog3 | |
3 | LIBDEPS += libs/qux:tools/prog4 | |
4 | 4 | |
5 | 5 | SUBPRJ += tools/prog1:tests/prog1 |
6 | 6 | SUBPRJ += tools/prog2:tests/prog2 |
50 | 50 | /objdir/libs/bar/bar.h |
51 | 51 | /objdir/libs/bar/bar.o |
52 | 52 | /objdir/libs/bar/libbar.a |
53 | /objdir/libs/bar/linkme.mk | |
54 | 53 | /objdir/libs/foo/Makefile |
55 | 54 | /objdir/libs/foo/foo.c |
56 | 55 | /objdir/libs/foo/foo.h |
57 | 56 | /objdir/libs/foo/foo.o |
58 | 57 | /objdir/libs/foo/libfoo.a |
59 | /objdir/libs/foo/linkme.mk | |
60 | 58 | /objdir/libs/qux/Makefile |
61 | 59 | /objdir/libs/qux/libqux.a |
62 | /objdir/libs/qux/linkme.mk | |
63 | 60 | /objdir/libs/qux/qux.c |
64 | 61 | /objdir/libs/qux/qux.h |
65 | 62 | /objdir/libs/qux/qux.h.in |
150 | 147 | /objdir/libs/bar/Makefile |
151 | 148 | /objdir/libs/bar/bar.c |
152 | 149 | /objdir/libs/bar/bar.h |
153 | /objdir/libs/bar/linkme.mk | |
154 | /objdir/libs/foo/Makefile | |
155 | /objdir/libs/foo/foo.c | |
156 | /objdir/libs/foo/foo.h | |
157 | /objdir/libs/foo/linkme.mk | |
158 | /objdir/libs/qux/Makefile | |
159 | /objdir/libs/qux/linkme.mk | |
150 | /objdir/libs/foo/Makefile | |
151 | /objdir/libs/foo/foo.c | |
152 | /objdir/libs/foo/foo.h | |
153 | /objdir/libs/qux/Makefile | |
160 | 154 | /objdir/libs/qux/qux.c |
161 | 155 | /objdir/libs/qux/qux.h.in |
162 | 156 | /objdir/test.mk |
179 | 173 | /objdir/libs/bar/Makefile |
180 | 174 | /objdir/libs/bar/bar.c |
181 | 175 | /objdir/libs/bar/bar.h |
182 | /objdir/libs/bar/linkme.mk | |
183 | /objdir/libs/foo/Makefile | |
184 | /objdir/libs/foo/foo.c | |
185 | /objdir/libs/foo/foo.h | |
186 | /objdir/libs/foo/linkme.mk | |
187 | /objdir/libs/qux/Makefile | |
188 | /objdir/libs/qux/linkme.mk | |
176 | /objdir/libs/foo/Makefile | |
177 | /objdir/libs/foo/foo.c | |
178 | /objdir/libs/foo/foo.h | |
179 | /objdir/libs/qux/Makefile | |
189 | 180 | /objdir/libs/qux/qux.c |
190 | 181 | /objdir/libs/qux/qux.h.in |
191 | 182 | /objdir/test.mk |
212 | 203 | /objdir/libs/bar/Makefile |
213 | 204 | /objdir/libs/bar/bar.c |
214 | 205 | /objdir/libs/bar/bar.h |
215 | /objdir/libs/bar/linkme.mk | |
216 | 206 | /objdir/libs/foo/Makefile |
217 | 207 | /objdir/libs/foo/foo.c |
218 | 208 | /objdir/libs/foo/foo.h |
219 | 209 | /objdir/libs/foo/foo.o |
220 | 210 | /objdir/libs/foo/libfoo.a |
221 | /objdir/libs/foo/linkme.mk | |
222 | /objdir/libs/qux/Makefile | |
223 | /objdir/libs/qux/linkme.mk | |
211 | /objdir/libs/qux/Makefile | |
224 | 212 | /objdir/libs/qux/qux.c |
225 | 213 | /objdir/libs/qux/qux.h.in |
226 | 214 | /objdir/test.mk |
249 | 237 | /objdir/libs/bar/Makefile |
250 | 238 | /objdir/libs/bar/bar.c |
251 | 239 | /objdir/libs/bar/bar.h |
252 | /objdir/libs/bar/linkme.mk | |
253 | 240 | /objdir/libs/foo/Makefile |
254 | 241 | /objdir/libs/foo/foo.c |
255 | 242 | /objdir/libs/foo/foo.h |
256 | 243 | /objdir/libs/foo/foo.o |
257 | 244 | /objdir/libs/foo/libfoo.a |
258 | /objdir/libs/foo/linkme.mk | |
259 | /objdir/libs/qux/Makefile | |
260 | /objdir/libs/qux/linkme.mk | |
245 | /objdir/libs/qux/Makefile | |
261 | 246 | /objdir/libs/qux/qux.c |
262 | 247 | /objdir/libs/qux/qux.h.in |
263 | 248 | /objdir/test.mk |
288 | 273 | /objdir/libs/bar/bar.h |
289 | 274 | /objdir/libs/bar/bar.o |
290 | 275 | /objdir/libs/bar/libbar.a |
291 | /objdir/libs/bar/linkme.mk | |
292 | /objdir/libs/foo/Makefile | |
293 | /objdir/libs/foo/foo.c | |
294 | /objdir/libs/foo/foo.h | |
295 | /objdir/libs/foo/linkme.mk | |
296 | /objdir/libs/qux/Makefile | |
297 | /objdir/libs/qux/linkme.mk | |
276 | /objdir/libs/foo/Makefile | |
277 | /objdir/libs/foo/foo.c | |
278 | /objdir/libs/foo/foo.h | |
279 | /objdir/libs/qux/Makefile | |
298 | 280 | /objdir/libs/qux/qux.c |
299 | 281 | /objdir/libs/qux/qux.h.in |
300 | 282 | /objdir/test.mk |
325 | 307 | /objdir/libs/bar/bar.h |
326 | 308 | /objdir/libs/bar/bar.o |
327 | 309 | /objdir/libs/bar/libbar.a |
328 | /objdir/libs/bar/linkme.mk | |
329 | /objdir/libs/foo/Makefile | |
330 | /objdir/libs/foo/foo.c | |
331 | /objdir/libs/foo/foo.h | |
332 | /objdir/libs/foo/linkme.mk | |
333 | /objdir/libs/qux/Makefile | |
334 | /objdir/libs/qux/linkme.mk | |
310 | /objdir/libs/foo/Makefile | |
311 | /objdir/libs/foo/foo.c | |
312 | /objdir/libs/foo/foo.h | |
313 | /objdir/libs/qux/Makefile | |
335 | 314 | /objdir/libs/qux/qux.c |
336 | 315 | /objdir/libs/qux/qux.h.in |
337 | 316 | /objdir/test.mk |
362 | 341 | /objdir/libs/bar/bar.h |
363 | 342 | /objdir/libs/bar/bar.o |
364 | 343 | /objdir/libs/bar/libbar.a |
365 | /objdir/libs/bar/linkme.mk | |
366 | 344 | /objdir/libs/foo/Makefile |
367 | 345 | /objdir/libs/foo/foo.c |
368 | 346 | /objdir/libs/foo/foo.h |
369 | 347 | /objdir/libs/foo/foo.o |
370 | 348 | /objdir/libs/foo/libfoo.a |
371 | /objdir/libs/foo/linkme.mk | |
372 | /objdir/libs/qux/Makefile | |
373 | /objdir/libs/qux/linkme.mk | |
349 | /objdir/libs/qux/Makefile | |
374 | 350 | /objdir/libs/qux/qux.c |
375 | 351 | /objdir/libs/qux/qux.h.in |
376 | 352 | /objdir/test.mk |
402 | 378 | /objdir/libs/bar/Makefile |
403 | 379 | /objdir/libs/bar/bar.c |
404 | 380 | /objdir/libs/bar/bar.h |
405 | /objdir/libs/bar/linkme.mk | |
406 | /objdir/libs/foo/Makefile | |
407 | /objdir/libs/foo/foo.c | |
408 | /objdir/libs/foo/foo.h | |
409 | /objdir/libs/foo/linkme.mk | |
381 | /objdir/libs/foo/Makefile | |
382 | /objdir/libs/foo/foo.c | |
383 | /objdir/libs/foo/foo.h | |
410 | 384 | /objdir/libs/qux/Makefile |
411 | 385 | /objdir/libs/qux/libqux.a |
412 | /objdir/libs/qux/linkme.mk | |
413 | 386 | /objdir/libs/qux/qux.c |
414 | 387 | /objdir/libs/qux/qux.h |
415 | 388 | /objdir/libs/qux/qux.h.in |
454 | 427 | obj/tools/prog4/prog4 |
455 | 428 | obj/tools/prog4/prog4.o |
456 | 429 | =========== print_deps ============ |
430 | all-tools/prog1 all-tests/prog1 | |
431 | all-tools/prog2 all-tests/prog2 | |
432 | all-tools/prog3 all-tests/prog3 | |
433 | all-tools/prog4 all-tests/prog4 | |
457 | 434 | all-libs/foo all-tools/prog1 |
458 | 435 | all-libs/bar all-tools/prog2 |
459 | 436 | all-libs/foo all-tools/prog3 |
460 | 437 | all-libs/bar all-tools/prog3 |
461 | 438 | all-libs/qux all-tools/prog4 |
462 | all-tools/prog1 all-tests/prog1 | |
463 | all-tools/prog2 all-tests/prog2 | |
464 | all-tools/prog3 all-tests/prog3 | |
465 | all-tools/prog4 all-tests/prog4 | |
466 | 439 | all-libs/bar libs/bar |
467 | 440 | all-libs/foo libs/foo |
468 | 441 | all-libs/qux libs/qux |
0 | PATH.bar := ${.PARSEDIR} | |
1 | ||
2 | CPPFLAGS += -I${PATH.bar} | |
3 | DPLIBDIRS += libs/${PATH.bar:T} | |
4 | LDADD0 += -lbar |
0 | PATH.foo := ${.PARSEDIR} | |
1 | ||
2 | CPPFLAGS += -I${PATH.foo} | |
3 | DPLIBDIRS += libs/${PATH.foo:T} | |
4 | LDADD0 += -lfoo |
0 | PATH.qux := ${.PARSEDIR} | |
1 | ||
2 | CPPFLAGS += -I${OBJDIR_libs_qux} | |
3 | DPLIBDIRS += libs/${PATH.qux:T} | |
4 | LDADD0 += -lqux |
7 | 7 | check: |
8 | 8 | @: do something useful |
9 | 9 | |
10 | .include "../../libs/foo/linkme.mk" | |
11 | 10 | .include <mkc.prog.mk> |
7 | 7 | check: |
8 | 8 | @: do something useful |
9 | 9 | |
10 | .include "../../libs/bar/linkme.mk" | |
11 | 10 | .include <mkc.prog.mk> |
7 | 7 | check: |
8 | 8 | @: do something useful |
9 | 9 | |
10 | .include "../../libs/foo/linkme.mk" | |
11 | .include "../../libs/bar/linkme.mk" | |
12 | ||
13 | 10 | .include <mkc.prog.mk> |
6 | 6 | check: |
7 | 7 | @: do something useful |
8 | 8 | |
9 | .include "../../libs/qux/linkme.mk" | |
10 | 9 | .include <mkc.prog.mk> |
0 | /* $NetBSD: err.c,v 1.4 2004/08/23 03:32:12 jlam Exp $ */ | |
1 | ||
2 | /* | |
3 | * Copyright 1997-2000 Luke Mewburn <lukem@netbsd.org>. | |
4 | * Copyright 2014 Aleksey Cheusov <vle@gmx.net>. | |
5 | * All rights reserved. | |
6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | |
15 | * 3. The name of the author may not be used to endorse or promote products | |
16 | * derived from this software without specific prior written permission. | |
17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |
24 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | |
26 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | |
27 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
28 | */ | |
29 | ||
30 | #include <stdarg.h> | |
31 | #include <stdlib.h> | |
32 | #include <string.h> | |
33 | #include <stdio.h> | |
34 | #include <errno.h> | |
35 | ||
36 | #include <mkc_progname.h> | |
37 | #include <mkc_err.h> | |
38 | ||
39 | #if !HAVE_FUNC3_ERR_ERR_H | |
40 | void err (int eval, const char *fmt, ...) | |
41 | { | |
42 | va_list ap; | |
43 | int sverrno; | |
44 | ||
45 | sverrno = errno; | |
46 | fprintf (stderr, "%s: ", getprogname ()); | |
47 | va_start (ap, fmt); | |
48 | if (fmt != NULL) { | |
49 | vfprintf (stderr, fmt, ap); | |
50 | fprintf (stderr, ": "); | |
51 | } | |
52 | va_end (ap); | |
53 | fprintf (stderr, "%s\n", strerror (sverrno)); | |
54 | exit (eval); | |
55 | } | |
56 | #endif | |
57 | ||
58 | #if !HAVE_FUNC3_ERRX_ERR_H | |
59 | void errx (int eval, const char *fmt, ...) | |
60 | { | |
61 | va_list ap; | |
62 | ||
63 | fprintf (stderr, "%s: ", getprogname ()); | |
64 | va_start (ap, fmt); | |
65 | if (fmt != NULL) | |
66 | vfprintf (stderr, fmt, ap); | |
67 | va_end (ap); | |
68 | fprintf (stderr, "\n"); | |
69 | exit (eval); | |
70 | } | |
71 | #endif | |
72 | ||
73 | #if !HAVE_FUNC3_VERR_ERR_H | |
74 | void verr (int eval, const char *fmt, va_list ap) | |
75 | { | |
76 | int sverrno; | |
77 | ||
78 | sverrno = errno; | |
79 | fprintf (stderr, "%s: ", getprogname ()); | |
80 | if (fmt != NULL) { | |
81 | vfprintf (stderr, fmt, ap); | |
82 | fprintf (stderr, ": "); | |
83 | } | |
84 | fprintf (stderr, "%s\n", strerror (sverrno)); | |
85 | exit (eval); | |
86 | } | |
87 | #endif | |
88 | ||
89 | #if !HAVE_FUNC3_VERRX_ERR_H | |
90 | void verrx (int eval, const char *fmt, va_list ap) | |
91 | { | |
92 | fprintf (stderr, "%s: ", getprogname ()); | |
93 | if (fmt != NULL) | |
94 | vfprintf (stderr, fmt, ap); | |
95 | fprintf (stderr, "\n"); | |
96 | exit (eval); | |
97 | } | |
98 | #endif |
0 | /* | |
1 | * Copyright (c) 2005 Hector Garcia Alvarez | |
2 | * Copyright (c) 2005, 2008-2012 Guillem Jover <guillem@hadrons.org> | |
3 | * Copyright (c) 2014 Aleksey Cheusov <vle@gmx.net> | |
4 | * | |
5 | * Redistribution and use in source and binary forms, with or without | |
6 | * modification, are permitted provided that the following conditions | |
7 | * are met: | |
8 | * 1. Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * 2. Redistributions in binary form must reproduce the above copyright | |
11 | * notice, this list of conditions and the following disclaimer in the | |
12 | * documentation and/or other materials provided with the distribution. | |
13 | * 3. The name of the author may not be used to endorse or promote products | |
14 | * derived from this software without specific prior written permission. | |
15 | * | |
16 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, | |
17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | |
18 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | |
19 | * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
22 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
23 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
24 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
25 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
26 | */ | |
27 | ||
28 | #include <stdio.h> | |
29 | #include <string.h> | |
30 | ||
31 | #include <mkc_getline.h> | |
32 | #include <mkc_fgetln.h> | |
33 | ||
34 | struct filebuf { | |
35 | FILE *fp; | |
36 | char *buf; | |
37 | size_t len; | |
38 | }; | |
39 | ||
40 | #define FILEBUF_POOL_ITEMS 128 | |
41 | ||
42 | static struct filebuf fb_pool [FILEBUF_POOL_ITEMS]; | |
43 | static int fb_pool_cur; | |
44 | ||
45 | char * fgetln (FILE *stream, size_t *len) | |
46 | { | |
47 | struct filebuf *fb; | |
48 | ssize_t nread; | |
49 | ||
50 | /* Try to diminish the possibility of several fgetln() calls being | |
51 | * used on different streams, by using a pool of buffers per file. */ | |
52 | fb = &fb_pool [fb_pool_cur]; | |
53 | if (fb->fp != stream && fb->fp != NULL) { | |
54 | fb_pool_cur++; | |
55 | fb_pool_cur %= FILEBUF_POOL_ITEMS; | |
56 | fb = &fb_pool [fb_pool_cur]; | |
57 | } | |
58 | fb->fp = stream; | |
59 | ||
60 | nread = getline (&fb->buf, &fb->len, stream); | |
61 | /* Note: the getdelim/getline API ensures nread != 0. */ | |
62 | if (nread == -1) { | |
63 | *len = 0; | |
64 | return NULL; | |
65 | } else { | |
66 | *len = (size_t) nread; | |
67 | return fb->buf; | |
68 | } | |
69 | } |
0 | /********************************************************************\ | |
1 | Copyright (c) 2014 by Aleksey Cheusov | |
2 | ||
3 | See LICENSE file in the distribution. | |
4 | \********************************************************************/ | |
5 | ||
6 | #ifndef _MKC_ERR_H_ | |
7 | #define _MKC_ERR_H_ | |
8 | ||
9 | #include <stdarg.h> | |
10 | ||
11 | #if HAVE_HEADER_ERR_H | |
12 | #include <err.h> | |
13 | #endif | |
14 | ||
15 | #ifdef MKC_ERR_IS_FINE | |
16 | ||
17 | #include <err.h> | |
18 | ||
19 | #else | |
20 | #if !HAVE_FUNC3_ERR_ERR_H | |
21 | void err (int, const char *, ...); | |
22 | #endif | |
23 | #if !HAVE_FUNC3_ERRX_ERR_H | |
24 | void errx (int, const char *, ...); | |
25 | #endif | |
26 | #if !HAVE_FUNC3_VERR_ERR_H | |
27 | void verr (int, const char *, va_list); | |
28 | #endif | |
29 | #if !HAVE_FUNC3_VERRX_ERR_H | |
30 | void verrx (int, const char *, va_list); | |
31 | #endif | |
32 | ||
33 | #endif /* MKC_ERR_IS_FINE */ | |
34 | ||
35 | #endif // _MKC_ERR_H_ |
0 | /********************************************************************\ | |
1 | Copyright (c) 2014 by Aleksey Cheusov | |
2 | ||
3 | See LICENSE file in the distribution. | |
4 | \********************************************************************/ | |
5 | ||
6 | #ifndef _MKC_FGETLN_H_ | |
7 | #define _MKC_FGETLN_H_ | |
8 | ||
9 | #include <stdio.h> | |
10 | ||
11 | #ifndef HAVE_FUNC3_FGETLN_STDIO_H | |
12 | char *fgetln (FILE *stream, size_t *len); | |
13 | #endif | |
14 | ||
15 | #endif // _MKC_FGETLN_H_ |
1 | 1 | # |
2 | 2 | # See LICENSE file in the distribution. |
3 | 3 | ############################################################ |
4 | .ifndef _MKC_IMP_F_RB_MK | |
5 | _MKC_IMP_F_RB_MK := 1 | |
4 | 6 | |
5 | 7 | MKC_CHECK_DEFINES += RB_ENTRY:sys/tree.h |
6 | 8 | MKC_CHECK_DEFINES += SPLAY_ENTRY:sys/tree.h |
9 | ||
10 | .endif # _MKC_IMP_F_RB_MK |
1 | 1 | # |
2 | 2 | # See LICENSE file in the distribution. |
3 | 3 | ############################################################ |
4 | .include <mkc.configure.mk> | |
4 | .ifndef _MKC_IMP_F_SYSQUEUE_MK | |
5 | _MKC_IMP_F_SYSQUEUE_MK := 1 | |
6 | ||
7 | .include <mkc_imp.conf-cleanup.mk> | |
5 | 8 | |
6 | 9 | _macro = SLIST SIMPLEQ STAILQ LIST TAILQ TAILQ |
7 | 10 | |
10 | 13 | _macro.${m} = 1 |
11 | 14 | .endfor |
12 | 15 | |
13 | MKC_NOAUTO.orig := ${MKC_NOAUTO} | |
14 | MKC_NOAUTO = 1 | |
15 | ||
16 | .include <mkc.configure.mk> | |
16 | .include <mkc_imp.conf-cleanup.mk> | |
17 | 17 | |
18 | 18 | .for f in ${MKC_FEATURES} |
19 | 19 | .if defined(_macro.${f}) && !${HAVE_DEFINE.${m}_ENTRY.sys/queue.h:U0} |
29 | 29 | .undef _macro.${m} |
30 | 30 | .endfor |
31 | 31 | |
32 | MKC_NOAUTO := ${MKC_NOAUTO.orig} | |
33 | ||
34 | 32 | .undef bad |
35 | 33 | .undef _macro |
36 | .undef MKC_NOAUTO.orig | |
34 | ||
35 | .endif # _MKC_IMP_F_SYSQUEUE_MK |
0 | # Copyright (c) 2014 by Aleksey Cheusov | |
1 | # | |
2 | # See LICENSE file in the distribution. | |
3 | ############################################################ | |
4 | .ifndef _MKC_IMP_F_ERR_MK | |
5 | _MKC_IMP_F_ERR_MK := 1 | |
6 | ||
7 | .include <mkc_imp.f_progname.mk> | |
8 | ||
9 | .include <mkc_imp.conf-cleanup.mk> | |
10 | ||
11 | MKC_CHECK_HEADERS += err.h | |
12 | MKC_CHECK_FUNCLIBS += err errx verr verrx | |
13 | MKC_CHECK_FUNCS3 += err:err.h errx:err.h verr:err.h verrx:err.h | |
14 | ||
15 | .include <mkc_imp.conf-cleanup.mk> | |
16 | ||
17 | .if ${HAVE_FUNCLIB.err:U0} && ${HAVE_FUNCLIB.errx:U0} && \ | |
18 | ${HAVE_FUNCLIB.verr:U0} && ${HAVE_FUNCLIB.verrx:U0} && \ | |
19 | ${HAVE_FUNC3.err.err_h:U0} && ${HAVE_FUNC3.errx.err_h:U0} && \ | |
20 | ${HAVE_FUNC3.verr.err_h:U0} && ${HAVE_FUNC3.verrx.err_h:U0} | |
21 | CFLAGS += -DMKC_ERR_IS_FINE | |
22 | .else | |
23 | MKC_SRCS += ${FEATURESDIR}/err/err.c | |
24 | .endif | |
25 | ||
26 | .include <mkc_imp.conf-final.mk> | |
27 | ||
28 | .endif #_MKC_IMP_F_ERR_MK |
0 | # Copyright (c) 2014 by Aleksey Cheusov | |
1 | # | |
2 | # See LICENSE file in the distribution. | |
3 | .ifndef _MKC_IMP.F_FGETLN_MK | |
4 | _MKC_IMP.F_FGETLN_MK := 1 | |
5 | ||
6 | .include <mkc_imp.f_getline.mk> | |
7 | ||
8 | MKC_SOURCE_FUNCLIBS += fgetln | |
9 | MKC_SOURCE_DIR.fgetln.c = ${FEATURESDIR}/fgetln | |
10 | MKC_CHECK_FUNCS3 += fgetln:stdio.h | |
11 | ||
12 | .endif # _MKC_IMP.F_FGETLN_MK |
0 | 0 | # Copyright (c) 2014 by Aleksey Cheusov |
1 | 1 | # |
2 | 2 | # See LICENSE file in the distribution. |
3 | .ifndef _MKC_IMP.F_GETLINE_MK | |
4 | _MKC_IMP.F_GETLINE_MK := 1 | |
3 | 5 | |
4 | 6 | MKC_SOURCE_FUNCLIBS += getline |
5 | 7 | MKC_SOURCE_DIR.getline.c = ${FEATURESDIR}/getline |
6 | 8 | MKC_CHECK_FUNCS3 += getline:stdio.h |
9 | ||
10 | .endif # _MKC_IMP.F_GETLINE_MK |
0 | 0 | # Copyright (c) 2014 by Aleksey Cheusov |
1 | 1 | # |
2 | 2 | # See LICENSE file in the distribution. |
3 | .ifndef _MKC_IMP_F_LIBDL_MK | |
4 | _MKC_IMP_F_LIBDL_MK := 1 | |
3 | 5 | |
4 | 6 | MKC_COMMON_DEFINES += -D_GNU_SOURCE |
5 | 7 | |
6 | 8 | MKC_REQUIRE_FUNCLIBS += dlopen:dl |
7 | 9 | MKC_REQUIRE_FUNCS2 += dlopen:dlfcn.h |
10 | ||
11 | .endif # _MKC_IMP_F_LIBDL_MK |
0 | 0 | # Copyright (c) 2014 by Aleksey Cheusov |
1 | 1 | # |
2 | 2 | # See LICENSE file in the distribution. |
3 | .ifndef _MKC_IMP_F_LIBM_MK | |
4 | _MKC_IMP_F_LIBM_MK := 1 | |
3 | 5 | |
4 | 6 | MKC_CHECK_FUNCLIBS += sqrt:m |
7 | ||
8 | .endif #_MKC_IMP_F_LIBM_MK |
0 | # Copyright (c) 2014 by Aleksey Cheusov | |
1 | # | |
2 | # See LICENSE file in the distribution. | |
3 | ############################################################ | |
4 | .ifndef _MKC_IMP.F_PROGNAME_MK | |
5 | _MKC_IMP.F_PROGNAME_MK := 1 | |
6 | ||
7 | MKC_COMMON_DEFINES += -D_GNU_SOURCE | |
8 | ||
9 | MKC_CHECK_FUNCLIBS += getprogname setprogname | |
10 | MKC_CHECK_FUNCS0 += getprogname:stdlib.h getexecname:stdlib.h | |
11 | MKC_CHECK_FUNCS1 += setprogname:stdlib.h | |
12 | MKC_CHECK_VARS += program_invocation_short_name:errno.h | |
13 | ||
14 | .include <mkc_imp.conf-cleanup.mk> | |
15 | ||
16 | .if ${HAVE_FUNCLIB.getprogname:U0} && \ | |
17 | ${HAVE_FUNCLIB.setprogname:U0} && \ | |
18 | ${HAVE_FUNC0.getprogname.stdlib_h:U0} && \ | |
19 | ${HAVE_FUNC1.setprogname.stdlib_h:U0} | |
20 | CFLAGS += -DMKC_PROGNAME_IS_FINE | |
21 | .else | |
22 | MKC_SRCS += ${FEATURESDIR}/progname/progname.c | |
23 | .endif | |
24 | ||
25 | .include <mkc_imp.conf-final.mk> | |
26 | ||
27 | .endif # _MKC_IMP.F_PROGNAME_MK |
0 | 0 | # Copyright (c) 2014 by Aleksey Cheusov |
1 | 1 | # |
2 | 2 | # See LICENSE file in the distribution. |
3 | .ifndef _MKC_IMP_F_STRLCAT_MK | |
4 | _MKC_IMP_F_STRLCAT_MK := 1 | |
3 | 5 | |
4 | 6 | MKC_SOURCE_FUNCLIBS += strlcat |
5 | 7 | MKC_SOURCE_DIR.strlcat.c = ${FEATURESDIR}/strlcat |
6 | 8 | MKC_CHECK_FUNCS3 += strlcat:string.h |
9 | ||
10 | .endif # _MKC_IMP_F_STRLCAT_MK |
0 | 0 | # Copyright (c) 2014 by Aleksey Cheusov |
1 | 1 | # |
2 | 2 | # See LICENSE file in the distribution. |
3 | .ifndef _MKC_IMP_F_STRLCPY_MK | |
4 | _MKC_IMP_F_STRLCPY_MK := 1 | |
3 | 5 | |
4 | 6 | MKC_SOURCE_FUNCLIBS += strlcpy |
5 | 7 | MKC_SOURCE_DIR.strlcpy.c = ${FEATURESDIR}/strlcpy |
6 | 8 | MKC_CHECK_FUNCS3 += strlcpy:string.h |
9 | ||
10 | .endif #_MKC_IMP_F_STRLCPY_MK |
0 | # Copyright (c) 2014 by Aleksey Cheusov | |
1 | # | |
2 | # See LICENSE file in the distribution. | |
3 | ############################################################ | |
4 | .ifndef _MKC_IMP_F_WARN_MK | |
5 | _MKC_IMP_F_WARN_MK := 1 | |
6 | ||
7 | .include <mkc_imp.f_progname.mk> | |
8 | ||
9 | .include <mkc_imp.conf-cleanup.mk> | |
10 | ||
11 | MKC_CHECK_HEADERS += err.h | |
12 | MKC_CHECK_FUNCLIBS += warn warnx vwarn vwarnx | |
13 | MKC_CHECK_FUNCS2 += warn:err.h warnx:err.h vwarn:err.h vwarnx:err.h | |
14 | ||
15 | .include <mkc_imp.conf-cleanup.mk> | |
16 | ||
17 | .if ${HAVE_FUNCLIB.warn:U0} && ${HAVE_FUNCLIB.warnx:U0} && \ | |
18 | ${HAVE_FUNCLIB.vwarn:U0} && ${HAVE_FUNCLIB.vwarnx:U0} && \ | |
19 | ${HAVE_FUNC2.warn.err_h:U0} && ${HAVE_FUNC2.warnx.err_h:U0} && \ | |
20 | ${HAVE_FUNC2.vwarn.err_h:U0} && ${HAVE_FUNC2.vwarnx.err_h:U0} | |
21 | CFLAGS += -DMKC_WARN_IS_FINE | |
22 | .else | |
23 | MKC_SRCS += ${FEATURESDIR}/warn/warn.c | |
24 | .endif | |
25 | ||
26 | .include <mkc_imp.conf-final.mk> | |
27 | ||
28 | .endif # _MKC_IMP_F_WARN_MK |
0 | /********************************************************************\ | |
1 | Copyright (c) 2014 by Aleksey Cheusov | |
2 | ||
3 | See LICENSE file in the distribution. | |
4 | \********************************************************************/ | |
5 | ||
6 | #ifndef _MKC_PROGNAME_H_ | |
7 | #define _MKC_PROGNAME_H_ | |
8 | ||
9 | #ifdef MKC_PROGNAME_IS_FINE | |
10 | ||
11 | #include <stdlib.h> | |
12 | ||
13 | #else | |
14 | ||
15 | #if !HAVE_FUNC1_SETPROGNAME_STDLIB_H | |
16 | void setprogname (const char *progname); | |
17 | #endif | |
18 | ||
19 | #if !HAVE_FUNC0_GETPROGNAME_STDLIB_H | |
20 | const char * getprogname (void); | |
21 | #endif | |
22 | ||
23 | #endif /* MKC_PROGNAME_IS_FINE */ | |
24 | ||
25 | #endif // _MKC_PROGNAME_H_ |
0 | /********************************************************************\ | |
1 | Copyright (c) 2014 by Aleksey Cheusov | |
2 | ||
3 | See LICENSE file in the distribution. | |
4 | \********************************************************************/ | |
5 | ||
6 | #ifndef _MKC_WARN_H_ | |
7 | #define _MKC_WARN_H_ | |
8 | ||
9 | #include <stdarg.h> | |
10 | ||
11 | #if HAVE_HEADER_ERR_H | |
12 | #include <err.h> | |
13 | #endif | |
14 | ||
15 | #ifdef MKC_WARN_IS_FINE | |
16 | ||
17 | #include <err.h> | |
18 | ||
19 | #else | |
20 | #if !HAVE_FUNC2_WARN_ERR_H | |
21 | void warn (const char *, ...); | |
22 | #endif | |
23 | #if !HAVE_FUNC2_WARNX_ERR_H | |
24 | void warnx (const char *, ...); | |
25 | #endif | |
26 | #if !HAVE_FUNC2_VWARN_ERR_H | |
27 | void vwarn (const char *, va_list); | |
28 | #endif | |
29 | #if !HAVE_FUNC2_VWARNX_ERR_H | |
30 | void vwarnx (const char *, va_list); | |
31 | #endif | |
32 | ||
33 | #endif /* MKC_WARN_IS_FINE */ | |
34 | ||
35 | #endif // _MKC_WARN_H_ |
0 | /* | |
1 | * Copyright (c) 2014 by Aleksey Cheusov | |
2 | * See LICENSE file in the distribution. | |
3 | */ | |
4 | ||
5 | #include <string.h> | |
6 | #include <stdlib.h> | |
7 | #include <errno.h> | |
8 | ||
9 | #include <mkc_progname.h> | |
10 | ||
11 | static const char *__prog = NULL; | |
12 | ||
13 | const char * getprogname (void) | |
14 | { | |
15 | if (__prog) | |
16 | return __prog; | |
17 | ||
18 | #ifdef HAVE_FUNC0_GETEXECNAME_STDLIB_H | |
19 | /* SunOS */ | |
20 | setprogname (getexecname ()); | |
21 | return getprogname (); | |
22 | #elif defined(HAVE_VAR_PROGRAM_INVOCATION_SHORT_NAME_ERRNO_H) | |
23 | return program_invocation_short_name; | |
24 | #else | |
25 | return "<unset_progname>"; | |
26 | #endif | |
27 | } | |
28 | ||
29 | void setprogname (const char *progname) | |
30 | { | |
31 | const char *s = strrchr (progname, '/'); | |
32 | __prog = progname; | |
33 | ||
34 | if (s) | |
35 | __prog = s + 1; | |
36 | } |
0 | /* $NetBSD: warn.c,v 1.4 2004/08/23 03:32:12 jlam Exp $ */ | |
1 | ||
2 | /* | |
3 | * Copyright 1997-2000 Luke Mewburn <lukem@netbsd.org>. | |
4 | * Copyright 2014 Aleksey Cheusov <vle@gmx.net>. | |
5 | * All rights reserved. | |
6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | |
15 | * 3. The name of the author may not be used to endorse or promote products | |
16 | * derived from this software without specific prior written permission. | |
17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |
24 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | |
26 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | |
27 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
28 | */ | |
29 | ||
30 | #include <stdarg.h> | |
31 | #include <stdlib.h> | |
32 | #include <string.h> | |
33 | #include <stdio.h> | |
34 | #include <errno.h> | |
35 | ||
36 | #include <mkc_progname.h> | |
37 | #include <mkc_warn.h> | |
38 | ||
39 | #if !HAVE_FUNC2_WARN_ERR_H | |
40 | void warn (const char *fmt, ...) | |
41 | { | |
42 | va_list ap; | |
43 | int sverrno; | |
44 | ||
45 | sverrno = errno; | |
46 | fprintf (stderr, "%s: ", getprogname ()); | |
47 | va_start (ap, fmt); | |
48 | if (fmt != NULL) { | |
49 | vfprintf (stderr, fmt, ap); | |
50 | fprintf (stderr, ": "); | |
51 | } | |
52 | va_end (ap); | |
53 | fprintf (stderr, "%s\n", strerror (sverrno)); | |
54 | } | |
55 | #endif | |
56 | ||
57 | #if !HAVE_FUNC2_WARNX_ERR_H | |
58 | void warnx (const char *fmt, ...) | |
59 | { | |
60 | va_list ap; | |
61 | ||
62 | fprintf (stderr, "%s: ", getprogname ()); | |
63 | va_start (ap, fmt); | |
64 | if (fmt != NULL) | |
65 | vfprintf (stderr, fmt, ap); | |
66 | va_end (ap); | |
67 | fprintf (stderr, "\n"); | |
68 | } | |
69 | #endif | |
70 | ||
71 | #if !HAVE_FUNC2_VWARN_ERR_H | |
72 | void vwarn (const char *fmt, va_list ap) | |
73 | { | |
74 | int sverrno; | |
75 | ||
76 | sverrno = errno; | |
77 | fprintf (stderr, "%s: ", getprogname ()); | |
78 | if (fmt != NULL) { | |
79 | vfprintf (stderr, fmt, ap); | |
80 | fprintf (stderr, ": "); | |
81 | } | |
82 | fprintf (stderr, "%s\n", strerror (sverrno)); | |
83 | } | |
84 | #endif | |
85 | ||
86 | #if !HAVE_FUNC2_VWARNX_ERR_H | |
87 | void vwarnx (const char *fmt, va_list ap) | |
88 | { | |
89 | fprintf (stderr, "%s: ", getprogname ()); | |
90 | if (fmt != NULL) | |
91 | vfprintf (stderr, fmt, ap); | |
92 | fprintf (stderr, "\n"); | |
93 | } | |
94 | #endif |
0 | SCRIPTS = mkc_test_helper | |
0 | SCRIPTS = mkc_test_helper ${INSCRIPTS} | |
1 | INSCRIPTS = mkc_long_lines | |
1 | 2 | |
2 | 3 | .include <mkc.mk> |
0 | #!@AWK@ -f | |
1 | ||
2 | ############################################################ | |
3 | # Copyright (c) 2014 by Aleksey Cheusov | |
4 | # | |
5 | # See LICENSE file in the distribution. | |
6 | ############################################################ | |
7 | ||
8 | # processes backslash in the end of line | |
9 | ||
10 | /\\$/ { | |
11 | printf "%s", substr($0, 1, length($0)-1) | |
12 | next | |
13 | } | |
14 | { | |
15 | ||
16 | } |
0 | #!/bin/sh | |
1 | ||
2 | : ${OPSYS:=`uname -s`} | |
3 | : ${NM:=nm} | |
4 | ||
5 | case ${OPSYS} in | |
6 | *BSD|DragonFly) | |
7 | ${NM} "$@" | | |
8 | grep -Ev 'fini|init' | | |
9 | awk '$2=="T" {print "symbol " $3}' | |
10 | ;; | |
11 | SunOS) | |
12 | ${NM} -P "$@" | | |
13 | grep -Ev 'fini|init' | | |
14 | awk 'NF==4 && $2=="T" {print "symbol " $1}' | |
15 | ;; | |
16 | Linux) | |
17 | ${NM} "$@" | | |
18 | grep -Ev 'fini|init' | | |
19 | awk 'NF==3 && $2 ~ /^[DT]$/ {print "symbol " $3}' | |
20 | ;; | |
21 | esac |
0 | # Copyright (c) 2014 by Aleksey Cheusov | |
1 | # | |
2 | # See LICENSE file in the distribution. | |
3 | ############################################################ | |
4 | ||
0 | 5 | .sinclude "cheusov_local_settings.mk" # for debugging |
1 | 6 | |
2 | 7 | ################################################## |
3 | SUBPRJ_DFLT = custom helpers mk scripts features | |
4 | SUBPRJ = examples doc presentation ${SUBPRJ_DFLT} | |
8 | SUBPRJ_DFLT = builtins helpers mk scripts features doc | |
9 | SUBPRJ = examples presentation ${SUBPRJ_DFLT} | |
5 | 10 | |
6 | 11 | tests = configure_test mkinstall mkshlib mkstaticlib mkpiclib \ |
7 | 12 | mkprofilelib mkdll pkg_config_0 pkg_config_1 pkg_config_1_1 pkg_config_2 \ |
8 | 13 | lua_dirs rec_makefiles reqd reqd2 reqd3 reqd4 reqd_clean_cache \ |
9 | 14 | intexts_cleantrg require_prototype test_subprj_dash test_mkc_vs_PROG \ |
10 | 15 | test_mkc_vs_LIB test_mkc_vs_SUBDIR test_mkc_vs_SUBPRJ endianess \ |
11 | create_cachedir sys_queue predopost_targets | |
16 | create_cachedir sys_queue predopost_targets FSRCDIR | |
12 | 17 | .for t in ${tests} |
13 | 18 | SUBPRJ += tests/${t}:tests |
14 | 19 | .endfor |
19 | 24 | hello_strlcpy3 hello_customtests hello_customtests2 hello_requirements \ |
20 | 25 | hello_iconv hello_cxx hello_cxxlib hello_dictd hello_lua hello_lua2 \ |
21 | 26 | hello_lua3 hello_superfs hello_xxzip hello_progs hello_progs2 tools \ |
22 | tools2 pkgconfig3 hello_SLIST hello_RBTREE # hello_require_tools | |
27 | tools2 pkgconfig3 hello_SLIST hello_RBTREE hello_errwarn hello_fgetln \ | |
28 | hello_autotools hello_autoconf hello_libdeps hello_compatlib \ | |
29 | hello_require_tools | |
23 | 30 | .for t in ${examples} |
24 | 31 | SUBPRJ += examples/${t}:tests |
25 | 32 | .endfor |
35 | 42 | DIST_TARGETS = pdf clean-mk clean-scripts mkc_clean |
36 | 43 | |
37 | 44 | INSTALL = ${.CURDIR}/scripts/mkc_install |
38 | PATH := ${OBJDIR_custom}:${OBJDIR_helpers}:${.CURDIR}/helpers:${OBJDIR_scripts}:${.CURDIR}/scripts:${PATH} | |
45 | PATH := ${OBJDIR_builtins}:${OBJDIR_helpers}:${.CURDIR}/helpers:${OBJDIR_scripts}:${.CURDIR}/scripts:${PATH} | |
39 | 46 | |
40 | 47 | .export SHRTOUT INSTALL PATH |
41 | 48 |
0 | FILES = sys.mk mkc.configure.mk configure.mk mkc.mk \ | |
1 | mkc.init.mk mkc_imp.intexts.mk mkc_imp.mk \ | |
2 | mkc.minitest.mk mkc_imp.pkg-config.mk \ | |
0 | FILES = sys.mk mkc.configure.mk mkc_imp.conf.mk mkc_imp.conf-cleanup.mk \ | |
1 | mkc.mk mkc.init.mk mkc_imp.intexts.mk mkc_imp.mk \ | |
2 | mkc.minitest.mk mkc_imp.pkg-config.mk mkc_imp.dpvars.mk \ | |
3 | 3 | mkc_imp.files.mk mkc_imp.inc.mk mkc_imp.info.mk mkc_imp.lib.mk \ |
4 | 4 | mkc_imp.links.mk mkc_imp.man.mk mkc_imp.prog.mk \ |
5 | 5 | mkc_imp.subprj.mk mkc_imp.conf-final.mk mkc_imp.rules.mk \ |
16 | 16 | ################################################# |
17 | 17 | .for i in prog_mkdep prog_nbmkdep |
18 | 18 | MKC_CHECK_CUSTOM += ${i} |
19 | MKC_CUSTOM_FN.${i} = ${.CURDIR}/../custom/${i} | |
19 | MKC_CUSTOM_FN.${i} = ${.CURDIR}/../builtins/${i} | |
20 | 20 | .endfor |
21 | 21 | |
22 | 22 | MKC_CHECK_PROGS += makedepend |
37 | 37 | MKC_ERR_MSG += "mkdep(1) cannot be found" |
38 | 38 | .endif |
39 | 39 | |
40 | .if exists(/usr/xpg4/bin/nm) | |
41 | PROG.nm ?= /usr/xpg4/bin/nm | |
42 | .else | |
43 | MKC_REQUIRE_PROGS += nm | |
44 | .endif | |
45 | ||
40 | 46 | makedepend_cmd ?= makedepend |
41 | 47 | |
42 | 48 | INTEXTS_REPLS += mkdep_cmd ${mkdep_cmd} |
43 | 49 | INTEXTS_REPLS += makedepend_cmd ${makedepend_cmd} |
44 | 50 | INTEXTS_REPLS += mkdep_type ${mkdep_type} |
45 | 51 | INTEXTS_REPLS += featuresdir ${FEATURESDIR} |
52 | INTEXTS_REPLS += NM ${PROG.nm} | |
46 | 53 | |
47 | 54 | ################################################# |
48 | 55 | .include <mkc.mk> |
0 | # Copyright (c) 2009-2013, Aleksey Cheusov <vle@gmx.net> | |
1 | # All rights reserved. | |
2 | # | |
3 | # Redistribution and use in source and binary forms, with or without | |
4 | # modification, are permitted provided that the following conditions | |
5 | # are met: | |
6 | # 1. Redistributions of source code must retain the above copyright | |
7 | # notice, this list of conditions and the following disclaimer. | |
8 | # 2. Redistributions in binary form must reproduce the above copyright | |
9 | # notice, this list of conditions and the following disclaimer in the | |
10 | # documentation and/or other materials provided with the distribution. | |
11 | # | |
12 | # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
13 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
14 | # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
15 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
16 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
17 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
18 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
19 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
20 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
21 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
22 | # POSSIBILITY OF SUCH DAMAGE. | |
23 | ||
24 | ###################################################################### | |
25 | # See mk-configure(7) for documentation | |
26 | # | |
27 | ||
28 | # user defined variables | |
29 | MKC_SHOW_CACHED ?= 0 # set it to `1' to show "...(cached)..." lines | |
30 | MKC_DELETE_TMPFILES ?= 0 # set it to `1' to delete temporary files | |
31 | MKC_CACHEDIR ?= ${.OBJDIR} # directory for cache and intermediate files | |
32 | MKC_COMMON_HEADERS ?= # list of headers always #included | |
33 | MKC_NOCACHE ?= # 1 or yes for disabling cache | |
34 | MKC_CUSTOM_DIR ?=${.CURDIR} # directory with custom tests.c | |
35 | MKC_SOURCE_DIR ?=${.CURDIR} # directory with missing strlcat.c etc. | |
36 | ||
37 | # | |
38 | MKC_SOURCE_FUNCLIBS ?= | |
39 | _MKC_SOURCE_FUNCS = ${MKC_SOURCE_FUNCLIBS:C/:.*//} | |
40 | ||
41 | # .endif for the next .if is in the end of file | |
42 | .if ${MKCHECKS:Uno:tl} == "yes" | |
43 | ||
44 | HAVE_FUNCLIB.main ?= 1 | |
45 | ||
46 | .if defined(MKC_COMMON_DEFINES.${TARGET_OPSYS}) | |
47 | CPPFLAGS += ${MKC_COMMON_DEFINES.${TARGET_OPSYS}} | |
48 | .endif | |
49 | .if defined(MKC_COMMON_DEFINES) | |
50 | CPPFLAGS += ${MKC_COMMON_DEFINES} | |
51 | .endif | |
52 | ||
53 | # | |
54 | _MKC_CPPFLAGS := ${CPPFLAGS} | |
55 | _MKC_CFLAGS := ${CFLAGS} | |
56 | _MKC_CXXFLAGS := ${CXXFLAGS} | |
57 | _MKC_FFLAGS := ${FFLAGS} | |
58 | _MKC_LDFLAGS := ${LDFLAGS} | |
59 | _MKC_LDADD := ${LDADD} | |
60 | ||
61 | mkc.environ=CC='${CC}' CXX='${CXX}' FC='${FC}' CPPFLAGS='${_MKC_CPPFLAGS}' CFLAGS='${_MKC_CFLAGS}' CXXFLAGS='${_MKC_CXXFLAGS}' FFLAGS='${_MKC_FFLAGS}' LDFLAGS='${_MKC_LDFLAGS}' LDADD='${_MKC_LDADD}' LEX='${LEX}' YACC='${YACC}' MKC_CACHEDIR='${MKC_CACHEDIR}' MKC_COMMON_HEADERS='${MKC_COMMON_HEADERS}' MKC_DELETE_TMPFILES='${MKC_DELETE_TMPFILES}' MKC_SHOW_CACHED='${MKC_SHOW_CACHED}' MKC_NOCACHE='${MKC_NOCACHE}' MKC_VERBOSE=1 | |
62 | ||
63 | ###################################################### | |
64 | # checking for builtin checks | |
65 | .for i in ${MKC_CHECK_BUILTINS} ${MKC_REQUIRE_BUILTINS} | |
66 | MKC_CUSTOM_FN.${i} ?= ${BUILTINSDIR}/${i:S/endianess/endianness/} | |
67 | MKC_CHECK_CUSTOM += ${i} | |
68 | MKC_REQUIRE_CUSTOM += ${MKC_REQUIRE_BUILTINS:M${i}} | |
69 | .endfor | |
70 | ||
71 | ###################################################### | |
72 | # checking for headers | |
73 | .for h in ${MKC_CHECK_HEADERS} ${MKC_REQUIRE_HEADERS} | |
74 | .if !defined(HAVE_HEADER.${h:S|.|_|g:S|/|_|g}) | |
75 | HAVE_HEADER.${h:S|.|_|g:S|/|_|g} != env ${mkc.environ} mkc_check_header ${h} | |
76 | .endif | |
77 | .if ${HAVE_HEADER.${h:S|.|_|g:S|/|_|g}} | |
78 | .if empty(MKC_REQUIRE_HEADERS:U:M${h}) | |
79 | MKC_CFLAGS += -DHAVE_HEADER_${h:tu:S|.|_|g:S|/|_|g}=${HAVE_HEADER.${h:S|.|_|g:S|/|_|g}} | |
80 | .endif | |
81 | .elif !empty(MKC_REQUIRE_HEADERS:U:M${h}) | |
82 | _fake != env ${mkc.environ} mkc_check_header -d ${h} && echo | |
83 | MKC_ERR_MSG += "ERROR: cannot find header ${h}" | |
84 | .endif | |
85 | .endfor | |
86 | ||
87 | .undef MKC_CHECK_HEADERS | |
88 | .undef MKC_REQUIRE_HEADERS | |
89 | ||
90 | ###################################################### | |
91 | # checking for functions in libraries | |
92 | .for f in ${MKC_CHECK_FUNCLIBS:U} ${MKC_SOURCE_FUNCLIBS:U} ${MKC_REQUIRE_FUNCLIBS:U} | |
93 | .if !defined(HAVE_FUNCLIB.${f:S/:/./g}) | |
94 | HAVE_FUNCLIB.${f:S/:/./g} != env ${mkc.environ} mkc_check_funclib ${f:S/:/ /g} | |
95 | .endif | |
96 | .if !defined(HAVE_FUNCLIB.${f:C/:.*//}) | |
97 | HAVE_FUNCLIB.${f:C/:.*//} != env ${mkc.environ} mkc_check_funclib ${f:C/:.*//} | |
98 | .endif | |
99 | .if ${HAVE_FUNCLIB.${f:C/:.*//}} != ${HAVE_FUNCLIB.${f:S/:/./g}} | |
100 | .if empty(MKC_NOAUTO_FUNCLIBS:U:S/:/./g:M${f:S/:/./g}) && empty(MKC_NOAUTO_FUNCLIBS:U:M1) && ${HAVE_FUNCLIB.${f:S/:/./g}} && !${HAVE_FUNCLIB.${f:C/:.*//}} | |
101 | MKC_LDADD += -l${f:C/^.*://} | |
102 | .endif | |
103 | .endif | |
104 | .if !${HAVE_FUNCLIB.${f:S/:/./g}} && !${HAVE_FUNCLIB.${f:C/:.*//}} && !empty(_MKC_SOURCE_FUNCS:M${f:C/:.*//}) | |
105 | MKC_SRCS += ${MKC_SOURCE_DIR.${f:C/:.*//}.c:U${MKC_SOURCE_DIR}}/${f:C/:.*//}.c | |
106 | .endif | |
107 | .endfor # f | |
108 | ||
109 | .for f in ${MKC_REQUIRE_FUNCLIBS:U} | |
110 | .if !${HAVE_FUNCLIB.${f:S/:/./g}} && !${HAVE_FUNCLIB.${f:C/:.*//}} | |
111 | _fake != env ${mkc.environ} mkc_check_funclib -d ${f:C/:.*//} && echo | |
112 | _fake != env ${mkc.environ} mkc_check_funclib -d ${f:S/:/ /g} && echo | |
113 | MKC_ERR_MSG += "ERROR: cannot find function ${f}" | |
114 | .endif | |
115 | .endfor # f | |
116 | ||
117 | .undef MKC_CHECK_FUNCLIBS | |
118 | .undef MKC_REQUIRE_FUNCLIBS | |
119 | ||
120 | ###################################################### | |
121 | # checking for sizeof(xxx) | |
122 | .for t in ${MKC_CHECK_SIZEOF:U} | |
123 | .if !defined(SIZEOF.${t:S|.|_|g:S|-|_|g:S|*|P|g:S|/|_|g:S|:|.|g}) | |
124 | SIZEOF.${t:S|.|_|g:S|-|_|g:S|*|P|g:S|/|_|g:S|:|.|g} != env ${mkc.environ} mkc_check_sizeof ${t:S/:/ /g} | |
125 | .endif | |
126 | .if ${SIZEOF.${t:S|.|_|g:S|-|_|g:S|*|P|g:S|/|_|g:S|:|.|g}} != failed | |
127 | MKC_CFLAGS += -DSIZEOF_${t:S/-/_/g:S| |_|g:S|*|P|g:S|:|_|g:S|.|_|g:tu}=${SIZEOF.${t:S|.|_|g:S|-|_|g:S|*|P|g:S|/|_|g:S|:|.|g}} | |
128 | .endif | |
129 | .endfor | |
130 | ||
131 | .undef MKC_CHECK_SIZEOF | |
132 | ||
133 | ###################################################### | |
134 | # checking for declared #define | |
135 | .for d in ${MKC_CHECK_DEFINES:U} ${MKC_REQUIRE_DEFINES:U} | |
136 | .if !defined(HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g}) | |
137 | HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_decl define ${d:S/:/ /g} | |
138 | .endif | |
139 | .if ${HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g}} | |
140 | .if empty(MKC_REQUIRE_DEFINES:U:M${d}) | |
141 | MKC_CFLAGS += -DHAVE_DEFINE_${d:tu:S/:/_/g:S/./_/g:S|/|_|g}=1 | |
142 | .endif | |
143 | .endif | |
144 | .endfor | |
145 | ||
146 | .for d in ${MKC_REQUIRE_DEFINES:U} | |
147 | .if !${HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g}} | |
148 | _fake != env ${mkc.environ} mkc_check_decl -d define ${d:S/:/ /g} && echo | |
149 | MKC_ERR_MSG += "ERROR: cannot find declaration of define ${d}" | |
150 | .endif | |
151 | .endfor | |
152 | ||
153 | .undef MKC_CHECK_DEFINES | |
154 | .undef MKC_REQUIRE_DEFINES | |
155 | ||
156 | ###################################################### | |
157 | # checking for declared type | |
158 | .for t in ${MKC_CHECK_TYPES:U} ${MKC_REQUIRE_TYPES:U} | |
159 | .if !defined(HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g}) | |
160 | HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_decl type ${t:S/:/ /g} | |
161 | .endif | |
162 | .if ${HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g}} | |
163 | .if empty(MKC_REQUIRE_TYPES:U:M${t}) | |
164 | MKC_CFLAGS += -DHAVE_TYPE_${t:tu:S/:/_/g:S/./_/g:S|/|_|g}=1 | |
165 | .endif | |
166 | .endif | |
167 | .endfor | |
168 | ||
169 | .for t in ${MKC_REQUIRE_TYPES:U} | |
170 | .if !${HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g}} | |
171 | _fake != env ${mkc.environ} mkc_check_decl -d type ${t:S/:/ /g} && echo | |
172 | MKC_ERR_MSG += "ERROR: cannot find declaration of type ${t}" | |
173 | .endif | |
174 | .endfor | |
175 | ||
176 | .undef MKC_CHECK_TYPES | |
177 | .undef MKC_REQUIRE_TYPES | |
178 | ||
179 | ###################################################### | |
180 | # checking for declared variables | |
181 | .for d in ${MKC_CHECK_VARS:U} ${MKC_REQUIRE_VARS:U} | |
182 | .if !defined(HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g}) | |
183 | HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_decl variable ${d:S/:/ /g} | |
184 | .endif | |
185 | .if ${HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g}} | |
186 | .if empty(MKC_REQUIRE_VARS:U:M${d}) | |
187 | MKC_CFLAGS += -DHAVE_VAR_${d:tu:S/:/_/g:S/./_/g:S|/|_|g}=1 | |
188 | .endif | |
189 | .endif | |
190 | .endfor | |
191 | ||
192 | .for d in ${MKC_REQUIRE_VARS:U} | |
193 | .if !${HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g}} | |
194 | _fake != env ${mkc.environ} mkc_check_decl -d variable ${d:S/:/ /g} && echo | |
195 | MKC_ERR_MSG += "ERROR: cannot find declaration of variable ${d}" | |
196 | .endif | |
197 | .endfor | |
198 | ||
199 | .undef MKC_CHECK_VARS | |
200 | .undef MKC_REQUIRE_VARS | |
201 | ||
202 | ###################################################### | |
203 | # checking for struct members | |
204 | .for m in ${MKC_CHECK_MEMBERS:U} ${MKC_REQUIRE_MEMBERS:U} | |
205 | .if !defined(HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g}) | |
206 | HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g} != env ${mkc.environ} mkc_check_decl member ${m:S/:/ /g} | |
207 | .endif | |
208 | .if ${HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g}} | |
209 | .if empty(MKC_REQUIRE_MEMBERS:U:M${m}) | |
210 | MKC_CFLAGS += -DHAVE_MEMBER_${m:tu:S/:/_/g:S/./_/g:S|/|_|g:S/-/_/g}=1 | |
211 | .endif | |
212 | .endif | |
213 | .endfor | |
214 | ||
215 | .for m in ${MKC_REQUIRE_MEMBERS:U} | |
216 | .if !${HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g}} | |
217 | _fake != env ${mkc.environ} mkc_check_decl -d member ${m:S/:/ /g} && echo | |
218 | MKC_ERR_MSG += "ERROR: cannot find member ${m}" | |
219 | .endif | |
220 | .endfor | |
221 | ||
222 | .undef MKC_CHECK_MEMBERS | |
223 | .undef MKC_REQUIRE_MEMBERS | |
224 | ||
225 | ###################################################### | |
226 | # checking for declared functions | |
227 | .for n in 0 1 2 3 4 5 6 7 8 9 | |
228 | ||
229 | .for d in ${MKC_CHECK_FUNCS${n}:U} ${MKC_REQUIRE_FUNCS${n}:U} | |
230 | .if !defined(HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g}) | |
231 | HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_decl func${n} ${d:S/:/ /g} | |
232 | .endif | |
233 | .if ${HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g}} | |
234 | .if empty(MKC_REQUIRE_FUNCS${n}:U:M${d}) | |
235 | MKC_CFLAGS += -DHAVE_FUNC${n}_${d:tu:S/:/_/g:S/./_/g:S|/|_|g}=1 | |
236 | .endif | |
237 | .endif | |
238 | .endfor # d | |
239 | ||
240 | .for d in ${MKC_REQUIRE_FUNCS${n}:U} | |
241 | .if !${HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g}} | |
242 | _fake != env ${mkc.environ} mkc_check_decl -d func${n} ${d:S/:/ /g} && echo | |
243 | MKC_ERR_MSG += "ERROR: cannot find declaration of function ${d}" | |
244 | .endif | |
245 | .endfor # d | |
246 | ||
247 | MKC_CHECK_FUNCS${n} := # workaround for buggy bmake-20110606 | |
248 | MKC_REQUIRE_FUNCS${n} := # workaround for buggy bmake-20110606 | |
249 | ||
250 | .undef MKC_CHECK_FUNCS${n} | |
251 | .undef MKC_REQUIRE_FUNCS${n} | |
252 | ||
253 | .endfor # n | |
254 | ||
255 | ###################################################### | |
256 | # custom checks | |
257 | .for c in ${MKC_CHECK_CUSTOM} ${MKC_REQUIRE_CUSTOM} | |
258 | .if !defined(CUSTOM.${c}) | |
259 | .if !defined(MKC_CUSTOM_FN.${c}) | |
260 | MKC_CUSTOM_FN.${c} = ${c}.c | |
261 | .endif | |
262 | .if empty(MKC_CUSTOM_FN.${c}:M/*) | |
263 | MKC_CUSTOM_FN.${c} := ${MKC_CUSTOM_DIR}/${MKC_CUSTOM_FN.${c}} | |
264 | .endif | |
265 | .if ${c} == "endianess" | |
266 | .warning "endianess test deprecated; use endianness instead" | |
267 | .endif | |
268 | CUSTOM.${c} != env ${mkc.environ} mkc_check_custom ${MKC_CUSTOM_FN.${c}} | |
269 | .endif | |
270 | .if !empty(CUSTOM.${c}) && ${CUSTOM.${c}} != 0 | |
271 | .if empty(MKC_REQUIRE_CUSTOM:U:M${c}) | |
272 | MKC_CFLAGS += -DCUSTOM_${c:tu}=${CUSTOM.${c}} | |
273 | .endif | |
274 | .endif | |
275 | .endfor | |
276 | ||
277 | .for c in ${MKC_REQUIRE_CUSTOM} | |
278 | .if empty(CUSTOM.${c}) || ${CUSTOM.${c}} == 0 | |
279 | _fake != env ${mkc.environ} mkc_check_custom -d ${MKC_CUSTOM_FN.${c}} && echo | |
280 | MKC_ERR_MSG += "ERROR: custom test ${c} failed" | |
281 | .endif | |
282 | .endfor | |
283 | ||
284 | .for c in ${MKC_CHECK_BUILTINS} | |
285 | BUILTIN.${c} = ${CUSTOM.${c}} | |
286 | .endfor | |
287 | ||
288 | ###################################################### | |
289 | # checking for programs | |
290 | .for p in ${MKC_CHECK_PROGS} ${MKC_REQUIRE_PROGS} | |
291 | p_ := ${p} | |
292 | prog_id := ${MKC_PROG.id.${p:S|+|x|g}:U${p}:S|/|_|g} | |
293 | .ifdef PROG.${prog_id} | |
294 | .elif !empty(p_:M/*) | |
295 | PROG.${prog_id} = ${p} | |
296 | .else | |
297 | PROG.${prog_id} != env ${mkc.environ} mkc_check_prog -i '${prog_id}' '${p}' | |
298 | .endif # !defined(PROG.${prog_id}) | |
299 | .ifndef HAVE_PROG.${prog_id} | |
300 | .if !empty(PROG.${prog_id}) && exists(${PROG.${prog_id}}) | |
301 | HAVE_PROG.${prog_id} = 1 | |
302 | .else | |
303 | HAVE_PROG.${prog_id} = 0 | |
304 | .endif | |
305 | .endif # ifndef HAVE_PROG.${prog_id} | |
306 | ||
307 | .if !${HAVE_PROG.${prog_id}} && !empty(MKC_REQUIRE_PROGS:U1:M${p}) | |
308 | _fake != env ${mkc.environ} mkc_check_prog -d -i '${prog_id}' '${p}' && echo | |
309 | MKC_ERR_MSG += "ERROR: cannot find program ${p}" | |
310 | .endif | |
311 | .endfor # p | |
312 | ||
313 | .undef MKC_CHECK_PROGS | |
314 | .undef MKC_REQUIRE_PROGS | |
315 | ||
316 | .undef MKC_CHECK_CUSTOM | |
317 | .undef MKC_REQUIRE_CUSTOM | |
318 | ||
319 | ###################################################### | |
320 | # prototype checks | |
321 | .for p in ${MKC_CHECK_PROTOTYPES} ${MKC_REQUIRE_PROTOTYPES} | |
322 | .if !defined(HAVE_PROTOTYPE.${p}) | |
323 | HAVE_PROTOTYPE.${p} != env ${mkc.environ} mkc_check_decl prototype \ | |
324 | ${MKC_PROTOTYPE_FUNC.${p}:Q} ${MKC_PROTOTYPE_HEADERS.${p}} | |
325 | .endif # !defined(HAVE_PROTOTYPE.${p}) | |
326 | .if ${HAVE_PROTOTYPE.${p}} | |
327 | MKC_CFLAGS += -DHAVE_PROTOTYPE_${p:tu}=1 | |
328 | .elif !empty(MKC_REQUIRE_PROTOTYPES:U:M${p}) | |
329 | _fake != env ${mkc.environ} mkc_check_decl -d prototype \ | |
330 | ${MKC_PROTOTYPE_FUNC.${p}:Q} ${MKC_PROTOTYPE_HEADERS.${p}}; echo | |
331 | MKC_ERR_MSG += "ERROR: prototype test ${p} failed" | |
332 | .endif # ${PROTOTYPE.${p}} | |
333 | .endfor # p | |
334 | ||
335 | .undef MKC_CHECK_PROTOTYPES | |
336 | .undef MKC_REQUIRE_PROTOTYPES | |
337 | ||
338 | ###################################################### | |
339 | # final assignment | |
340 | .include <mkc_imp.conf-final.mk> | |
341 | ||
342 | .endif # MKCHECKS == yes | |
343 | ||
344 | ###################################################### | |
345 | ###################################################### | |
346 | ###################################################### | |
347 | .for i in ${_MKC_SOURCE_FUNCS} | |
348 | CLEANFILES += ${i}.o | |
349 | .endfor | |
350 | ||
351 | .undef MKC_SOURCE_FUNCLIBS |
5 | 5 | .include <mkc_imp.preinit.mk> |
6 | 6 | .include <mkc.init.mk> |
7 | 7 | |
8 | .include <configure.mk> | |
8 | .include <mkc_imp.conf.mk> | |
9 | 9 | |
10 | 10 | .PHONY: configure |
11 | 11 | configure: errorcheck |
0 | # Copyright (c) 2009-2013 by Aleksey Cheusov | |
0 | # Copyright (c) 2009-2014 by Aleksey Cheusov | |
1 | 1 | # Copyright (c) 1994-2009 The NetBSD Foundation, Inc. |
2 | 2 | # Copyright (c) 1988, 1989, 1993 The Regents of the University of California |
3 | 3 | # Copyright (c) 1988, 1989 by Adam de Boor |
16 | 16 | ########### |
17 | 17 | SHORTPRJNAME ?= yes |
18 | 18 | |
19 | .ifdef DPLIBDIRS | |
20 | .for _dir in ${DPLIBDIRS} | |
21 | .ifndef DPLIBDIRS.${_dir} | |
22 | .if ${SHORTPRJNAME:tl} == "yes" | |
23 | DPLIBDIRS.${_dir} = ${OBJDIR_${_dir:T}} | |
24 | .else | |
25 | DPLIBDIRS.${_dir} = ${OBJDIR_${_dir:S,/,_,g}} | |
26 | .endif | |
27 | .if ${TARGET_OPSYS} == "HP-UX" | |
28 | LDFLAGS0 += ${CFLAGS.cctold}+b ${CFLAGS.cctold}${LIBDIR} | |
29 | .endif | |
30 | LDFLAGS0 += -L${DPLIBDIRS.${_dir}} | |
31 | .endif | |
32 | .endfor | |
33 | ||
34 | #.undef DPLIBDIRS | |
35 | ||
36 | .endif # DPLIBDIRS | |
37 | ||
38 | 19 | ###################################################################### |
39 | 20 | .ifndef __initialized__ |
40 | 21 | __initialized__ := 1 |
54 | 35 | |
55 | 36 | .for p in ${PROGS} |
56 | 37 | SRCS.${p} ?= ${p}.c |
57 | SRCS.${p} += ${SRCS} # SRCS may be changed by mkc_imp.configure.mk | |
38 | SRCS.${p} += ${SRCS} # SRCS may be changed by mkc_imp.conf.mk | |
58 | 39 | _srcsall += ${SRCS.${p}} |
59 | 40 | .endfor |
60 | 41 | |
63 | 44 | SRCS ?= ${PROG}.c |
64 | 45 | SRCS.${PROG} ?= ${SRCS} |
65 | 46 | _srcsall += ${SRCS} |
47 | .elif ${.CURDIR:T} == ${COMPATLIB:U} | |
48 | SRCS ?= ${FEATURESDIR}/_mkcfake.c | |
49 | _srcsall += ${SRCS} | |
66 | 50 | .elif defined(LIB) |
67 | 51 | SRCS ?= ${LIB}.c |
68 | 52 | _srcsall += ${SRCS} |
70 | 54 | |
71 | 55 | .if !empty(_srcsall:U:M*.cxx) || !empty(_srcsall:U:M*.cpp) || !empty(_srcsall:U:M*.C) || !empty(_srcsall:U:M*.cc) |
72 | 56 | src_type += cxx |
73 | LDCOMPILER = yes | |
74 | 57 | LDREAL ?= ${CXX} |
75 | 58 | .elif !empty(_srcsall:U:M*.pas) || !empty(_srcsall:U:M*.p) |
76 | 59 | src_type += pas |
77 | LDCOMPILER = yes | |
78 | 60 | LDREAL ?= ${PC} |
79 | 61 | .endif |
80 | ||
81 | LDCOMPILER.Interix = yes | |
82 | LDCOMPILER.Darwin = yes | |
83 | #LDCOMPILER.HP-UX= yes | |
84 | LDCOMPILER ?= ${LDCOMPILER.${TARGET_OPSYS}:Uyes} | |
85 | 62 | |
86 | 63 | .if !empty(_srcsall:U:M*.c) || !empty(_srcsall:U:M*.l) || !empty(_srcsall:U:M*.y) || defined(MKC_SOURCE_FUNCLIBS) |
87 | 64 | src_type += c |
89 | 66 | |
90 | 67 | src_type ?= 0 |
91 | 68 | |
92 | .if ${LDCOMPILER:tl} == "yes" | |
93 | 69 | LDREAL ?= ${CC} |
94 | .endif | |
95 | 70 | |
96 | 71 | .if defined(PROGS) |
97 | 72 | LDREAL ?= ${CC} |
101 | 76 | |
102 | 77 | MKC_CACHEDIR ?= ${.OBJDIR} # directory for cache and intermediate files |
103 | 78 | |
104 | init_make_level ?= 0 # for mkc.configure.mk | |
79 | init_make_level ?= 0 # for mkc_imp.conf.mk | |
105 | 80 | |
106 | 81 | .if ${.MAKE.LEVEL} == ${init_make_level} |
107 | 82 | SRCTOP ?= ${.CURDIR} |
124 | 99 | |
125 | 100 | .if defined(MAKECONF) && exists(${MAKECONF}) |
126 | 101 | .include "${MAKECONF}" |
102 | .elif defined(MKC_SYSCONFDIR) && exists(${MKC_SYSCONFDIR}/mk-c.conf) | |
103 | .include "${MKC_SYSCONFDIR}/mk-c.conf" | |
127 | 104 | .elif defined(MKC_SYSCONFDIR) && exists(${MKC_SYSCONFDIR}/mk.conf) |
128 | 105 | .include "${MKC_SYSCONFDIR}/mk.conf" |
129 | .elif exists(/etc/mk.conf) | |
130 | .include "/etc/mk.conf" | |
131 | 106 | .endif |
132 | 107 | |
133 | 108 | .if ${OPSYS:Ux} == "SunOS" |
154 | 129 | LIBEXECDIR ?= ${PREFIX}/libexec |
155 | 130 | INCSDIR ?= ${PREFIX}/include |
156 | 131 | DATADIR ?= ${PREFIX}/share |
132 | SHAREDSTATEDIR ?= ${PREFIX}/com | |
133 | VARDIR ?= ${PREFIX}/var | |
157 | 134 | SYSCONFDIR ?= ${PREFIX}/etc |
158 | 135 | INFODIR ?= ${PREFIX}/info |
159 | 136 | MANDIR ?= ${PREFIX}/man |
260 | 237 | SHLIB_MAJOR ?= 1 |
261 | 238 | .endif # MKDLL |
262 | 239 | |
263 | .if defined(SHLIB_MAJOR) | |
240 | INTERNALLIBS += ${COMPATLIB} | |
241 | STATICLIBS += ${INTERNALLIBS} | |
242 | ||
243 | .if defined(SHLIB_MAJOR) && empty(STATICLIBS:M${.CURDIR:T}) | |
264 | 244 | MKSHLIB ?= yes |
265 | 245 | .else |
266 | 246 | MKSHLIB ?= no |
267 | 247 | .endif # SHLIB_MAJOR |
268 | 248 | |
269 | MKPICLIB ?= no | |
270 | MKPROFILELIB ?= no | |
249 | .if !empty(STATICLIBS:M${.CURDIR:T}) | |
250 | MKPICLIB ?= yes | |
251 | .else | |
252 | MKPICLIB ?= no | |
253 | .endif | |
254 | ||
255 | MKPROFILELIB ?= no | |
271 | 256 | |
272 | 257 | MKINSTALLDIRS ?= yes |
273 | 258 | |
324 | 309 | |
325 | 310 | CC ?= cc |
326 | 311 | CFLAGS ?= |
327 | COMPILE.c ?= ${_V} ${CC_PREFIX} ${CC} ${CFLAGS} ${CPPFLAGS} ${_CFLAGS.ssp} ${_CFLAGS.pie} ${CFLAGS.warns} -c | |
312 | COMPILE.c ?= ${_V} ${CC_PREFIX} ${CC} ${CFLAGS} ${_CPPFLAGS} ${_CFLAGS.ssp} ${_CFLAGS.pie} ${CFLAGS.warns} -c | |
328 | 313 | MESSAGE.c ?= @${_MESSAGE} "CC: ${.IMPSRC}" |
329 | 314 | |
330 | 315 | CXX ?= c++ |
331 | 316 | CXXFLAGS += ${CFLAGS} |
332 | COMPILE.cc ?= ${_V} ${CXX_PREFIX} ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${_CXXFLAGS.ssp} ${_CXXFLAGS.pie} ${CXXFLAGS.warns} -c | |
317 | COMPILE.cc ?= ${_V} ${CXX_PREFIX} ${CXX} ${CXXFLAGS} ${_CPPFLAGS} ${_CXXFLAGS.ssp} ${_CXXFLAGS.pie} ${CXXFLAGS.warns} -c | |
333 | 318 | MESSAGE.cc ?= @${_MESSAGE} "CXX: ${.IMPSRC}" |
334 | 319 | |
335 | 320 | OBJC ?= ${CC} |
336 | 321 | OBJCFLAGS ?= ${CFLAGS} |
337 | COMPILE.m ?= ${_V} ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c | |
322 | COMPILE.m ?= ${_V} ${OBJC} ${OBJCFLAGS} ${_CPPFLAGS} -c | |
338 | 323 | MESSAGE.m ?= @${_MESSAGE} "OBJC: ${.IMPSRC}" |
339 | 324 | |
340 | 325 | CPP ?= cpp |
341 | 326 | CPPFLAGS ?= |
327 | ||
328 | _CPPFLAGS = ${CPPFLAGS0} ${CPPFLAGS} | |
342 | 329 | |
343 | 330 | FC ?= f77 |
344 | 331 | FFLAGS ?= -O |
345 | 332 | RFLAGS ?= |
346 | 333 | COMPILE.f ?= ${_V} ${FC} ${FFLAGS} -c |
347 | 334 | MESSAGE.f ?= @${_MESSAGE} "FC: ${.IMPSRC}" |
348 | COMPILE.F ?= ${_V} ${FC} ${FFLAGS} ${CPPFLAGS} -c | |
335 | COMPILE.F ?= ${_V} ${FC} ${FFLAGS} ${_CPPFLAGS} -c | |
349 | 336 | MESSAGE.F ?= ${MESSAGE.f} |
350 | 337 | COMPILE.r ?= ${_V} ${FC} ${FFLAGS} ${RFLAGS} -c |
351 | 338 | MESSAGE.r ?= ${MESSAGE.f} |
368 | 355 | LD ?= ${LD.${TARGET_OPSYS}:Uld} |
369 | 356 | LDFLAGS ?= |
370 | 357 | |
358 | .if ${OPSYS} == "Haiku" | |
359 | LN ?= ln -s | |
360 | LN_S ?= ln -s | |
361 | .else | |
371 | 362 | LN ?= ln |
372 | 363 | LN_S ?= ${LN} -s |
364 | .endif | |
373 | 365 | |
374 | 366 | LORDER ?= lorder |
375 | 367 | |
379 | 371 | |
380 | 372 | PC ?= pc |
381 | 373 | PFLAGS ?= |
382 | COMPILE.p ?= ${_V} ${PC} ${PFLAGS} ${CPPFLAGS} -c | |
374 | COMPILE.p ?= ${_V} ${PC} ${PFLAGS} ${_CPPFLAGS} -c | |
383 | 375 | MESSAGE.p ?= @${_MESSAGE} "PC: ${.IMPSRC}" |
384 | 376 | |
385 | 377 | SHELL ?= sh |
392 | 384 | YFLAGS ?= |
393 | 385 | YACC.y ?= ${_V} ${YACC} ${YFLAGS} |
394 | 386 | MESSAGE.y ?= @${_MESSAGE} "YACC: ${.IMPSRC}" |
387 | ||
388 | MESSAGE.mkgen ?= @${_MESSAGE} "MKGEN:" | |
395 | 389 | |
396 | 390 | TAR ?= tar |
397 | 391 | GZIP ?= gzip |
434 | 428 | ########### |
435 | 429 | |
436 | 430 | TARGETS += all install clean cleandir depend test \ |
437 | installdirs uninstall errorcheck filelist obj | |
431 | installdirs uninstall errorcheck filelist obj mkgen | |
438 | 432 | TARGETS := ${TARGETS:O:u} |
439 | 433 | |
440 | ALLTARGETS += all install clean cleandir depend uninstall installdirs \ | |
441 | bin_tar bin_targz bin_tarbz2 bin_zip bin_deb | |
434 | ALLTARGETS += errorcheck all install clean cleandir depend uninstall installdirs \ | |
435 | mkgen bin_tar bin_targz bin_tarbz2 bin_zip bin_deb | |
442 | 436 | |
443 | 437 | VERBOSE_ECHO ?= echo |
444 | 438 |
4 | 4 | |
5 | 5 | TEST_PREREQS ?= all |
6 | 6 | |
7 | _tmp_out:=${.OBJDIR}/${.CURDIR:T}.test.out | |
8 | ||
7 | 9 | .PHONY : test |
8 | 10 | test: ${TEST_PREREQS} |
9 | 11 | @echo 'Testing ${.CURDIR}... ' 1>&2; \ |
10 | 12 | set -e; cd ${.CURDIR}; \ |
11 | tmp_out=${.OBJDIR}/${.CURDIR:T}.test.out; \ | |
12 | ${RM} -f $$tmp_out; \ | |
13 | ${MAKE} ${MAKEFLAGS} test_output > $$tmp_out.tmp; \ | |
14 | mv $$tmp_out.tmp $$tmp_out; \ | |
13 | ${RM} -f ${_tmp_out}; \ | |
14 | ${MAKE} ${MAKEFLAGS} test_output > ${_tmp_out}.tmp; \ | |
15 | mv ${_tmp_out}.tmp ${_tmp_out}; \ | |
15 | 16 | if test -f ${.CURDIR}/expect.${OPSYS}.out; then \ |
16 | 17 | expect=${.CURDIR}/expect.${OPSYS}.out; \ |
17 | 18 | else \ |
18 | 19 | expect=${.CURDIR}/expect.out; \ |
19 | 20 | fi; \ |
20 | diff $$expect $$tmp_out && \ | |
21 | diff $$expect ${_tmp_out} && \ | |
21 | 22 | echo ' succeeded' 1>&2 || \ |
22 | 23 | { echo ' FAILED' 1>&2; false; } |
23 | 24 |
0 | # Copyright (c) 2014 by Aleksey Cheusov | |
1 | # | |
2 | # See LICENSE file in the distribution. | |
3 | ############################################################ | |
4 | ||
5 | .include <mkc_imp.conf.mk> | |
6 | ||
7 | .undef MKC_NOAUTO | |
8 | .undef MKC_NOSRCSAUTO |
37 | 37 | .for i in ${MKC_LDADD} |
38 | 38 | LDADD += ${i} |
39 | 39 | .endfor |
40 | .for i in ${MKC_SRCS} | |
40 | .if !${MKC_NOSRCSAUTO:U0} | |
41 | . for i in ${MKC_SRCS} | |
41 | 42 | SRCS += ${i} |
42 | .endfor | |
43 | . endfor | |
44 | .endif | |
43 | 45 | .endif # .if MKC_AUTO |
44 | 46 | |
45 | 47 | .undef MKC_CPPFLAGS |
0 | # Copyright (c) 2009-2014, Aleksey Cheusov <vle@gmx.net> | |
1 | # All rights reserved. | |
2 | # | |
3 | # Redistribution and use in source and binary forms, with or without | |
4 | # modification, are permitted provided that the following conditions | |
5 | # are met: | |
6 | # 1. Redistributions of source code must retain the above copyright | |
7 | # notice, this list of conditions and the following disclaimer. | |
8 | # 2. Redistributions in binary form must reproduce the above copyright | |
9 | # notice, this list of conditions and the following disclaimer in the | |
10 | # documentation and/or other materials provided with the distribution. | |
11 | # | |
12 | # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
13 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
14 | # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
15 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
16 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
17 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
18 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
19 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
20 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
21 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
22 | # POSSIBILITY OF SUCH DAMAGE. | |
23 | ||
24 | ###################################################################### | |
25 | # See mk-configure(7) for documentation | |
26 | # | |
27 | ||
28 | # user defined variables | |
29 | MKC_SHOW_CACHED ?= 0 # set it to `1' to show "...(cached)..." lines | |
30 | MKC_DELETE_TMPFILES ?= 0 # set it to `1' to delete temporary files | |
31 | MKC_CACHEDIR ?= ${.OBJDIR} # directory for cache and intermediate files | |
32 | MKC_COMMON_HEADERS ?= # list of headers always #included | |
33 | MKC_NOCACHE ?= # 1 or yes for disabling cache | |
34 | MKC_CUSTOM_DIR ?=${.CURDIR} # directory with custom tests.c | |
35 | MKC_SOURCE_DIR ?=${.CURDIR} # directory with missing strlcat.c etc. | |
36 | .if ${COMPATLIB:U} == ${.CURDIR:T} | |
37 | MKC_NOSRCSAUTO ?= 1 | |
38 | .else | |
39 | MKC_NOSRCSAUTO ?= 0 | |
40 | .endif | |
41 | ||
42 | # | |
43 | MKC_SOURCE_FUNCLIBS ?= | |
44 | _MKC_SOURCE_FUNCS = ${MKC_SOURCE_FUNCLIBS:C/:.*//} | |
45 | ||
46 | # .endif for the next .if is in the end of file | |
47 | .if ${MKCHECKS:Uno:tl} == "yes" | |
48 | ||
49 | HAVE_FUNCLIB.main ?= 1 | |
50 | ||
51 | .if defined(MKC_COMMON_DEFINES.${TARGET_OPSYS}) | |
52 | CPPFLAGS += ${MKC_COMMON_DEFINES.${TARGET_OPSYS}} | |
53 | .endif | |
54 | .if defined(MKC_COMMON_DEFINES) | |
55 | CPPFLAGS += ${MKC_COMMON_DEFINES} | |
56 | .endif | |
57 | ||
58 | # | |
59 | _MKC_CPPFLAGS := ${CPPFLAGS} | |
60 | _MKC_CFLAGS := ${CFLAGS} | |
61 | _MKC_CXXFLAGS := ${CXXFLAGS} | |
62 | _MKC_FFLAGS := ${FFLAGS} | |
63 | _MKC_LDFLAGS := ${LDFLAGS} | |
64 | _MKC_LDADD := ${LDADD} | |
65 | ||
66 | mkc.environ=CC='${CC}' CXX='${CXX}' FC='${FC}' CPPFLAGS='${_MKC_CPPFLAGS}' CFLAGS='${_MKC_CFLAGS}' CXXFLAGS='${_MKC_CXXFLAGS}' FFLAGS='${_MKC_FFLAGS}' LDFLAGS='${_MKC_LDFLAGS}' LDADD='${_MKC_LDADD}' LEX='${LEX}' YACC='${YACC}' MKC_CACHEDIR='${MKC_CACHEDIR}' MKC_COMMON_HEADERS='${MKC_COMMON_HEADERS}' MKC_DELETE_TMPFILES='${MKC_DELETE_TMPFILES}' MKC_SHOW_CACHED='${MKC_SHOW_CACHED}' MKC_NOCACHE='${MKC_NOCACHE}' MKC_VERBOSE=1 | |
67 | ||
68 | ###################################################### | |
69 | # checking for builtin checks | |
70 | .for i in ${MKC_CHECK_BUILTINS} ${MKC_REQUIRE_BUILTINS} | |
71 | MKC_CUSTOM_FN.${i} ?= ${BUILTINSDIR}/${i:S/endianess/endianness/} | |
72 | MKC_CHECK_CUSTOM += ${i} | |
73 | MKC_REQUIRE_CUSTOM += ${MKC_REQUIRE_BUILTINS:M${i}} | |
74 | .endfor | |
75 | ||
76 | ###################################################### | |
77 | # checking for headers | |
78 | .for h in ${MKC_CHECK_HEADERS} ${MKC_REQUIRE_HEADERS} | |
79 | .if !defined(HAVE_HEADER.${h:S|.|_|g:S|/|_|g}) | |
80 | HAVE_HEADER.${h:S|.|_|g:S|/|_|g} != env ${mkc.environ} mkc_check_header ${h} | |
81 | .endif | |
82 | .if ${HAVE_HEADER.${h:S|.|_|g:S|/|_|g}} | |
83 | .if empty(MKC_REQUIRE_HEADERS:U:M${h}) | |
84 | MKC_CFLAGS += -DHAVE_HEADER_${h:tu:S|.|_|g:S|/|_|g}=${HAVE_HEADER.${h:S|.|_|g:S|/|_|g}} | |
85 | .endif | |
86 | .elif !empty(MKC_REQUIRE_HEADERS:U:M${h}) | |
87 | _fake != env ${mkc.environ} mkc_check_header -d ${h} && echo | |
88 | MKC_ERR_MSG += "ERROR: cannot find header ${h}" | |
89 | .endif | |
90 | .endfor | |
91 | ||
92 | .undef MKC_CHECK_HEADERS | |
93 | .undef MKC_REQUIRE_HEADERS | |
94 | ||
95 | ###################################################### | |
96 | # checking for functions in libraries | |
97 | .for f in ${MKC_CHECK_FUNCLIBS:U} ${MKC_SOURCE_FUNCLIBS:U} ${MKC_REQUIRE_FUNCLIBS:U} | |
98 | .if !defined(HAVE_FUNCLIB.${f:S/:/./g}) | |
99 | HAVE_FUNCLIB.${f:S/:/./g} != env ${mkc.environ} mkc_check_funclib ${f:S/:/ /g} | |
100 | .endif | |
101 | .if !defined(HAVE_FUNCLIB.${f:C/:.*//}) | |
102 | HAVE_FUNCLIB.${f:C/:.*//} != env ${mkc.environ} mkc_check_funclib ${f:C/:.*//} | |
103 | .endif | |
104 | .if ${HAVE_FUNCLIB.${f:C/:.*//}} != ${HAVE_FUNCLIB.${f:S/:/./g}} | |
105 | .if empty(MKC_NOAUTO_FUNCLIBS:U:S/:/./g:M${f:S/:/./g}) && empty(MKC_NOAUTO_FUNCLIBS:U:M1) && ${HAVE_FUNCLIB.${f:S/:/./g}} && !${HAVE_FUNCLIB.${f:C/:.*//}} | |
106 | MKC_LDADD += -l${f:C/^.*://} | |
107 | .endif | |
108 | .endif | |
109 | .if !${HAVE_FUNCLIB.${f:S/:/./g}} && !${HAVE_FUNCLIB.${f:C/:.*//}} && !empty(_MKC_SOURCE_FUNCS:M${f:C/:.*//}) | |
110 | MKC_SRCS += ${MKC_SOURCE_DIR.${f:C/:.*//}.c:U${MKC_SOURCE_DIR}}/${f:C/:.*//}.c | |
111 | .endif | |
112 | .endfor # f | |
113 | ||
114 | .for f in ${MKC_REQUIRE_FUNCLIBS:U} | |
115 | .if !${HAVE_FUNCLIB.${f:S/:/./g}} && !${HAVE_FUNCLIB.${f:C/:.*//}} | |
116 | _fake != env ${mkc.environ} mkc_check_funclib -d ${f:C/:.*//} && echo | |
117 | _fake != env ${mkc.environ} mkc_check_funclib -d ${f:S/:/ /g} && echo | |
118 | MKC_ERR_MSG += "ERROR: cannot find function ${f}" | |
119 | .endif | |
120 | .endfor # f | |
121 | ||
122 | .undef MKC_CHECK_FUNCLIBS | |
123 | .undef MKC_REQUIRE_FUNCLIBS | |
124 | ||
125 | ###################################################### | |
126 | # checking for sizeof(xxx) | |
127 | .for t in ${MKC_CHECK_SIZEOF:U} | |
128 | .if !defined(SIZEOF.${t:S|.|_|g:S|-|_|g:S|*|P|g:S|/|_|g:S|:|.|g}) | |
129 | SIZEOF.${t:S|.|_|g:S|-|_|g:S|*|P|g:S|/|_|g:S|:|.|g} != env ${mkc.environ} mkc_check_sizeof ${t:S/:/ /g} | |
130 | .endif | |
131 | .if ${SIZEOF.${t:S|.|_|g:S|-|_|g:S|*|P|g:S|/|_|g:S|:|.|g}} != failed | |
132 | MKC_CFLAGS += -DSIZEOF_${t:S/-/_/g:S| |_|g:S|*|P|g:S|:|_|g:S|.|_|g:tu}=${SIZEOF.${t:S|.|_|g:S|-|_|g:S|*|P|g:S|/|_|g:S|:|.|g}} | |
133 | .endif | |
134 | .endfor | |
135 | ||
136 | .undef MKC_CHECK_SIZEOF | |
137 | ||
138 | ###################################################### | |
139 | # checking for declared #define | |
140 | .for d in ${MKC_CHECK_DEFINES:U} ${MKC_REQUIRE_DEFINES:U} | |
141 | .if !defined(HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g}) | |
142 | HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_decl define ${d:S/:/ /g} | |
143 | .endif | |
144 | .if ${HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g}} | |
145 | .if empty(MKC_REQUIRE_DEFINES:U:M${d}) | |
146 | MKC_CFLAGS += -DHAVE_DEFINE_${d:tu:S/:/_/g:S/./_/g:S|/|_|g}=1 | |
147 | .endif | |
148 | .endif | |
149 | .endfor | |
150 | ||
151 | .for d in ${MKC_REQUIRE_DEFINES:U} | |
152 | .if !${HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g}} | |
153 | _fake != env ${mkc.environ} mkc_check_decl -d define ${d:S/:/ /g} && echo | |
154 | MKC_ERR_MSG += "ERROR: cannot find declaration of define ${d}" | |
155 | .endif | |
156 | .endfor | |
157 | ||
158 | .undef MKC_CHECK_DEFINES | |
159 | .undef MKC_REQUIRE_DEFINES | |
160 | ||
161 | ###################################################### | |
162 | # checking for declared type | |
163 | .for t in ${MKC_CHECK_TYPES:U} ${MKC_REQUIRE_TYPES:U} | |
164 | .if !defined(HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g}) | |
165 | HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_decl type ${t:S/:/ /g} | |
166 | .endif | |
167 | .if ${HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g}} | |
168 | .if empty(MKC_REQUIRE_TYPES:U:M${t}) | |
169 | MKC_CFLAGS += -DHAVE_TYPE_${t:tu:S/:/_/g:S/./_/g:S|/|_|g}=1 | |
170 | .endif | |
171 | .endif | |
172 | .endfor | |
173 | ||
174 | .for t in ${MKC_REQUIRE_TYPES:U} | |
175 | .if !${HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g}} | |
176 | _fake != env ${mkc.environ} mkc_check_decl -d type ${t:S/:/ /g} && echo | |
177 | MKC_ERR_MSG += "ERROR: cannot find declaration of type ${t}" | |
178 | .endif | |
179 | .endfor | |
180 | ||
181 | .undef MKC_CHECK_TYPES | |
182 | .undef MKC_REQUIRE_TYPES | |
183 | ||
184 | ###################################################### | |
185 | # checking for declared variables | |
186 | .for d in ${MKC_CHECK_VARS:U} ${MKC_REQUIRE_VARS:U} | |
187 | .if !defined(HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g}) | |
188 | HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_decl variable ${d:S/:/ /g} | |
189 | .endif | |
190 | .if ${HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g}} | |
191 | .if empty(MKC_REQUIRE_VARS:U:M${d}) | |
192 | MKC_CFLAGS += -DHAVE_VAR_${d:tu:S/:/_/g:S/./_/g:S|/|_|g}=1 | |
193 | .endif | |
194 | .endif | |
195 | .endfor | |
196 | ||
197 | .for d in ${MKC_REQUIRE_VARS:U} | |
198 | .if !${HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g}} | |
199 | _fake != env ${mkc.environ} mkc_check_decl -d variable ${d:S/:/ /g} && echo | |
200 | MKC_ERR_MSG += "ERROR: cannot find declaration of variable ${d}" | |
201 | .endif | |
202 | .endfor | |
203 | ||
204 | .undef MKC_CHECK_VARS | |
205 | .undef MKC_REQUIRE_VARS | |
206 | ||
207 | ###################################################### | |
208 | # checking for struct members | |
209 | .for m in ${MKC_CHECK_MEMBERS:U} ${MKC_REQUIRE_MEMBERS:U} | |
210 | .if !defined(HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g}) | |
211 | HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g} != env ${mkc.environ} mkc_check_decl member ${m:S/:/ /g} | |
212 | .endif | |
213 | .if ${HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g}} | |
214 | .if empty(MKC_REQUIRE_MEMBERS:U:M${m}) | |
215 | MKC_CFLAGS += -DHAVE_MEMBER_${m:tu:S/:/_/g:S/./_/g:S|/|_|g:S/-/_/g}=1 | |
216 | .endif | |
217 | .endif | |
218 | .endfor | |
219 | ||
220 | .for m in ${MKC_REQUIRE_MEMBERS:U} | |
221 | .if !${HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g}} | |
222 | _fake != env ${mkc.environ} mkc_check_decl -d member ${m:S/:/ /g} && echo | |
223 | MKC_ERR_MSG += "ERROR: cannot find member ${m}" | |
224 | .endif | |
225 | .endfor | |
226 | ||
227 | .undef MKC_CHECK_MEMBERS | |
228 | .undef MKC_REQUIRE_MEMBERS | |
229 | ||
230 | ###################################################### | |
231 | # checking for declared functions | |
232 | .for n in 0 1 2 3 4 5 6 7 8 9 | |
233 | ||
234 | .for d in ${MKC_CHECK_FUNCS${n}:U} ${MKC_REQUIRE_FUNCS${n}:U} | |
235 | .if !defined(HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g}) | |
236 | HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_decl func${n} ${d:S/:/ /g} | |
237 | .endif | |
238 | .if ${HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g}} | |
239 | .if empty(MKC_REQUIRE_FUNCS${n}:U:M${d}) | |
240 | MKC_CFLAGS += -DHAVE_FUNC${n}_${d:tu:S/:/_/g:S/./_/g:S|/|_|g}=1 | |
241 | .endif | |
242 | .endif | |
243 | .endfor # d | |
244 | ||
245 | .for d in ${MKC_REQUIRE_FUNCS${n}:U} | |
246 | .if !${HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g}} | |
247 | _fake != env ${mkc.environ} mkc_check_decl -d func${n} ${d:S/:/ /g} && echo | |
248 | MKC_ERR_MSG += "ERROR: cannot find declaration of function ${d}" | |
249 | .endif | |
250 | .endfor # d | |
251 | ||
252 | MKC_CHECK_FUNCS${n} := # workaround for buggy bmake-20110606 | |
253 | MKC_REQUIRE_FUNCS${n} := # workaround for buggy bmake-20110606 | |
254 | ||
255 | .undef MKC_CHECK_FUNCS${n} | |
256 | .undef MKC_REQUIRE_FUNCS${n} | |
257 | ||
258 | .endfor # n | |
259 | ||
260 | ###################################################### | |
261 | # custom checks | |
262 | .for c in ${MKC_CHECK_CUSTOM} ${MKC_REQUIRE_CUSTOM} | |
263 | .if !defined(CUSTOM.${c}) | |
264 | .if !defined(MKC_CUSTOM_FN.${c}) | |
265 | MKC_CUSTOM_FN.${c} = ${c}.c | |
266 | .endif | |
267 | .if empty(MKC_CUSTOM_FN.${c}:M/*) | |
268 | MKC_CUSTOM_FN.${c} := ${MKC_CUSTOM_DIR}/${MKC_CUSTOM_FN.${c}} | |
269 | .endif | |
270 | .if ${c} == "endianess" | |
271 | .warning "endianess test deprecated; use endianness instead" | |
272 | .endif | |
273 | CUSTOM.${c} != env ${mkc.environ} mkc_check_custom ${MKC_CUSTOM_FN.${c}} | |
274 | .endif | |
275 | .if !empty(CUSTOM.${c}) && ${CUSTOM.${c}} != 0 | |
276 | .if empty(MKC_REQUIRE_CUSTOM:U:M${c}) | |
277 | MKC_CFLAGS += -DCUSTOM_${c:tu}=${CUSTOM.${c}} | |
278 | .endif | |
279 | .endif | |
280 | .endfor | |
281 | ||
282 | .for c in ${MKC_REQUIRE_CUSTOM} | |
283 | .if empty(CUSTOM.${c}) || ${CUSTOM.${c}} == 0 | |
284 | _fake != env ${mkc.environ} mkc_check_custom -d ${MKC_CUSTOM_FN.${c}} && echo | |
285 | MKC_ERR_MSG += "ERROR: custom test ${c} failed" | |
286 | .endif | |
287 | .endfor | |
288 | ||
289 | .for c in ${MKC_CHECK_BUILTINS} | |
290 | BUILTIN.${c} = ${CUSTOM.${c}} | |
291 | .endfor | |
292 | ||
293 | ###################################################### | |
294 | # checking for programs | |
295 | .for p in ${MKC_CHECK_PROGS} ${MKC_REQUIRE_PROGS} | |
296 | p_ := ${p} | |
297 | prog_id := ${MKC_PROG.id.${p:S|+|x|g}:U${p}:S|/|_|g} | |
298 | .ifdef PROG.${prog_id} | |
299 | .elif !empty(p_:M/*) | |
300 | PROG.${prog_id} = ${p} | |
301 | .else | |
302 | PROG.${prog_id} != env ${mkc.environ} mkc_check_prog -i '${prog_id}' '${p}' | |
303 | .endif # !defined(PROG.${prog_id}) | |
304 | .ifndef HAVE_PROG.${prog_id} | |
305 | .if !empty(PROG.${prog_id}) && exists(${PROG.${prog_id}}) | |
306 | HAVE_PROG.${prog_id} = 1 | |
307 | .else | |
308 | HAVE_PROG.${prog_id} = 0 | |
309 | .endif | |
310 | .endif # ifndef HAVE_PROG.${prog_id} | |
311 | ||
312 | .if !${HAVE_PROG.${prog_id}} && !empty(MKC_REQUIRE_PROGS:U1:M${p}) | |
313 | _fake != env ${mkc.environ} mkc_check_prog -d -i '${prog_id}' '${p}' && echo | |
314 | MKC_ERR_MSG += "ERROR: cannot find program ${p}" | |
315 | .endif | |
316 | .endfor # p | |
317 | ||
318 | .undef MKC_CHECK_PROGS | |
319 | .undef MKC_REQUIRE_PROGS | |
320 | ||
321 | .undef MKC_CHECK_CUSTOM | |
322 | .undef MKC_REQUIRE_CUSTOM | |
323 | ||
324 | ###################################################### | |
325 | # prototype checks | |
326 | .for p in ${MKC_CHECK_PROTOTYPES} ${MKC_REQUIRE_PROTOTYPES} | |
327 | .if !defined(HAVE_PROTOTYPE.${p}) | |
328 | HAVE_PROTOTYPE.${p} != env ${mkc.environ} mkc_check_decl prototype \ | |
329 | ${MKC_PROTOTYPE_FUNC.${p}:Q} ${MKC_PROTOTYPE_HEADERS.${p}} | |
330 | .endif # !defined(HAVE_PROTOTYPE.${p}) | |
331 | .if ${HAVE_PROTOTYPE.${p}} | |
332 | MKC_CFLAGS += -DHAVE_PROTOTYPE_${p:tu}=1 | |
333 | .elif !empty(MKC_REQUIRE_PROTOTYPES:U:M${p}) | |
334 | _fake != env ${mkc.environ} mkc_check_decl -d prototype \ | |
335 | ${MKC_PROTOTYPE_FUNC.${p}:Q} ${MKC_PROTOTYPE_HEADERS.${p}}; echo | |
336 | MKC_ERR_MSG += "ERROR: prototype test ${p} failed" | |
337 | .endif # ${PROTOTYPE.${p}} | |
338 | .endfor # p | |
339 | ||
340 | .undef MKC_CHECK_PROTOTYPES | |
341 | .undef MKC_REQUIRE_PROTOTYPES | |
342 | ||
343 | .else # MKCHECKS == yes | |
344 | ||
345 | .for i in ${_MKC_SOURCE_FUNCS} | |
346 | MKC_SRCS += ${i} # for changing CLEANFILES | |
347 | .endfor | |
348 | ||
349 | .endif # MKCHECKS? | |
350 | ||
351 | ###################################################### | |
352 | # final assignments | |
353 | .include <mkc_imp.conf-final.mk> | |
354 | ||
355 | ###################################################### | |
356 | ###################################################### | |
357 | ###################################################### | |
358 | ||
359 | .undef MKC_SOURCE_FUNCLIBS |
1 | 1 | # Copyright (c) 1994-2009 The NetBSD Foundation, Inc. |
2 | 2 | |
3 | 3 | ###################################################################### |
4 | .ifndef _MKC_IMP_DEP_MK | |
4 | .if !defined(_MKC_IMP_DEP_MK) && !empty(_SRCS_ALL) | |
5 | 5 | _MKC_IMP_DEP_MK := 1 |
6 | 6 | |
7 | 7 | DISTCLEANFILES += .depend ${__DPSRCS.d} ${CLEANDEPEND} |
43 | 43 | |
44 | 44 | .if ${MKDEP_TYPE:U} == "makedepend" |
45 | 45 | MKDEP.c = ${MAKEDEPEND} -f- ${ddash} ${MKDEPFLAGS} \ |
46 | ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET} | |
46 | ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS} > ${.TARGET} | |
47 | 47 | MKDEP.m = ${MKDEP} -f- ${ddash} ${MKDEPFLAGS} \ |
48 | ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET} | |
48 | ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS} > ${.TARGET} | |
49 | 49 | MKDEP.cc = ${MKDEP} -f- ${ddash} ${MKDEPFLAGS} \ |
50 | ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET} | |
50 | ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS} > ${.TARGET} | |
51 | 51 | MKDEP.s = ${MKDEP} -f- ${ddash} ${MKDEPFLAGS} \ |
52 | ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET} | |
52 | ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS} > ${.TARGET} | |
53 | 53 | .else |
54 | 54 | MKDEP.c = ${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \ |
55 | ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} | |
55 | ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS} | |
56 | 56 | MKDEP.m = ${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \ |
57 | ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} | |
57 | ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS} | |
58 | 58 | MKDEP.cc = ${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \ |
59 | ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} | |
59 | ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS} | |
60 | 60 | MKDEP.s = ${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \ |
61 | ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} | |
61 | ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS} | |
62 | 62 | .endif |
63 | 63 | |
64 | 64 | .depend: ${__DPSRCS.d} |
74 | 74 | |
75 | 75 | .c.d: |
76 | 76 | ${MESSAGE.dep} |
77 | @env CC=${MKDEP_CC} ${MKDEP.c} ${.IMPSRC} | |
77 | @env CC=${MKDEP_CC:Q} ${MKDEP.c} ${.IMPSRC} | |
78 | 78 | |
79 | 79 | .m.d: |
80 | 80 | ${MESSAGE.dep} |
82 | 82 | |
83 | 83 | .s.d .S.d: |
84 | 84 | ${MESSAGE.dep} |
85 | @env CC=${MKDEP_CC} ${MKDEP.s} ${.IMPSRC} | |
85 | @env CC=${MKDEP_CC:Q} ${MKDEP.s} ${.IMPSRC} | |
86 | 86 | |
87 | 87 | .C.d .cc.d .cpp.d .cxx.d: |
88 | 88 | ${MESSAGE.dep} |
89 | @env CC=${MKDEP_CC} ${MKDEP.cc} ${.IMPSRC} | |
89 | @env CC=${MKDEP_CC:Q} ${MKDEP.cc} ${.IMPSRC} | |
90 | 90 | |
91 | 91 | .endif # defined(SRCS) |
92 | 92 |
0 | # Copyright (c) 2014 by Aleksey Cheusov | |
1 | # | |
2 | # See LICENSE file in the distribution. | |
3 | ############################################################ | |
4 | ||
5 | .for i in ${DPLDADD} | |
6 | . if ( ${MKPIE:U:tl} == "yes" || defined(SHLIB_MAJOR) ) && !empty(STATICLIBS:Mlib${i}) | |
7 | LDADD0 += -l${i}_pic | |
8 | . else | |
9 | LDADD0 += -l${i} | |
10 | . endif | |
11 | .endfor | |
12 | ||
13 | .for i in ${DPLIBDIRS} | |
14 | . if ${TARGET_OPSYS} == "HP-UX" | |
15 | LDFLAGS0 += ${CFLAGS.cctold}+b ${CFLAGS.cctold}${LIBDIR} | |
16 | . endif | |
17 | LDFLAGS0 += -L${i} | |
18 | .endfor | |
19 | ||
20 | .for i in ${DPINCDIRS:O:u} | |
21 | CPPFLAGS0 += -I${i} | |
22 | .endfor | |
23 | ||
24 | .undef DPLIBDIRS | |
25 | .undef DPINCDIRS | |
26 | .undef DPLDADD |
0 | # Copyright (c) 2014 by Aleksey Cheusov | |
1 | # | |
2 | # See LICENSE file in the distribution. | |
3 | ############################################################ | |
4 | ||
5 | .ifndef _MKC_IMP_FOREIGN_AUTOTOOLS_MK | |
6 | _MKC_IMP_FOREIGN_AUTOTOOLS_MK := 1 | |
7 | ||
8 | MESSAGE.atconf ?= @${_MESSAGE} "CONFIGURE:" | |
9 | MESSAGE.autotools ?= @${_MESSAGE} "AUTOTOOLS:" | |
10 | ||
11 | MKC_REQUIRE_PROGS += autoreconf | |
12 | ||
13 | AT_USE_AUTOMAKE ?= yes | |
14 | AT_MAKE ?= ${MAKE} | |
15 | AT_AUTORECONF_ARGS ?= -is -f | |
16 | ||
17 | .if empty(FSRCDIR) | |
18 | MKC_ERR_MSG += "FSRCDIR should not be empty" | |
19 | .elif empty(FSRCDIR:M/*) | |
20 | _FSRCDIR = ${.CURDIR}/${FSRCDIR} | |
21 | .else | |
22 | _FSRCDIR = ${FSRCDIR} | |
23 | .endif | |
24 | ||
25 | .if ${.OBJDIR} == ${.CURDIR} | |
26 | .OBJDIR = ${_FSRCDIR} | |
27 | .endif | |
28 | _FOBJDIR = ${.OBJDIR} | |
29 | ||
30 | _CONFIGURE_ARGS = --prefix ${PREFIX:Q} --bindir=${BINDIR:Q} \ | |
31 | --sbindir=${SBINDIR:Q} --libexecdir=${LIBEXECDIR} \ | |
32 | --sysconfdir=${SYSCONFDIR:Q} --sharedstatedir=${SHAREDSTATEDIR:Q} \ | |
33 | --localstatedir=${VARDIR:Q} --libdir=${LIBDIR:Q} \ | |
34 | --includedir=${INCSDIR:Q} --datarootdir=${DATADIR:Q} \ | |
35 | --infodir=${INFODIR:Q} --localedir=${DATADIR:Q}/locale \ | |
36 | --mandir=${MANDIR:Q} --docdir=${DATADIR:Q}/doc/${PROJECTNAME} \ | |
37 | --srcdir=${_FSRCDIR} ${AT_CONFIGURE_ARGS} | |
38 | ||
39 | _CONFIGURE_ENV = CC=${CC:Q} CFLAGS=${CFLAGS:Q} \ | |
40 | CXX=${CXX:Q} CXXFLAGS=${CXXFLAGS:Q} \ | |
41 | CPPFLAGS=${_CPPFLAGS:Q} \ | |
42 | LDFLAGS=${LDFLAGS:Q} LIBS=${LDADD:Q} CPP=${CPP:Q} ${AT_CONFIGURE_ENV} | |
43 | ||
44 | _AT_MAKE_ENV = ${DESTDIR:DDESTDIR=${DESTDIR:Q}} ${AT_MAKE_ENV} | |
45 | ||
46 | realdo_mkgen: | |
47 | ${MESSAGE.mkgen} | |
48 | ${_V} ${PROG.autoreconf} ${AT_AUTORECONF_ARGS} ${_FSRCDIR} | |
49 | ||
50 | realdo_errorcheck: check_mkc_err_msg .WAIT at_do_errorcheck | |
51 | ||
52 | at_do_errorcheck: .PHONY | |
53 | ${MESSAGE.atconf} | |
54 | ${_V} cd ${_FOBJDIR}; env ${_CONFIGURE_ENV} ${_FSRCDIR}/configure ${_CONFIGURE_ARGS} | |
55 | ||
56 | .for i in all clean cleandir install uninstall | |
57 | realdo_${i}: at_do_${i} | |
58 | at_do_${i}: .PHONY | |
59 | ${MESSAGE.autotools} | |
60 | ${_V} set -e; \ | |
61 | cd ${_FOBJDIR}; \ | |
62 | if test -f Makefile; then \ | |
63 | env ${_AT_MAKE_ENV} ${AT_MAKE} ${AT_MAKEFLAGS} ${.TARGET:S/^at_do_//:S/cleandir/distclean/}; \ | |
64 | fi | |
65 | .endfor | |
66 | ||
67 | DISTCLEANDIRS += ${_FSRCDIR}/autom4te.cache | |
68 | DISTCLEANFILES += ${_FSRCDIR}/aclocal.m4 ${_FOBJDIR}/config.log \ | |
69 | ${_FOBJDIR}/config.status ${_FSRCDIR}/configure ${_FSRCDIR}/depcomp \ | |
70 | ${_FSRCDIR}/INSTALL ${_FSRCDIR}/install-sh ${_FOBJDIR}/Makefile \ | |
71 | ${_FSRCDIR}/missing ${_FSRCDIR}/compile ${_FOBJDIR}/stamp-h1 | |
72 | ||
73 | .if ${AT_USE_AUTOMAKE:tl:U} == yes | |
74 | DISTCLEANFILES += ${_FSRCDIR}/Makefile.in | |
75 | MKC_REQUIRE_PROGS += automake | |
76 | .endif | |
77 | ||
78 | .endif # _MKC_IMP_FOREIGN_AUTOTOOLS_MK |
11 | 11 | |
12 | 12 | .if defined(INCS) |
13 | 13 | INCSSRCDIR ?= . |
14 | CPPFLAGS += -I${INCSSRCDIR} | |
14 | CPPFLAGS0 += -I${INCSSRCDIR} | |
15 | 15 | |
16 | 16 | .if ${MKINSTALL:tl} == "yes" |
17 | 17 | destination_incs = ${INCS:@I@${DESTDIR}${INCSDIR}/$I@} |
0 | # Copyright (c) 2009-2010 by Aleksey Cheusov | |
0 | # Copyright (c) 2009-2014 by Aleksey Cheusov | |
1 | 1 | # |
2 | 2 | # See LICENSE file in the distribution. |
3 | 3 | ############################################################ |
21 | 21 | INTEXTS_SED += -e 's,@datadir@,${DATADIR},g' |
22 | 22 | INTEXTS_SED += -e 's,@mandir@,${MANDIR},g' |
23 | 23 | INTEXTS_SED += -e 's,@incsdir@,${INCSDIR},g' |
24 | INTEXTS_SED += -e 's,@vardir@,${VARDIR},g' | |
25 | INTEXTS_SED += -e 's,@sharedstatedir@,${SHAREDSTATEDIR},g' | |
24 | 26 | |
25 | .if !make(clean) && !make(cleandir) && !make(distclean) | |
26 | .for _pattern _repl in ${INTEXTS_REPLS} | |
27 | .if !make(clean) && !make(cleandir) && !make(distclean) #&& empty(MKC_ERR_MSG) | |
28 | . if !empty(INTEXTS_REPLS) && ${INTEXTS_REPLS:[\#]:M*[13579]} != "" | |
29 | MKC_ERR_MSG += "ERROR: odd number of tokens in INTEXTS_REPLS" | |
30 | . else | |
31 | . for _pattern _repl in ${INTEXTS_REPLS} | |
27 | 32 | INTEXTS_SED += -e 's,@${_pattern}@,${_repl},g' |
28 | .endfor | |
33 | . endfor | |
34 | . endif | |
29 | 35 | .endif |
30 | 36 | |
31 | 37 | .for i in ${INFILES} |
0 | # Copyright (c) 2009-2010 by Aleksey Cheusov | |
0 | # Copyright (c) 2009-2014 by Aleksey Cheusov | |
1 | 1 | # Copyright (c) 1994-2009 The NetBSD Foundation, Inc. |
2 | 2 | # Copyright (c) 1988, 1989, 1993 The Regents of the University of California |
3 | 3 | # Copyright (c) 1988, 1989 by Adam de Boor |
109 | 109 | .endif # !commands(...) |
110 | 110 | |
111 | 111 | CLEANFILES += \ |
112 | ${OBJS} ${POBJS} ${SOBJS} \ | |
113 | lib${LIB}${SHLIB_EXT} lib${LIB}${SHLIB_EXT1} \ | |
114 | lib${LIB}${SHLIB_EXT2} lib${LIB}${SHLIB_EXT3} ${SHLIBFN} | |
112 | ${OBJS} ${POBJS} ${SOBJS} | |
115 | 113 | |
116 | 114 | .if !target(libinstall) |
117 | 115 | # Make sure it gets defined |
118 | 116 | libinstall:: |
117 | ||
118 | CLEANFILES += lib${LIB}.a lib${LIB}_pic.a lib${LIB}_p.a | |
119 | 119 | |
120 | 120 | # MKSTATICLIB |
121 | 121 | .if ${MKSTATICLIB:tl} != "no" |
123 | 123 | .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a |
124 | 124 | .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a |
125 | 125 | UNINSTALLFILES.lib += ${DESTDIR}${LIBDIR}/lib${LIB}.a |
126 | CLEANFILES += lib${LIB}.a | |
127 | 126 | |
128 | 127 | ${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall |
129 | 128 | .endif |
134 | 133 | .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a |
135 | 134 | .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a |
136 | 135 | UNINSTALLFILES.lib += ${DESTDIR}${LIBDIR}/lib${LIB}_p.a |
137 | CLEANFILES += lib${LIB}_p.a | |
138 | 136 | |
139 | 137 | ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall |
140 | 138 | .endif |
141 | 139 | |
142 | 140 | # MKPICLIB |
143 | 141 | .if ${MKPICLIB:tl} != "no" |
144 | CLEANFILES += lib${LIB}_pic.a | |
145 | .endif | |
146 | ||
147 | .if ${MKPICLIB:tl} != "no" | |
148 | 142 | libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a |
149 | 143 | .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a |
150 | 144 | .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a |
151 | UNINSTALLFILES.lib += ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a | |
145 | UNINSTALLFILES.lib += ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a | |
152 | 146 | |
153 | 147 | ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall |
154 | 148 | .endif |
162 | 156 | .if ${MKDLL:tl} == "no" |
163 | 157 | UNINSTALLFILES.lib += ${DESTDIR}${LIBDIR}/lib${LIB}${SHLIB_EXT} \ |
164 | 158 | ${DESTDIR}${LIBDIR}/lib${LIB}${SHLIB_EXT1} |
159 | CLEANFILES += \ | |
160 | lib${LIB}${SHLIB_EXT} lib${LIB}${SHLIB_EXT1} \ | |
161 | lib${LIB}${SHLIB_EXT2} ${SHLIB_EXT3:Dlib${LIB}${SHLIB_EXT3}} | |
162 | .else | |
163 | CLEANFILES += ${SHLIBFN} | |
165 | 164 | .endif |
166 | 165 | |
167 | 166 | ${DESTDIR}${LIBDIR}/${SHLIBFN}: ${SHLIBFN} |
35 | 35 | LIB = ${LUA_CMODULE:S|.|/|:T} |
36 | 36 | SRCS ?= ${LUA_CMODULE:S/./_/g}.c |
37 | 37 | MKDLL = Only |
38 | LDCOMPILER = Yes | |
39 | 38 | DLL_EXT = .so |
40 | 39 | LIBDIR = ${LUA_CMODDIR}/${LUA_CMODULE:S|.|/|g:H} |
41 | 40 | .endif # defined(LUA_CMODULES) |
0 | # Copyright (c) 2009-2013 by Aleksey Cheusov | |
0 | # Copyright (c) 2009-2014 by Aleksey Cheusov | |
1 | 1 | # |
2 | 2 | # See LICENSE file in the distribution. |
3 | 3 | ############################################################ |
8 | 8 | .endif |
9 | 9 | |
10 | 10 | .ifdef SUBPRJS |
11 | SUBPRJ += ${SUBPRJS} # for backward compatility only, use SUBPRJ! | |
11 | SUBPRJ += ${SUBPRJS} # for backward compatibility only, use SUBPRJ! | |
12 | 12 | .endif # defined(SUBPRJS) |
13 | ||
14 | .include <mkc_imp.lua.mk> | |
15 | .include <mkc_imp.pod.mk> | |
16 | .include <mkc.init.mk> | |
17 | ||
18 | .ifdef AXCIENT_LIBDEPS # This feature was proposed by axcient.com developers | |
19 | all_deps != mkc_get_deps ${.CURDIR:S,^${SUBPRJSRCTOP}/,,} | |
20 | . for p in ${all_deps} | |
21 | _mkfile = ${SUBPRJSRCTOP}/${p}/linkme.mk | |
22 | . if exists(${_mkfile}) | |
23 | . include "${_mkfile}" | |
24 | . endif | |
25 | DPLDADD ?= ${p:T:S/^lib//} | |
26 | DPLIBDIRS ?= ${OBJDIR_${p:S,/,_,g}} | |
27 | DPINCDIRS ?= ${SRCDIR_${p:S,/,_,g}} ${OBJDIR_${p:S,/,_,g}} | |
28 | . include <mkc_imp.dpvars.mk> | |
29 | . endfor | |
30 | .endif | |
31 | ||
32 | .ifdef DPLIBDIRS | |
33 | .warning "This way of using DPLIBDIRS is deprecated since 2014-08-21" | |
34 | _DPLIBDIRS := ${DPLIBDIRS} | |
35 | . for _dir in ${_DPLIBDIRS} | |
36 | DPLIBDIRS = ${OBJDIR_${_dir:S,^${SUBPRJSRCTOP}/,,:S,/,_,g}} | |
37 | . include <mkc_imp.dpvars.mk> | |
38 | . endfor | |
39 | . undef _DPLIBDIRS | |
40 | . undef DPLIBDIRS | |
41 | .endif | |
42 | ||
43 | .if defined(LIBDEPS) | |
44 | SUBPRJ += ${LIBDEPS} # library dependencies | |
45 | AXCIENT_LIBDEPS := ${LIBDEPS} | |
46 | EXPORT_VARNAMES += AXCIENT_LIBDEPS | |
47 | .endif # defined(LIBDEPS) | |
13 | 48 | |
14 | 49 | .if !defined(LIB) && !defined(SUBPRJ) |
15 | 50 | _use_prog := 1 |
16 | 51 | .endif |
17 | 52 | |
18 | .include <mkc_imp.lua.mk> | |
19 | .include <mkc_imp.pod.mk> | |
20 | ||
21 | .include <mkc.init.mk> | |
53 | .ifdef FOREIGN | |
54 | .include <mkc_imp.foreign_${FOREIGN}.mk> | |
55 | .endif | |
22 | 56 | .include <mkc_imp.rules.mk> |
23 | 57 | .include <mkc_imp.obj.mk> |
24 | 58 | |
55 | 89 | .endif # SUBPRJ |
56 | 90 | |
57 | 91 | ########### |
58 | .PHONY : print-values | |
59 | print-values : | |
92 | .PHONY : print_values | |
93 | print_values : | |
60 | 94 | .for v in ${VARS} |
61 | 95 | @printf "%s=%s\n" ${v} ${${v}:Q} |
62 | 96 | .endfor |
63 | 97 | |
64 | .PHONY : print-values2 | |
65 | print-values2 : | |
98 | .PHONY : print_values2 | |
99 | print_values2 : | |
66 | 100 | .for v in ${VARS} |
67 | 101 | @printf "%s\n" ${${v}:Q} |
68 | 102 | .endfor |
69 | 103 | |
70 | 104 | ########### |
71 | .PHONY: realerrorcheck | |
72 | ||
73 | __errorcheck: .USE | |
105 | check_mkc_err_msg: | |
74 | 106 | @if test -n '${MKC_ERR_MSG}'; then \ |
75 | 107 | for msg in '' ${MKC_ERR_MSG}; do \ |
76 | 108 | fn=`printf '%s\n' "$$msg" | sed -n 's/^%%%: //p'`; \ |
82 | 114 | exit $$ex; \ |
83 | 115 | fi |
84 | 116 | |
85 | do_all : realerrorcheck | |
86 | realerrorcheck: __errorcheck | |
117 | all: pre_errorcheck .WAIT do_errorcheck .WAIT post_errorcheck .WAIT pre_all .WAIT do_all .WAIT post_all | |
118 | realdo_errorcheck: check_mkc_err_msg | |
87 | 119 | |
88 | 120 | .include <mkc_imp.checkprogs.mk> |
89 | .include <configure.mk> | |
121 | .include <mkc_imp.conf-cleanup.mk> | |
90 | 122 | |
91 | 123 | # features |
92 | 124 | .for f in ${MKC_FEATURES} |
93 | 125 | .include <mkc_imp.f_${f}.mk> |
94 | 126 | .endfor |
95 | .include <configure.mk> | |
127 | .include <mkc_imp.conf-cleanup.mk> | |
96 | 128 | CFLAGS += ${MKC_FEATURES:D-I${FEATURESDIR}} |
97 | 129 | |
98 | 130 | .if !defined(MKC_ERR_MSG) || make(clean) || make(cleandir) || make(distclean) |
15 | 15 | .if empty(j:U:M*[.]*) |
16 | 16 | EXPORT_VARNAMES += OBJDIR_${i:S,/,_,g} |
17 | 17 | . if ${MKRELOBJDIR:tl} == "yes" |
18 | OBJDIR_${j} = ${.OBJDIR}/${i} | |
18 | OBJDIR_${j} := ${.OBJDIR}/${i} | |
19 | 19 | . elif defined(MAKEOBJDIRPREFIX) |
20 | OBJDIR_${j} = ${MAKEOBJDIRPREFIX}${.CURDIR} | |
20 | OBJDIR_${j} := ${MAKEOBJDIRPREFIX}${.CURDIR} | |
21 | 21 | . elif defined(MAKEOBJDIR) |
22 | OBJDIR_${j} = ${MAKEOBJDIR} | |
22 | OBJDIR_${j} := ${MAKEOBJDIR} | |
23 | 23 | . elif defined(_OBJ_MACHINE_DIR) |
24 | OBJDIR_${j} = ${.CURDIR}/obj.${MACHINE} | |
24 | OBJDIR_${j} := ${.CURDIR}/obj.${MACHINE} | |
25 | 25 | . elif defined(_OBJ_DIR) |
26 | OBJDIR_${j} = ${.CURDIR}/obj | |
26 | OBJDIR_${j} := ${.CURDIR}/obj | |
27 | 27 | . else |
28 | OBJDIR_${j} = ${.CURDIR}/${i} | |
28 | OBJDIR_${j} := ${.CURDIR}/${i} | |
29 | 29 | . endif # MAKEOBJDIRPREFIX... |
30 | 30 | . if ${SHORTPRJNAME:tl} == "yes" && ${i} != ${j} |
31 | 31 | OBJDIR_${i:T} := ${OBJDIR_${j}} |
11 | 11 | |
12 | 12 | .if defined(MKC_CHECK_PKGCONFIG) && !make(clean) && !make(cleandir) && !make(distclean) |
13 | 13 | MKC_REQUIRE_PROGS+= pkg-config |
14 | .include <configure.mk> | |
14 | .include <mkc_imp.conf-cleanup.mk> | |
15 | 15 | |
16 | 16 | .if ${HAVE_PROG.pkg-config} |
17 | 17 |
319 | 319 | .if ${TARGET_OPSYS:Unone} == "Darwin" |
320 | 320 | .if ${MKDLL:U} == "no" |
321 | 321 | LDFLAGS.shared.gcc.Darwin = -dynamiclib -install_name ${LIBDIR}/lib${LIB}${SHLIB_EXTFULL} |
322 | LDFLAGS.shared.clang.Darwin = -dynamiclib -install_name ${LIBDIR}/lib${LIB}${SHLIB_EXTFULL} | |
322 | 323 | SHLIB_MAJORp1 != expr 1 + ${SHLIB_MAJOR:U0} |
323 | 324 | LDFLAGS.soname.gcc = -current_version ${SHLIB_MAJORp1}${SHLIB_MINOR:D.${SHLIB_MINOR}}${SHLIB_TEENY:D.${SHLIB_TEENY}} |
324 | 325 | LDFLAGS.soname.gcc += -compatibility_version ${SHLIB_MAJORp1} |
325 | 326 | .else |
326 | 327 | LDFLAGS.shared.gcc.Darwin = -flat_namespace -bundle -undefined suppress |
328 | LDFLAGS.shared.clang.Darwin = -flat_namespace -bundle -undefined suppress | |
327 | 329 | .endif |
328 | 330 | .elif ${TARGET_OPSYS:Unone} == "OSF1" && defined(LIB) |
329 | 331 | CLEANFILES += ${.OBJDIR}/${LIB}_so_locations |
370 | 372 | .if ${TARGET_OPSYS:Unone} == "Darwin" |
371 | 373 | |
372 | 374 | COMPILE.s ?= ${AS} ${AFLAGS} |
373 | COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c | |
375 | COMPILE.S ?= ${CC} ${AFLAGS} ${_CPPFLAGS} -c | |
374 | 376 | |
375 | 377 | .if ${MKDLL:U} != "no" |
376 | 378 |
9 | 9 | .if !defined(_MKC_IMP_SUBPRJ_MK) |
10 | 10 | _MKC_IMP_SUBPRJ_MK := 1 |
11 | 11 | |
12 | EXPORT_VARNAMES += STATICLIBS COMPATLIB | |
13 | ||
12 | 14 | .for dir in ${SUBPRJ:S/:/ /g} |
13 | 15 | .if empty(NOSUBDIR:U:M${dir}) |
14 | 16 | __REALSUBPRJ += ${dir} |
17 | 19 | |
18 | 20 | .for dir in ${NOSUBDIR} |
19 | 21 | NODEPS += *-${dir}:* *:*-${dir} *-*/${dir}:* *:*-*/${dir} |
22 | .endfor | |
23 | .for dir in ${INTERNALLIBS} | |
24 | NODEPS += install-${dir}:* install-*/${dir}:* \ | |
25 | uninstall-${dir}:* uninstall-*/${dir}:* \ | |
26 | installdirs-${dir}:* installdirs-*/${dir}:* | |
20 | 27 | .endfor |
21 | 28 | |
22 | 29 | .ifndef SUBDIR |
120 | 127 | esac |
121 | 128 | |
122 | 129 | ########### |
130 | SUBPRJSRCTOP = ${.CURDIR} | |
131 | .export SUBPRJSRCTOP | |
132 | ########### | |
123 | 133 | |
124 | 134 | .include <mkc_imp.objdir.mk> |
125 | 135 |
0 | /usr/bin/awk |
Binary diff not shown
6 | 6 | mkc_check_prog mkc_check_custom \ |
7 | 7 | mkc_which mkc_check_compiler \ |
8 | 8 | mkc_install ${INSCRIPTS} |
9 | INSCRIPTS += mkc_check_version mkcmake | |
9 | INSCRIPTS += mkc_check_version mkcmake mkc_get_deps | |
10 | 10 | |
11 | 11 | MAN = mkc_check_funclib.1 mkc_check_header.1 \ |
12 | 12 | mkc_check_sizeof.1 mkc_check_decl.1 \ |
17 | 17 | .sp |
18 | 18 | .. |
19 | 19 | .\" ------------------------------------------------------------------ |
20 | .TH MK-CONFIGURE 7 "Dec 1, 2013" "" "" | |
20 | .TH MK-CONFIGURE 7 "Aug 21, 2014" "" "" | |
21 | 21 | .SH NAME |
22 | 22 | mk-configure \- lightweight replacement for GNU autotools |
23 | 23 | .SH DESCRIPTION |
26 | 26 | NetBSD make) and a number of executables. It is intended to simplify |
27 | 27 | crossplatform development and software building. |
28 | 28 | .P |
29 | To get system-specific configuration parameters, mkc.*.mk include | |
30 | files try to include the file specified by the "MAKECONF" | |
31 | variable. If MAKECONF is not set, or no such file exists, the system | |
32 | make configuration file, @sysconfdir@/mk.conf or /etc/mk.conf, is | |
33 | included. If "${SRCTOP}/Makefile.common" file exists it is also included | |
29 | There are only a few top-level makefiles: | |
30 | .BR mkc.init.mk ", " mkc.mk ", " mkc.configure.mk ", " mkc.minitest.mk . | |
31 | Everything else | |
32 | .RB ( mkc_imp.*.mk " files)" | |
33 | is included implicitely. Do not use | |
34 | .B mkc_imp.*.mk | |
35 | files directly! If you do, I cannot guarantee backward compatibility. | |
36 | .B mkc.configure.mk | |
37 | is included automatically by | |
38 | .BR mkc.mk , | |
39 | but can be included explicitely. | |
40 | .B mkc.minitest.mk | |
41 | provides a trivial support for regression tests and should be included explicitely. | |
42 | Usually mk-c makefiles consist of variables assignments | |
43 | and inclusion of | |
44 | .B mkc.mk | |
45 | in the and. | |
46 | One can also use | |
47 | .BR mkc.prog.mk ", " mkc.lib.mk ", " mkc.files.mk ", " mkc.subdir.mk " and " mkc.subprj.mk | |
48 | instead of | |
49 | .BR mkc.mk . | |
50 | The latter activates | |
51 | .B mkc.lib.mk | |
52 | if variable LIB is set, | |
53 | .B mkc.prog.mk | |
54 | if variables PROG or PROGS are set, | |
55 | .B mkc.subprj.mk | |
56 | if variable SUBPRJ is set, | |
57 | .B mkc.subdir.mk | |
58 | if variable SUBDIR is set, | |
59 | and | |
60 | .B mkc.files.mk | |
61 | otherwise. | |
62 | .B | |
63 | .P | |
64 | To get system-wide configuration parameters, mkc.init.mk loads | |
65 | "${MAKECONF}" file if it exists. | |
66 | Otherwise, it loads | |
67 | @sysconfdir@/mk-c.conf if it exists. | |
68 | If neither ${MAKECONF} nor @sysconfdir@/mk-c.conf exist, | |
69 | it tries to load @sysconfdir@/mk.conf file. | |
70 | If "${SRCTOP}/Makefile.common" file exists it is also included | |
34 | 71 | by all subprojects. |
35 | 72 | Unless SRCTOP variable is set, "../Makefile.inc" |
36 | 73 | is also included if exists. |
50 | 87 | .I Mu |
51 | 88 | means "May be set in project's Makefile but may be initialized or overriden by user". |
52 | 89 | .SS "Targets" |
53 | .BR mkc.prog.mk ", " mkc.lib.mk ", " mkc.files.mk ", " mkc.subdir.mk ", and " mkc.subprj.mk | |
54 | include files provide the following targets: | |
90 | Mk-configure provides the following targets: | |
55 | 91 | .IP all |
56 | 92 | build everything. |
57 | 93 | .IP clean |
85 | 121 | if MKOBJDIR is "yes", creates object directories (${.OBJDIR}) according |
86 | 122 | to MAKEOBJDIR and MAKEOBJPREFIX variables. Current umask is used for |
87 | 123 | this. |
124 | .VE | |
125 | .IP mkgen | |
126 | .RB See " mkc_imp.foreign_autotools.mk" . | |
88 | 127 | .IP "bin_tar, bin_targz, bin_tarbz2, bin_zip, bin_deb" |
89 | 128 | build software, install it to a temporary directory (using DESTDIR) |
90 | 129 | and create .tar/.tar.gz/.tar.bz2/.zip/.deb archive |
103 | 142 | All targets in this list have |
104 | 143 | .IR pre\_* ", " do\_* " and " post\_* |
105 | 144 | counterparts. See ALLTARGETS for details. |
106 | .SS "Common variables" | |
107 | The following variables control how various files are compiled/built. | |
145 | .SS "mkc.init.mk" | |
146 | This file is included by | |
147 | .BR mkc.mk " and " mkc.configure.mk | |
148 | automatically but can be used by users directly. | |
149 | .B mkc.init.mk | |
150 | uses the following variables. | |
108 | 151 | .IP AR |
109 | 152 | Create, modify, and extract from archives. |
110 | 153 | .RI < Iu > |
175 | 218 | .IP CPPFLAGS_<project> |
176 | 219 | Similar to CPPFLAGS but for project ${PROJECTNAME}. |
177 | 220 | .RI < "U" > |
221 | .IP CPPFLAGS0 | |
222 | The same as CPPFLAGS but CPPFLAGS0 are passed to the compiler before CPPFLAGS. | |
223 | Normally, CPPFLAGS0 should be modified in makefiles and should not | |
224 | be set from environment by user. | |
178 | 225 | .IP FC |
179 | 226 | Fortran compiler. |
180 | 227 | .RI < Iu > |
369 | 416 | Target directory for architecture-independent text files. |
370 | 417 | .RI < "Iu" > |
371 | 418 | .RI [ ${PREFIX}/share ] |
419 | .IP SHAREDSTATEDIR | |
420 | Target directory for modifiable architecture-independent data files. | |
421 | .RI < "Iu" > | |
422 | .RI [ ${PREFIX}/com ] | |
423 | .IP VARDIR | |
424 | Target directory for modifiable single-machine data files. | |
425 | .RI < "Iu" > | |
426 | .RI [ ${PREFIX}/var ] | |
427 | .IP INCSDIR | |
428 | Target directory for header files. | |
429 | .RI < "Iu" > | |
430 | .RI [ ${PREFIX}/include ] | |
372 | 431 | .IP SYSCONFDIR |
373 | 432 | Target directory for configuration files. |
374 | 433 | .RI < "Iu" > |
550 | 609 | Top-level object directory which |
551 | 610 | defaults to ${.OBJDIR} if ${.MAKE.LEVEL} is 0. |
552 | 611 | .RI < I > |
553 | .SS "mkc.init.mk" | |
554 | This file sets most important mk-configure variables, for example, | |
555 | OPSYS, PREFIX, CC_TYPE etc. and is included automatically by | |
556 | .BR mkc.files.mk ", " mkc.lib.mk ", " mkc.prog.mk ", " mkc.subdir.mk " and " mkc.subprj.mk | |
557 | 612 | .SS "mkc.files.mk" |
558 | 613 | The include file |
559 | 614 | .B mkc.files.mk |
560 | handles the FILES variables and is included | |
615 | handles the FILES variable and is included | |
561 | 616 | from |
562 | 617 | .BR mkc.lib.mk " and " mkc.prog.mk . |
563 | .B mkc_imp.files.mk | |
564 | 618 | List of supported variables: |
565 | 619 | .IP FILES |
566 | 620 | The list of files to install. |
708 | 762 | Similar to LDFLAGS but for project ${PROJECTNAME}. |
709 | 763 | .IP LDFLAGS0 |
710 | 764 | The same as LDFLAGS but LDFLAGS0 and LDADD0 are passed to the linker before LDFLAGS and LDADD. |
711 | Normally LDFLAGS0 and LDADD0 should be modified in makefiles and should not | |
765 | Normally, LDFLAGS0 and LDADD0 should be modified in makefiles and should not | |
712 | 766 | be set from environment by user. |
713 | 767 | .RI < "M" > |
714 | 768 | .IP "BINDIR, BINMODE, BINOWN and BINGRP" |
739 | 793 | be exported. |
740 | 794 | .RI < "M" > |
741 | 795 | .RI [ no ] |
796 | .IP DPINCDIRS | |
797 | See LIBDEPS in section | |
798 | .BR mk.subprj.mk . | |
799 | .IP DPLIBDIRS | |
800 | See LIBDEPS in section | |
801 | .BR mk.subprj.mk . | |
802 | .IP DPLDADD | |
803 | See LIBDEPS in section | |
804 | .BR mk.subprj.mk . | |
742 | 805 | .PP |
743 | 806 | .B mkc.prog.mk |
744 | 807 | includes |
747 | 810 | .SS "mkc.lib.mk" |
748 | 811 | The include file |
749 | 812 | .B mkc.lib.mk |
750 | has support for building a static or dynanic library. It has a | |
751 | limited number of suffixes. | |
813 | has support for building a static and dynanic library or DLL. | |
752 | 814 | .B mkc.lib.mk |
753 | 815 | uses the following variables: |
754 | 816 | .IP LIB |
823 | 885 | .\" |
824 | 886 | .\" It has rules for building profiled objects; profiled libraries are |
825 | 887 | .\" built by default. |
826 | .IP LDCOMPILER | |
827 | If "yes", ${CC} is used for linking instead of ${LD}. | |
828 | For C++ sources ${CXX} is used for linking. | |
829 | .RI < "Iu" > | |
830 | .RI [ yes ] | |
831 | 888 | .IP MKSHLIB |
832 | 889 | If not "no", build and install shared library provided that SHLIB_MAJOR is defined. |
833 | 890 | .RI < "IMu" > |
856 | 913 | all symbols are exported. |
857 | 914 | .RI < "M" > |
858 | 915 | [] |
916 | .IP DPINCDIRS | |
917 | See LIBDEPS in section | |
918 | .BR mk.subprj.mk . | |
919 | .IP DPLIBDIRS | |
920 | See LIBDEPS in section | |
921 | .BR mk.subprj.mk . | |
922 | .IP DPLDADD | |
923 | See LIBDEPS in section | |
924 | .BR mk.subprj.mk . | |
859 | 925 | .\" .IP "COPTS.lib<lib> OBJCCOPTS.lib<lib> LDADD.lib<lib> CPPFLAGS.lib<lib> CXXFLAGS.lib<lib>" |
860 | 926 | .\" These provide a way to specify additions to the associated |
861 | 927 | .\" variables in a way that applies only to a particular |
924 | 990 | subdirectory doesn't exist the subproject becomes "virtual" and may be |
925 | 991 | used to group several subprojects into a new virtual one. |
926 | 992 | .RI < "M" > |
993 | .IP LIBDEPS | |
994 | A list of library dependencies. Each token is a colon-separated pair. | |
995 | Its first component is a library subproject (dependency), the second | |
996 | one is the subproject for library or executable. The value of this | |
997 | variable is automatically added to SUBPRJ. Library dependencies listed | |
998 | in LIBDEPS automatically change CPPFLAGS0, LDFLAGS0 and LDADD0 of | |
999 | approptiate subprojects. | |
1000 | .RI < "M" > | |
1001 | Suppose, we have <library:program> pair in LIBDEPS, also suppose that variable | |
1002 | .B library | |
1003 | is set to "library" subdirectory and variable | |
1004 | .B program | |
1005 | is set to "program" subdirectory. | |
1006 | ${SRCDIR_library}/linkme.mk file is automatically included from | |
1007 | ${SRCDIR_program}/Makefile if it exists. In this file | |
1008 | .RI "DPLDADD [" "${library:T:S/^lib//}" "]," | |
1009 | .RI "DPLIBDIRS [" "${OBJDIR_${library:S,/,_,g}}" "] and" | |
1010 | .RI "DPINCDIRS [" "${SRCDIR_${library:S,/,_,g}} ${OBJDIR_${library:S,/,_,g}}" "]," | |
1011 | may be set to non-default values. These three variables then changes | |
1012 | LDADD0, LDFLAGS0 and CPPFLAGS0 respectively in subproject "program". | |
1013 | The dependency graph specified by variable LIBDEPS is available to all | |
1014 | subproject via environment. | |
1015 | .IP STATICLIBS | |
1016 | A list of subprojects (basenames) with static libraries. If dependency is | |
1017 | mentioned in this variable, the suffix _pic is automatically added | |
1018 | for PIE-executables or shared libraries that depend on this library. | |
1019 | This variable is automatically passed to subprojects via environment. | |
1020 | .RI < Mu > | |
1021 | .RI [ "" ] | |
1022 | .IP INTERNALLIBS | |
1023 | A list of subprojects (basenames) with internal libraries. | |
1024 | These libraries are static and not installed by target "install". | |
1025 | .RI < M > | |
1026 | .RI [ "" ] | |
1027 | .IP COMPATLIB | |
1028 | Subproject's basename for compatibility library. | |
1029 | If this variable is set, MKC_SOURCE_FUNCLIBS and FEATURES | |
1030 | do not change SRCS for subprojects other than ${COMPATLIB}. | |
1031 | .RI < M > | |
1032 | .RI [ "" ] | |
927 | 1033 | .IP SUBPRJ_DFLT |
928 | 1034 | List of projects built and installed by default. |
929 | 1035 | The default is all projects listed in SUBPRJ. |
992 | 1098 | top-level ${.CURDIR} in paths. |
993 | 1099 | .RI < "Iu" > |
994 | 1100 | .RI [ no ] |
1101 | .IP SUBPRJSRCTOP | |
1102 | This variables contains ${.CURDIR} directory and is passed to subprojects. | |
1103 | .RI < "I" > | |
1104 | .RI [ ${.CURDIR} ] | |
995 | 1105 | .P |
996 | 1106 | .B mkc.subprj.mk |
997 | 1107 | provides the following targets: |
1325 | 1435 | .RS |
1326 | 1436 | Avalable values: |
1327 | 1437 | .TP |
1328 | .BR prog_flex ", " prog_bison ", " prog_gawk ", " prog_gm4 | |
1329 | Find flex, bison, GNU awk or GNU m4 by analysing program's help and/or | |
1330 | version messages. If found, BUILTIN.prog_<progname> is set to a path, | |
1331 | otherwise it is set to an empty string. Note that | |
1438 | .BR prog_flex ", " prog_bison ", " prog_gawk ", " prog_gm4 ", " prog_gmake | |
1439 | Find flex, bison, GNU awk, GNU m4 or GNU make respectively | |
1440 | by analysing program's help and/or | |
1441 | version messages. If found, BUILTIN.prog_<progname> is set to the path, | |
1442 | otherwise it is set to empty string. Note that | |
1332 | 1443 | .I gawk |
1333 | 1444 | may be found as |
1334 | 1445 | .IR awk , |
1337 | 1448 | .IR yacc , |
1338 | 1449 | .I gm4 |
1339 | 1450 | as |
1340 | .IR m4 | |
1341 | and | |
1451 | .IR m4 , | |
1342 | 1452 | .I flex |
1343 | 1453 | as |
1344 | .IR lex . | |
1454 | .IR lex " and" | |
1455 | .I gmake | |
1456 | as | |
1457 | .IR make . | |
1345 | 1458 | .TP |
1346 | 1459 | .BR prog_mkdep ", " prog_nbmkdep |
1347 | 1460 | Find traditional BSD mkdep(1) or recent NetBSD version of it respectively. |
1499 | 1612 | mkc_strlcat.h header. |
1500 | 1613 | .TP |
1501 | 1614 | .B strlcpy |
1502 | The same as strlcat. | |
1615 | Similar to strlcat. | |
1503 | 1616 | .TP |
1504 | 1617 | .B getline |
1505 | 1618 | This feature corresponds to getline(3) function which is a part of POSIX2008 |
1509 | 1622 | implementation is available in libc. If not, getline.c provided by |
1510 | 1623 | mk-configure is added to SRCS and declaration is provided in |
1511 | 1624 | mkc_getline.h header. |
1625 | .TP | |
1626 | .B progname | |
1627 | This feature provides getprogname(3) and setprogname(3) functions | |
1628 | available in *BSD. | |
1629 | .TP | |
1630 | .B fgetln | |
1631 | This feature provides fgetln(3) BSD-ism. | |
1632 | .TP | |
1633 | .B err | |
1634 | This feature provides err(3), errx(3), verr(3) and verrx(3) BSD-isms. | |
1635 | .TP | |
1636 | .B warn | |
1637 | This feature provides warn(3), warnx(3), vwarn(3) and vwarnx(3) BSD-isms. | |
1512 | 1638 | .TP |
1513 | 1639 | .B libm |
1514 | 1640 | This feature checks whether libm is available and if yes, adds -lm to |
1659 | 1785 | .RI @ "" "datadir@ ${DATADIR}" |
1660 | 1786 | .RI @ "" "sysconfdir@ ${SYSCONFDIR}" |
1661 | 1787 | .RI @ "" "incsdir@ ${INCSDIR}" |
1788 | .RI @ "" "vardir@ ${VARDIR}" | |
1789 | .RI @ "" "sharedstate@ ${SHAREDSTATEDIR}" | |
1662 | 1790 | .VE |
1663 | 1791 | The following variables are provided: |
1664 | 1792 | .IP INFILES |
1776 | 1904 | This module provides installation of header files and provides |
1777 | 1905 | the following variables: |
1778 | 1906 | .IP INCSDIR |
1779 | Target directory for includes. | |
1780 | .RI < "Iu" > | |
1781 | .RI [ ${PREFIX}/include ] | |
1907 | See | |
1908 | .BR mkc.init.mk . | |
1782 | 1909 | .IP INCS |
1783 | 1910 | The list of include files. |
1784 | 1911 | .RI < "M" > |
1899 | 2026 | Compiler passed to mkdep(1). |
1900 | 2027 | .RI < "Iu" > |
1901 | 2028 | .RI [ "${CC}" ]. |
2029 | .SS "mkc_imp.foreign_autotools.mk" | |
2030 | This module is activated if variable FOREIGN is set to "autotools" and provides | |
2031 | support for building external projects using autotools. | |
2032 | It also provides a recursive target | |
2033 | .B mkgen | |
2034 | for generating "configure" script, "Makefile.in" file etc. using | |
2035 | .BR autoreconf(1) " utility." | |
2036 | The following variables are provided: | |
2037 | .IP FSRCDIR | |
2038 | Relative (to ${.CURDIR}) or absolute directory to autotools-based sources. | |
2039 | .IP AT_MAKE | |
2040 | Make(1)-like utility for the project. | |
2041 | .RI < "Imu" > | |
2042 | .RI [ "${MAKE}" ]. | |
2043 | .IP AT_USE_AUTOMAKE | |
2044 | If "yes", | |
2045 | .B automake(1) | |
2046 | is used. | |
2047 | .RI < "M" > | |
2048 | .RI [ yes ]. | |
2049 | .IP AT_CONFIGURE_ARGS | |
2050 | Extra arguments passed to "configure" script set in addition to | |
2051 | standard ones (--prefix, --bindir etc.). | |
2052 | .RI < "Mu" > | |
2053 | .RI [ "" ]. | |
2054 | .IP AT_CONFIGURE_ENV | |
2055 | Environment variables for "configure" script set in addition to | |
2056 | standard ones (CC, CFLAGS etc.). | |
2057 | .RI < "Mu" > | |
2058 | .RI [ "" ]. | |
2059 | .IP AT_AUTORECONF_ARGS | |
2060 | Arguments passed to | |
2061 | .BR autoreconf(1) . | |
2062 | .RI < "U" > | |
2063 | .RI [ "-sif" ]. | |
1902 | 2064 | .SH "CROSS COMPILATION" |
1903 | 2065 | The following variables are used for compiling software using cross-tools. |
1904 | 2066 | .IP MACHINE_GNU_PLATFORM |
1927 | 2089 | Path to mk.conf file .include-ed by mkc.*.mk files |
1928 | 2090 | .SH "FILES" |
1929 | 2091 | .IP @sysconfdir@/mk.conf |
1930 | .include-ed by mkc.*.mk if exists | |
1931 | .IP /etc/mk.conf | |
1932 | .include-ed by mkc.*.mk if exists | |
2092 | .include-ed by mkc.init.mk if exists | |
1933 | 2093 | .SH "BUGS" |
1934 | 2094 | Target |
1935 | 2095 | .IR errorcheck " (" configure ")" |
0 | 0 | #!/bin/sh |
1 | 1 | |
2 | 2 | ############################################################ |
3 | # Copyright (c) 2009-2010 by Aleksey Cheusov | |
3 | # Copyright (c) 2009-2014 by Aleksey Cheusov | |
4 | 4 | # |
5 | 5 | # See LICENSE file in the distribution. |
6 | 6 | ############################################################ |
0 | #!@AWK@ -f | |
1 | ||
2 | # Usage: mkc_get_deps | |
3 | # $1 -- project name | |
4 | # ENVIRON ["AXCIENT_LIBDEPS"] -- dep1:prj1 dep2:prj2 ... | |
5 | ||
6 | function print_all_deps (prj, i,next_prj){ | |
7 | if (prj in processed) | |
8 | return | |
9 | ||
10 | processed [prj]=1 | |
11 | ||
12 | for (i=1; i <= count [prj]; ++i){ | |
13 | next_prj = graph[prj, i] | |
14 | print_all_deps(next_prj) | |
15 | } | |
16 | ||
17 | if (topprj != prj) | |
18 | result [++result_sz] = prj | |
19 | } | |
20 | ||
21 | BEGIN { | |
22 | topprj = ARGV [1] | |
23 | if (!topprj) | |
24 | exit(10) | |
25 | ||
26 | cnt = split(ENVIRON ["AXCIENT_LIBDEPS"], deps, / +|:/) | |
27 | if (int(cnt/2)*2 != cnt) | |
28 | exit(11) | |
29 | ||
30 | for (i=1; i <= cnt; i += 2){ | |
31 | from = deps [i] | |
32 | to = deps [i+1] | |
33 | graph[to, ++count [to]] = from | |
34 | } | |
35 | ||
36 | print_all_deps(topprj) | |
37 | ||
38 | for (i=result_sz; i >= 1; --i) | |
39 | print result [i] | |
40 | ||
41 | print "" # for bmake | |
42 | } |
0 | .PHONY : test_output | |
1 | test_output : | |
2 | @set -e; \ | |
3 | \ | |
4 | echo =========== all ============; \ | |
5 | ${MAKE} ${MAKEFLAGS} all 2>&1 | head -n 2; \ | |
6 | \ | |
7 | ${MAKE} ${MAKEFLAGS} cleandir > /dev/null | |
8 | ||
9 | .include <mkc.minitest.mk> |
0 | 0 | .PATH: ../../examples/hello_cxxlib/cxxlib |
1 | 1 | |
2 | MKDLL= yes | |
2 | MKDLL = only | |
3 | 3 | |
4 | 4 | .include "../../examples/hello_cxxlib/cxxlib/Makefile" |
5 | 5 | .include "../mkpiclib/test.mk" |
0 | 0 | =========== all ============ |
1 | 1 | /objdir/Makefile |
2 | /objdir/_mkc_compiler_type.err | |
3 | /objdir/_mkc_compiler_type.res | |
2 | 4 | /objdir/_mkc_cxx_type.err |
3 | 5 | /objdir/_mkc_cxx_type.res |
6 | /objdir/_mkc_funclib_dummy.c | |
7 | /objdir/_mkc_funclib_dummy.err | |
8 | /objdir/_mkc_funclib_dummy.res | |
4 | 9 | /objdir/_mkc_prog_cxx.err |
5 | 10 | /objdir/_mkc_prog_cxx.res |
6 | 11 | /objdir/cxxlib.so |
12 | /objdir/dummy.os | |
7 | 13 | /objdir/expect.out |
8 | /objdir/hello_msg1.o | |
9 | 14 | /objdir/hello_msg1.os |
10 | /objdir/hello_msg2.o | |
11 | 15 | /objdir/hello_msg2.os |
12 | /objdir/libcxxlib.a | |
13 | 16 | /objdir/mkdll.test.out.tmp |
14 | 17 | ========= install ========== |
15 | 18 | /objdir/prefix |
20 | 23 | /objdir/prefix/include/impl/hello_msg2.h |
21 | 24 | /objdir/prefix/lib |
22 | 25 | /objdir/prefix/lib/cxxlib.so |
23 | /objdir/prefix/lib/libcxxlib.a | |
24 | 26 | ======== uninstall ========= |
25 | 27 | ========== clean =========== |
26 | 28 | /objdir/Makefile |
29 | /objdir/_mkc_compiler_type.err | |
30 | /objdir/_mkc_compiler_type.res | |
27 | 31 | /objdir/_mkc_cxx_type.err |
28 | 32 | /objdir/_mkc_cxx_type.res |
33 | /objdir/_mkc_funclib_dummy.c | |
34 | /objdir/_mkc_funclib_dummy.err | |
35 | /objdir/_mkc_funclib_dummy.res | |
29 | 36 | /objdir/_mkc_prog_cxx.err |
30 | 37 | /objdir/_mkc_prog_cxx.res |
31 | 38 | /objdir/expect.out |
32 | 39 | /objdir/mkdll.test.out.tmp |
40 | ======= CLEANFILES ========== | |
41 | /objdir/mkdll.test.out | |
42 | cxxlib.so | |
43 | dummy.o | |
44 | dummy.op | |
45 | dummy.os | |
46 | hello_msg1.o | |
47 | hello_msg1.op | |
48 | hello_msg1.os | |
49 | hello_msg2.o | |
50 | hello_msg2.op | |
51 | hello_msg2.os | |
52 | libcxxlib.a | |
53 | libcxxlib_p.a | |
54 | libcxxlib_pic.a | |
55 | ======= UNINSTALLFILES ========== | |
56 | /prefix/include/hello_msg.h | |
57 | /prefix/include/impl/hello_msg1.h | |
58 | /prefix/include/impl/hello_msg2.h | |
59 | /prefix/lib/cxxlib.so | |
33 | 60 | ======= distclean ========== |
34 | 61 | /objdir/Makefile |
35 | 62 | /objdir/expect.out |
0 | 0 | =========== all ============ |
1 | 1 | /objdir/Makefile |
2 | /objdir/_mkc_compiler_type.err | |
3 | /objdir/_mkc_compiler_type.res | |
2 | 4 | /objdir/_mkc_cxx_type.err |
3 | 5 | /objdir/_mkc_cxx_type.res |
6 | /objdir/_mkc_funclib_dummy.c | |
7 | /objdir/_mkc_funclib_dummy.err | |
8 | /objdir/_mkc_funclib_dummy.res | |
4 | 9 | /objdir/_mkc_prog_cxx.err |
5 | 10 | /objdir/_mkc_prog_cxx.res |
11 | /objdir/dummy.os | |
6 | 12 | /objdir/expect.out |
7 | 13 | /objdir/hello_msg1.os |
8 | 14 | /objdir/hello_msg2.os |
21 | 27 | ======== uninstall ========= |
22 | 28 | ========== clean =========== |
23 | 29 | /objdir/Makefile |
30 | /objdir/_mkc_compiler_type.err | |
31 | /objdir/_mkc_compiler_type.res | |
24 | 32 | /objdir/_mkc_cxx_type.err |
25 | 33 | /objdir/_mkc_cxx_type.res |
34 | /objdir/_mkc_funclib_dummy.c | |
35 | /objdir/_mkc_funclib_dummy.err | |
36 | /objdir/_mkc_funclib_dummy.res | |
26 | 37 | /objdir/_mkc_prog_cxx.err |
27 | 38 | /objdir/_mkc_prog_cxx.res |
28 | 39 | /objdir/expect.out |
29 | 40 | /objdir/mkpiclib.test.out.tmp |
30 | 41 | /objdir/test.mk |
42 | ======= CLEANFILES ========== | |
43 | /objdir/mkpiclib.test.out | |
44 | dummy.o | |
45 | dummy.op | |
46 | dummy.os | |
47 | hello_msg1.o | |
48 | hello_msg1.op | |
49 | hello_msg1.os | |
50 | hello_msg2.o | |
51 | hello_msg2.op | |
52 | hello_msg2.os | |
53 | libcxxlib.a | |
54 | libcxxlib_p.a | |
55 | libcxxlib_pic.a | |
56 | ======= UNINSTALLFILES ========== | |
57 | /prefix/include/hello_msg.h | |
58 | /prefix/include/impl/hello_msg1.h | |
59 | /prefix/include/impl/hello_msg2.h | |
60 | /prefix/lib/libcxxlib_pic.a | |
31 | 61 | ======= distclean ========== |
32 | 62 | /objdir/Makefile |
33 | 63 | /objdir/expect.out |
24 | 24 | find ${.OBJDIR} -type f | \ |
25 | 25 | mkc_test_helper "${PREFIX}" "${.OBJDIR}";\ |
26 | 26 | \ |
27 | echo ======= CLEANFILES ==========; \ | |
28 | ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \ | |
29 | awk '{for(i=1; i<=NF; ++i) print $$i}' | \ | |
30 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ | |
31 | echo ======= UNINSTALLFILES ==========; \ | |
32 | ${MAKE} ${MAKEFLAGS} print_values2 VARS='UNINSTALLFILES' MKCHECKS=no | \ | |
33 | awk '{for(i=1; i<=NF; ++i) print $$i}' | \ | |
34 | mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ | |
27 | 35 | echo ======= distclean ==========; \ |
28 | 36 | ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \ |
29 | 37 | find ${.OBJDIR} -type f | \ |
0 | 0 | =========== all ============ |
1 | 1 | /objdir/Makefile |
2 | /objdir/_mkc_compiler_type.err | |
3 | /objdir/_mkc_compiler_type.res | |
2 | 4 | /objdir/_mkc_cxx_type.err |
3 | 5 | /objdir/_mkc_cxx_type.res |
6 | /objdir/_mkc_funclib_dummy.c | |
7 | /objdir/_mkc_funclib_dummy.err | |
8 | /objdir/_mkc_funclib_dummy.res | |
4 | 9 | /objdir/_mkc_prog_cxx.err |
5 | 10 | /objdir/_mkc_prog_cxx.res |
11 | /objdir/dummy.o | |
12 | /objdir/dummy.op | |
13 | /objdir/dummy.os | |
6 | 14 | /objdir/expect.out |
7 | 15 | /objdir/hello_msg1.o |
8 | 16 | /objdir/hello_msg1.op |
30 | 38 | ======== uninstall ========= |
31 | 39 | ========== clean =========== |
32 | 40 | /objdir/Makefile |
41 | /objdir/_mkc_compiler_type.err | |
42 | /objdir/_mkc_compiler_type.res | |
33 | 43 | /objdir/_mkc_cxx_type.err |
34 | 44 | /objdir/_mkc_cxx_type.res |
45 | /objdir/_mkc_funclib_dummy.c | |
46 | /objdir/_mkc_funclib_dummy.err | |
47 | /objdir/_mkc_funclib_dummy.res | |
35 | 48 | /objdir/_mkc_prog_cxx.err |
36 | 49 | /objdir/_mkc_prog_cxx.res |
37 | 50 | /objdir/expect.out |
38 | 51 | /objdir/mkprofilelib.test.out.tmp |
52 | ======= CLEANFILES ========== | |
53 | /objdir/mkprofilelib.test.out | |
54 | dummy.o | |
55 | dummy.op | |
56 | dummy.os | |
57 | hello_msg1.o | |
58 | hello_msg1.op | |
59 | hello_msg1.os | |
60 | hello_msg2.o | |
61 | hello_msg2.op | |
62 | hello_msg2.os | |
63 | libcxxlib.a | |
64 | libcxxlib.so | |
65 | libcxxlib.so.1 | |
66 | libcxxlib.so.1.0 | |
67 | libcxxlib.so.1.0.5 | |
68 | libcxxlib_p.a | |
69 | libcxxlib_pic.a | |
70 | ======= UNINSTALLFILES ========== | |
71 | /prefix/include/hello_msg.h | |
72 | /prefix/include/impl/hello_msg1.h | |
73 | /prefix/include/impl/hello_msg2.h | |
74 | /prefix/lib/libcxxlib.a | |
75 | /prefix/lib/libcxxlib.so | |
76 | /prefix/lib/libcxxlib.so.1 | |
77 | /prefix/lib/libcxxlib.so.1.0.5 | |
78 | /prefix/lib/libcxxlib_p.a | |
39 | 79 | ======= distclean ========== |
40 | 80 | /objdir/Makefile |
41 | 81 | /objdir/expect.out |
0 | 0 | =========== all ============ |
1 | 1 | /objdir/Makefile |
2 | /objdir/_mkc_compiler_type.err | |
3 | /objdir/_mkc_compiler_type.res | |
2 | 4 | /objdir/_mkc_cxx_type.err |
3 | 5 | /objdir/_mkc_cxx_type.res |
6 | /objdir/_mkc_funclib_dummy.c | |
7 | /objdir/_mkc_funclib_dummy.err | |
8 | /objdir/_mkc_funclib_dummy.res | |
4 | 9 | /objdir/_mkc_prog_cxx.err |
5 | 10 | /objdir/_mkc_prog_cxx.res |
11 | /objdir/dummy.o | |
6 | 12 | /objdir/expect.out |
7 | 13 | /objdir/hello_msg1.o |
8 | 14 | /objdir/hello_msg2.o |
20 | 26 | ======== uninstall ========= |
21 | 27 | ========== clean =========== |
22 | 28 | /objdir/Makefile |
29 | /objdir/_mkc_compiler_type.err | |
30 | /objdir/_mkc_compiler_type.res | |
23 | 31 | /objdir/_mkc_cxx_type.err |
24 | 32 | /objdir/_mkc_cxx_type.res |
33 | /objdir/_mkc_funclib_dummy.c | |
34 | /objdir/_mkc_funclib_dummy.err | |
35 | /objdir/_mkc_funclib_dummy.res | |
25 | 36 | /objdir/_mkc_prog_cxx.err |
26 | 37 | /objdir/_mkc_prog_cxx.res |
27 | 38 | /objdir/expect.out |
28 | 39 | /objdir/mkshlib.test.out.tmp |
40 | ======= CLEANFILES ========== | |
41 | /objdir/mkshlib.test.out | |
42 | dummy.o | |
43 | dummy.op | |
44 | dummy.os | |
45 | hello_msg1.o | |
46 | hello_msg1.op | |
47 | hello_msg1.os | |
48 | hello_msg2.o | |
49 | hello_msg2.op | |
50 | hello_msg2.os | |
51 | libcxxlib.a | |
52 | libcxxlib_p.a | |
53 | libcxxlib_pic.a | |
54 | ======= UNINSTALLFILES ========== | |
55 | /prefix/include/hello_msg.h | |
56 | /prefix/include/impl/hello_msg1.h | |
57 | /prefix/include/impl/hello_msg2.h | |
58 | /prefix/lib/libcxxlib.a | |
29 | 59 | ======= distclean ========== |
30 | 60 | /objdir/Makefile |
31 | 61 | /objdir/expect.out |
0 | 0 | =========== all ============ |
1 | 1 | /objdir/Makefile |
2 | /objdir/_mkc_compiler_type.err | |
3 | /objdir/_mkc_compiler_type.res | |
2 | 4 | /objdir/_mkc_cxx_type.err |
3 | 5 | /objdir/_mkc_cxx_type.res |
6 | /objdir/_mkc_funclib_dummy.c | |
7 | /objdir/_mkc_funclib_dummy.err | |
8 | /objdir/_mkc_funclib_dummy.res | |
4 | 9 | /objdir/_mkc_prog_cxx.err |
5 | 10 | /objdir/_mkc_prog_cxx.res |
11 | /objdir/dummy.os | |
6 | 12 | /objdir/expect.out |
7 | 13 | /objdir/hello_msg1.os |
8 | 14 | /objdir/hello_msg2.os |
22 | 28 | ======== uninstall ========= |
23 | 29 | ========== clean =========== |
24 | 30 | /objdir/Makefile |
31 | /objdir/_mkc_compiler_type.err | |
32 | /objdir/_mkc_compiler_type.res | |
25 | 33 | /objdir/_mkc_cxx_type.err |
26 | 34 | /objdir/_mkc_cxx_type.res |
35 | /objdir/_mkc_funclib_dummy.c | |
36 | /objdir/_mkc_funclib_dummy.err | |
37 | /objdir/_mkc_funclib_dummy.res | |
27 | 38 | /objdir/_mkc_prog_cxx.err |
28 | 39 | /objdir/_mkc_prog_cxx.res |
29 | 40 | /objdir/expect.out |
30 | 41 | /objdir/mkstaticlib.test.out.tmp |
42 | ======= CLEANFILES ========== | |
43 | /objdir/mkstaticlib.test.out | |
44 | dummy.o | |
45 | dummy.op | |
46 | dummy.os | |
47 | hello_msg1.o | |
48 | hello_msg1.op | |
49 | hello_msg1.os | |
50 | hello_msg2.o | |
51 | hello_msg2.op | |
52 | hello_msg2.os | |
53 | libcxxlib.a | |
54 | libcxxlib.so | |
55 | libcxxlib.so.1 | |
56 | libcxxlib.so.1.0 | |
57 | libcxxlib.so.1.0.5 | |
58 | libcxxlib_p.a | |
59 | libcxxlib_pic.a | |
60 | ======= UNINSTALLFILES ========== | |
61 | /prefix/include/hello_msg.h | |
62 | /prefix/include/impl/hello_msg1.h | |
63 | /prefix/include/impl/hello_msg2.h | |
64 | /prefix/lib/libcxxlib.so | |
65 | /prefix/lib/libcxxlib.so.1 | |
66 | /prefix/lib/libcxxlib.so.1.0.5 | |
31 | 67 | ======= distclean ========== |
32 | 68 | /objdir/Makefile |
33 | 69 | /objdir/expect.out |
0 | 0 | .ifndef REAL_TARGETS |
1 | .for i in clean cleandir install all uninstall installdirs depend \ | |
1 | .for i in errorcheck clean cleandir install all uninstall installdirs depend \ | |
2 | 2 | bin_tar bin_targz bin_tarbz2 bin_zip bin_deb |
3 | 3 | pre_${i} do_${i} post_${i}: |
4 | 4 | @echo "fake target ${.TARGET}" |
0 | 0 | =========== {pre,do,post}_recursive ============ |
1 | ================================================== | |
2 | errorcheck ===> tests/predopost_targets/lib | |
3 | fake target pre_errorcheck | |
4 | fake target do_errorcheck | |
5 | fake target post_errorcheck | |
6 | ================================================== | |
7 | errorcheck ===> tests/predopost_targets/others | |
8 | fake target pre_errorcheck | |
9 | fake target do_errorcheck | |
10 | fake target post_errorcheck | |
11 | ================================================== | |
12 | errorcheck ===> tests/predopost_targets/lua | |
13 | fake target pre_errorcheck | |
14 | fake target do_errorcheck | |
15 | fake target post_errorcheck | |
1 | 16 | ================================================== |
2 | 17 | clean ===> tests/predopost_targets/lib |
3 | 18 | fake target pre_clean |
56 | 71 | fake target post_install |
57 | 72 | ================================================== |
58 | 73 | all ===> tests/predopost_targets/lib |
74 | fake target pre_errorcheck | |
75 | fake target do_errorcheck | |
76 | fake target post_errorcheck | |
59 | 77 | fake target pre_all |
60 | 78 | fake target do_all |
61 | 79 | fake target post_all |
62 | 80 | ================================================== |
63 | 81 | all ===> tests/predopost_targets/others |
82 | fake target pre_errorcheck | |
83 | fake target do_errorcheck | |
84 | fake target post_errorcheck | |
64 | 85 | fake target pre_all |
65 | 86 | fake target do_all |
66 | 87 | fake target post_all |
67 | 88 | ================================================== |
68 | 89 | all ===> tests/predopost_targets/lua |
90 | fake target pre_errorcheck | |
91 | fake target do_errorcheck | |
92 | fake target post_errorcheck | |
69 | 93 | fake target pre_all |
70 | 94 | fake target do_all |
71 | 95 | fake target post_all |
3 | 3 | \ |
4 | 4 | { \ |
5 | 5 | echo '=========== {pre,do,post}_recursive ============'; \ |
6 | for t in clean cleandir install all uninstall installdirs depend; do \ | |
6 | for t in errorcheck clean cleandir install all uninstall installdirs depend; do \ | |
7 | 7 | ${MAKE} ${MAKEFLAGS} -j1 $$t | \ |
8 | 8 | grep -v checking; \ |
9 | 9 | done ; \ |
0 | ERROR: We need mk-configure v.999.0.0 while 0.27.0 is detected | |
0 | ERROR: We need mk-configure v.999.0.0 while 0.28.0 is detected |
0 | ERROR: We need mk-configure v.999.0.0 while 0.27.0 is detected | |
0 | ERROR: We need mk-configure v.999.0.0 while 0.28.0 is detected |
0 | ERROR: We need mk-configure v.999.0.0 while 0.27.0 is detected | |
0 | ERROR: We need mk-configure v.999.0.0 while 0.28.0 is detected |
0 | ERROR: We need mk-configure v.999.0.0 while 0.27.0 is detected | |
0 | ERROR: We need mk-configure v.999.0.0 while 0.28.0 is detected | |
1 | 1 | "bmake-20110606 or newer is required" |
2 | 2 | =========== all ============ |
3 | 3 | /objdir/Makefile |