summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Shadura <andrewsh@debian.org>2014-09-14 17:41:43 +0200
committerAndrew Shadura <andrew@shadura.me>2015-07-25 14:44:57 +0200
commit02e4dec7376d8e7b563b8008b979682b82b23e11 (patch)
tree18b1263e3a507d785fbde6a8a09e6e019ff986a8
parent99305952b2affb1672b6f44834378729c753aab4 (diff)
parent7bea690e43ee009efc9e8f6a45504496348cd3ee (diff)
Imported Debian patch 0.28.0-1
-rw-r--r--Makefile5
-rw-r--r--Makefile.inc12
-rw-r--r--README6
-rw-r--r--_mkc_prog_awk.err0
-rw-r--r--_mkc_prog_awk.res1
-rw-r--r--builtins/Makefile5
-rwxr-xr-xbuiltins/endianness (renamed from custom/endianness)0
-rwxr-xr-xbuiltins/prog_bison (renamed from custom/prog_bison)0
-rwxr-xr-xbuiltins/prog_flex (renamed from custom/prog_flex)0
-rwxr-xr-xbuiltins/prog_gawk (renamed from custom/prog_gawk)0
-rwxr-xr-xbuiltins/prog_gm4 (renamed from custom/prog_gm4)0
-rwxr-xr-xbuiltins/prog_gmake18
-rwxr-xr-xbuiltins/prog_mkdep (renamed from custom/prog_mkdep)0
-rwxr-xr-xbuiltins/prog_nbmkdep (renamed from custom/prog_nbmkdep)0
-rw-r--r--custom/Makefile5
-rw-r--r--debian/changelog7
-rw-r--r--debian/patches/01-lua-mk.patch13
-rw-r--r--debian/patches/series1
-rw-r--r--debian/sys.mk2
-rw-r--r--doc/Makefile2
-rw-r--r--doc/NEWS63
-rw-r--r--doc/NOTES179
-rw-r--r--doc/TODO59
-rw-r--r--examples/Makefile.inc4
-rw-r--r--examples/hello_autoconf/Makefile15
-rw-r--r--examples/hello_autoconf/expect.out46
-rw-r--r--examples/hello_autoconf/proj/AUTHORS1
-rw-r--r--examples/hello_autoconf/proj/COPYING26
-rw-r--r--examples/hello_autoconf/proj/ChangeLog1
-rw-r--r--examples/hello_autoconf/proj/Makefile.in26
-rw-r--r--examples/hello_autoconf/proj/NEWS1
-rw-r--r--examples/hello_autoconf/proj/README1
-rw-r--r--examples/hello_autoconf/proj/configure.ac14
-rw-r--r--examples/hello_autoconf/proj/hello_autoconf.c11
-rw-r--r--examples/hello_autoconf/test.mk27
-rw-r--r--examples/hello_autotools/Makefile11
-rw-r--r--examples/hello_autotools/expect.out62
-rw-r--r--examples/hello_autotools/proj/AUTHORS1
-rw-r--r--examples/hello_autotools/proj/COPYING26
-rw-r--r--examples/hello_autotools/proj/ChangeLog1
-rw-r--r--examples/hello_autotools/proj/Makefile.am3
-rw-r--r--examples/hello_autotools/proj/NEWS1
-rw-r--r--examples/hello_autotools/proj/README1
-rw-r--r--examples/hello_autotools/proj/configure.ac17
-rw-r--r--examples/hello_autotools/proj/main.c11
-rw-r--r--examples/hello_autotools/test.mk39
-rw-r--r--examples/hello_calc2/Makefile2
-rw-r--r--examples/hello_compatlib/Makefile5
-rw-r--r--examples/hello_compatlib/Makefile.inc1
-rw-r--r--examples/hello_compatlib/expect.out90
-rw-r--r--examples/hello_compatlib/libcmpt/Makefile3
-rw-r--r--examples/hello_compatlib/prog1/Makefile7
-rw-r--r--examples/hello_compatlib/prog1/prog1.c38
-rw-r--r--examples/hello_compatlib/prog2/Makefile7
-rw-r--r--examples/hello_compatlib/prog2/prog2.c24
-rw-r--r--examples/hello_compatlib/test.mk14
-rw-r--r--examples/hello_cxxlib/cxxlib/Makefile3
-rw-r--r--examples/hello_cxxlib/cxxlib/dummy.c6
-rw-r--r--examples/hello_cxxlib/cxxlib/linkme.mk6
-rw-r--r--examples/hello_cxxlib/expect.out15
-rw-r--r--examples/hello_cxxlib/test.mk3
-rw-r--r--examples/hello_dictd/Makefile20
-rw-r--r--examples/hello_dictd/dict/Makefile3
-rw-r--r--examples/hello_dictd/dictd/Makefile3
-rw-r--r--examples/hello_dictd/dictfmt/Makefile3
-rw-r--r--examples/hello_dictd/dictzip/Makefile4
-rw-r--r--examples/hello_dictd/expect.out231
-rw-r--r--examples/hello_dictd/libcommon/Makefile2
-rw-r--r--examples/hello_dictd/libcommon/linkme.mk5
-rw-r--r--examples/hello_dictd/libdz/dz.c8
-rw-r--r--examples/hello_dictd/libdz/linkme.mk5
-rw-r--r--examples/hello_dictd/libmaa/linkme.mk5
-rw-r--r--examples/hello_dictd/test.mk39
-rw-r--r--examples/hello_errwarn/Makefile10
-rw-r--r--examples/hello_errwarn/expect.out23
-rw-r--r--examples/hello_errwarn/hello.c54
-rw-r--r--examples/hello_errwarn/test.mk19
-rw-r--r--examples/hello_fgetln/Makefile10
-rw-r--r--examples/hello_fgetln/expect.out99
-rw-r--r--examples/hello_fgetln/hello.c24
-rw-r--r--examples/hello_fgetln/test.mk19
-rw-r--r--examples/hello_files/expect.NetBSD.out3
-rw-r--r--examples/hello_files/expect.out3
-rw-r--r--examples/hello_files/test.mk5
-rw-r--r--examples/hello_libdeps/Makefile7
-rw-r--r--examples/hello_libdeps/expect.out127
-rw-r--r--examples/hello_libdeps/libs/libbar/Makefile9
-rw-r--r--examples/hello_libdeps/libs/libbar/bar.c8
-rw-r--r--examples/hello_libdeps/libs/libbar/bar.h6
-rw-r--r--examples/hello_libdeps/libs/libbaz/Makefile10
-rw-r--r--examples/hello_libdeps/libs/libbaz/baz.c8
-rw-r--r--examples/hello_libdeps/libs/libbaz/include/baz.h6
-rw-r--r--examples/hello_libdeps/libs/libbaz/linkme.mk5
-rw-r--r--examples/hello_libdeps/libs/libfoo/Makefile9
-rw-r--r--examples/hello_libdeps/libs/libfoo/foo.c8
-rw-r--r--examples/hello_libdeps/libs/libfoo/foo.h6
-rw-r--r--examples/hello_libdeps/libs/libfoo/linkme.mk1
-rw-r--r--examples/hello_libdeps/libs/libfooqux/Makefile9
-rw-r--r--examples/hello_libdeps/libs/libfooqux/fooqux.c9
-rw-r--r--examples/hello_libdeps/libs/libfooqux/fooqux.h8
-rw-r--r--examples/hello_libdeps/progs/foobaz/Makefile5
-rw-r--r--examples/hello_libdeps/progs/foobaz/foobaz.c11
-rw-r--r--examples/hello_libdeps/progs/fooquxfoobar/Makefile5
-rw-r--r--examples/hello_libdeps/progs/fooquxfoobar/fooquxfoobar.c12
-rw-r--r--examples/hello_libdeps/test.mk52
-rw-r--r--examples/hello_lua/Makefile2
-rw-r--r--examples/hello_require_tools/Makefile13
-rw-r--r--examples/hello_scripts/Makefile6
-rw-r--r--examples/hello_scripts/expect.out12
-rwxr-xr-xexamples/hello_scripts/hello_world3.in (renamed from examples/hello_scripts/hello_world3)2
-rw-r--r--examples/hello_strlcpy/expect.out2
-rw-r--r--examples/hello_strlcpy/test.mk4
-rw-r--r--examples/hello_strlcpy2/expect.out2
-rw-r--r--examples/hello_strlcpy2/test.mk4
-rw-r--r--examples/hello_strlcpy3/Makefile2
-rw-r--r--examples/hello_strlcpy3/expect.out41
-rw-r--r--examples/hello_strlcpy3/hello.c6
-rw-r--r--examples/hello_strlcpy3/test.mk9
-rw-r--r--examples/hello_subdirs/prog1/Makefile6
-rw-r--r--examples/hello_subdirs/prog1/expect.out5
-rwxr-xr-xexamples/hello_subdirs/prog1/prog1.awk.in (renamed from examples/hello_subdirs/prog1/prog1.awk)2
-rw-r--r--examples/subprojects/libhello1/linkme.mk6
-rw-r--r--examples/subprojects/libhello2/linkme.mk6
-rw-r--r--examples/subprojects/test.mk4
-rw-r--r--examples/tools/Makefile8
-rw-r--r--examples/tools/expect.out31
-rw-r--r--examples/tools/libs/bar/linkme.mk5
-rw-r--r--examples/tools/libs/foo/linkme.mk5
-rw-r--r--examples/tools/libs/qux/linkme.mk5
-rw-r--r--examples/tools/tools/prog1/Makefile1
-rw-r--r--examples/tools/tools/prog2/Makefile1
-rw-r--r--examples/tools/tools/prog3/Makefile3
-rw-r--r--examples/tools/tools/prog4/Makefile1
-rw-r--r--examples/tools2/Makefile8
-rw-r--r--examples/tools2/expect.out35
-rw-r--r--examples/tools2/libs/bar/linkme.mk5
-rw-r--r--examples/tools2/libs/foo/linkme.mk5
-rw-r--r--examples/tools2/libs/qux/linkme.mk5
-rw-r--r--examples/tools2/tools/prog1/Makefile1
-rw-r--r--examples/tools2/tools/prog2/Makefile1
-rw-r--r--examples/tools2/tools/prog3/Makefile3
-rw-r--r--examples/tools2/tools/prog4/Makefile1
-rw-r--r--features/_mkcfake.c3
-rw-r--r--features/err/err.c99
-rw-r--r--features/fgetln/fgetln.c70
-rw-r--r--features/mkc_err.h36
-rw-r--r--features/mkc_fgetln.h16
-rw-r--r--features/mkc_imp.f_RB.mk4
-rw-r--r--features/mkc_imp.f_SLIST.mk15
-rw-r--r--features/mkc_imp.f_err.mk29
-rw-r--r--features/mkc_imp.f_fgetln.mk13
-rw-r--r--features/mkc_imp.f_getline.mk4
-rw-r--r--features/mkc_imp.f_libdl.mk4
-rw-r--r--features/mkc_imp.f_libm.mk4
-rw-r--r--features/mkc_imp.f_progname.mk28
-rw-r--r--features/mkc_imp.f_strlcat.mk4
-rw-r--r--features/mkc_imp.f_strlcpy.mk4
-rw-r--r--features/mkc_imp.f_warn.mk29
-rw-r--r--features/mkc_progname.h26
-rw-r--r--features/mkc_warn.h36
-rw-r--r--features/progname/progname.c37
-rw-r--r--features/warn/warn.c95
-rw-r--r--helpers/Makefile3
-rwxr-xr-xhelpers/mkc_long_lines.in17
-rwxr-xr-xhelpers/mkc_test_nm22
-rw-r--r--main.mk17
-rw-r--r--mk/Makefile15
-rw-r--r--mk/mkc.configure.mk2
-rw-r--r--mk/mkc.init.mk82
-rw-r--r--mk/mkc.minitest.mk11
-rw-r--r--mk/mkc_imp.conf-cleanup.mk9
-rw-r--r--mk/mkc_imp.conf-final.mk6
-rw-r--r--mk/mkc_imp.conf.mk (renamed from mk/configure.mk)22
-rw-r--r--mk/mkc_imp.dep.mk24
-rw-r--r--mk/mkc_imp.dpvars.mk27
-rw-r--r--mk/mkc_imp.foreign_autotools.mk79
-rw-r--r--mk/mkc_imp.inc.mk2
-rw-r--r--mk/mkc_imp.intexts.mk16
-rw-r--r--mk/mkc_imp.lib.mk21
-rw-r--r--mk/mkc_imp.lua.mk1
-rw-r--r--mk/mkc_imp.mk66
-rw-r--r--mk/mkc_imp.objdir.mk12
-rw-r--r--mk/mkc_imp.pkg-config.mk2
-rw-r--r--mk/mkc_imp.platform.sys.mk4
-rw-r--r--mk/mkc_imp.subprj.mk10
-rw-r--r--mk/mkc_imp.vars.mk.in1
-rw-r--r--presentation/_mkc_prog_awk.err0
-rw-r--r--presentation/_mkc_prog_awk.res1
-rw-r--r--presentation/presentation.pdfbin160669 -> 161123 bytes
-rw-r--r--scripts/Makefile2
-rw-r--r--scripts/mk-configure.7.in236
-rwxr-xr-xscripts/mkc_check_custom2
-rwxr-xr-xscripts/mkc_get_deps.in43
-rw-r--r--tests/FSRCDIR/Makefile5
-rw-r--r--tests/FSRCDIR/expect.out3
-rw-r--r--tests/FSRCDIR/test.mk10
-rw-r--r--tests/mkdll/Makefile2
-rw-r--r--tests/mkdll/expect.out35
-rw-r--r--tests/mkpiclib/expect.out30
-rw-r--r--tests/mkpiclib/test.mk8
-rw-r--r--tests/mkprofilelib/expect.out40
-rw-r--r--tests/mkshlib/expect.out30
-rw-r--r--tests/mkstaticlib/expect.out36
-rw-r--r--tests/predopost_targets/Makefile.inc2
-rw-r--r--tests/predopost_targets/expect.out24
-rw-r--r--tests/predopost_targets/test.mk2
-rw-r--r--tests/reqd/expect.out2
-rw-r--r--tests/reqd2/expect.out2
-rw-r--r--tests/reqd3/expect.out2
-rw-r--r--tests/reqd4/expect.out2
-rw-r--r--tests/sys_queue/Makefile1
-rw-r--r--tests/sys_queue/test.mk3
212 files changed, 3169 insertions, 505 deletions
diff --git a/Makefile b/Makefile
index f92bdac..eae5079 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,8 @@
+# Copyright (c) 2014 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
.MAIN: all
.DEFAULT:
@unset ROOT_GROUP; ${MAKE} ${MAKEFLAGS} -m ${.CURDIR}/mk -m ${.CURDIR}/features -f main.mk ${.TARGET}
diff --git a/Makefile.inc b/Makefile.inc
index 84c7c52..38d9be8 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -1,14 +1,14 @@
-VERSION = 0.27.0
+VERSION = 0.28.0
BIRTHDATE = 2009-02-21
MKFILESDIR ?= ${PREFIX}/share/mkc-mk
DOCDIR ?= ${PREFIX}/share/doc/mk-configure
-BUILTINSDIR ?= ${PREFIX}/share/mk-configure/custom
+BUILTINSDIR ?= ${PREFIX}/share/mk-configure/builtins
FEATURESDIR ?= ${PREFIX}/share/mk-configure/features
INTEXTS_REPLS += version ${VERSION}
-INTEXTS_REPLS += AWK ${AWK}
+INTEXTS_REPLS += AWK ${PROG.awk}
INTEXTS_REPLS += BMAKE ${BMAKE}
INTEXTS_REPLS += mkfilesdir ${MKFILESDIR}
INTEXTS_REPLS += syscustomdir ${BUILTINSDIR}
@@ -17,11 +17,9 @@ INTEXTS_REPLS += mkc_libexecdir ${LIBEXECDIR}
.if exists(/usr/xpg4/bin/awk)
# Solaris' /usr/bin/awk is completely broken,
# /usr/xpg4/bin/awk sucks too but sucks less.
-AWK ?= /usr/xpg4/bin/awk
-.elif exists(/usr/bin/awk)
-AWK ?= /usr/bin/awk
+PROG.awk ?= /usr/xpg4/bin/awk
.else
-AWK ?= /bin/awk
+MKC_REQUIRE_PROGS += awk
.endif
BMAKE ?= bmake
diff --git a/README b/README
index bb39f50..b28207e 100644
--- a/README
+++ b/README
@@ -258,7 +258,7 @@ WHAT MK-CONFIGURE CONSISTS OF?
the samples.
- mkc.configure.mk is a replacement for GNU autoconf. Its
- functionality is large enough to describe here. It short, it allows
+ functionality is large enough to describe here. In short, it allows
to check for presence of header files, function or variable
declarations, presence of function in a particular library, defines,
sizeof of data types and other useful things. Read the documentation
@@ -281,6 +281,8 @@ DOCUMENTATION:
- Documentation for mk include files is in mk-configure(7).
+ - doc/NOTES contains a number of useful recipes.
+
- Most programs (mkc_check_{decl,header,funclib,sizeof,prog,custom})
have -h option and manual pages.
@@ -292,8 +294,6 @@ DOCUMENTATION:
- AWK interpreter from NetBSD cvs tree,
ported to Darwin, Solaris, Linux and other BSD.
http://mova.org/~cheusov/pub/mk-configure/nbawk/
- - getopt_long(3) like module for Lua programming language (>=0.8.0)
- http://sourceforge.net/projects/lua-alt-getopt/
-------------------------------------------------------------------------
IS MK-CONFIGURE STABLE?
diff --git a/_mkc_prog_awk.err b/_mkc_prog_awk.err
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/_mkc_prog_awk.err
diff --git a/_mkc_prog_awk.res b/_mkc_prog_awk.res
new file mode 100644
index 0000000..36178d1
--- /dev/null
+++ b/_mkc_prog_awk.res
@@ -0,0 +1 @@
+/usr/bin/awk
diff --git a/builtins/Makefile b/builtins/Makefile
new file mode 100644
index 0000000..0b350bc
--- /dev/null
+++ b/builtins/Makefile
@@ -0,0 +1,5 @@
+SCRIPTS = endianness prog_bison prog_flex prog_gawk prog_gm4 prog_gmake
+
+SCRIPTSDIR = ${BUILTINSDIR}
+
+.include <mkc.mk>
diff --git a/custom/endianness b/builtins/endianness
index fb7d76e..fb7d76e 100755
--- a/custom/endianness
+++ b/builtins/endianness
diff --git a/custom/prog_bison b/builtins/prog_bison
index dd7867f..dd7867f 100755
--- a/custom/prog_bison
+++ b/builtins/prog_bison
diff --git a/custom/prog_flex b/builtins/prog_flex
index d8cc5a8..d8cc5a8 100755
--- a/custom/prog_flex
+++ b/builtins/prog_flex
diff --git a/custom/prog_gawk b/builtins/prog_gawk
index d0403a7..d0403a7 100755
--- a/custom/prog_gawk
+++ b/builtins/prog_gawk
diff --git a/custom/prog_gm4 b/builtins/prog_gm4
index e82dc55..e82dc55 100755
--- a/custom/prog_gm4
+++ b/builtins/prog_gm4
diff --git a/builtins/prog_gmake b/builtins/prog_gmake
new file mode 100755
index 0000000..b942600
--- /dev/null
+++ b/builtins/prog_gmake
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+############################################################
+# Copyright (c) 2014 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+LC_ALL=C
+export LC_ALL
+
+pathpart=' ' # fake
+. mkc_check_common.sh
+
+find_n_match make --version 'gnu make'
+find_n_match gmake --version 'gnu make'
+
+echo ''
diff --git a/custom/prog_mkdep b/builtins/prog_mkdep
index c2e1b94..c2e1b94 100755
--- a/custom/prog_mkdep
+++ b/builtins/prog_mkdep
diff --git a/custom/prog_nbmkdep b/builtins/prog_nbmkdep
index aad3716..aad3716 100755
--- a/custom/prog_nbmkdep
+++ b/builtins/prog_nbmkdep
diff --git a/custom/Makefile b/custom/Makefile
deleted file mode 100644
index c79e9ab..0000000
--- a/custom/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-SCRIPTS = endianness prog_bison prog_flex prog_gawk prog_gm4
-
-SCRIPTSDIR = ${BUILTINSDIR}
-
-.include <mkc.mk>
diff --git a/debian/changelog b/debian/changelog
index a4c6361..cfb95d4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+mk-configure (0.28.0-1) unstable; urgency=medium
+
+ * New upstream release.
+ * Drop an old patch and a custom sys.mk.
+
+ -- Andrew Shadura <andrewsh@debian.org> Sun, 14 Sep 2014 17:41:43 +0200
+
mk-configure (0.27.0-1) unstable; urgency=medium
* New upstream release.
diff --git a/debian/patches/01-lua-mk.patch b/debian/patches/01-lua-mk.patch
deleted file mode 100644
index 970e812..0000000
--- a/debian/patches/01-lua-mk.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/mk/mkc_imp.lua.mk
-+++ b/mk/mkc_imp.lua.mk
-@@ -35,8 +35,8 @@
- .endif
- LIB = ${LUA_CMODULE:S|.|/|:T}
- SRCS ?= ${LUA_CMODULE:S/./_/g}.c
--MKDLL = Only
--LDCOMPILER = Yes
-+MKDLL = only
-+LDCOMPILER = yes
- DLL_EXT = .so
- LIBDIR = ${LUA_CMODDIR}/${LUA_CMODULE:S|.|/|g:H}
- .endif # defined(LUA_CMODULES)
diff --git a/debian/patches/series b/debian/patches/series
deleted file mode 100644
index b518ce1..0000000
--- a/debian/patches/series
+++ /dev/null
@@ -1 +0,0 @@
-01-lua-mk.patch
diff --git a/debian/sys.mk b/debian/sys.mk
deleted file mode 100644
index 86ce66b..0000000
--- a/debian/sys.mk
+++ /dev/null
@@ -1,2 +0,0 @@
-LDCOMPILER ?= yes
-
diff --git a/doc/Makefile b/doc/Makefile
index 2295297..96a2fca 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,4 +1,4 @@
-FILES = ../README NEWS TODO LICENSE FAQ
+FILES = ../README NEWS TODO LICENSE FAQ NOTES
FILESDIR = ${DOCDIR}
.include <mkc.mk>
diff --git a/doc/NEWS b/doc/NEWS
index c665192..7ebad3a 100644
--- a/doc/NEWS
+++ b/doc/NEWS
@@ -1,4 +1,67 @@
======================================================================
+Version 0.28.0, by Aleksey Cheusov, Sun, 14 Sep 2014 14:52:34 +0300
+
+ LIBDEPS, STATICLIBS, DPLDADD, DPLIBDIRS and DPINCDIRS variables were
+ introduced. With their help one can specify library dependencies in
+ the top-level Makefile. Users are also able to build some libraries
+ statically even if they were designed to be a dynamic libraries.
+
+ New variable FOREIGN was introduced. With its help one can embed
+ autotools-based projects (as a subproject) to mk-configure-based once.
+ See mkc_imp.foreign_autotools.mk section in man page for details.
+
+ Support for Darwin was fixed. Nowadays it uses clang.
+
+ New features were introduced:
+ - "progname" for setprogname(3) and getprogname(3) BSDisms;
+ - "err" for err(3), errx(3), verr(3) and verrx(3) BSDisms;
+ - "warn" for warn(3), warnx(3), vwarn(3) and vwarnx(3) BSD-isms;
+ - "fgetln" for fgetln(3) BSD-ism;
+
+ Support for Haiku was fixed. It does not support hard links
+ and uses LIBRARY_PATH.
+
+ LDCOMPILER variable was removed.
+ Compiler is always used for linking.
+
+ New builtin "prog_gmake" was introduced which search GNU make.
+
+ INTERNALLIBS variable was introduced. With its help one can
+ implement libraries common for several subprojects.
+
+ COMPATLIB variable was introduced. It is ideal solution for
+ portability code.
+
+ MKC_FEATURES: all objects are removed by target "clean"
+
+ Target "errorcheck" was added to ALLTARGETS. Therefore it also have
+ pre_, do_, post_ counterparts.
+
+ VARDIR, SHAREDSTATEDIR, SUBPRJSRCTOP, CPPFLAGS0 variables were introduced.
+
+ MKC_SOURCE_FUNCSLIBS: .o{s,p} objects are also removed by target "clean"
+
+ Hardcoded /etc/mk.conf is not included anymore. New mk-configure
+ specific configuration file @sysconfdir@/mk-c.conf was introduced.
+
+ Additions to doc/NOTES
+
+ .depends is added to DISTCLEANDIRS only for non-empty SRCS
+
+ mkc_imp.intexts.mk: new error type for odd tokens in INTEXTS_REPLS
+
+ MKDEP_CC is shquoted when passed to mkdep(1) as CC.
+
+ Code clean-ups, more regression tests.
+
+ This release was sucessfully tested on the following platforms.
+ NetBSD-6.1/x86_64/gcc-4.5, FreeBSD-9.0/i386/gcc-4.2,
+ OpenBSD-4.9/i386/gcc-4.2, DragonFlyBSD-3.4/x86_64/gcc-4.7,
+ Darwin-14.0/x86_64/clang-600.0.53, SunOS-5.11/i86pc/gcc-4.7,
+ SunOS-5.10/sparc/{gcc-4.8,SunStudio-12.3}, diverse
+ Linux-es/{gcc,icc-12.1,SunStudio-12.3}, Haiku/gcc-4.8.
+
+======================================================================
Version 0.27.0, by Aleksey Cheusov, Sun, 13 Jul 2014 17:03:12 +0300
Fix pkg-config support (github issue #8).
diff --git a/doc/NOTES b/doc/NOTES
new file mode 100644
index 0000000..733033d
--- /dev/null
+++ b/doc/NOTES
@@ -0,0 +1,179 @@
+BUILD SYSTEM IN GENERAL AND MK-CONFIGURE IN PARTICULAR IS A COMPLEX
+SYSTEM. THIS FILE CONTAINS UNORDERED NOTES ABOUT HOW TO USE
+MK-CONFIGURE EFFICIENTLY. I HOPE THESE NOTES WILL BE VALUABLE ADDON TO
+MK-CONFIGURE(7) REFERENCE AND HELP USERS UNDERSTAND MK-CONFIGURE.
+TAKE A NOTE THAT THESE NOTES ARE UNSORTED.
+
+***
+
+For building projects with /usr prefix, run the following.
+
+ export PREFIX=/usr SYSCONFDIR=/etc VARDIR=/var
+ mkcmake all
+ mkcmake install
+
+Packagers may use the following for creating a package using
+unprivileged user.
+
+ mkdir /tmp/destdir
+ mkcmake install DESTDIR=/tmp/destdir
+
+***
+
+mk-configure supports out-of-tree builds. Most of functionality is
+supported by bmake. Examples are below.
+
+1)
+ mkdir /tmp/xxxproj-obj
+ mkcmake MAKEOBJDIR=/tmp/xxxproj-obj
+
+In this case all objects and temporary files are created in
+/tmp/xxxproj-obj. Obviously, this may work if different subprojects
+doesn't produce files with the same name. This features is supported
+directly by bmake.
+
+2)
+ mkdir /tmp/xxxproj-obj
+ mkcmake MAKEOBJDIRPREFIX=/tmp/xxxproj-obj
+
+Here all objects and temporary files are saved to
+${MAKEOBJDIRPREFIX}${.CURDIR} directory. This features is also
+supported by bmake.
+
+3)
+ mkdir /tmp/xxxproj-obj
+ env MKRELOBJDIR=yes MAKEOBJDIR=/tmp/xxxproj-obj mkcmake
+
+Unlike example 2) subdirectories under /tmp/xxxproj-obj for temporary
+files won't contain ${SRCTOP}. The variable MKRELOBJDIR is provided by mk-c.
+
+***
+
+Even if you project is trivial, that is consists of single executable
+or library, I'd recommend to use mkc.subprj.mk in the top-level Makefile.
+In provides better flexibility and easier work for packagers.
+
+***
+
+It's very important to understand what is a recursive target.
+See variable TARGETS.
+
+***
+
+The variable TARGETS is a way to extend mk-c functionality.
+See examples/hello_TARGETS.
+
+***
+
+Look at examples/hello_superfs/Makefile.inc.
+There you'll find a cool mk-configure's feature.
+
+***
+
+If you want to override values for MKC_CHECK_* checks, run mkcmake
+with additional parameters, like this
+
+ mkcmake all HAVE_HEADER.stdio_h=1 HAVE_HEADER.stdlib_h=1
+
+See mkc.configure.mk section in mk-configure.7 for details.
+
+***
+
+There are several ways of passing additional information from
+top-level project to subprojects:
+ - environment variables via .export and .export-env bmake directives.
+ - EXPORT_VARNAMES and NOEXPORT_VARNAMES variables from mkc.subprj.mk.
+ - Makefile.common and Makefile.inc files.
+
+***
+
+For prettifying mkcmake output, one can use
+
+ export SHRTOUT=yes
+ mkcmake all
+
+***
+
+If your top-level Makefile looks like this
+
+ Makefile:
+ SUBPRJ = libA:progA libB:progB
+ .include <mkc.subprj.mk>
+
+one can use
+
+ mkcmake all-progB
+
+for building progB subproject without probA and libA. In this case libB
+will also be built as it is a dependency. The same for
+
+ mkcmake install-progB
+ mkcmake test-progB
+ ...
+
+and others. "all", "install", "test" and others are listed in variable
+TARGETS.
+
+***
+
+In traditional BSD mk files bsd.subdir.mk is allowed in any
+subdirectory. The same is true for mk-configure. However, for better
+flexibility it is recomended to have mkc.subprj.mk in the top-level
+Makefile and specify the whole dependency graph of subpojects in
+it. This allows, for example, building and testing any subproject
+separately by running one command from top-level directory,
+i.e. "mkcmake all-sub/sub/project". In this case all required
+dependencies (and nothing else) will be built recursively. For running
+mkcmake in subproject's directory, set the variable SRCTOP.
+
+***
+
+SUBPRJ variable (mkc.subprj.mk) may contain subprojects, not
+associated with any subdirectory. Such subprojects may be used as "the
+name of subprojects collection". I call them "virtual
+subprojects". If, for example, you're developing traditional UNIX
+tools, you may have such projects as POSIX_tools BSD_tools,
+bin_tools, sbin_tools etc.
+
+***
+
+Subprojects from SUBDIR (mkc.subdir.mk) and SUBPRJ (mkc.subprj.mk) may
+have slashes inside.
+
+***
+
+NODEPS variable may be used for stripping unnecessary
+dependencies. This is especially useful for target "test". In the
+following example "mkcmake test" tests only programs but not libraries
+(recursively). That is, it runs targets "test-tools/prog1",
+"test-tools/prog2", "test-tools/prog3" and "test-tools/prog4"
+but "test-libs/foo" and others.
+
+Example:
+ SUBPRJ = libs/foo:tools/prog1
+ SUBPRJ += libs/bar:tools/prog2
+ SUBPRJ += libs/foo:tools/prog3 libs/bar:tools/prog3
+ SUBPRJ += libs/qux:tools/prog4
+
+ NODEPS += test-libs/*:test test-libs/*:test-tools/*
+
+ .include <mkc.subprj.mk>
+
+***
+
+Makefile.common and Makefile.inc included implicitely by subprojects
+may be used for common code. For examples, in these files one can do
+something like this.
+
+ VERSION = 1.2.3
+ INTEXTS_REPLS += version ${VERSION}
+
+for replacing @version@ with real version.
+
+***
+
+If your project consists of libraries and executables, use
+mkc.subprj.mk and its LIBDEPS variable. Even if you prefer shared
+libraries, users will be able to link them statically with a help
+STATICLIBS variable specified in environment. For this to work you
+have to use += for STATICLIBS in Makefiles.
diff --git a/doc/TODO b/doc/TODO
index 00d77ad..f631dd9 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -1,44 +1,36 @@
============================================================
-Plan 0.26.0
+Plan 0.28.0
-- CLEANFILES: pod2htmd.tmp pod2htmi.tmp only if POD is built
+- check awk capabilities at build time
+- Hide regression tests details
+- "bmake -k regrtest/check" (mkc.minitest.mk?)
-- DISTCLEANFILES: .depend for C/C++ projects
+- strndup(SunOS-5.10, -fgetln,_compatlib)
+- PRId64
+- leveldb, strtoll, strtoull
+- wmemcpy, strnlen
+- wcsdup
+- CFLAGS0
-- MKC_FEATURES: err(err,warn etc.), fgetln(via getline(3))
- Special marker for checks that cannot be possible in cross-compiling
+- regression tests without garbage, make it look like paexec\
+
+- MKC_FEATURES: inttypes
+
Some thoughts inspired by talks with Michael Crogan
- MKASNEEDED=yes => ld --as-needed
-- VARIANTS for libraries.
-
- _mkc_done_<prj>_<trg>
- project "roundup" for testing
-- Better explain how "test" target works, maybe as a couple of slides
- in the PDF presentation. With and without mkc.minitest.mk.
-- One more example/ for TARGETS, demonstrating such things as
- "mkcmake all_clang/all_gcc" or "valgrind_test"/"gcov_test" etc.
-- Additional slides in PDF for virtual subprojects.
- Notes about "virtual subproject" in examples/.
-- Notes in examples/hello_dictd and other examples based on
- mkc.subprj.mk about what mkc.subprj.mk really does. Reference (man page)
- is not enough for newcomers. Notes about clean-SUBPRJ, all-SUBPRJ etc.
-- Better explain ../Makefile.inc included automatically. For those who
- are not familiar with *BSD it is not obvious how to use it.
- "errorcheck/configure" tests should be run in parallel. Something
like shlock(1) or flock(1) is needed for this.
-- Example is needed for how to embed autoconf-based subproject into a
- project based on mk-configure. The sad fact is autoconf/automake is
- everywhere. So, it would be nice to integrate mk-c into reality.
- mkc_imp.autotools.mk is needed for this.
- Alternative .depend generation, e.g. like it is described in GNU
make info files
-- Higher priority for fixing handling of dependencies between
- libraries and programs. In addition examples/ is needed for
+- Additional examples/ is needed for
triggering rebuild of subproject if "something" was rebuild in
another subproject (build script for example).
- Interdependencies between targetX-subprjA and targetY-subprjB (for
@@ -47,25 +39,11 @@ Some thoughts inspired by talks with Michael Crogan
<<<depend-project1:errorcheck-autotools_based_project2>>>!!!
- Steal cool features from Simon Gerraty's mk files and analyse
"meta mode" he invented.
-- Better support for working without installation to /. -rpath, additional
- directories for objects, binaries and libs.
-- symlinks in object directories to source files for easier running
- unitest, for example. lndir(1).
Some "targets" from TARGETS should set MKCHECKS to "no"
ronn(1) : markdown to man pages
- Reimplement linkme.mk. It is not flexible enough.
- - Additional type of dependencies in mkc.subprjs.mk (LIBDEPS =
- libfoo:bar ...), pass them to subprojects using enironment and
- include appropriate libfoo/linkme.mk if it is
- available. Otherwise, use default -l and -I.
- or
- - keep linkme.mk and avoid direct use of CPPFLAGS, LDADD and
- DPLIBDIRS. Instead use special variables XXX.includes,
- XXX.ldflags, XXX.ldadd, SRCDIR_<lib> and OBJDIR_<lib>.
-
custom test failed -> exit status of mkcmake should not be zero
MKC_CUSTOM_ERR.qqqq -> error message before exiting just like
@@ -79,7 +57,6 @@ ronn(1) : markdown to man pages
- BINSUBDIR, LIBSUBDIR, LIBEXECSUBDIR etc...
- Fix USE_SSP support for clang (-mllvm -stack-protector-buffer-size=1)
- - @sysconfdir@/mkc.conf
- USE_RPATH
- OBJCOPTS_<proj>
- Regression tests:
@@ -125,12 +102,8 @@ Plan 3)
run generated executables, i.e. not ready
for cross-compilation
- = symlinks to executables and libraries in ${OBJDIR}/{bin,lib}
-
= support for gettext
- = xxxDIR variable for /var
-
= mkclint?
= Command line may be limited in size.
@@ -145,7 +118,7 @@ Plan 3)
= shared libraries support for nwcc and other compilers.
= Comparison with quagmire, kBuild, CMake, scons, waf, framewerk, pmk,
- MagicMakefiles, bjam, pymake, bitmake, pkgconf,
+ MagicMakefiles, bjam, pymake, bitmake, pkgconf, Gradle
http://sourceforge.net/projects/mkbuild etc.
= Often compilers need special options to compile pthread code.
diff --git a/examples/Makefile.inc b/examples/Makefile.inc
index eadc408..1c1912d 100644
--- a/examples/Makefile.inc
+++ b/examples/Makefile.inc
@@ -1,9 +1,9 @@
CLEANDIRS += ${.CURDIR}/usr ${.CURDIR}/opt
-.ifdef SRCDIR_custom
+.ifdef SRCDIR_builtins
# regression test for mk-configure
MKC_CACHEDIR = ${.CURDIR}
-BUILTINSDIR = ${SRCDIR_custom}
+BUILTINSDIR = ${SRCDIR_builtins}
FEATURESDIR = ${SRCDIR_features}
SHRTOUT = no
.export MKC_CACHEDIR BUILTINSDIR FEATURESDIR SHRTOUT
diff --git a/examples/hello_autoconf/Makefile b/examples/hello_autoconf/Makefile
new file mode 100644
index 0000000..3f6e87b
--- /dev/null
+++ b/examples/hello_autoconf/Makefile
@@ -0,0 +1,15 @@
+FOREIGN = autotools
+FSRCDIR = proj
+
+AT_USE_AUTOMAKE = no
+AT_MAKE = ${BUILTIN.prog_gmake}
+
+MKC_CHECK_BUILTINS = prog_gmake
+MKCHECKS = yes # we need path to gmake for target "clean"
+
+# The following line is for regression tests.
+# In real life we don't need this.
+all: mkgen
+
+.include "test.mk"
+.include <mkc.mk>
diff --git a/examples/hello_autoconf/expect.out b/examples/hello_autoconf/expect.out
new file mode 100644
index 0000000..86d30a6
--- /dev/null
+++ b/examples/hello_autoconf/expect.out
@@ -0,0 +1,46 @@
+Hello autoconf
+=========== all ============
+/objdir/AUTHORS
+/objdir/COPYING
+/objdir/ChangeLog
+/objdir/Makefile
+/objdir/Makefile.in
+/objdir/NEWS
+/objdir/README
+/objdir/config.h
+/objdir/config.h.in
+/objdir/config.log
+/objdir/config.status
+/objdir/configure
+/objdir/configure.ac
+/objdir/hello_autoconf
+/objdir/hello_autoconf.c
+========== clean ===========
+/objdir/AUTHORS
+/objdir/COPYING
+/objdir/ChangeLog
+/objdir/Makefile
+/objdir/Makefile.in
+/objdir/NEWS
+/objdir/README
+/objdir/config.h
+/objdir/config.h.in
+/objdir/config.log
+/objdir/config.status
+/objdir/configure
+/objdir/configure.ac
+/objdir/hello_autoconf.c
+========== all SHRTOUT=yes ===========
+MKGEN:
+CONFIGURE:
+configure: creating ./config.status
+AUTOTOOLS:
+======= cleandir ==========
+/objdir/AUTHORS
+/objdir/COPYING
+/objdir/ChangeLog
+/objdir/Makefile.in
+/objdir/NEWS
+/objdir/README
+/objdir/configure.ac
+/objdir/hello_autoconf.c
diff --git a/examples/hello_autoconf/proj/AUTHORS b/examples/hello_autoconf/proj/AUTHORS
new file mode 100644
index 0000000..28b4a17
--- /dev/null
+++ b/examples/hello_autoconf/proj/AUTHORS
@@ -0,0 +1 @@
+Aleksey Cheusov <vle@gmx.net>
diff --git a/examples/hello_autoconf/proj/COPYING b/examples/hello_autoconf/proj/COPYING
new file mode 100644
index 0000000..332900b
--- /dev/null
+++ b/examples/hello_autoconf/proj/COPYING
@@ -0,0 +1,26 @@
+Copyright (c) 2014 by Aleksey Cheusov <vle@gmx.net>
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the
+ distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
+CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/examples/hello_autoconf/proj/ChangeLog b/examples/hello_autoconf/proj/ChangeLog
new file mode 100644
index 0000000..82573db
--- /dev/null
+++ b/examples/hello_autoconf/proj/ChangeLog
@@ -0,0 +1 @@
+Useless ChangeLog
diff --git a/examples/hello_autoconf/proj/Makefile.in b/examples/hello_autoconf/proj/Makefile.in
new file mode 100644
index 0000000..0ea68cc
--- /dev/null
+++ b/examples/hello_autoconf/proj/Makefile.in
@@ -0,0 +1,26 @@
+# GNU Make is required
+
+srcdir = @srcdir@
+
+CC ?= @CC@
+
+CFLAGS ?= @CFLAGS@
+CPPFLAGS ?= @CPPFLAGS@
+LDFLAGS ?= @LDFLAGS@
+LIBS ?= @LIBS@
+
+CPPFLAGS += -I. -I${srcdir}
+CFLAGS += -DMSG='"$(shell echo Hello autoconf)"'
+
+.PHONY: all clean distclean
+
+all: hello_autoconf
+
+%: %.c
+ ${CC} -o $@ ${CPPFLAGS} ${CFLAGS} $< ${LDFLAGS} ${LIBS}
+
+clean:
+ -rm -f hello_autoconf
+
+distclean: clean # mk-configure removes almost everything
+ -rm -f ${srcdir}/config.h.in config.h
diff --git a/examples/hello_autoconf/proj/NEWS b/examples/hello_autoconf/proj/NEWS
new file mode 100644
index 0000000..5d9ab38
--- /dev/null
+++ b/examples/hello_autoconf/proj/NEWS
@@ -0,0 +1 @@
+No news is good news
diff --git a/examples/hello_autoconf/proj/README b/examples/hello_autoconf/proj/README
new file mode 100644
index 0000000..3d1830e
--- /dev/null
+++ b/examples/hello_autoconf/proj/README
@@ -0,0 +1 @@
+This is a trivial autoconf-based project.
diff --git a/examples/hello_autoconf/proj/configure.ac b/examples/hello_autoconf/proj/configure.ac
new file mode 100644
index 0000000..bc5c142
--- /dev/null
+++ b/examples/hello_autoconf/proj/configure.ac
@@ -0,0 +1,14 @@
+dnl
+dnl Process this file with autoconf to create configure.
+
+# Initialize Autoconf
+AC_PREREQ([2.60])
+AC_INIT([hello_autotools], [0.28.0],
+ [https://github.com/cheusov/mk-configure])
+AC_CONFIG_SRCDIR([Makefile.in])
+AC_CONFIG_HEADERS([config.h])
+
+dnl Checks for functions
+AC_CHECK_HEADERS([stdio.h])
+
+AC_OUTPUT([Makefile])
diff --git a/examples/hello_autoconf/proj/hello_autoconf.c b/examples/hello_autoconf/proj/hello_autoconf.c
new file mode 100644
index 0000000..111fc7e
--- /dev/null
+++ b/examples/hello_autoconf/proj/hello_autoconf.c
@@ -0,0 +1,11 @@
+#include <config.h>
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+
+int main (int argc, char **argv)
+{
+ puts (MSG);
+ return 0;
+}
diff --git a/examples/hello_autoconf/test.mk b/examples/hello_autoconf/test.mk
new file mode 100644
index 0000000..8e6586e
--- /dev/null
+++ b/examples/hello_autoconf/test.mk
@@ -0,0 +1,27 @@
+EXCL_RE='autom4te[.]cache'
+
+.PHONY : test_output
+test_output:
+ @ \
+ ${.OBJDIR}/hello_autoconf; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | grep -Ev '${EXCL_RE}' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean > /dev/null; \
+ find ${.OBJDIR} -type f | grep -vE '${EXCL_RE}' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========== all SHRTOUT=yes ===========; \
+ ${MAKE} ${MAKEFLAGS} all SHRTOUT=yes | \
+ grep -E '^[[:alpha:]]+:'; \
+ \
+ echo ======= cleandir ==========; \
+ ${MAKE} ${MAKEFLAGS} cleandir > /dev/null; \
+ find ${.OBJDIR} -type f | grep -vE '${EXCL_RE}' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_autotools/Makefile b/examples/hello_autotools/Makefile
new file mode 100644
index 0000000..fa4c406
--- /dev/null
+++ b/examples/hello_autotools/Makefile
@@ -0,0 +1,11 @@
+FOREIGN = autotools
+FSRCDIR = proj
+
+DISTCLEANFILES += ${.CURDIR}/${FSRCDIR}/hello_autotools-config.h.in
+
+
+# the following is for regression tests. In real life we don't need this.
+all: mkgen
+
+.include "test.mk"
+.include <mkc.mk>
diff --git a/examples/hello_autotools/expect.out b/examples/hello_autotools/expect.out
new file mode 100644
index 0000000..0900108
--- /dev/null
+++ b/examples/hello_autotools/expect.out
@@ -0,0 +1,62 @@
+Hello AutoShi^H^H^HTools!
+=========== all ============
+/objdir/.deps/main.Po
+/objdir/AUTHORS
+/objdir/COPYING
+/objdir/ChangeLog
+/objdir/Makefile
+/objdir/Makefile.am
+/objdir/Makefile.in
+/objdir/NEWS
+/objdir/README
+/objdir/aclocal.m4
+/objdir/config.log
+/objdir/config.status
+/objdir/configure
+/objdir/configure.ac
+/objdir/hello_autotools
+/objdir/hello_autotools-config.h
+/objdir/hello_autotools-config.h.in
+/objdir/main.c
+/objdir/main.o
+/objdir/stamp-h1
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/hello_autotools
+======== uninstall =========
+/objdir/prefix
+/objdir/prefix/bin
+========== clean ===========
+/objdir/.deps/main.Po
+/objdir/AUTHORS
+/objdir/COPYING
+/objdir/ChangeLog
+/objdir/Makefile
+/objdir/Makefile.am
+/objdir/Makefile.in
+/objdir/NEWS
+/objdir/README
+/objdir/aclocal.m4
+/objdir/config.log
+/objdir/config.status
+/objdir/configure
+/objdir/configure.ac
+/objdir/hello_autotools-config.h
+/objdir/hello_autotools-config.h.in
+/objdir/main.c
+/objdir/stamp-h1
+========== all SHRTOUT=yes ===========
+MKGEN:
+CONFIGURE:
+configure: creating ./config.status
+AUTOTOOLS:
+======= cleandir ==========
+/objdir/AUTHORS
+/objdir/COPYING
+/objdir/ChangeLog
+/objdir/Makefile.am
+/objdir/NEWS
+/objdir/README
+/objdir/configure.ac
+/objdir/main.c
diff --git a/examples/hello_autotools/proj/AUTHORS b/examples/hello_autotools/proj/AUTHORS
new file mode 100644
index 0000000..28b4a17
--- /dev/null
+++ b/examples/hello_autotools/proj/AUTHORS
@@ -0,0 +1 @@
+Aleksey Cheusov <vle@gmx.net>
diff --git a/examples/hello_autotools/proj/COPYING b/examples/hello_autotools/proj/COPYING
new file mode 100644
index 0000000..332900b
--- /dev/null
+++ b/examples/hello_autotools/proj/COPYING
@@ -0,0 +1,26 @@
+Copyright (c) 2014 by Aleksey Cheusov <vle@gmx.net>
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the
+ distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
+CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/examples/hello_autotools/proj/ChangeLog b/examples/hello_autotools/proj/ChangeLog
new file mode 100644
index 0000000..82573db
--- /dev/null
+++ b/examples/hello_autotools/proj/ChangeLog
@@ -0,0 +1 @@
+Useless ChangeLog
diff --git a/examples/hello_autotools/proj/Makefile.am b/examples/hello_autotools/proj/Makefile.am
new file mode 100644
index 0000000..5316cb9
--- /dev/null
+++ b/examples/hello_autotools/proj/Makefile.am
@@ -0,0 +1,3 @@
+bin_PROGRAMS = hello_autotools
+
+hello_autotools_SOURCES = main.c
diff --git a/examples/hello_autotools/proj/NEWS b/examples/hello_autotools/proj/NEWS
new file mode 100644
index 0000000..5d9ab38
--- /dev/null
+++ b/examples/hello_autotools/proj/NEWS
@@ -0,0 +1 @@
+No news is good news
diff --git a/examples/hello_autotools/proj/README b/examples/hello_autotools/proj/README
new file mode 100644
index 0000000..8b75e2d
--- /dev/null
+++ b/examples/hello_autotools/proj/README
@@ -0,0 +1 @@
+This is a trivial autotools-based project.
diff --git a/examples/hello_autotools/proj/configure.ac b/examples/hello_autotools/proj/configure.ac
new file mode 100644
index 0000000..9122a3f
--- /dev/null
+++ b/examples/hello_autotools/proj/configure.ac
@@ -0,0 +1,17 @@
+dnl
+dnl Process this file with autoconf to create configure.
+
+# Initialize Autoconf
+AC_PREREQ([2.60])
+AC_INIT([hello_autotools], [0.28.0],
+ [https://github.com/cheusov/mk-configure])
+AC_CONFIG_SRCDIR([Makefile.am])
+AC_CONFIG_HEADERS([hello_autotools-config.h])
+
+# Initialize Automake
+AM_INIT_AUTOMAKE
+
+dnl Checks for functions
+AC_CHECK_HEADERS([stdio.h])
+
+AC_OUTPUT([Makefile])
diff --git a/examples/hello_autotools/proj/main.c b/examples/hello_autotools/proj/main.c
new file mode 100644
index 0000000..05a6dd3
--- /dev/null
+++ b/examples/hello_autotools/proj/main.c
@@ -0,0 +1,11 @@
+#include <hello_autotools-config.h>
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+
+int main (int argc, char **argv)
+{
+ puts ("Hello AutoShi^H^H^HTools!");
+ return 0;
+}
diff --git a/examples/hello_autotools/test.mk b/examples/hello_autotools/test.mk
new file mode 100644
index 0000000..b8f96f3
--- /dev/null
+++ b/examples/hello_autotools/test.mk
@@ -0,0 +1,39 @@
+EXCL_RE='autom4te[.]cache'
+
+.PHONY : test_output
+test_output:
+ @ \
+ ${.OBJDIR}/hello_autotools; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | grep -Ev '${EXCL_RE}' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install -j3 \
+ DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall \
+ DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean > /dev/null; \
+ find ${.OBJDIR} -type f | grep -vE '${EXCL_RE}' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========== all SHRTOUT=yes ===========; \
+ ${MAKE} ${MAKEFLAGS} all SHRTOUT=yes | \
+ grep -E '^[[:alpha:]]+:'; \
+ \
+ echo ======= cleandir ==========; \
+ ${MAKE} ${MAKEFLAGS} cleandir > /dev/null; \
+ find ${.OBJDIR} -type f | grep -vE '${EXCL_RE}' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_calc2/Makefile b/examples/hello_calc2/Makefile
index 8005614..dbb0682 100644
--- a/examples/hello_calc2/Makefile
+++ b/examples/hello_calc2/Makefile
@@ -17,7 +17,7 @@ lex.o: parser.h
YACC = ${"${BUILTIN.prog_bison}" != "":?${BUILTIN.prog_bison} -y:}
LEX = ${BUILTIN.prog_flex}
-LEXLIB = -lfl
+LEXLIB = #-lfl
.if empty(BUILTIN.prog_flex)
MKC_ERR_MSG += "Cannot find flex, good bye!"
diff --git a/examples/hello_compatlib/Makefile b/examples/hello_compatlib/Makefile
new file mode 100644
index 0000000..82ec6b0
--- /dev/null
+++ b/examples/hello_compatlib/Makefile
@@ -0,0 +1,5 @@
+LIBDEPS = libcmpt:prog1 libcmpt:prog2
+COMPATLIB = libcmpt
+
+.include "test.mk"
+.include <mkc.subprj.mk>
diff --git a/examples/hello_compatlib/Makefile.inc b/examples/hello_compatlib/Makefile.inc
new file mode 100644
index 0000000..de1cf0d
--- /dev/null
+++ b/examples/hello_compatlib/Makefile.inc
@@ -0,0 +1 @@
+MKC_FEATURES = strlcpy strlcat getline progname fgetln err
diff --git a/examples/hello_compatlib/expect.out b/examples/hello_compatlib/expect.out
new file mode 100644
index 0000000..de509d4
--- /dev/null
+++ b/examples/hello_compatlib/expect.out
@@ -0,0 +1,90 @@
+=========== all ============
+/objdir/Makefile
+/objdir/Makefile.inc
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_func0_getexecname_stdlib_h.c
+/objdir/_mkc_func0_getexecname_stdlib_h.err
+/objdir/_mkc_func0_getexecname_stdlib_h.res
+/objdir/_mkc_func0_getprogname_stdlib_h.c
+/objdir/_mkc_func0_getprogname_stdlib_h.err
+/objdir/_mkc_func0_getprogname_stdlib_h.res
+/objdir/_mkc_func1_setprogname_stdlib_h.c
+/objdir/_mkc_func1_setprogname_stdlib_h.err
+/objdir/_mkc_func1_setprogname_stdlib_h.res
+/objdir/_mkc_func3_err_err_h.c
+/objdir/_mkc_func3_err_err_h.err
+/objdir/_mkc_func3_err_err_h.res
+/objdir/_mkc_func3_errx_err_h.c
+/objdir/_mkc_func3_errx_err_h.err
+/objdir/_mkc_func3_errx_err_h.res
+/objdir/_mkc_func3_fgetln_stdio_h.c
+/objdir/_mkc_func3_fgetln_stdio_h.err
+/objdir/_mkc_func3_fgetln_stdio_h.res
+/objdir/_mkc_func3_getline_stdio_h.c
+/objdir/_mkc_func3_getline_stdio_h.err
+/objdir/_mkc_func3_getline_stdio_h.res
+/objdir/_mkc_func3_strlcat_string_h.c
+/objdir/_mkc_func3_strlcat_string_h.err
+/objdir/_mkc_func3_strlcat_string_h.res
+/objdir/_mkc_func3_strlcpy_string_h.c
+/objdir/_mkc_func3_strlcpy_string_h.err
+/objdir/_mkc_func3_strlcpy_string_h.res
+/objdir/_mkc_func3_verr_err_h.c
+/objdir/_mkc_func3_verr_err_h.err
+/objdir/_mkc_func3_verr_err_h.res
+/objdir/_mkc_func3_verrx_err_h.c
+/objdir/_mkc_func3_verrx_err_h.err
+/objdir/_mkc_func3_verrx_err_h.res
+/objdir/_mkc_funclib_err.c
+/objdir/_mkc_funclib_err.err
+/objdir/_mkc_funclib_err.res
+/objdir/_mkc_funclib_errx.c
+/objdir/_mkc_funclib_errx.err
+/objdir/_mkc_funclib_errx.res
+/objdir/_mkc_funclib_fgetln.c
+/objdir/_mkc_funclib_fgetln.err
+/objdir/_mkc_funclib_fgetln.res
+/objdir/_mkc_funclib_getline.c
+/objdir/_mkc_funclib_getline.err
+/objdir/_mkc_funclib_getline.res
+/objdir/_mkc_funclib_getprogname.c
+/objdir/_mkc_funclib_getprogname.err
+/objdir/_mkc_funclib_getprogname.res
+/objdir/_mkc_funclib_setprogname.c
+/objdir/_mkc_funclib_setprogname.err
+/objdir/_mkc_funclib_setprogname.res
+/objdir/_mkc_funclib_strlcat.c
+/objdir/_mkc_funclib_strlcat.err
+/objdir/_mkc_funclib_strlcat.res
+/objdir/_mkc_funclib_strlcpy.c
+/objdir/_mkc_funclib_strlcpy.err
+/objdir/_mkc_funclib_strlcpy.res
+/objdir/_mkc_funclib_verr.c
+/objdir/_mkc_funclib_verr.err
+/objdir/_mkc_funclib_verr.res
+/objdir/_mkc_funclib_verrx.c
+/objdir/_mkc_funclib_verrx.err
+/objdir/_mkc_funclib_verrx.res
+/objdir/_mkc_header_err_h.c
+/objdir/_mkc_header_err_h.err
+/objdir/_mkc_header_err_h.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/_mkc_variable_program_invocation_short_name_errno_h.c
+/objdir/_mkc_variable_program_invocation_short_name_errno_h.err
+/objdir/_mkc_variable_program_invocation_short_name_errno_h.res
+/objdir/expect.out
+/objdir/hello_compatlib.test.out.tmp
+/objdir/libcmpt/Makefile
+/objdir/libcmpt/libcmpt.a
+/objdir/libcmpt/libcmpt_pic.a
+/objdir/prog1/Makefile
+/objdir/prog1/prog1
+/objdir/prog1/prog1.c
+/objdir/prog1/prog1.o
+/objdir/prog2/Makefile
+/objdir/prog2/prog2
+/objdir/prog2/prog2.c
+/objdir/prog2/prog2.o
+/objdir/test.mk
diff --git a/examples/hello_compatlib/libcmpt/Makefile b/examples/hello_compatlib/libcmpt/Makefile
new file mode 100644
index 0000000..a0d0bda
--- /dev/null
+++ b/examples/hello_compatlib/libcmpt/Makefile
@@ -0,0 +1,3 @@
+LIB = cmpt
+
+.include <mkc.lib.mk>
diff --git a/examples/hello_compatlib/prog1/Makefile b/examples/hello_compatlib/prog1/Makefile
new file mode 100644
index 0000000..4a343d0
--- /dev/null
+++ b/examples/hello_compatlib/prog1/Makefile
@@ -0,0 +1,7 @@
+PROG = prog1
+
+WARNS = 4
+
+MKC_REQD = 0.27.0
+
+.include <mkc.prog.mk>
diff --git a/examples/hello_compatlib/prog1/prog1.c b/examples/hello_compatlib/prog1/prog1.c
new file mode 100644
index 0000000..b662024
--- /dev/null
+++ b/examples/hello_compatlib/prog1/prog1.c
@@ -0,0 +1,38 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <mkc_strlcpy.h>
+#include <mkc_strlcat.h>
+#include <mkc_getline.h>
+#include <mkc_progname.h>
+
+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.\"";
+
+int main (int argc, char ** argv)
+{
+ char *buf = NULL;
+ size_t size = 0;
+ ssize_t len = 0;
+ char small_buf [15];
+ char said [19];
+
+ setprogname (argv [0]);
+
+ while (len = getline (&buf, &size, stdin), len != -1){
+ len = strlen (buf);
+ if (len > 0 && buf [len-1] == '\n')
+ buf [len-1] = 0;
+
+ strlcpy (small_buf, "foo17", sizeof (small_buf));
+ strlcat (small_buf, buf, sizeof (small_buf));
+ puts (small_buf);
+ }
+
+ strlcpy (said, message, sizeof (said));
+ puts (said);
+
+ printf ("short progname=%s\n", getprogname ());
+ printf ("full progname=%s\n", argv [0]);
+
+ return 0;
+}
diff --git a/examples/hello_compatlib/prog2/Makefile b/examples/hello_compatlib/prog2/Makefile
new file mode 100644
index 0000000..6cde3eb
--- /dev/null
+++ b/examples/hello_compatlib/prog2/Makefile
@@ -0,0 +1,7 @@
+PROG = prog2
+
+WARNS = 4
+
+MKC_REQD = 0.27.0
+
+.include <mkc.prog.mk>
diff --git a/examples/hello_compatlib/prog2/prog2.c b/examples/hello_compatlib/prog2/prog2.c
new file mode 100644
index 0000000..8a4f0fb
--- /dev/null
+++ b/examples/hello_compatlib/prog2/prog2.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <mkc_fgetln.h>
+#include <mkc_err.h>
+
+int main (int argc, char ** argv)
+{
+ char *buf, *lbuf;
+ size_t len;
+
+ while ((lbuf = buf = fgetln (stdin, &len)) != NULL) {
+ if (len > 0 && buf [len - 1] == '\n')
+ buf[len - 1] = '\0';
+ else if ((lbuf = strndup (buf, len + 1)) == NULL)
+ err (1, NULL);
+ printf ("%s\n", lbuf);
+
+ if (lbuf != buf)
+ free (lbuf);
+ }
+ return 0;
+}
diff --git a/examples/hello_compatlib/test.mk b/examples/hello_compatlib/test.mk
new file mode 100644
index 0000000..425ad83
--- /dev/null
+++ b/examples/hello_compatlib/test.mk
@@ -0,0 +1,14 @@
+FUNCS_RE=(fgetln|progname|strlcat|strlcpy|getline)[.]o
+
+.PHONY : test_output
+test_output :
+ @set -e; \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | grep -Ev '${FUNCS_RE}' | \
+ grep -vE 'libcmpt/.*[.]os?$$' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ true =========== cleandir ============; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_cxxlib/cxxlib/Makefile b/examples/hello_cxxlib/cxxlib/Makefile
index a9f974a..540eb02 100644
--- a/examples/hello_cxxlib/cxxlib/Makefile
+++ b/examples/hello_cxxlib/cxxlib/Makefile
@@ -12,4 +12,7 @@ INCSSRCDIR = include
SRCS = hello_msg1.cpp hello_msg2.cpp
+MKC_SOURCE_FUNCLIBS = dummy # a part of regression test
+MKC_SOURCE_DIR.dummy.c := ${.PARSEDIR}
+
.include <mkc.lib.mk>
diff --git a/examples/hello_cxxlib/cxxlib/dummy.c b/examples/hello_cxxlib/cxxlib/dummy.c
new file mode 100644
index 0000000..a30fafb
--- /dev/null
+++ b/examples/hello_cxxlib/cxxlib/dummy.c
@@ -0,0 +1,6 @@
+/* we do use this function, this is just a part of regression test */
+void dummy_func (void);
+void dummy_func (void)
+{
+ /* we do nothing here */
+}
diff --git a/examples/hello_cxxlib/cxxlib/linkme.mk b/examples/hello_cxxlib/cxxlib/linkme.mk
index 85b9277..20864c9 100644
--- a/examples/hello_cxxlib/cxxlib/linkme.mk
+++ b/examples/hello_cxxlib/cxxlib/linkme.mk
@@ -1,5 +1,5 @@
-PATH.cxxlib := ${.PARSEDIR}
+PATH.cxxlib := ${.PARSEDIR:tA}
-CPPFLAGS += -I${PATH.cxxlib}/include
+DPINCDIRS += ${PATH.cxxlib}/include
DPLIBDIRS += ${PATH.cxxlib}
-LDADD0 += -lcxxlib
+DPLDADD += cxxlib
diff --git a/examples/hello_cxxlib/expect.out b/examples/hello_cxxlib/expect.out
index e961c75..09dc8a7 100644
--- a/examples/hello_cxxlib/expect.out
+++ b/examples/hello_cxxlib/expect.out
@@ -2,8 +2,13 @@ Hello world 1!
hello world 2!
=========== all ============
/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
/objdir/_mkc_cxx_type.err
/objdir/_mkc_cxx_type.res
+/objdir/_mkc_funclib_dummy.c
+/objdir/_mkc_funclib_dummy.err
+/objdir/_mkc_funclib_dummy.res
/objdir/_mkc_prog_cxx.err
/objdir/_mkc_prog_cxx.res
/objdir/cxxapp/Makefile
@@ -11,6 +16,9 @@ hello world 2!
/objdir/cxxapp/cxxapp.cc
/objdir/cxxapp/cxxapp.o
/objdir/cxxlib/Makefile
+/objdir/cxxlib/dummy.c
+/objdir/cxxlib/dummy.o
+/objdir/cxxlib/dummy.os
/objdir/cxxlib/hello_msg1.cpp
/objdir/cxxlib/hello_msg1.o
/objdir/cxxlib/hello_msg1.os
@@ -43,13 +51,19 @@ hello world 2!
======== uninstall =========
========== clean ===========
/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
/objdir/_mkc_cxx_type.err
/objdir/_mkc_cxx_type.res
+/objdir/_mkc_funclib_dummy.c
+/objdir/_mkc_funclib_dummy.err
+/objdir/_mkc_funclib_dummy.res
/objdir/_mkc_prog_cxx.err
/objdir/_mkc_prog_cxx.res
/objdir/cxxapp/Makefile
/objdir/cxxapp/cxxapp.cc
/objdir/cxxlib/Makefile
+/objdir/cxxlib/dummy.c
/objdir/cxxlib/hello_msg1.cpp
/objdir/cxxlib/hello_msg2.cpp
/objdir/cxxlib/include/hello_msg.h
@@ -64,6 +78,7 @@ hello world 2!
/objdir/cxxapp/Makefile
/objdir/cxxapp/cxxapp.cc
/objdir/cxxlib/Makefile
+/objdir/cxxlib/dummy.c
/objdir/cxxlib/hello_msg1.cpp
/objdir/cxxlib/hello_msg2.cpp
/objdir/cxxlib/include/hello_msg.h
diff --git a/examples/hello_cxxlib/test.mk b/examples/hello_cxxlib/test.mk
index ce5dd80..96b2a2b 100644
--- a/examples/hello_cxxlib/test.mk
+++ b/examples/hello_cxxlib/test.mk
@@ -5,7 +5,8 @@ test_output:
rm -rf ${.OBJDIR}${PREFIX}; \
LD_LIBRARY_PATH=${.CURDIR}/cxxlib:$$LD_LIBRARY_PATH; \
DYLD_LIBRARY_PATH=${.CURDIR}/cxxlib:$$LD_LIBRARY_PATH; \
- export LD_LIBRARY_PATH DYLD_LIBRARY_PATH; \
+ LIBRARY_PATH=$$LIBRARY_PATH:$$LD_LIBRARY_PATH; \
+ export LD_LIBRARY_PATH DYLD_LIBRARY_PATH LIBRARY_PATH; \
${.CURDIR}/cxxapp/cxxapp; \
\
echo =========== all ============; \
diff --git a/examples/hello_dictd/Makefile b/examples/hello_dictd/Makefile
index fe7e319..5c4c567 100644
--- a/examples/hello_dictd/Makefile
+++ b/examples/hello_dictd/Makefile
@@ -1,12 +1,14 @@
-SUBPRJ = libcommon:dict
-SUBPRJ += libcommon:dictd
-SUBPRJ += libcommon:dictzip
-SUBPRJ += libcommon:dictfmt
-SUBPRJ += libmaa:dict
-SUBPRJ += libmaa:dictd
-SUBPRJ += libmaa:dictzip
-SUBPRJ += libmaa:dictfmt
-SUBPRJ += libdz:dictzip
+LIBDEPS = libcommon:dict
+LIBDEPS += libcommon:dictd
+LIBDEPS += libcommon:dictzip
+LIBDEPS += libcommon:dictfmt
+LIBDEPS += libmaa:dict
+LIBDEPS += libmaa:dictd
+LIBDEPS += libmaa:dictzip
+LIBDEPS += libmaa:dictfmt
+LIBDEPS += libdz:dictzip
+
+INTERNALLIBS += libcommon
# Subproject "doc" has no dependencies
SUBPRJ += doc
diff --git a/examples/hello_dictd/dict/Makefile b/examples/hello_dictd/dict/Makefile
index b7e3e1c..17f232f 100644
--- a/examples/hello_dictd/dict/Makefile
+++ b/examples/hello_dictd/dict/Makefile
@@ -3,7 +3,4 @@ MAN = dict.1
WARNS = 4
-.include "../libcommon/linkme.mk"
-.include "../libmaa/linkme.mk"
-
.include <mkc.prog.mk>
diff --git a/examples/hello_dictd/dictd/Makefile b/examples/hello_dictd/dictd/Makefile
index 1f3d8ca..325df68 100644
--- a/examples/hello_dictd/dictd/Makefile
+++ b/examples/hello_dictd/dictd/Makefile
@@ -3,7 +3,4 @@ MAN = dictd.8
WARNS = 4
-.include "../libcommon/linkme.mk"
-.include "../libmaa/linkme.mk"
-
.include <mkc.prog.mk>
diff --git a/examples/hello_dictd/dictfmt/Makefile b/examples/hello_dictd/dictfmt/Makefile
index a34d541..c30ed3e 100644
--- a/examples/hello_dictd/dictfmt/Makefile
+++ b/examples/hello_dictd/dictfmt/Makefile
@@ -3,7 +3,4 @@ MAN = dictfmt.1
WARNS = 4
-.include "../libcommon/linkme.mk"
-.include "../libmaa/linkme.mk"
-
.include <mkc.prog.mk>
diff --git a/examples/hello_dictd/dictzip/Makefile b/examples/hello_dictd/dictzip/Makefile
index db50d14..456bb00 100644
--- a/examples/hello_dictd/dictzip/Makefile
+++ b/examples/hello_dictd/dictzip/Makefile
@@ -3,8 +3,4 @@ MAN = dictzip.1
WARNS = 4
-.include "../libcommon/linkme.mk"
-.include "../libdz/linkme.mk"
-.include "../libmaa/linkme.mk"
-
.include <mkc.prog.mk>
diff --git a/examples/hello_dictd/expect.out b/examples/hello_dictd/expect.out
index 462d425..9c3f7f1 100644
--- a/examples/hello_dictd/expect.out
+++ b/examples/hello_dictd/expect.out
@@ -20,10 +20,11 @@ dictzip: fake4=4
dictzip: fake5=5
dictzip: fake6=6
=========== nm ============
-libmaa fake4
-libmaa fake5
-libmaa fake6
-libdz fake3
+symbol fake4
+symbol fake5
+symbol fake6
+=
+symbol fake3
=========== all ============
/objdir/Makefile
/objdir/Makefile.inc
@@ -71,10 +72,12 @@ libdz fake3
/objdir/libcommon/Makefile
/objdir/libcommon/iswalnum.c
/objdir/libcommon/iswalnum.o
+/objdir/libcommon/iswalnum.os
/objdir/libcommon/libcommon.a
-/objdir/libcommon/linkme.mk
+/objdir/libcommon/libcommon_pic.a
/objdir/libcommon/str.c
/objdir/libcommon/str.o
+/objdir/libcommon/str.os
/objdir/libdz/Makefile
/objdir/libdz/dz.c
/objdir/libdz/dz.o
@@ -84,14 +87,12 @@ libdz fake3
/objdir/libdz/libdz.so
/objdir/libdz/libdz.so.1
/objdir/libdz/libdz.so.1.0
-/objdir/libdz/linkme.mk
/objdir/libmaa/Makefile
/objdir/libmaa/export.sym
/objdir/libmaa/libmaa.a
/objdir/libmaa/libmaa.so
/objdir/libmaa/libmaa.so.1
/objdir/libmaa/libmaa.so.1.2.0
-/objdir/libmaa/linkme.mk
/objdir/libmaa/log.c
/objdir/libmaa/log.o
/objdir/libmaa/log.os
@@ -102,6 +103,25 @@ libdz fake3
/objdir/libmaa/set.o
/objdir/libmaa/set.os
/objdir/test.mk
+========= INTERNALLIBS ==========
+installdirs ===> examples/hello_dictd/libmaa
+installdirs ===> examples/hello_dictd/dict
+installdirs ===> examples/hello_dictd/dictd
+installdirs ===> examples/hello_dictd/libdz
+installdirs ===> examples/hello_dictd/dictzip
+installdirs ===> examples/hello_dictd/dictfmt
+install ===> examples/hello_dictd/libmaa
+install ===> examples/hello_dictd/dict
+install ===> examples/hello_dictd/dictd
+install ===> examples/hello_dictd/libdz
+install ===> examples/hello_dictd/dictzip
+install ===> examples/hello_dictd/dictfmt
+uninstall ===> examples/hello_dictd/libmaa
+uninstall ===> examples/hello_dictd/dict
+uninstall ===> examples/hello_dictd/dictd
+uninstall ===> examples/hello_dictd/libdz
+uninstall ===> examples/hello_dictd/dictzip
+uninstall ===> examples/hello_dictd/dictfmt
========= installdirs ==========
/objdir/prefix
/objdir/prefix/bin
@@ -169,10 +189,12 @@ libdz fake3
/objdir/libcommon/Makefile
/objdir/libcommon/iswalnum.c
/objdir/libcommon/iswalnum.o
+/objdir/libcommon/iswalnum.os
/objdir/libcommon/libcommon.a
-/objdir/libcommon/linkme.mk
+/objdir/libcommon/libcommon_pic.a
/objdir/libcommon/str.c
/objdir/libcommon/str.o
+/objdir/libcommon/str.os
/objdir/libdz/Makefile
/objdir/libdz/dz.c
/objdir/libdz/dz.o
@@ -182,14 +204,12 @@ libdz fake3
/objdir/libdz/libdz.so
/objdir/libdz/libdz.so.1
/objdir/libdz/libdz.so.1.0
-/objdir/libdz/linkme.mk
/objdir/libmaa/Makefile
/objdir/libmaa/export.sym
/objdir/libmaa/libmaa.a
/objdir/libmaa/libmaa.so
/objdir/libmaa/libmaa.so.1
/objdir/libmaa/libmaa.so.1.2.0
-/objdir/libmaa/linkme.mk
/objdir/libmaa/log.c
/objdir/libmaa/log.o
/objdir/libmaa/log.os
@@ -221,15 +241,12 @@ libdz fake3
/objdir/hello_dictd.test.out.tmp
/objdir/libcommon/Makefile
/objdir/libcommon/iswalnum.c
-/objdir/libcommon/linkme.mk
/objdir/libcommon/str.c
/objdir/libdz/Makefile
/objdir/libdz/dz.c
/objdir/libdz/export.sym
-/objdir/libdz/linkme.mk
/objdir/libmaa/Makefile
/objdir/libmaa/export.sym
-/objdir/libmaa/linkme.mk
/objdir/libmaa/log.c
/objdir/libmaa/prime.c
/objdir/libmaa/set.c
@@ -255,15 +272,12 @@ libdz fake3
/objdir/hello_dictd.test.out.tmp
/objdir/libcommon/Makefile
/objdir/libcommon/iswalnum.c
-/objdir/libcommon/linkme.mk
/objdir/libcommon/str.c
/objdir/libdz/Makefile
/objdir/libdz/dz.c
/objdir/libdz/export.sym
-/objdir/libdz/linkme.mk
/objdir/libmaa/Makefile
/objdir/libmaa/export.sym
-/objdir/libmaa/linkme.mk
/objdir/libmaa/log.c
/objdir/libmaa/prime.c
/objdir/libmaa/set.c
@@ -296,17 +310,14 @@ libdz fake3
/objdir/libcommon
/objdir/libcommon/Makefile
/objdir/libcommon/iswalnum.c
-/objdir/libcommon/linkme.mk
/objdir/libcommon/str.c
/objdir/libdz
/objdir/libdz/Makefile
/objdir/libdz/dz.c
/objdir/libdz/export.sym
-/objdir/libdz/linkme.mk
/objdir/libmaa
/objdir/libmaa/Makefile
/objdir/libmaa/export.sym
-/objdir/libmaa/linkme.mk
/objdir/libmaa/log.c
/objdir/libmaa/prime.c
/objdir/libmaa/set.c
@@ -350,17 +361,14 @@ obj1 does not exist
/objdir/libcommon
/objdir/libcommon/Makefile
/objdir/libcommon/iswalnum.c
-/objdir/libcommon/linkme.mk
/objdir/libcommon/str.c
/objdir/libdz
/objdir/libdz/Makefile
/objdir/libdz/dz.c
/objdir/libdz/export.sym
-/objdir/libdz/linkme.mk
/objdir/libmaa
/objdir/libmaa/Makefile
/objdir/libmaa/export.sym
-/objdir/libmaa/linkme.mk
/objdir/libmaa/log.c
/objdir/libmaa/prime.c
/objdir/libmaa/set.c
@@ -410,15 +418,12 @@ obj1 does not exist
/objdir/hello_dictd.test.out.tmp
/objdir/libcommon/Makefile
/objdir/libcommon/iswalnum.c
-/objdir/libcommon/linkme.mk
/objdir/libcommon/str.c
/objdir/libdz/Makefile
/objdir/libdz/dz.c
/objdir/libdz/export.sym
-/objdir/libdz/linkme.mk
/objdir/libmaa/Makefile
/objdir/libmaa/export.sym
-/objdir/libmaa/linkme.mk
/objdir/libmaa/log.c
/objdir/libmaa/prime.c
/objdir/libmaa/set.c
@@ -452,21 +457,21 @@ obj1 does not exist
/objdir/libcommon/Makefile
/objdir/libcommon/iswalnum.c
/objdir/libcommon/iswalnum.o
+/objdir/libcommon/iswalnum.os
/objdir/libcommon/libcommon.a
-/objdir/libcommon/linkme.mk
+/objdir/libcommon/libcommon_pic.a
/objdir/libcommon/str.c
/objdir/libcommon/str.o
+/objdir/libcommon/str.os
/objdir/libdz/Makefile
/objdir/libdz/dz.c
/objdir/libdz/export.sym
-/objdir/libdz/linkme.mk
/objdir/libmaa/Makefile
/objdir/libmaa/export.sym
/objdir/libmaa/libmaa.a
/objdir/libmaa/libmaa.so
/objdir/libmaa/libmaa.so.1
/objdir/libmaa/libmaa.so.1.2.0
-/objdir/libmaa/linkme.mk
/objdir/libmaa/log.c
/objdir/libmaa/log.o
/objdir/libmaa/log.os
@@ -506,21 +511,21 @@ obj1 does not exist
/objdir/libcommon/Makefile
/objdir/libcommon/iswalnum.c
/objdir/libcommon/iswalnum.o
+/objdir/libcommon/iswalnum.os
/objdir/libcommon/libcommon.a
-/objdir/libcommon/linkme.mk
+/objdir/libcommon/libcommon_pic.a
/objdir/libcommon/str.c
/objdir/libcommon/str.o
+/objdir/libcommon/str.os
/objdir/libdz/Makefile
/objdir/libdz/dz.c
/objdir/libdz/export.sym
-/objdir/libdz/linkme.mk
/objdir/libmaa/Makefile
/objdir/libmaa/export.sym
/objdir/libmaa/libmaa.a
/objdir/libmaa/libmaa.so
/objdir/libmaa/libmaa.so.1
/objdir/libmaa/libmaa.so.1.2.0
-/objdir/libmaa/linkme.mk
/objdir/libmaa/log.c
/objdir/libmaa/log.o
/objdir/libmaa/log.os
@@ -592,15 +597,12 @@ obj1 does not exist
/objdir/hello_dictd.test.out.tmp
/objdir/libcommon/Makefile
/objdir/libcommon/iswalnum.c
-/objdir/libcommon/linkme.mk
/objdir/libcommon/str.c
/objdir/libdz/Makefile
/objdir/libdz/dz.c
/objdir/libdz/export.sym
-/objdir/libdz/linkme.mk
/objdir/libmaa/Makefile
/objdir/libmaa/export.sym
-/objdir/libmaa/linkme.mk
/objdir/libmaa/log.c
/objdir/libmaa/prime.c
/objdir/libmaa/set.c
@@ -626,15 +628,12 @@ obj1 does not exist
/objdir/hello_dictd.test.out.tmp
/objdir/libcommon/Makefile
/objdir/libcommon/iswalnum.c
-/objdir/libcommon/linkme.mk
/objdir/libcommon/str.c
/objdir/libdz/Makefile
/objdir/libdz/dz.c
/objdir/libdz/export.sym
-/objdir/libdz/linkme.mk
/objdir/libmaa/Makefile
/objdir/libmaa/export.sym
-/objdir/libmaa/linkme.mk
/objdir/libmaa/log.c
/objdir/libmaa/prime.c
/objdir/libmaa/set.c
@@ -683,21 +682,173 @@ obj1 does not exist
/objdir/libcommon/Makefile
/objdir/libcommon/iswalnum.c
/objdir/libcommon/iswalnum.o
+/objdir/libcommon/iswalnum.os
/objdir/libcommon/libcommon.a
-/objdir/libcommon/linkme.mk
+/objdir/libcommon/libcommon_pic.a
/objdir/libcommon/str.c
/objdir/libcommon/str.o
+/objdir/libcommon/str.os
/objdir/libdz/Makefile
/objdir/libdz/dz.c
/objdir/libdz/export.sym
-/objdir/libdz/linkme.mk
/objdir/libmaa/Makefile
/objdir/libmaa/export.sym
/objdir/libmaa/libmaa.a
/objdir/libmaa/libmaa.so
/objdir/libmaa/libmaa.so.1
/objdir/libmaa/libmaa.so.1.2.0
-/objdir/libmaa/linkme.mk
+/objdir/libmaa/log.c
+/objdir/libmaa/log.o
+/objdir/libmaa/log.os
+/objdir/libmaa/prime.c
+/objdir/libmaa/prime.o
+/objdir/libmaa/prime.os
+/objdir/libmaa/set.c
+/objdir/libmaa/set.o
+/objdir/libmaa/set.os
+/objdir/test.mk
+=========== all with MKPIE=yes ============
+/objdir/Makefile
+/objdir/Makefile.inc
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_funclib_deflate.c
+/objdir/_mkc_funclib_deflate.err
+/objdir/_mkc_funclib_deflate.res
+/objdir/_mkc_funclib_deflate_z.c
+/objdir/_mkc_funclib_deflate_z.err
+/objdir/_mkc_funclib_deflate_z.res
+/objdir/_mkc_header_zlib_h.c
+/objdir/_mkc_header_zlib_h.err
+/objdir/_mkc_header_zlib_h.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/dict/Makefile
+/objdir/dict/dict
+/objdir/dict/dict.1
+/objdir/dict/dict.c
+/objdir/dict/dict.cat1
+/objdir/dict/dict.o
+/objdir/dictd/Makefile
+/objdir/dictd/dictd
+/objdir/dictd/dictd.8
+/objdir/dictd/dictd.c
+/objdir/dictd/dictd.cat8
+/objdir/dictd/dictd.o
+/objdir/dictfmt/Makefile
+/objdir/dictfmt/dictfmt
+/objdir/dictfmt/dictfmt.1
+/objdir/dictfmt/dictfmt.c
+/objdir/dictfmt/dictfmt.cat1
+/objdir/dictfmt/dictfmt.o
+/objdir/dictzip/Makefile
+/objdir/dictzip/dictzip
+/objdir/dictzip/dictzip.1
+/objdir/dictzip/dictzip.c
+/objdir/dictzip/dictzip.cat1
+/objdir/dictzip/dictzip.o
+/objdir/doc/Makefile
+/objdir/doc/doc.txt
+/objdir/expect.out
+/objdir/hello_dictd.test.out.tmp
+/objdir/libcommon/Makefile
+/objdir/libcommon/iswalnum.c
+/objdir/libcommon/iswalnum.o
+/objdir/libcommon/iswalnum.os
+/objdir/libcommon/libcommon.a
+/objdir/libcommon/libcommon_pic.a
+/objdir/libcommon/str.c
+/objdir/libcommon/str.o
+/objdir/libcommon/str.os
+/objdir/libdz/Makefile
+/objdir/libdz/dz.c
+/objdir/libdz/dz.o
+/objdir/libdz/dz.os
+/objdir/libdz/export.sym
+/objdir/libdz/libdz.a
+/objdir/libdz/libdz.so
+/objdir/libdz/libdz.so.1
+/objdir/libdz/libdz.so.1.0
+/objdir/libmaa/Makefile
+/objdir/libmaa/export.sym
+/objdir/libmaa/libmaa.a
+/objdir/libmaa/libmaa.so
+/objdir/libmaa/libmaa.so.1
+/objdir/libmaa/libmaa.so.1.2.0
+/objdir/libmaa/log.c
+/objdir/libmaa/log.o
+/objdir/libmaa/log.os
+/objdir/libmaa/prime.c
+/objdir/libmaa/prime.o
+/objdir/libmaa/prime.os
+/objdir/libmaa/set.c
+/objdir/libmaa/set.o
+/objdir/libmaa/set.os
+/objdir/test.mk
+=========== all with STATICLIBS=everything... ============
+/objdir/Makefile
+/objdir/Makefile.inc
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_funclib_deflate.c
+/objdir/_mkc_funclib_deflate.err
+/objdir/_mkc_funclib_deflate.res
+/objdir/_mkc_funclib_deflate_z.c
+/objdir/_mkc_funclib_deflate_z.err
+/objdir/_mkc_funclib_deflate_z.res
+/objdir/_mkc_header_zlib_h.c
+/objdir/_mkc_header_zlib_h.err
+/objdir/_mkc_header_zlib_h.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/dict/Makefile
+/objdir/dict/dict
+/objdir/dict/dict.1
+/objdir/dict/dict.c
+/objdir/dict/dict.cat1
+/objdir/dict/dict.o
+/objdir/dictd/Makefile
+/objdir/dictd/dictd
+/objdir/dictd/dictd.8
+/objdir/dictd/dictd.c
+/objdir/dictd/dictd.cat8
+/objdir/dictd/dictd.o
+/objdir/dictfmt/Makefile
+/objdir/dictfmt/dictfmt
+/objdir/dictfmt/dictfmt.1
+/objdir/dictfmt/dictfmt.c
+/objdir/dictfmt/dictfmt.cat1
+/objdir/dictfmt/dictfmt.o
+/objdir/dictzip/Makefile
+/objdir/dictzip/dictzip
+/objdir/dictzip/dictzip.1
+/objdir/dictzip/dictzip.c
+/objdir/dictzip/dictzip.cat1
+/objdir/dictzip/dictzip.o
+/objdir/doc/Makefile
+/objdir/doc/doc.txt
+/objdir/expect.out
+/objdir/hello_dictd.test.out.tmp
+/objdir/libcommon/Makefile
+/objdir/libcommon/iswalnum.c
+/objdir/libcommon/iswalnum.o
+/objdir/libcommon/iswalnum.os
+/objdir/libcommon/libcommon.a
+/objdir/libcommon/libcommon_pic.a
+/objdir/libcommon/str.c
+/objdir/libcommon/str.o
+/objdir/libcommon/str.os
+/objdir/libdz/Makefile
+/objdir/libdz/dz.c
+/objdir/libdz/dz.o
+/objdir/libdz/dz.os
+/objdir/libdz/export.sym
+/objdir/libdz/libdz.a
+/objdir/libdz/libdz_pic.a
+/objdir/libmaa/Makefile
+/objdir/libmaa/export.sym
+/objdir/libmaa/libmaa.a
+/objdir/libmaa/libmaa_pic.a
/objdir/libmaa/log.c
/objdir/libmaa/log.o
/objdir/libmaa/log.os
diff --git a/examples/hello_dictd/libcommon/Makefile b/examples/hello_dictd/libcommon/Makefile
index 33e4167..c3c5253 100644
--- a/examples/hello_dictd/libcommon/Makefile
+++ b/examples/hello_dictd/libcommon/Makefile
@@ -5,6 +5,4 @@ SRCS = str.c iswalnum.c # and others
WARNS = 4
-MKINSTALL = no
-
.include <mkc.lib.mk>
diff --git a/examples/hello_dictd/libcommon/linkme.mk b/examples/hello_dictd/libcommon/linkme.mk
deleted file mode 100644
index 84c543c..0000000
--- a/examples/hello_dictd/libcommon/linkme.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-PATH.common := ${.PARSEDIR}
-
-CPPFLAGS += -I${PATH.common}
-DPLIBDIRS += ${PATH.common}
-LDADD0 += -lcommon
diff --git a/examples/hello_dictd/libdz/dz.c b/examples/hello_dictd/libdz/dz.c
index 1fbe98e..81442b5 100644
--- a/examples/hello_dictd/libdz/dz.c
+++ b/examples/hello_dictd/libdz/dz.c
@@ -5,10 +5,10 @@ int fake3 (void)
return 3;
}
-/* fake must not be exported */
-int fake2 (void);
+/* fake22 must not be exported */
+int fake22 (void);
-int fake2 (void)
+int fake22 (void)
{
- return 2;
+ return 22;
}
diff --git a/examples/hello_dictd/libdz/linkme.mk b/examples/hello_dictd/libdz/linkme.mk
deleted file mode 100644
index 5904614..0000000
--- a/examples/hello_dictd/libdz/linkme.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-PATH.dz := ${.PARSEDIR}
-
-CPPFLAGS += -I${PATH.dz}
-DPLIBDIRS += ${PATH.dz}
-LDADD0 += -ldz
diff --git a/examples/hello_dictd/libmaa/linkme.mk b/examples/hello_dictd/libmaa/linkme.mk
deleted file mode 100644
index 9d1456e..0000000
--- a/examples/hello_dictd/libmaa/linkme.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-PATH.maa := ${.PARSEDIR}
-
-CPPFLAGS += -I${PATH.maa}
-DPLIBDIRS += ${PATH.maa}
-LDADD0 += -lmaa
diff --git a/examples/hello_dictd/test.mk b/examples/hello_dictd/test.mk
index 2ec6e83..7081e20 100644
--- a/examples/hello_dictd/test.mk
+++ b/examples/hello_dictd/test.mk
@@ -1,5 +1,7 @@
next_level != expr ${.MAKE.LEVEL} + 1
+run_nm := env NM=${NM:Q} OPSYS=${OPSTS:Q} mkc_test_nm
+
.PHONY : test_output
test_output :
@set -e; \
@@ -9,7 +11,8 @@ test_output :
rm -rf ${.OBJDIR}${PREFIX}; \
LD_LIBRARY_PATH=${.CURDIR}/libdz:${.CURDIR}/libmaa:$$LD_LIBRARY_PATH; \
DYLD_LIBRARY_PATH=${.CURDIR}/libdz:${.CURDIR}/libmaa:$$LD_LIBRARY_PATH; \
- export LD_LIBRARY_PATH DYLD_LIBRARY_PATH; \
+ LIBRARY_PATH=$$LIBRARY_PATH:$$LD_LIBRARY_PATH; \
+ export LD_LIBRARY_PATH DYLD_LIBRARY_PATH LIBRARY_PATH; \
${.CURDIR}/dict/dict; \
${.CURDIR}/dictd/dictd; \
${.CURDIR}/dictfmt/dictfmt; \
@@ -17,17 +20,12 @@ test_output :
\
echo =========== nm ============; \
case ${OPSYS} in \
- OpenBSD) \
- ${NM} ${.CURDIR}/libmaa/libmaa*.so | awk '$$2=="T" {print "libmaa " $$3}'; \
- ${NM} ${.CURDIR}/libdz/libdz*.so | awk '$$2=="T" {print "libdz " $$3}';; \
- *BSD|SunOS|DragonFly) \
- ${NM} -P ${.CURDIR}/libmaa/libmaa*.so | awk 'NF==4 && $$2=="T" {print "libmaa " $$1}'; \
- ${NM} -P ${.CURDIR}/libdz/libdz*.so | awk 'NF==4 && $$2=="T" {print "libdz " $$1}';; \
- Linux) \
- ${NM} -P ${.CURDIR}/libmaa/libmaa*.so | awk 'NF==4 && $$2 ~ /^[DT]$$/ {print "libmaa " $$1}'; \
- ${NM} -P ${.CURDIR}/libdz/libdz*.so | awk 'NF==4 && $$2 ~ /^[DT]$$/ {print "libdz " $$1}';; \
+ *BSD|DragonFly|SunOS|Linux) \
+ ${run_nm} ${OBJDIR_libmaa}/libmaa*.so; \
+ echo =; \
+ ${run_nm} ${OBJDIR_libdz}/libdz*.so;; \
*) \
- printf 'libmaa fake4\nlibmaa fake5\nlibmaa fake6\nlibdz fake3\n';; \
+ printf 'symbol fake4\nsymbol fake5\nsymbol fake6\n=\nsymbol fake3\n';; \
esac; \
\
echo =========== all ============; \
@@ -35,6 +33,11 @@ test_output :
find ${.OBJDIR} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
+ echo ========= INTERNALLIBS ==========; \
+ { ${MAKE} ${MAKEFLAGS} installdirs DESTDIR=${.OBJDIR}; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR}; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR}; } 2>&1 | awk '/^(un)?install/'; \
+ rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/home ${.OBJDIR}/Users; \
echo ========= installdirs ==========; \
${MAKE} ${MAKEFLAGS} installdirs DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \
@@ -64,7 +67,7 @@ test_output :
${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
find ${.OBJDIR} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
- rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/home; \
+ rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/home ${.OBJDIR}/Users; \
echo =========== MKOBJDIRS=auto ============; \
env TARGETS=fake ${MAKE} ${MAKEFLAGS} fake \
MKCHECKS=no MAKEOBJDIRPREFIX=${.OBJDIR}/obj1 > /dev/null; \
@@ -168,6 +171,18 @@ test_output :
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
unset NOSUBDIR; \
\
+ echo =========== all with MKPIE=yes ============; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 all MKPIE=yes > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo =========== all with STATICLIBS=everything... ============; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
+ env STATICLIBS='libmaa libdz' ${MAKE} ${MAKEFLAGS} -j4 all > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
echo =========== print_deps ============; \
${MAKE} ${MAKEFLAGS} print_deps | grep -E '^(all|test)'; \
echo =====; \
diff --git a/examples/hello_errwarn/Makefile b/examples/hello_errwarn/Makefile
new file mode 100644
index 0000000..6b8c160
--- /dev/null
+++ b/examples/hello_errwarn/Makefile
@@ -0,0 +1,10 @@
+PROG = hello
+
+WARNS = 4
+
+MKC_FEATURES = err warn
+
+MKC_REQD = 0.26.0
+
+.include "test.mk"
+.include <mkc.mk>
diff --git a/examples/hello_errwarn/expect.out b/examples/hello_errwarn/expect.out
new file mode 100644
index 0000000..8587981
--- /dev/null
+++ b/examples/hello_errwarn/expect.out
@@ -0,0 +1,23 @@
+======= ex ==========
+hello: warnx test1: Cannot allocate memory
+hello: errx test1: Cannot allocate memory
+$?=21
+hello: warnx test2, six=6: Cannot allocate memory
+hello: errx test2, six=6: Cannot allocate memory
+$?=22
+errx(3): invalid argv
+$?=94
+hello: warn test1
+hello: err test1
+$?=11
+hello: warn test2, five=5
+hello: err test2, five=5
+$?=12
+err(3): invalid argv
+$?=93
+======= CLEANFILES ==========
+hello.o
+progname.o
+err.o
+warn.o
+======= cleandir ==========
diff --git a/examples/hello_errwarn/hello.c b/examples/hello_errwarn/hello.c
new file mode 100644
index 0000000..a648890
--- /dev/null
+++ b/examples/hello_errwarn/hello.c
@@ -0,0 +1,54 @@
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <mkc_err.h>
+#include <mkc_warn.h>
+
+int main (int argc, char ** argv)
+{
+ --argc;
+ ++argv;
+
+ if (argc != 2)
+ return (90);
+
+ if (!strcmp (argv [0], "errx")){
+ switch (argv [1][0]){
+ case '1':
+ warnx ("warn test1");
+ errx (11, "err test1");
+ break;
+ case '2':
+ warnx ("warn test2, five=%d", 5);
+ errx (12, "err test2, five=%d", 5);
+ break;
+ default:
+ fprintf (stderr, "err(3): invalid argv\n");
+ return 93;
+ }
+ }else if (!strcmp (argv [0], "err")){
+ switch (argv [1][0]){
+ case '1':
+ errno = ENOMEM;
+ warn ("warnx test1");
+ errno = ENOMEM;
+ err (21, "errx test1");
+ break;
+ case '2':
+ errno = ENOMEM;
+ warn ("warnx test2, six=%d", 6);
+ errno = ENOMEM;
+ err (22, "errx test2, six=%d", 6);
+ break;
+ default:
+ fprintf (stderr, "errx(3): invalid argv\n");
+ return 94;
+ }
+ }else{
+ fprintf (stderr, "bad err id '%s'\n", argv [0]);
+ return (91);
+ }
+
+ return 0;
+}
diff --git a/examples/hello_errwarn/test.mk b/examples/hello_errwarn/test.mk
new file mode 100644
index 0000000..94f48a2
--- /dev/null
+++ b/examples/hello_errwarn/test.mk
@@ -0,0 +1,19 @@
+SUBST_CMD=sed -e 's,Not enough space,Cannot allocate memory,'
+
+.PHONY : test_output
+test_output:
+ @\
+ echo ======= ex ==========; \
+ { ${.OBJDIR}/hello err 1 2>&1 >/dev/null; echo '$$?='$$?; } | ${SUBST_CMD}; \
+ { ${.OBJDIR}/hello err 2 2>&1 >/dev/null; echo '$$?='$$?; } | ${SUBST_CMD}; \
+ { ${.OBJDIR}/hello err 3 2>&1 >/dev/null; echo '$$?='$$?; } | ${SUBST_CMD}; \
+ ${.OBJDIR}/hello errx 1 2>&1 >/dev/null; echo '$$?='$$?; \
+ ${.OBJDIR}/hello errx 2 2>&1 >/dev/null; echo '$$?='$$?; \
+ ${.OBJDIR}/hello errx 3 2>&1 >/dev/null; echo '$$?='$$?; \
+ echo ======= CLEANFILES ==========; \
+ ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \
+ awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}'; \
+ echo ======= cleandir ==========; \
+ ${MAKE} ${MAKEFLAGS} cleandir > /dev/null
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_fgetln/Makefile b/examples/hello_fgetln/Makefile
new file mode 100644
index 0000000..d77b37e
--- /dev/null
+++ b/examples/hello_fgetln/Makefile
@@ -0,0 +1,10 @@
+MKC_FEATURES = fgetln err
+
+PROG = hello
+
+WARNS = 4
+
+MKC_REQD = 0.26.0
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_fgetln/expect.out b/examples/hello_fgetln/expect.out
new file mode 100644
index 0000000..cd19953
--- /dev/null
+++ b/examples/hello_fgetln/expect.out
@@ -0,0 +1,99 @@
+# Copyright (c) 2009, Aleksey Cheusov <vle@gmx.net>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_func0_getexecname_stdlib_h.c
+/objdir/_mkc_func0_getexecname_stdlib_h.err
+/objdir/_mkc_func0_getexecname_stdlib_h.res
+/objdir/_mkc_func0_getprogname_stdlib_h.c
+/objdir/_mkc_func0_getprogname_stdlib_h.err
+/objdir/_mkc_func0_getprogname_stdlib_h.res
+/objdir/_mkc_func1_setprogname_stdlib_h.c
+/objdir/_mkc_func1_setprogname_stdlib_h.err
+/objdir/_mkc_func1_setprogname_stdlib_h.res
+/objdir/_mkc_func3_err_err_h.c
+/objdir/_mkc_func3_err_err_h.err
+/objdir/_mkc_func3_err_err_h.res
+/objdir/_mkc_func3_errx_err_h.c
+/objdir/_mkc_func3_errx_err_h.err
+/objdir/_mkc_func3_errx_err_h.res
+/objdir/_mkc_func3_fgetln_stdio_h.c
+/objdir/_mkc_func3_fgetln_stdio_h.err
+/objdir/_mkc_func3_fgetln_stdio_h.res
+/objdir/_mkc_func3_getline_stdio_h.c
+/objdir/_mkc_func3_getline_stdio_h.err
+/objdir/_mkc_func3_getline_stdio_h.res
+/objdir/_mkc_func3_verr_err_h.c
+/objdir/_mkc_func3_verr_err_h.err
+/objdir/_mkc_func3_verr_err_h.res
+/objdir/_mkc_func3_verrx_err_h.c
+/objdir/_mkc_func3_verrx_err_h.err
+/objdir/_mkc_func3_verrx_err_h.res
+/objdir/_mkc_funclib_err.c
+/objdir/_mkc_funclib_err.err
+/objdir/_mkc_funclib_err.res
+/objdir/_mkc_funclib_errx.c
+/objdir/_mkc_funclib_errx.err
+/objdir/_mkc_funclib_errx.res
+/objdir/_mkc_funclib_fgetln.c
+/objdir/_mkc_funclib_fgetln.err
+/objdir/_mkc_funclib_fgetln.res
+/objdir/_mkc_funclib_getline.c
+/objdir/_mkc_funclib_getline.err
+/objdir/_mkc_funclib_getline.res
+/objdir/_mkc_funclib_getprogname.c
+/objdir/_mkc_funclib_getprogname.err
+/objdir/_mkc_funclib_getprogname.res
+/objdir/_mkc_funclib_setprogname.c
+/objdir/_mkc_funclib_setprogname.err
+/objdir/_mkc_funclib_setprogname.res
+/objdir/_mkc_funclib_verr.c
+/objdir/_mkc_funclib_verr.err
+/objdir/_mkc_funclib_verr.res
+/objdir/_mkc_funclib_verrx.c
+/objdir/_mkc_funclib_verrx.err
+/objdir/_mkc_funclib_verrx.res
+/objdir/_mkc_header_err_h.c
+/objdir/_mkc_header_err_h.err
+/objdir/_mkc_header_err_h.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/_mkc_variable_program_invocation_short_name_errno_h.c
+/objdir/_mkc_variable_program_invocation_short_name_errno_h.err
+/objdir/_mkc_variable_program_invocation_short_name_errno_h.res
+/objdir/expect.out
+/objdir/hello
+/objdir/hello.c
+/objdir/hello.o
+/objdir/hello_fgetln.test.out.tmp
+/objdir/test.mk
+======= CLEANFILES ==========
+hello.o
+getline.o
+fgetln.o
+progname.o
+err.o
+======= cleandir ==========
diff --git a/examples/hello_fgetln/hello.c b/examples/hello_fgetln/hello.c
new file mode 100644
index 0000000..8a4f0fb
--- /dev/null
+++ b/examples/hello_fgetln/hello.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <mkc_fgetln.h>
+#include <mkc_err.h>
+
+int main (int argc, char ** argv)
+{
+ char *buf, *lbuf;
+ size_t len;
+
+ while ((lbuf = buf = fgetln (stdin, &len)) != NULL) {
+ if (len > 0 && buf [len - 1] == '\n')
+ buf[len - 1] = '\0';
+ else if ((lbuf = strndup (buf, len + 1)) == NULL)
+ err (1, NULL);
+ printf ("%s\n", lbuf);
+
+ if (lbuf != buf)
+ free (lbuf);
+ }
+ return 0;
+}
diff --git a/examples/hello_fgetln/test.mk b/examples/hello_fgetln/test.mk
new file mode 100644
index 0000000..58c7925
--- /dev/null
+++ b/examples/hello_fgetln/test.mk
@@ -0,0 +1,19 @@
+FUNCS_RE=(fgetln|getline|err|progname)[.]o
+
+.PHONY : test_output
+test_output:
+ @set -e; \
+ ${.OBJDIR}/hello < ${.CURDIR}/../hello_strlcpy2/input.in; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | grep -Ev '${FUNCS_RE}' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======= CLEANFILES ==========; \
+ ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \
+ awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}'; \
+ echo ======= cleandir ==========; \
+ ${MAKE} ${MAKEFLAGS} cleandir > /dev/null
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_files/expect.NetBSD.out b/examples/hello_files/expect.NetBSD.out
index ca8f78e..0b28371 100644
--- a/examples/hello_files/expect.NetBSD.out
+++ b/examples/hello_files/expect.NetBSD.out
@@ -1,3 +1,6 @@
+=========== vars ============
+CLEANFILES=/path/to/hello_files.test.out pod2htmd.tmp pod2htmi.tmp shell_func.cat7 shell_func.html7 shell_func.info
+DISTCLEANFILES=/path/to/_mkc_*
=========== all ============
/objdir/DEBIAN/control
/objdir/Makefile
diff --git a/examples/hello_files/expect.out b/examples/hello_files/expect.out
index 932f5b8..5eebc44 100644
--- a/examples/hello_files/expect.out
+++ b/examples/hello_files/expect.out
@@ -1,3 +1,6 @@
+=========== vars ============
+CLEANFILES=/path/to/hello_files.test.out pod2htmd.tmp pod2htmi.tmp shell_func.cat7 shell_func.html7 shell_func.info
+DISTCLEANFILES=/path/to/_mkc_*
=========== all ============
/objdir/DEBIAN/control
/objdir/Makefile
diff --git a/examples/hello_files/test.mk b/examples/hello_files/test.mk
index 8764c4b..e7dbfec 100644
--- a/examples/hello_files/test.mk
+++ b/examples/hello_files/test.mk
@@ -4,6 +4,11 @@ test_output:
MKCATPAGES=yes; export MKCATPAGES; \
rm -rf ${.OBJDIR}${PREFIX}; \
\
+ echo =========== vars ============; \
+ echo CLEANFILES=${CLEANFILES:Q} | \
+ mkc_test_helper_paths; \
+ echo DISTCLEANFILES=${DISTCLEANFILES:Q} | \
+ mkc_test_helper_paths; \
echo =========== all ============; \
${MAKE} ${MAKEFLAGS} -j4 all > /dev/null; \
find ${.OBJDIR} -type f -o -type l | \
diff --git a/examples/hello_libdeps/Makefile b/examples/hello_libdeps/Makefile
new file mode 100644
index 0000000..40ea9d6
--- /dev/null
+++ b/examples/hello_libdeps/Makefile
@@ -0,0 +1,7 @@
+LIBDEPS += libs/libfoo:libs/libfooqux
+LIBDEPS += libs/libbar:progs/fooquxfoobar
+LIBDEPS += libs/libfooqux:progs/fooquxfoobar
+LIBDEPS += libs/libfoo:progs/foobaz libs/libbaz:progs/foobaz
+
+.include "test.mk"
+.include <mkc.mk>
diff --git a/examples/hello_libdeps/expect.out b/examples/hello_libdeps/expect.out
new file mode 100644
index 0000000..a80481d
--- /dev/null
+++ b/examples/hello_libdeps/expect.out
@@ -0,0 +1,127 @@
+=========== fooquxfoobar ============
+I am foo
+ and qux
+I am foo
+I am bar
+=========== foobaz ============
+I am foo
+I am baz
+=========== depends ============
+bar.o bar.o bar.o: bar.c bar.h
+baz.o baz.o baz.o: baz.c include/baz.h
+foo.o foo.o foo.o: foo.c foo.h
+foobaz.o foobaz.o foobaz.o: foobaz.c /objdir/libs/libfoo/foo.h /objdir/libs/libbaz/include/baz.h
+fooqux.o fooqux.o fooqux.o: fooqux.c fooqux.h /objdir/libs/libfoo/foo.h
+fooquxfoobar.o fooquxfoobar.o fooquxfoobar.o: fooquxfoobar.c /objdir/libs/libfooqux/fooqux.h /objdir/libs/libfoo/foo.h /objdir/libs/libbar/bar.h
+======= install ==========
+/objdir/prefix/bin/foobaz
+/objdir/prefix/bin/fooquxfoobar
+/objdir/prefix/include/bar.h
+/objdir/prefix/include/baz.h
+/objdir/prefix/include/foo.h
+/objdir/prefix/include/fooqux.h
+/objdir/prefix/lib/libbar.a
+/objdir/prefix/lib/libbar.so
+/objdir/prefix/lib/libbar.so.0
+/objdir/prefix/lib/libbar.so.0.0
+/objdir/prefix/lib/libbazbaz.a
+/objdir/prefix/lib/libfoo.a
+/objdir/prefix/lib/libfoo.so
+/objdir/prefix/lib/libfoo.so.0
+/objdir/prefix/lib/libfoo.so.0.0
+/objdir/prefix/lib/libfooqux.a
+/objdir/prefix/lib/libfooqux.so
+/objdir/prefix/lib/libfooqux.so.0
+/objdir/prefix/lib/libfooqux.so.0.0
+=========== all with STATICLIBS=... ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/expect.out
+/objdir/hello_libdeps.test.out.tmp
+/objdir/libs/libbar/Makefile
+/objdir/libs/libbar/bar.c
+/objdir/libs/libbar/bar.h
+/objdir/libs/libbar/bar.o
+/objdir/libs/libbar/bar.os
+/objdir/libs/libbar/libbar.a
+/objdir/libs/libbar/libbar_pic.a
+/objdir/libs/libbaz/Makefile
+/objdir/libs/libbaz/baz.c
+/objdir/libs/libbaz/baz.o
+/objdir/libs/libbaz/include/baz.h
+/objdir/libs/libbaz/libbazbaz.a
+/objdir/libs/libbaz/linkme.mk
+/objdir/libs/libfoo/Makefile
+/objdir/libs/libfoo/foo.c
+/objdir/libs/libfoo/foo.h
+/objdir/libs/libfoo/foo.o
+/objdir/libs/libfoo/foo.os
+/objdir/libs/libfoo/libfoo.a
+/objdir/libs/libfoo/libfoo_pic.a
+/objdir/libs/libfoo/linkme.mk
+/objdir/libs/libfooqux/Makefile
+/objdir/libs/libfooqux/fooqux.c
+/objdir/libs/libfooqux/fooqux.h
+/objdir/libs/libfooqux/fooqux.o
+/objdir/libs/libfooqux/fooqux.os
+/objdir/libs/libfooqux/libfooqux.a
+/objdir/libs/libfooqux/libfooqux.so
+/objdir/libs/libfooqux/libfooqux.so.0
+/objdir/libs/libfooqux/libfooqux.so.0.0
+/objdir/progs/foobaz/Makefile
+/objdir/progs/foobaz/foobaz
+/objdir/progs/foobaz/foobaz.c
+/objdir/progs/foobaz/foobaz.o
+/objdir/progs/fooquxfoobar/Makefile
+/objdir/progs/fooquxfoobar/fooquxfoobar
+/objdir/progs/fooquxfoobar/fooquxfoobar.c
+/objdir/progs/fooquxfoobar/fooquxfoobar.o
+/objdir/test.mk
+========= install with STATICLIBS=... ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/foobaz
+/objdir/prefix/bin/fooquxfoobar
+/objdir/prefix/include
+/objdir/prefix/include/bar.h
+/objdir/prefix/include/baz.h
+/objdir/prefix/include/foo.h
+/objdir/prefix/include/fooqux.h
+/objdir/prefix/lib
+/objdir/prefix/lib/libbar.a
+/objdir/prefix/lib/libbar_pic.a
+/objdir/prefix/lib/libbazbaz.a
+/objdir/prefix/lib/libfoo.a
+/objdir/prefix/lib/libfoo_pic.a
+/objdir/prefix/lib/libfooqux.a
+/objdir/prefix/lib/libfooqux.so
+/objdir/prefix/lib/libfooqux.so.0
+/objdir/prefix/lib/libfooqux.so.0.0
+symbol foo
+symbol fooqux
+======= distclean ==========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/hello_libdeps.test.out.tmp
+/objdir/libs/libbar/Makefile
+/objdir/libs/libbar/bar.c
+/objdir/libs/libbar/bar.h
+/objdir/libs/libbaz/Makefile
+/objdir/libs/libbaz/baz.c
+/objdir/libs/libbaz/include/baz.h
+/objdir/libs/libbaz/linkme.mk
+/objdir/libs/libfoo/Makefile
+/objdir/libs/libfoo/foo.c
+/objdir/libs/libfoo/foo.h
+/objdir/libs/libfoo/linkme.mk
+/objdir/libs/libfooqux/Makefile
+/objdir/libs/libfooqux/fooqux.c
+/objdir/libs/libfooqux/fooqux.h
+/objdir/progs/foobaz/Makefile
+/objdir/progs/foobaz/foobaz.c
+/objdir/progs/fooquxfoobar/Makefile
+/objdir/progs/fooquxfoobar/fooquxfoobar.c
+/objdir/test.mk
diff --git a/examples/hello_libdeps/libs/libbar/Makefile b/examples/hello_libdeps/libs/libbar/Makefile
new file mode 100644
index 0000000..6514a70
--- /dev/null
+++ b/examples/hello_libdeps/libs/libbar/Makefile
@@ -0,0 +1,9 @@
+LIB = bar
+INCS = bar.h
+
+SHLIB_MAJOR = 0
+SHLIB_MINOR = 0
+
+WARNS = 4
+
+.include <mkc.mk>
diff --git a/examples/hello_libdeps/libs/libbar/bar.c b/examples/hello_libdeps/libs/libbar/bar.c
new file mode 100644
index 0000000..b8015fc
--- /dev/null
+++ b/examples/hello_libdeps/libs/libbar/bar.c
@@ -0,0 +1,8 @@
+#include "bar.h"
+
+#include <stdio.h>
+
+void bar (void)
+{
+ puts ("I am bar");
+}
diff --git a/examples/hello_libdeps/libs/libbar/bar.h b/examples/hello_libdeps/libs/libbar/bar.h
new file mode 100644
index 0000000..e1d9f28
--- /dev/null
+++ b/examples/hello_libdeps/libs/libbar/bar.h
@@ -0,0 +1,6 @@
+#ifndef _BAR_H_
+#define _BAR_H_
+
+void bar (void);
+
+#endif // _BAR_H_
diff --git a/examples/hello_libdeps/libs/libbaz/Makefile b/examples/hello_libdeps/libs/libbaz/Makefile
new file mode 100644
index 0000000..fb96ef1
--- /dev/null
+++ b/examples/hello_libdeps/libs/libbaz/Makefile
@@ -0,0 +1,10 @@
+LIB = bazbaz # LIB name is not equal to ${.CURDIR:T}!
+SRCS = baz.c
+INCS = baz.h
+INCSSRCDIR = include
+
+CPPFLAGS += ${INCSSRCDIR}
+
+WARNS = 4
+
+.include <mkc.mk>
diff --git a/examples/hello_libdeps/libs/libbaz/baz.c b/examples/hello_libdeps/libs/libbaz/baz.c
new file mode 100644
index 0000000..e9000dc
--- /dev/null
+++ b/examples/hello_libdeps/libs/libbaz/baz.c
@@ -0,0 +1,8 @@
+#include "baz.h"
+
+#include <stdio.h>
+
+void baz (void)
+{
+ puts ("I am baz");
+}
diff --git a/examples/hello_libdeps/libs/libbaz/include/baz.h b/examples/hello_libdeps/libs/libbaz/include/baz.h
new file mode 100644
index 0000000..3a8879c
--- /dev/null
+++ b/examples/hello_libdeps/libs/libbaz/include/baz.h
@@ -0,0 +1,6 @@
+#ifndef _BAZ_H_
+#define _BAZ_H_
+
+void baz (void);
+
+#endif // _BAZ_H_
diff --git a/examples/hello_libdeps/libs/libbaz/linkme.mk b/examples/hello_libdeps/libs/libbaz/linkme.mk
new file mode 100644
index 0000000..8127ebd
--- /dev/null
+++ b/examples/hello_libdeps/libs/libbaz/linkme.mk
@@ -0,0 +1,5 @@
+PATH.baz := ${.PARSEDIR:tA}
+
+DPINCDIRS += ${PATH.baz}/include # non-default dir for headers
+DPLIBDIRS += ${OBJDIR_libs_libbaz}
+DPLDADD += bazbaz # non-default library name
diff --git a/examples/hello_libdeps/libs/libfoo/Makefile b/examples/hello_libdeps/libs/libfoo/Makefile
new file mode 100644
index 0000000..747a9e6
--- /dev/null
+++ b/examples/hello_libdeps/libs/libfoo/Makefile
@@ -0,0 +1,9 @@
+LIB = foo
+INCS = foo.h
+
+SHLIB_MAJOR = 0
+SHLIB_MINOR = 0
+
+WARNS = 4
+
+.include <mkc.mk>
diff --git a/examples/hello_libdeps/libs/libfoo/foo.c b/examples/hello_libdeps/libs/libfoo/foo.c
new file mode 100644
index 0000000..fa86b30
--- /dev/null
+++ b/examples/hello_libdeps/libs/libfoo/foo.c
@@ -0,0 +1,8 @@
+#include "foo.h"
+
+#include <stdio.h>
+
+void foo (void)
+{
+ puts ("I am foo");
+}
diff --git a/examples/hello_libdeps/libs/libfoo/foo.h b/examples/hello_libdeps/libs/libfoo/foo.h
new file mode 100644
index 0000000..a5bf6dd
--- /dev/null
+++ b/examples/hello_libdeps/libs/libfoo/foo.h
@@ -0,0 +1,6 @@
+#ifndef _FOO_H_
+#define _FOO_H_
+
+void foo (void);
+
+#endif // _FOO_H_
diff --git a/examples/hello_libdeps/libs/libfoo/linkme.mk b/examples/hello_libdeps/libs/libfoo/linkme.mk
new file mode 100644
index 0000000..25e2e05
--- /dev/null
+++ b/examples/hello_libdeps/libs/libfoo/linkme.mk
@@ -0,0 +1 @@
+# empty linkme.mk is useless, this is a part of regression tests
diff --git a/examples/hello_libdeps/libs/libfooqux/Makefile b/examples/hello_libdeps/libs/libfooqux/Makefile
new file mode 100644
index 0000000..9157963
--- /dev/null
+++ b/examples/hello_libdeps/libs/libfooqux/Makefile
@@ -0,0 +1,9 @@
+LIB = fooqux
+INCS = fooqux.h
+
+SHLIB_MAJOR = 0
+SHLIB_MINOR = 0
+
+WARNS = 4
+
+.include <mkc.mk>
diff --git a/examples/hello_libdeps/libs/libfooqux/fooqux.c b/examples/hello_libdeps/libs/libfooqux/fooqux.c
new file mode 100644
index 0000000..27d5225
--- /dev/null
+++ b/examples/hello_libdeps/libs/libfooqux/fooqux.c
@@ -0,0 +1,9 @@
+#include "fooqux.h"
+
+#include <stdio.h>
+
+void fooqux (void)
+{
+ foo ();
+ puts (" and qux");
+}
diff --git a/examples/hello_libdeps/libs/libfooqux/fooqux.h b/examples/hello_libdeps/libs/libfooqux/fooqux.h
new file mode 100644
index 0000000..0c4f973
--- /dev/null
+++ b/examples/hello_libdeps/libs/libfooqux/fooqux.h
@@ -0,0 +1,8 @@
+#ifndef _FOOQUX_H_
+#define _FOOQUX_H_
+
+#include "foo.h"
+
+void fooqux (void);
+
+#endif // _FOOQUX_H_
diff --git a/examples/hello_libdeps/progs/foobaz/Makefile b/examples/hello_libdeps/progs/foobaz/Makefile
new file mode 100644
index 0000000..e24d1cf
--- /dev/null
+++ b/examples/hello_libdeps/progs/foobaz/Makefile
@@ -0,0 +1,5 @@
+PROG = foobaz
+
+WARNS = 4
+
+.include <mkc.mk>
diff --git a/examples/hello_libdeps/progs/foobaz/foobaz.c b/examples/hello_libdeps/progs/foobaz/foobaz.c
new file mode 100644
index 0000000..e2cf60b
--- /dev/null
+++ b/examples/hello_libdeps/progs/foobaz/foobaz.c
@@ -0,0 +1,11 @@
+#include "foo.h"
+#include "baz.h"
+
+#include <stdio.h>
+
+int main (int argc, char **argv)
+{
+ foo ();
+ baz ();
+ return 0;
+}
diff --git a/examples/hello_libdeps/progs/fooquxfoobar/Makefile b/examples/hello_libdeps/progs/fooquxfoobar/Makefile
new file mode 100644
index 0000000..5017e96
--- /dev/null
+++ b/examples/hello_libdeps/progs/fooquxfoobar/Makefile
@@ -0,0 +1,5 @@
+PROG = fooquxfoobar
+
+WARNS = 4
+
+.include <mkc.mk>
diff --git a/examples/hello_libdeps/progs/fooquxfoobar/fooquxfoobar.c b/examples/hello_libdeps/progs/fooquxfoobar/fooquxfoobar.c
new file mode 100644
index 0000000..3d154b6
--- /dev/null
+++ b/examples/hello_libdeps/progs/fooquxfoobar/fooquxfoobar.c
@@ -0,0 +1,12 @@
+#include "fooqux.h"
+#include "bar.h"
+
+#include <stdio.h>
+
+int main (int argc, char **argv)
+{
+ fooqux ();
+ foo ();
+ bar ();
+ return 0;
+}
diff --git a/examples/hello_libdeps/test.mk b/examples/hello_libdeps/test.mk
new file mode 100644
index 0000000..0c9daf4
--- /dev/null
+++ b/examples/hello_libdeps/test.mk
@@ -0,0 +1,52 @@
+run_nm := env NM=${NM:Q} OPSYS=${OPSTS:Q} mkc_test_nm
+
+.PHONY : test_output
+test_output:
+ @set -e; LC_ALL=C; export LC_ALL; \
+ LD_LIBRARY_PATH=${OBJDIR_libs_libfoo}:${OBJDIR_libs_libfooqux}:${OBJDIR_libs_libbar}:${OBJDIR_libs_libbaz}; \
+ DYLD_LIBRARY_PATH=$$LD_LIBRARY_PATH; \
+ LIBRARY_PATH=$$LIBRARY_PATH:$$LD_LIBRARY_PATH; \
+ export LD_LIBRARY_PATH DYLD_LIBRARY_PATH LIBRARY_PATH; \
+ echo =========== fooquxfoobar ============; \
+ ${OBJDIR_progs_fooquxfoobar}/fooquxfoobar; \
+ echo =========== foobaz ============; \
+ ${OBJDIR_progs_foobaz}/foobaz; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== depends ============; \
+ ${MAKE} ${MAKEFLAGS} -j4 depend > /dev/null; \
+ mkc_long_lines `find ${.CURDIR} -type f -name .depend` | \
+ awk '!/^#/ {for (i=1; i <= NF; ++i) if ($$i ~ /^\// && $$i !~ /mk-configure/) $$i = ""; print $$0; }' | \
+ awk '{$$1 = $$1; gsub(/[.]o[ps]/, ".o"); print $$0}' | sort | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/Users ${.OBJDIR}/home; \
+ \
+ echo =========== all with STATICLIBS=... ============; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
+ env STATICLIBS='libfoo libbar' ${MAKE} ${MAKEFLAGS} -j4 all > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install with STATICLIBS=... ==========; \
+ env STATICLIBS='libfoo libbar' ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ case ${OPSYS} in \
+ *BSD|DragonFly|SunOS|Linux) \
+ ${run_nm} ${OBJDIR_libfooqux}/libfooqux.so;; \
+ *) \
+ printf 'symbol foo\nsymbol fooqux\n';; \
+ esac; \
+ rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/home ${.OBJDIR}/Users; \
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_lua/Makefile b/examples/hello_lua/Makefile
index 3e40bfb..6bd702a 100644
--- a/examples/hello_lua/Makefile
+++ b/examples/hello_lua/Makefile
@@ -7,7 +7,7 @@ INSCRIPTS = foobar
SCRIPTS = ${INSCRIPTS}
INTEXTS_REPLS = LUA ${PROG.lua}
-MKC_CHECK_PROGS = lua
+MKC_REQUIRE_PROGS = lua
.include "test.mk"
.include <mkc.lib.mk>
diff --git a/examples/hello_require_tools/Makefile b/examples/hello_require_tools/Makefile
index ad4f88d..ee953c5 100644
--- a/examples/hello_require_tools/Makefile
+++ b/examples/hello_require_tools/Makefile
@@ -1,11 +1,12 @@
-MKC_REQUIRE_BUILTINS += prog_gawk prog_flex prog_gm4 prog_bison
+MKC_REQUIRE_BUILTINS += prog_gawk prog_flex prog_gm4 prog_bison prog_gmake
SCRIPTS = fake
-test: error-check
- @echo ${CUSTOM.prog_gawk}
- @echo ${CUSTOM.prog_gm4}
- @echo ${CUSTOM.prog_flex}
- @echo ${CUSTOM.prog_bison}
+test: errorcheck
+ @echo GNU awk: ${CUSTOM.prog_gawk}
+ @echo GNU m4: ${CUSTOM.prog_gm4}
+ @echo GNU make: ${CUSTOM.prog_gmake}
+ @echo flex: ${CUSTOM.prog_flex}
+ @echo bison: ${CUSTOM.prog_bison}
.include <mkc.prog.mk>
diff --git a/examples/hello_scripts/Makefile b/examples/hello_scripts/Makefile
index 9325a85..005f212 100644
--- a/examples/hello_scripts/Makefile
+++ b/examples/hello_scripts/Makefile
@@ -3,7 +3,8 @@ SRCS = main.c msg.c
WARNS = 4
-SCRIPTS = hello_world2 hello_world3
+INSCRIPTS = hello_world3
+SCRIPTS = hello_world2 ${INSCRIPTS}
SCRIPTS += ${:!echo more_scripts/*!:N*/CVS}
SCRIPTSDIR_more_scripts_script1 = ${BINDIR}/subdir1
@@ -13,6 +14,9 @@ SCRIPTSNAME_more_scripts_script2 = myscript2
SCRIPTSDIR_more_scripts_script3 = ${BINDIR}/subdir3
SCRIPTSNAME_more_scripts_script3 = myscript3
+MKC_REQUIRE_PROGS = awk
+INTEXTS_REPLS = AWK ${PROG.awk}
+
MAN = hello_world.1
MKC_REQD = 0.10.0
diff --git a/examples/hello_scripts/expect.out b/examples/hello_scripts/expect.out
index 72b1abb..fedcafd 100644
--- a/examples/hello_scripts/expect.out
+++ b/examples/hello_scripts/expect.out
@@ -5,6 +5,8 @@ Hello World 3!
/objdir/Makefile
/objdir/_mkc_compiler_type.err
/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_awk.err
+/objdir/_mkc_prog_awk.res
/objdir/_mkc_prog_cc.err
/objdir/_mkc_prog_cc.res
/objdir/expect.out
@@ -13,6 +15,7 @@ Hello World 3!
/objdir/hello_world1
/objdir/hello_world2
/objdir/hello_world3
+/objdir/hello_world3.in
/objdir/main.c
/objdir/main.o
/objdir/more_scripts/script1
@@ -42,13 +45,15 @@ Hello World 3!
/objdir/Makefile
/objdir/_mkc_compiler_type.err
/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_awk.err
+/objdir/_mkc_prog_awk.res
/objdir/_mkc_prog_cc.err
/objdir/_mkc_prog_cc.res
/objdir/expect.out
/objdir/hello_scripts.test.out.tmp
/objdir/hello_world.1
/objdir/hello_world2
-/objdir/hello_world3
+/objdir/hello_world3.in
/objdir/main.c
/objdir/more_scripts/script1
/objdir/more_scripts/script2
@@ -61,7 +66,7 @@ Hello World 3!
/objdir/hello_scripts.test.out.tmp
/objdir/hello_world.1
/objdir/hello_world2
-/objdir/hello_world3
+/objdir/hello_world3.in
/objdir/main.c
/objdir/more_scripts/script1
/objdir/more_scripts/script2
@@ -72,6 +77,8 @@ Hello World 3!
/objdir/Makefile
/objdir/_mkc_compiler_type.err
/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_awk.err
+/objdir/_mkc_prog_awk.res
/objdir/_mkc_prog_cc.err
/objdir/_mkc_prog_cc.res
/objdir/expect.out
@@ -81,6 +88,7 @@ Hello World 3!
/objdir/hello_world1
/objdir/hello_world2
/objdir/hello_world3
+/objdir/hello_world3.in
/objdir/main.c
/objdir/main.o
/objdir/more_scripts/script1
diff --git a/examples/hello_scripts/hello_world3 b/examples/hello_scripts/hello_world3.in
index 53bdd92..86dcd79 100755
--- a/examples/hello_scripts/hello_world3
+++ b/examples/hello_scripts/hello_world3.in
@@ -1,4 +1,4 @@
-#!/usr/bin/awk -f
+#!@AWK@ -f
BEGIN {
print "Hello World 3!"
diff --git a/examples/hello_strlcpy/expect.out b/examples/hello_strlcpy/expect.out
index d64ce75..8acecb6 100644
--- a/examples/hello_strlcpy/expect.out
+++ b/examples/hello_strlcpy/expect.out
@@ -88,6 +88,6 @@
/objdir/strlcpy.c
/objdir/test.mk
======= CLEANFILES ==========
+hello.o
strlcpy.o
getline.o
-hello.o
diff --git a/examples/hello_strlcpy/test.mk b/examples/hello_strlcpy/test.mk
index e0155bb..29a6e51 100644
--- a/examples/hello_strlcpy/test.mk
+++ b/examples/hello_strlcpy/test.mk
@@ -32,7 +32,7 @@ test_output:
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======= CLEANFILES ==========; \
- ${MAKE} ${MAKEFLAGS} print-values VARS='CLEANFILES' MKCHECKS=no | \
- awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o$$/) print $$i}'
+ ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \
+ awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}'
.include <mkc.minitest.mk>
diff --git a/examples/hello_strlcpy2/expect.out b/examples/hello_strlcpy2/expect.out
index 8ca6686..6f351e2 100644
--- a/examples/hello_strlcpy2/expect.out
+++ b/examples/hello_strlcpy2/expect.out
@@ -88,6 +88,6 @@
/objdir/missing/strlcpy.c
/objdir/test.mk
======= CLEANFILES ==========
+hello.o
strlcpy.o
getline.o
-hello.o
diff --git a/examples/hello_strlcpy2/test.mk b/examples/hello_strlcpy2/test.mk
index e0155bb..29a6e51 100644
--- a/examples/hello_strlcpy2/test.mk
+++ b/examples/hello_strlcpy2/test.mk
@@ -32,7 +32,7 @@ test_output:
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======= CLEANFILES ==========; \
- ${MAKE} ${MAKEFLAGS} print-values VARS='CLEANFILES' MKCHECKS=no | \
- awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o$$/) print $$i}'
+ ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \
+ awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}'
.include <mkc.minitest.mk>
diff --git a/examples/hello_strlcpy3/Makefile b/examples/hello_strlcpy3/Makefile
index 33e80b1..7257050 100644
--- a/examples/hello_strlcpy3/Makefile
+++ b/examples/hello_strlcpy3/Makefile
@@ -3,7 +3,7 @@ SRCS = hello.c
WARNS = 4
-MKC_FEATURES = strlcpy strlcat getline
+MKC_FEATURES = strlcpy strlcat getline progname
MKC_REQD = 0.26.0
diff --git a/examples/hello_strlcpy3/expect.out b/examples/hello_strlcpy3/expect.out
index 3cd8ac5..ce90dc7 100644
--- a/examples/hello_strlcpy3/expect.out
+++ b/examples/hello_strlcpy3/expect.out
@@ -22,10 +22,21 @@ foo17# CONTRAC
foo17# ARISING
foo17# POSSIBI
Theo de Raadt said
+short progname=hello
+full progname=/path/to/hello
=========== all ============
/objdir/Makefile
/objdir/_mkc_compiler_type.err
/objdir/_mkc_compiler_type.res
+/objdir/_mkc_func0_getexecname_stdlib_h.c
+/objdir/_mkc_func0_getexecname_stdlib_h.err
+/objdir/_mkc_func0_getexecname_stdlib_h.res
+/objdir/_mkc_func0_getprogname_stdlib_h.c
+/objdir/_mkc_func0_getprogname_stdlib_h.err
+/objdir/_mkc_func0_getprogname_stdlib_h.res
+/objdir/_mkc_func1_setprogname_stdlib_h.c
+/objdir/_mkc_func1_setprogname_stdlib_h.err
+/objdir/_mkc_func1_setprogname_stdlib_h.res
/objdir/_mkc_func3_getline_stdio_h.c
/objdir/_mkc_func3_getline_stdio_h.err
/objdir/_mkc_func3_getline_stdio_h.res
@@ -38,6 +49,12 @@ Theo de Raadt said
/objdir/_mkc_funclib_getline.c
/objdir/_mkc_funclib_getline.err
/objdir/_mkc_funclib_getline.res
+/objdir/_mkc_funclib_getprogname.c
+/objdir/_mkc_funclib_getprogname.err
+/objdir/_mkc_funclib_getprogname.res
+/objdir/_mkc_funclib_setprogname.c
+/objdir/_mkc_funclib_setprogname.err
+/objdir/_mkc_funclib_setprogname.res
/objdir/_mkc_funclib_strlcat.c
/objdir/_mkc_funclib_strlcat.err
/objdir/_mkc_funclib_strlcat.res
@@ -46,6 +63,9 @@ Theo de Raadt said
/objdir/_mkc_funclib_strlcpy.res
/objdir/_mkc_prog_cc.err
/objdir/_mkc_prog_cc.res
+/objdir/_mkc_variable_program_invocation_short_name_errno_h.c
+/objdir/_mkc_variable_program_invocation_short_name_errno_h.err
+/objdir/_mkc_variable_program_invocation_short_name_errno_h.res
/objdir/expect.out
/objdir/hello
/objdir/hello.c
@@ -62,6 +82,15 @@ Theo de Raadt said
/objdir/Makefile
/objdir/_mkc_compiler_type.err
/objdir/_mkc_compiler_type.res
+/objdir/_mkc_func0_getexecname_stdlib_h.c
+/objdir/_mkc_func0_getexecname_stdlib_h.err
+/objdir/_mkc_func0_getexecname_stdlib_h.res
+/objdir/_mkc_func0_getprogname_stdlib_h.c
+/objdir/_mkc_func0_getprogname_stdlib_h.err
+/objdir/_mkc_func0_getprogname_stdlib_h.res
+/objdir/_mkc_func1_setprogname_stdlib_h.c
+/objdir/_mkc_func1_setprogname_stdlib_h.err
+/objdir/_mkc_func1_setprogname_stdlib_h.res
/objdir/_mkc_func3_getline_stdio_h.c
/objdir/_mkc_func3_getline_stdio_h.err
/objdir/_mkc_func3_getline_stdio_h.res
@@ -74,6 +103,12 @@ Theo de Raadt said
/objdir/_mkc_funclib_getline.c
/objdir/_mkc_funclib_getline.err
/objdir/_mkc_funclib_getline.res
+/objdir/_mkc_funclib_getprogname.c
+/objdir/_mkc_funclib_getprogname.err
+/objdir/_mkc_funclib_getprogname.res
+/objdir/_mkc_funclib_setprogname.c
+/objdir/_mkc_funclib_setprogname.err
+/objdir/_mkc_funclib_setprogname.res
/objdir/_mkc_funclib_strlcat.c
/objdir/_mkc_funclib_strlcat.err
/objdir/_mkc_funclib_strlcat.res
@@ -82,6 +117,9 @@ Theo de Raadt said
/objdir/_mkc_funclib_strlcpy.res
/objdir/_mkc_prog_cc.err
/objdir/_mkc_prog_cc.res
+/objdir/_mkc_variable_program_invocation_short_name_errno_h.c
+/objdir/_mkc_variable_program_invocation_short_name_errno_h.err
+/objdir/_mkc_variable_program_invocation_short_name_errno_h.res
/objdir/expect.out
/objdir/hello.c
/objdir/hello_strlcpy3.test.out.tmp
@@ -95,7 +133,8 @@ Theo de Raadt said
/objdir/input.in
/objdir/test.mk
======= CLEANFILES ==========
+hello.o
strlcpy.o
strlcat.o
getline.o
-hello.o
+progname.o
diff --git a/examples/hello_strlcpy3/hello.c b/examples/hello_strlcpy3/hello.c
index 2993cc5..b662024 100644
--- a/examples/hello_strlcpy3/hello.c
+++ b/examples/hello_strlcpy3/hello.c
@@ -4,6 +4,7 @@
#include <mkc_strlcpy.h>
#include <mkc_strlcat.h>
#include <mkc_getline.h>
+#include <mkc_progname.h>
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.\"";
@@ -15,6 +16,8 @@ int main (int argc, char ** argv)
char small_buf [15];
char said [19];
+ setprogname (argv [0]);
+
while (len = getline (&buf, &size, stdin), len != -1){
len = strlen (buf);
if (len > 0 && buf [len-1] == '\n')
@@ -28,5 +31,8 @@ int main (int argc, char ** argv)
strlcpy (said, message, sizeof (said));
puts (said);
+ printf ("short progname=%s\n", getprogname ());
+ printf ("full progname=%s\n", argv [0]);
+
return 0;
}
diff --git a/examples/hello_strlcpy3/test.mk b/examples/hello_strlcpy3/test.mk
index a123816..065088a 100644
--- a/examples/hello_strlcpy3/test.mk
+++ b/examples/hello_strlcpy3/test.mk
@@ -1,9 +1,10 @@
-FUNCS_RE=(strlcat|strlcpy|getline)[.]o
+FUNCS_RE=(strlcat|strlcpy|getline|progname)[.]o
.PHONY : test_output
test_output:
@set -e; \
- ${.OBJDIR}/hello < ${.CURDIR}/input.in; \
+ ${.OBJDIR}/hello < ${.CURDIR}/input.in | \
+ mkc_test_helper_paths; \
rm -rf ${.OBJDIR}${PREFIX}; \
MKCATPAGES=yes; export MKCATPAGES; \
\
@@ -34,7 +35,7 @@ test_output:
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======= CLEANFILES ==========; \
- ${MAKE} ${MAKEFLAGS} print-values VARS='CLEANFILES' MKCHECKS=no | \
- awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o$$/) print $$i}'
+ ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \
+ awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}'
.include <mkc.minitest.mk>
diff --git a/examples/hello_subdirs/prog1/Makefile b/examples/hello_subdirs/prog1/Makefile
index d103cbe..0a4c0ad 100644
--- a/examples/hello_subdirs/prog1/Makefile
+++ b/examples/hello_subdirs/prog1/Makefile
@@ -1,8 +1,12 @@
PROG = prog1
-SCRIPTS = prog1.sh prog1.awk
+SCRIPTS = prog1.sh ${INSCRIPTS}
+INSCRIPTS = prog1.awk
WARNS = 4
+MKC_REQUIRE_PROGS = awk
+INTEXTS_REPLS = AWK ${PROG.awk}
+
# Do not set SCRIPTSNAME in project's Makefile!
# This is just a regression test.
SCRIPTSNAME_prog1.awk = program1.awk
diff --git a/examples/hello_subdirs/prog1/expect.out b/examples/hello_subdirs/prog1/expect.out
index 4930183..d3284bf 100644
--- a/examples/hello_subdirs/prog1/expect.out
+++ b/examples/hello_subdirs/prog1/expect.out
@@ -10,6 +10,7 @@ SRCDIR_prog2=hello_subdirs/prog2
/objdir/expect.out
/objdir/prog1
/objdir/prog1.awk
+/objdir/prog1.awk.in
/objdir/prog1.c
/objdir/prog1.o
/objdir/prog1.sh
@@ -23,7 +24,7 @@ SRCDIR_prog2=hello_subdirs/prog2
========== clean ===========
/objdir/Makefile
/objdir/expect.out
-/objdir/prog1.awk
+/objdir/prog1.awk.in
/objdir/prog1.c
/objdir/prog1.sh
/objdir/prog1.test.out.tmp
@@ -31,7 +32,7 @@ SRCDIR_prog2=hello_subdirs/prog2
======= distclean ==========
/objdir/Makefile
/objdir/expect.out
-/objdir/prog1.awk
+/objdir/prog1.awk.in
/objdir/prog1.c
/objdir/prog1.sh
/objdir/prog1.test.out.tmp
diff --git a/examples/hello_subdirs/prog1/prog1.awk b/examples/hello_subdirs/prog1/prog1.awk.in
index 5a03ed8..65ab78a 100755
--- a/examples/hello_subdirs/prog1/prog1.awk
+++ b/examples/hello_subdirs/prog1/prog1.awk.in
@@ -1,4 +1,4 @@
-#!/usr/bin/awk -f
+#!@AWK@ -f
BEGIN {
print "Hello World1-3"
diff --git a/examples/subprojects/libhello1/linkme.mk b/examples/subprojects/libhello1/linkme.mk
index 731ac90..41a35b6 100644
--- a/examples/subprojects/libhello1/linkme.mk
+++ b/examples/subprojects/libhello1/linkme.mk
@@ -1,5 +1,5 @@
-PATH.hello1 := ${.PARSEDIR}
+PATH.hello1 := ${.PARSEDIR:tA}
-CPPFLAGS += -I${PATH.hello1}
+DPINCDIRS += ${PATH.hello1}
DPLIBDIRS += ${PATH.hello1}
-LDADD0 += -lhello1
+DPLDADD += hello1
diff --git a/examples/subprojects/libhello2/linkme.mk b/examples/subprojects/libhello2/linkme.mk
index 135ad9e..ca21bf6 100644
--- a/examples/subprojects/libhello2/linkme.mk
+++ b/examples/subprojects/libhello2/linkme.mk
@@ -1,5 +1,5 @@
-PATH.hello2 := ${.PARSEDIR}
+PATH.hello2 := ${.PARSEDIR:tA}
-CPPFLAGS += -I${PATH.hello2}/include
+DPINCDIRS += ${PATH.hello2}/include
DPLIBDIRS += ${PATH.hello2}
-LDADD0 += -lhello2
+DPLDADD += hello2
diff --git a/examples/subprojects/test.mk b/examples/subprojects/test.mk
index 46ac375..27b2071 100644
--- a/examples/subprojects/test.mk
+++ b/examples/subprojects/test.mk
@@ -9,8 +9,9 @@ test_output :
rm -rf ${.OBJDIR}${PREFIX}; \
LD_LIBRARY_PATH=${.CURDIR}/libhello1:${.CURDIR}/libhello2:$$LD_LIBRARY_PATH; \
DYLD_LIBRARY_PATH=${.CURDIR}/libhello1:${.CURDIR}/libhello2:$$LD_LIBRARY_PATH; \
+ LIBRARY_PATH=$$LIBRARY_PATH:$$LD_LIBRARY_PATH; \
MKINSTALLDIRS=no; \
- export LD_LIBRARY_PATH DYLD_LIBRARY_PATH; \
+ export LD_LIBRARY_PATH DYLD_LIBRARY_PATH LIBRARY_PATH; \
${.CURDIR}/hello/hello_subprojects; \
${.CURDIR}/hello/hello_subprojects2; \
\
@@ -21,6 +22,7 @@ test_output :
echo ===== all SHRTOUT=yes ======; \
${MAKE} ${MAKEFLAGS} clean > /dev/null; \
${MAKE} ${MAKEFLAGS} all SHRTOUT=YES 2>&1 | \
+ grep -v warning: | \
mkc_test_helper_paths; \
\
echo ========= installdirs ==========; \
diff --git a/examples/tools/Makefile b/examples/tools/Makefile
index 5077390..6d59113 100644
--- a/examples/tools/Makefile
+++ b/examples/tools/Makefile
@@ -1,7 +1,7 @@
-SUBPRJ = libs/foo:tools/prog1
-SUBPRJ += libs/bar:tools/prog2
-SUBPRJ += libs/foo:tools/prog3 libs/bar:tools/prog3
-SUBPRJ += libs/qux:tools/prog4
+LIBDEPS = libs/foo:tools/prog1
+LIBDEPS += libs/bar:tools/prog2
+LIBDEPS += libs/foo:tools/prog3 libs/bar:tools/prog3
+LIBDEPS += libs/qux:tools/prog4
# target "check" is used for testing because "test" is used by mk-configure
TARGETS = check
diff --git a/examples/tools/expect.out b/examples/tools/expect.out
index df742fd..3ffe8cd 100644
--- a/examples/tools/expect.out
+++ b/examples/tools/expect.out
@@ -47,16 +47,13 @@ check ===> tools/prog1
/objdir/libs/bar/bar.h
/objdir/libs/bar/bar.o
/objdir/libs/bar/libbar.a
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
/objdir/libs/foo/foo.o
/objdir/libs/foo/libfoo.a
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
/objdir/libs/qux/libqux.a
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h
/objdir/libs/qux/qux.h.in
@@ -143,13 +140,10 @@ LD: prog4
/objdir/libs/bar/Makefile
/objdir/libs/bar/bar.c
/objdir/libs/bar/bar.h
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h.in
/objdir/test.mk
@@ -168,13 +162,10 @@ LD: prog4
/objdir/libs/bar/Makefile
/objdir/libs/bar/bar.c
/objdir/libs/bar/bar.h
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h.in
/objdir/test.mk
@@ -197,15 +188,12 @@ LD: prog4
/objdir/libs/bar/Makefile
/objdir/libs/bar/bar.c
/objdir/libs/bar/bar.h
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
/objdir/libs/foo/foo.o
/objdir/libs/foo/libfoo.a
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h.in
/objdir/test.mk
@@ -230,15 +218,12 @@ LD: prog4
/objdir/libs/bar/Makefile
/objdir/libs/bar/bar.c
/objdir/libs/bar/bar.h
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
/objdir/libs/foo/foo.o
/objdir/libs/foo/libfoo.a
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h.in
/objdir/test.mk
@@ -263,15 +248,12 @@ LD: prog4
/objdir/libs/bar/Makefile
/objdir/libs/bar/bar.c
/objdir/libs/bar/bar.h
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
/objdir/libs/foo/foo.o
/objdir/libs/foo/libfoo.a
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h.in
/objdir/test.mk
@@ -298,13 +280,10 @@ LD: prog4
/objdir/libs/bar/bar.h
/objdir/libs/bar/bar.o
/objdir/libs/bar/libbar.a
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h.in
/objdir/test.mk
@@ -331,13 +310,10 @@ LD: prog4
/objdir/libs/bar/bar.h
/objdir/libs/bar/bar.o
/objdir/libs/bar/libbar.a
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h.in
/objdir/test.mk
@@ -364,15 +340,12 @@ LD: prog4
/objdir/libs/bar/bar.h
/objdir/libs/bar/bar.o
/objdir/libs/bar/libbar.a
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
/objdir/libs/foo/foo.o
/objdir/libs/foo/libfoo.a
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h.in
/objdir/test.mk
@@ -400,14 +373,11 @@ LD: prog4
/objdir/libs/bar/Makefile
/objdir/libs/bar/bar.c
/objdir/libs/bar/bar.h
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
/objdir/libs/qux/libqux.a
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h
/objdir/libs/qux/qux.h.in
@@ -488,6 +458,7 @@ errorcheck
filelist
install
installdirs
+mkgen
obj
test
uninstall
diff --git a/examples/tools/libs/bar/linkme.mk b/examples/tools/libs/bar/linkme.mk
deleted file mode 100644
index 6d6ad74..0000000
--- a/examples/tools/libs/bar/linkme.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-PATH.bar := ${.PARSEDIR}
-
-CPPFLAGS += -I${PATH.bar}
-DPLIBDIRS += ${PATH.bar}
-LDADD0 += -lbar
diff --git a/examples/tools/libs/foo/linkme.mk b/examples/tools/libs/foo/linkme.mk
deleted file mode 100644
index 841ff33..0000000
--- a/examples/tools/libs/foo/linkme.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-PATH.foo := ${.PARSEDIR}
-
-CPPFLAGS += -I${PATH.foo}
-DPLIBDIRS += ${PATH.foo}
-LDADD0 += -lfoo
diff --git a/examples/tools/libs/qux/linkme.mk b/examples/tools/libs/qux/linkme.mk
deleted file mode 100644
index ebf405e..0000000
--- a/examples/tools/libs/qux/linkme.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-PATH.qux := ${.PARSEDIR}
-
-CPPFLAGS += -I${PATH.qux}
-DPLIBDIRS += ${PATH.qux}
-LDADD0 += -lqux
diff --git a/examples/tools/tools/prog1/Makefile b/examples/tools/tools/prog1/Makefile
index bca4588..bf306a3 100644
--- a/examples/tools/tools/prog1/Makefile
+++ b/examples/tools/tools/prog1/Makefile
@@ -8,5 +8,4 @@ MKC_REQD = 0.10.0
check:
@: do something useful
-.include "../../libs/foo/linkme.mk"
.include <mkc.prog.mk>
diff --git a/examples/tools/tools/prog2/Makefile b/examples/tools/tools/prog2/Makefile
index 63ab936..e80873a 100644
--- a/examples/tools/tools/prog2/Makefile
+++ b/examples/tools/tools/prog2/Makefile
@@ -8,5 +8,4 @@ MKC_REQD = 0.10.0
check:
@: do something useful
-.include "../../libs/bar/linkme.mk"
.include <mkc.prog.mk>
diff --git a/examples/tools/tools/prog3/Makefile b/examples/tools/tools/prog3/Makefile
index b361032..093e2d2 100644
--- a/examples/tools/tools/prog3/Makefile
+++ b/examples/tools/tools/prog3/Makefile
@@ -8,7 +8,4 @@ MKC_REQD = 0.10.0
check:
@: do something useful
-.include "../../libs/foo/linkme.mk"
-.include "../../libs/bar/linkme.mk"
-
.include <mkc.prog.mk>
diff --git a/examples/tools/tools/prog4/Makefile b/examples/tools/tools/prog4/Makefile
index 307f490..1d3ebf0 100644
--- a/examples/tools/tools/prog4/Makefile
+++ b/examples/tools/tools/prog4/Makefile
@@ -7,5 +7,4 @@ MKC_REQD = 0.10.0
check:
@: do something useful
-.include "../../libs/qux/linkme.mk"
.include <mkc.prog.mk>
diff --git a/examples/tools2/Makefile b/examples/tools2/Makefile
index fd00e1a..4476c66 100644
--- a/examples/tools2/Makefile
+++ b/examples/tools2/Makefile
@@ -1,7 +1,7 @@
-SUBPRJ = libs/foo:tools/prog1
-SUBPRJ += libs/bar:tools/prog2
-SUBPRJ += libs/foo:tools/prog3 libs/bar:tools/prog3
-SUBPRJ += libs/qux:tools/prog4
+LIBDEPS = libs/foo:tools/prog1
+LIBDEPS += libs/bar:tools/prog2
+LIBDEPS += libs/foo:tools/prog3 libs/bar:tools/prog3
+LIBDEPS += libs/qux:tools/prog4
SUBPRJ += tools/prog1:tests/prog1
SUBPRJ += tools/prog2:tests/prog2
diff --git a/examples/tools2/expect.out b/examples/tools2/expect.out
index 735c615..d86a609 100644
--- a/examples/tools2/expect.out
+++ b/examples/tools2/expect.out
@@ -51,16 +51,13 @@ check ===> tools/prog1
/objdir/libs/bar/bar.h
/objdir/libs/bar/bar.o
/objdir/libs/bar/libbar.a
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
/objdir/libs/foo/foo.o
/objdir/libs/foo/libfoo.a
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
/objdir/libs/qux/libqux.a
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h
/objdir/libs/qux/qux.h.in
@@ -151,13 +148,10 @@ LD: prog4
/objdir/libs/bar/Makefile
/objdir/libs/bar/bar.c
/objdir/libs/bar/bar.h
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h.in
/objdir/test.mk
@@ -180,13 +174,10 @@ LD: prog4
/objdir/libs/bar/Makefile
/objdir/libs/bar/bar.c
/objdir/libs/bar/bar.h
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h.in
/objdir/test.mk
@@ -213,15 +204,12 @@ LD: prog4
/objdir/libs/bar/Makefile
/objdir/libs/bar/bar.c
/objdir/libs/bar/bar.h
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
/objdir/libs/foo/foo.o
/objdir/libs/foo/libfoo.a
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h.in
/objdir/test.mk
@@ -250,15 +238,12 @@ LD: prog4
/objdir/libs/bar/Makefile
/objdir/libs/bar/bar.c
/objdir/libs/bar/bar.h
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
/objdir/libs/foo/foo.o
/objdir/libs/foo/libfoo.a
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h.in
/objdir/test.mk
@@ -289,13 +274,10 @@ LD: prog4
/objdir/libs/bar/bar.h
/objdir/libs/bar/bar.o
/objdir/libs/bar/libbar.a
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h.in
/objdir/test.mk
@@ -326,13 +308,10 @@ LD: prog4
/objdir/libs/bar/bar.h
/objdir/libs/bar/bar.o
/objdir/libs/bar/libbar.a
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h.in
/objdir/test.mk
@@ -363,15 +342,12 @@ LD: prog4
/objdir/libs/bar/bar.h
/objdir/libs/bar/bar.o
/objdir/libs/bar/libbar.a
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
/objdir/libs/foo/foo.o
/objdir/libs/foo/libfoo.a
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h.in
/objdir/test.mk
@@ -403,14 +379,11 @@ LD: prog4
/objdir/libs/bar/Makefile
/objdir/libs/bar/bar.c
/objdir/libs/bar/bar.h
-/objdir/libs/bar/linkme.mk
/objdir/libs/foo/Makefile
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
-/objdir/libs/foo/linkme.mk
/objdir/libs/qux/Makefile
/objdir/libs/qux/libqux.a
-/objdir/libs/qux/linkme.mk
/objdir/libs/qux/qux.c
/objdir/libs/qux/qux.h
/objdir/libs/qux/qux.h.in
@@ -455,15 +428,15 @@ obj/tools/prog3/prog3.o
obj/tools/prog4/prog4
obj/tools/prog4/prog4.o
=========== print_deps ============
+all-tools/prog1 all-tests/prog1
+all-tools/prog2 all-tests/prog2
+all-tools/prog3 all-tests/prog3
+all-tools/prog4 all-tests/prog4
all-libs/foo all-tools/prog1
all-libs/bar all-tools/prog2
all-libs/foo all-tools/prog3
all-libs/bar all-tools/prog3
all-libs/qux all-tools/prog4
-all-tools/prog1 all-tests/prog1
-all-tools/prog2 all-tests/prog2
-all-tools/prog3 all-tests/prog3
-all-tools/prog4 all-tests/prog4
all-libs/bar libs/bar
all-libs/foo libs/foo
all-libs/qux libs/qux
diff --git a/examples/tools2/libs/bar/linkme.mk b/examples/tools2/libs/bar/linkme.mk
deleted file mode 100644
index 10a6279..0000000
--- a/examples/tools2/libs/bar/linkme.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-PATH.bar := ${.PARSEDIR}
-
-CPPFLAGS += -I${PATH.bar}
-DPLIBDIRS += libs/${PATH.bar:T}
-LDADD0 += -lbar
diff --git a/examples/tools2/libs/foo/linkme.mk b/examples/tools2/libs/foo/linkme.mk
deleted file mode 100644
index b1da09b..0000000
--- a/examples/tools2/libs/foo/linkme.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-PATH.foo := ${.PARSEDIR}
-
-CPPFLAGS += -I${PATH.foo}
-DPLIBDIRS += libs/${PATH.foo:T}
-LDADD0 += -lfoo
diff --git a/examples/tools2/libs/qux/linkme.mk b/examples/tools2/libs/qux/linkme.mk
deleted file mode 100644
index ec0e23a..0000000
--- a/examples/tools2/libs/qux/linkme.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-PATH.qux := ${.PARSEDIR}
-
-CPPFLAGS += -I${OBJDIR_libs_qux}
-DPLIBDIRS += libs/${PATH.qux:T}
-LDADD0 += -lqux
diff --git a/examples/tools2/tools/prog1/Makefile b/examples/tools2/tools/prog1/Makefile
index bca4588..bf306a3 100644
--- a/examples/tools2/tools/prog1/Makefile
+++ b/examples/tools2/tools/prog1/Makefile
@@ -8,5 +8,4 @@ MKC_REQD = 0.10.0
check:
@: do something useful
-.include "../../libs/foo/linkme.mk"
.include <mkc.prog.mk>
diff --git a/examples/tools2/tools/prog2/Makefile b/examples/tools2/tools/prog2/Makefile
index 63ab936..e80873a 100644
--- a/examples/tools2/tools/prog2/Makefile
+++ b/examples/tools2/tools/prog2/Makefile
@@ -8,5 +8,4 @@ MKC_REQD = 0.10.0
check:
@: do something useful
-.include "../../libs/bar/linkme.mk"
.include <mkc.prog.mk>
diff --git a/examples/tools2/tools/prog3/Makefile b/examples/tools2/tools/prog3/Makefile
index b361032..093e2d2 100644
--- a/examples/tools2/tools/prog3/Makefile
+++ b/examples/tools2/tools/prog3/Makefile
@@ -8,7 +8,4 @@ MKC_REQD = 0.10.0
check:
@: do something useful
-.include "../../libs/foo/linkme.mk"
-.include "../../libs/bar/linkme.mk"
-
.include <mkc.prog.mk>
diff --git a/examples/tools2/tools/prog4/Makefile b/examples/tools2/tools/prog4/Makefile
index 307f490..1d3ebf0 100644
--- a/examples/tools2/tools/prog4/Makefile
+++ b/examples/tools2/tools/prog4/Makefile
@@ -7,5 +7,4 @@ MKC_REQD = 0.10.0
check:
@: do something useful
-.include "../../libs/qux/linkme.mk"
.include <mkc.prog.mk>
diff --git a/features/_mkcfake.c b/features/_mkcfake.c
new file mode 100644
index 0000000..1afa530
--- /dev/null
+++ b/features/_mkcfake.c
@@ -0,0 +1,3 @@
+static void _mkcfake(void)
+{
+}
diff --git a/features/err/err.c b/features/err/err.c
new file mode 100644
index 0000000..411f810
--- /dev/null
+++ b/features/err/err.c
@@ -0,0 +1,99 @@
+/* $NetBSD: err.c,v 1.4 2004/08/23 03:32:12 jlam Exp $ */
+
+/*
+ * Copyright 1997-2000 Luke Mewburn <lukem@netbsd.org>.
+ * Copyright 2014 Aleksey Cheusov <vle@gmx.net>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include <mkc_progname.h>
+#include <mkc_err.h>
+
+#if !HAVE_FUNC3_ERR_ERR_H
+void err (int eval, const char *fmt, ...)
+{
+ va_list ap;
+ int sverrno;
+
+ sverrno = errno;
+ fprintf (stderr, "%s: ", getprogname ());
+ va_start (ap, fmt);
+ if (fmt != NULL) {
+ vfprintf (stderr, fmt, ap);
+ fprintf (stderr, ": ");
+ }
+ va_end (ap);
+ fprintf (stderr, "%s\n", strerror (sverrno));
+ exit (eval);
+}
+#endif
+
+#if !HAVE_FUNC3_ERRX_ERR_H
+void errx (int eval, const char *fmt, ...)
+{
+ va_list ap;
+
+ fprintf (stderr, "%s: ", getprogname ());
+ va_start (ap, fmt);
+ if (fmt != NULL)
+ vfprintf (stderr, fmt, ap);
+ va_end (ap);
+ fprintf (stderr, "\n");
+ exit (eval);
+}
+#endif
+
+#if !HAVE_FUNC3_VERR_ERR_H
+void verr (int eval, const char *fmt, va_list ap)
+{
+ int sverrno;
+
+ sverrno = errno;
+ fprintf (stderr, "%s: ", getprogname ());
+ if (fmt != NULL) {
+ vfprintf (stderr, fmt, ap);
+ fprintf (stderr, ": ");
+ }
+ fprintf (stderr, "%s\n", strerror (sverrno));
+ exit (eval);
+}
+#endif
+
+#if !HAVE_FUNC3_VERRX_ERR_H
+void verrx (int eval, const char *fmt, va_list ap)
+{
+ fprintf (stderr, "%s: ", getprogname ());
+ if (fmt != NULL)
+ vfprintf (stderr, fmt, ap);
+ fprintf (stderr, "\n");
+ exit (eval);
+}
+#endif
diff --git a/features/fgetln/fgetln.c b/features/fgetln/fgetln.c
new file mode 100644
index 0000000..c600b06
--- /dev/null
+++ b/features/fgetln/fgetln.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2005 Hector Garcia Alvarez
+ * Copyright (c) 2005, 2008-2012 Guillem Jover <guillem@hadrons.org>
+ * Copyright (c) 2014 Aleksey Cheusov <vle@gmx.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <mkc_getline.h>
+#include <mkc_fgetln.h>
+
+struct filebuf {
+ FILE *fp;
+ char *buf;
+ size_t len;
+};
+
+#define FILEBUF_POOL_ITEMS 128
+
+static struct filebuf fb_pool [FILEBUF_POOL_ITEMS];
+static int fb_pool_cur;
+
+char * fgetln (FILE *stream, size_t *len)
+{
+ struct filebuf *fb;
+ ssize_t nread;
+
+ /* Try to diminish the possibility of several fgetln() calls being
+ * used on different streams, by using a pool of buffers per file. */
+ fb = &fb_pool [fb_pool_cur];
+ if (fb->fp != stream && fb->fp != NULL) {
+ fb_pool_cur++;
+ fb_pool_cur %= FILEBUF_POOL_ITEMS;
+ fb = &fb_pool [fb_pool_cur];
+ }
+ fb->fp = stream;
+
+ nread = getline (&fb->buf, &fb->len, stream);
+ /* Note: the getdelim/getline API ensures nread != 0. */
+ if (nread == -1) {
+ *len = 0;
+ return NULL;
+ } else {
+ *len = (size_t) nread;
+ return fb->buf;
+ }
+}
diff --git a/features/mkc_err.h b/features/mkc_err.h
new file mode 100644
index 0000000..16ee12f
--- /dev/null
+++ b/features/mkc_err.h
@@ -0,0 +1,36 @@
+/********************************************************************\
+ Copyright (c) 2014 by Aleksey Cheusov
+
+ See LICENSE file in the distribution.
+\********************************************************************/
+
+#ifndef _MKC_ERR_H_
+#define _MKC_ERR_H_
+
+#include <stdarg.h>
+
+#if HAVE_HEADER_ERR_H
+#include <err.h>
+#endif
+
+#ifdef MKC_ERR_IS_FINE
+
+#include <err.h>
+
+#else
+#if !HAVE_FUNC3_ERR_ERR_H
+void err (int, const char *, ...);
+#endif
+#if !HAVE_FUNC3_ERRX_ERR_H
+void errx (int, const char *, ...);
+#endif
+#if !HAVE_FUNC3_VERR_ERR_H
+void verr (int, const char *, va_list);
+#endif
+#if !HAVE_FUNC3_VERRX_ERR_H
+void verrx (int, const char *, va_list);
+#endif
+
+#endif /* MKC_ERR_IS_FINE */
+
+#endif // _MKC_ERR_H_
diff --git a/features/mkc_fgetln.h b/features/mkc_fgetln.h
new file mode 100644
index 0000000..4238478
--- /dev/null
+++ b/features/mkc_fgetln.h
@@ -0,0 +1,16 @@
+/********************************************************************\
+ Copyright (c) 2014 by Aleksey Cheusov
+
+ See LICENSE file in the distribution.
+\********************************************************************/
+
+#ifndef _MKC_FGETLN_H_
+#define _MKC_FGETLN_H_
+
+#include <stdio.h>
+
+#ifndef HAVE_FUNC3_FGETLN_STDIO_H
+char *fgetln (FILE *stream, size_t *len);
+#endif
+
+#endif // _MKC_FGETLN_H_
diff --git a/features/mkc_imp.f_RB.mk b/features/mkc_imp.f_RB.mk
index 57839ed..5661efd 100644
--- a/features/mkc_imp.f_RB.mk
+++ b/features/mkc_imp.f_RB.mk
@@ -2,6 +2,10 @@
#
# See LICENSE file in the distribution.
############################################################
+.ifndef _MKC_IMP_F_RB_MK
+_MKC_IMP_F_RB_MK := 1
MKC_CHECK_DEFINES += RB_ENTRY:sys/tree.h
MKC_CHECK_DEFINES += SPLAY_ENTRY:sys/tree.h
+
+.endif # _MKC_IMP_F_RB_MK
diff --git a/features/mkc_imp.f_SLIST.mk b/features/mkc_imp.f_SLIST.mk
index c00abc6..d5a1fc4 100644
--- a/features/mkc_imp.f_SLIST.mk
+++ b/features/mkc_imp.f_SLIST.mk
@@ -2,7 +2,10 @@
#
# See LICENSE file in the distribution.
############################################################
-.include <mkc.configure.mk>
+.ifndef _MKC_IMP_F_SYSQUEUE_MK
+_MKC_IMP_F_SYSQUEUE_MK := 1
+
+.include <mkc_imp.conf-cleanup.mk>
_macro = SLIST SIMPLEQ STAILQ LIST TAILQ TAILQ
@@ -11,10 +14,7 @@ MKC_CHECK_DEFINES += ${m}_ENTRY:sys/queue.h
_macro.${m} = 1
.endfor
-MKC_NOAUTO.orig := ${MKC_NOAUTO}
-MKC_NOAUTO = 1
-
-.include <mkc.configure.mk>
+.include <mkc_imp.conf-cleanup.mk>
.for f in ${MKC_FEATURES}
.if defined(_macro.${f}) && !${HAVE_DEFINE.${m}_ENTRY.sys/queue.h:U0}
@@ -30,8 +30,7 @@ CFLAGS+= -DMKC_SYS_QUEUE_IS_FINE=1
.undef _macro.${m}
.endfor
-MKC_NOAUTO := ${MKC_NOAUTO.orig}
-
.undef bad
.undef _macro
-.undef MKC_NOAUTO.orig
+
+.endif # _MKC_IMP_F_SYSQUEUE_MK
diff --git a/features/mkc_imp.f_err.mk b/features/mkc_imp.f_err.mk
new file mode 100644
index 0000000..d3b50e1
--- /dev/null
+++ b/features/mkc_imp.f_err.mk
@@ -0,0 +1,29 @@
+# Copyright (c) 2014 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+.ifndef _MKC_IMP_F_ERR_MK
+_MKC_IMP_F_ERR_MK := 1
+
+.include <mkc_imp.f_progname.mk>
+
+.include <mkc_imp.conf-cleanup.mk>
+
+MKC_CHECK_HEADERS += err.h
+MKC_CHECK_FUNCLIBS += err errx verr verrx
+MKC_CHECK_FUNCS3 += err:err.h errx:err.h verr:err.h verrx:err.h
+
+.include <mkc_imp.conf-cleanup.mk>
+
+.if ${HAVE_FUNCLIB.err:U0} && ${HAVE_FUNCLIB.errx:U0} && \
+ ${HAVE_FUNCLIB.verr:U0} && ${HAVE_FUNCLIB.verrx:U0} && \
+ ${HAVE_FUNC3.err.err_h:U0} && ${HAVE_FUNC3.errx.err_h:U0} && \
+ ${HAVE_FUNC3.verr.err_h:U0} && ${HAVE_FUNC3.verrx.err_h:U0}
+CFLAGS += -DMKC_ERR_IS_FINE
+.else
+MKC_SRCS += ${FEATURESDIR}/err/err.c
+.endif
+
+.include <mkc_imp.conf-final.mk>
+
+.endif #_MKC_IMP_F_ERR_MK
diff --git a/features/mkc_imp.f_fgetln.mk b/features/mkc_imp.f_fgetln.mk
new file mode 100644
index 0000000..07e408b
--- /dev/null
+++ b/features/mkc_imp.f_fgetln.mk
@@ -0,0 +1,13 @@
+# Copyright (c) 2014 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+.ifndef _MKC_IMP.F_FGETLN_MK
+_MKC_IMP.F_FGETLN_MK := 1
+
+.include <mkc_imp.f_getline.mk>
+
+MKC_SOURCE_FUNCLIBS += fgetln
+MKC_SOURCE_DIR.fgetln.c = ${FEATURESDIR}/fgetln
+MKC_CHECK_FUNCS3 += fgetln:stdio.h
+
+.endif # _MKC_IMP.F_FGETLN_MK
diff --git a/features/mkc_imp.f_getline.mk b/features/mkc_imp.f_getline.mk
index 50b3710..23dca91 100644
--- a/features/mkc_imp.f_getline.mk
+++ b/features/mkc_imp.f_getline.mk
@@ -1,7 +1,11 @@
# Copyright (c) 2014 by Aleksey Cheusov
#
# See LICENSE file in the distribution.
+.ifndef _MKC_IMP.F_GETLINE_MK
+_MKC_IMP.F_GETLINE_MK := 1
MKC_SOURCE_FUNCLIBS += getline
MKC_SOURCE_DIR.getline.c = ${FEATURESDIR}/getline
MKC_CHECK_FUNCS3 += getline:stdio.h
+
+.endif # _MKC_IMP.F_GETLINE_MK
diff --git a/features/mkc_imp.f_libdl.mk b/features/mkc_imp.f_libdl.mk
index 88833d9..fdee554 100644
--- a/features/mkc_imp.f_libdl.mk
+++ b/features/mkc_imp.f_libdl.mk
@@ -1,8 +1,12 @@
# Copyright (c) 2014 by Aleksey Cheusov
#
# See LICENSE file in the distribution.
+.ifndef _MKC_IMP_F_LIBDL_MK
+_MKC_IMP_F_LIBDL_MK := 1
MKC_COMMON_DEFINES += -D_GNU_SOURCE
MKC_REQUIRE_FUNCLIBS += dlopen:dl
MKC_REQUIRE_FUNCS2 += dlopen:dlfcn.h
+
+.endif # _MKC_IMP_F_LIBDL_MK
diff --git a/features/mkc_imp.f_libm.mk b/features/mkc_imp.f_libm.mk
index e7d9d0e..5134a02 100644
--- a/features/mkc_imp.f_libm.mk
+++ b/features/mkc_imp.f_libm.mk
@@ -1,5 +1,9 @@
# Copyright (c) 2014 by Aleksey Cheusov
#
# See LICENSE file in the distribution.
+.ifndef _MKC_IMP_F_LIBM_MK
+_MKC_IMP_F_LIBM_MK := 1
MKC_CHECK_FUNCLIBS += sqrt:m
+
+.endif #_MKC_IMP_F_LIBM_MK
diff --git a/features/mkc_imp.f_progname.mk b/features/mkc_imp.f_progname.mk
new file mode 100644
index 0000000..9df8119
--- /dev/null
+++ b/features/mkc_imp.f_progname.mk
@@ -0,0 +1,28 @@
+# Copyright (c) 2014 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+.ifndef _MKC_IMP.F_PROGNAME_MK
+_MKC_IMP.F_PROGNAME_MK := 1
+
+MKC_COMMON_DEFINES += -D_GNU_SOURCE
+
+MKC_CHECK_FUNCLIBS += getprogname setprogname
+MKC_CHECK_FUNCS0 += getprogname:stdlib.h getexecname:stdlib.h
+MKC_CHECK_FUNCS1 += setprogname:stdlib.h
+MKC_CHECK_VARS += program_invocation_short_name:errno.h
+
+.include <mkc_imp.conf-cleanup.mk>
+
+.if ${HAVE_FUNCLIB.getprogname:U0} && \
+ ${HAVE_FUNCLIB.setprogname:U0} && \
+ ${HAVE_FUNC0.getprogname.stdlib_h:U0} && \
+ ${HAVE_FUNC1.setprogname.stdlib_h:U0}
+CFLAGS += -DMKC_PROGNAME_IS_FINE
+.else
+MKC_SRCS += ${FEATURESDIR}/progname/progname.c
+.endif
+
+.include <mkc_imp.conf-final.mk>
+
+.endif # _MKC_IMP.F_PROGNAME_MK
diff --git a/features/mkc_imp.f_strlcat.mk b/features/mkc_imp.f_strlcat.mk
index 9f6afc5..5d7b35a 100644
--- a/features/mkc_imp.f_strlcat.mk
+++ b/features/mkc_imp.f_strlcat.mk
@@ -1,7 +1,11 @@
# Copyright (c) 2014 by Aleksey Cheusov
#
# See LICENSE file in the distribution.
+.ifndef _MKC_IMP_F_STRLCAT_MK
+_MKC_IMP_F_STRLCAT_MK := 1
MKC_SOURCE_FUNCLIBS += strlcat
MKC_SOURCE_DIR.strlcat.c = ${FEATURESDIR}/strlcat
MKC_CHECK_FUNCS3 += strlcat:string.h
+
+.endif # _MKC_IMP_F_STRLCAT_MK
diff --git a/features/mkc_imp.f_strlcpy.mk b/features/mkc_imp.f_strlcpy.mk
index 5c41db6..51759a2 100644
--- a/features/mkc_imp.f_strlcpy.mk
+++ b/features/mkc_imp.f_strlcpy.mk
@@ -1,7 +1,11 @@
# Copyright (c) 2014 by Aleksey Cheusov
#
# See LICENSE file in the distribution.
+.ifndef _MKC_IMP_F_STRLCPY_MK
+_MKC_IMP_F_STRLCPY_MK := 1
MKC_SOURCE_FUNCLIBS += strlcpy
MKC_SOURCE_DIR.strlcpy.c = ${FEATURESDIR}/strlcpy
MKC_CHECK_FUNCS3 += strlcpy:string.h
+
+.endif #_MKC_IMP_F_STRLCPY_MK
diff --git a/features/mkc_imp.f_warn.mk b/features/mkc_imp.f_warn.mk
new file mode 100644
index 0000000..c494d50
--- /dev/null
+++ b/features/mkc_imp.f_warn.mk
@@ -0,0 +1,29 @@
+# Copyright (c) 2014 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+.ifndef _MKC_IMP_F_WARN_MK
+_MKC_IMP_F_WARN_MK := 1
+
+.include <mkc_imp.f_progname.mk>
+
+.include <mkc_imp.conf-cleanup.mk>
+
+MKC_CHECK_HEADERS += err.h
+MKC_CHECK_FUNCLIBS += warn warnx vwarn vwarnx
+MKC_CHECK_FUNCS2 += warn:err.h warnx:err.h vwarn:err.h vwarnx:err.h
+
+.include <mkc_imp.conf-cleanup.mk>
+
+.if ${HAVE_FUNCLIB.warn:U0} && ${HAVE_FUNCLIB.warnx:U0} && \
+ ${HAVE_FUNCLIB.vwarn:U0} && ${HAVE_FUNCLIB.vwarnx:U0} && \
+ ${HAVE_FUNC2.warn.err_h:U0} && ${HAVE_FUNC2.warnx.err_h:U0} && \
+ ${HAVE_FUNC2.vwarn.err_h:U0} && ${HAVE_FUNC2.vwarnx.err_h:U0}
+CFLAGS += -DMKC_WARN_IS_FINE
+.else
+MKC_SRCS += ${FEATURESDIR}/warn/warn.c
+.endif
+
+.include <mkc_imp.conf-final.mk>
+
+.endif # _MKC_IMP_F_WARN_MK
diff --git a/features/mkc_progname.h b/features/mkc_progname.h
new file mode 100644
index 0000000..7925e60
--- /dev/null
+++ b/features/mkc_progname.h
@@ -0,0 +1,26 @@
+/********************************************************************\
+ Copyright (c) 2014 by Aleksey Cheusov
+
+ See LICENSE file in the distribution.
+\********************************************************************/
+
+#ifndef _MKC_PROGNAME_H_
+#define _MKC_PROGNAME_H_
+
+#ifdef MKC_PROGNAME_IS_FINE
+
+#include <stdlib.h>
+
+#else
+
+#if !HAVE_FUNC1_SETPROGNAME_STDLIB_H
+void setprogname (const char *progname);
+#endif
+
+#if !HAVE_FUNC0_GETPROGNAME_STDLIB_H
+const char * getprogname (void);
+#endif
+
+#endif /* MKC_PROGNAME_IS_FINE */
+
+#endif // _MKC_PROGNAME_H_
diff --git a/features/mkc_warn.h b/features/mkc_warn.h
new file mode 100644
index 0000000..3576032
--- /dev/null
+++ b/features/mkc_warn.h
@@ -0,0 +1,36 @@
+/********************************************************************\
+ Copyright (c) 2014 by Aleksey Cheusov
+
+ See LICENSE file in the distribution.
+\********************************************************************/
+
+#ifndef _MKC_WARN_H_
+#define _MKC_WARN_H_
+
+#include <stdarg.h>
+
+#if HAVE_HEADER_ERR_H
+#include <err.h>
+#endif
+
+#ifdef MKC_WARN_IS_FINE
+
+#include <err.h>
+
+#else
+#if !HAVE_FUNC2_WARN_ERR_H
+void warn (const char *, ...);
+#endif
+#if !HAVE_FUNC2_WARNX_ERR_H
+void warnx (const char *, ...);
+#endif
+#if !HAVE_FUNC2_VWARN_ERR_H
+void vwarn (const char *, va_list);
+#endif
+#if !HAVE_FUNC2_VWARNX_ERR_H
+void vwarnx (const char *, va_list);
+#endif
+
+#endif /* MKC_WARN_IS_FINE */
+
+#endif // _MKC_WARN_H_
diff --git a/features/progname/progname.c b/features/progname/progname.c
new file mode 100644
index 0000000..c025cfe
--- /dev/null
+++ b/features/progname/progname.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014 by Aleksey Cheusov
+ * See LICENSE file in the distribution.
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include <mkc_progname.h>
+
+static const char *__prog = NULL;
+
+const char * getprogname (void)
+{
+ if (__prog)
+ return __prog;
+
+#ifdef HAVE_FUNC0_GETEXECNAME_STDLIB_H
+ /* SunOS */
+ setprogname (getexecname ());
+ return getprogname ();
+#elif defined(HAVE_VAR_PROGRAM_INVOCATION_SHORT_NAME_ERRNO_H)
+ return program_invocation_short_name;
+#else
+ return "<unset_progname>";
+#endif
+}
+
+void setprogname (const char *progname)
+{
+ const char *s = strrchr (progname, '/');
+ __prog = progname;
+
+ if (s)
+ __prog = s + 1;
+}
diff --git a/features/warn/warn.c b/features/warn/warn.c
new file mode 100644
index 0000000..8b39b48
--- /dev/null
+++ b/features/warn/warn.c
@@ -0,0 +1,95 @@
+/* $NetBSD: warn.c,v 1.4 2004/08/23 03:32:12 jlam Exp $ */
+
+/*
+ * Copyright 1997-2000 Luke Mewburn <lukem@netbsd.org>.
+ * Copyright 2014 Aleksey Cheusov <vle@gmx.net>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include <mkc_progname.h>
+#include <mkc_warn.h>
+
+#if !HAVE_FUNC2_WARN_ERR_H
+void warn (const char *fmt, ...)
+{
+ va_list ap;
+ int sverrno;
+
+ sverrno = errno;
+ fprintf (stderr, "%s: ", getprogname ());
+ va_start (ap, fmt);
+ if (fmt != NULL) {
+ vfprintf (stderr, fmt, ap);
+ fprintf (stderr, ": ");
+ }
+ va_end (ap);
+ fprintf (stderr, "%s\n", strerror (sverrno));
+}
+#endif
+
+#if !HAVE_FUNC2_WARNX_ERR_H
+void warnx (const char *fmt, ...)
+{
+ va_list ap;
+
+ fprintf (stderr, "%s: ", getprogname ());
+ va_start (ap, fmt);
+ if (fmt != NULL)
+ vfprintf (stderr, fmt, ap);
+ va_end (ap);
+ fprintf (stderr, "\n");
+}
+#endif
+
+#if !HAVE_FUNC2_VWARN_ERR_H
+void vwarn (const char *fmt, va_list ap)
+{
+ int sverrno;
+
+ sverrno = errno;
+ fprintf (stderr, "%s: ", getprogname ());
+ if (fmt != NULL) {
+ vfprintf (stderr, fmt, ap);
+ fprintf (stderr, ": ");
+ }
+ fprintf (stderr, "%s\n", strerror (sverrno));
+}
+#endif
+
+#if !HAVE_FUNC2_VWARNX_ERR_H
+void vwarnx (const char *fmt, va_list ap)
+{
+ fprintf (stderr, "%s: ", getprogname ());
+ if (fmt != NULL)
+ vfprintf (stderr, fmt, ap);
+ fprintf (stderr, "\n");
+}
+#endif
diff --git a/helpers/Makefile b/helpers/Makefile
index eccb0c6..a37e0f2 100644
--- a/helpers/Makefile
+++ b/helpers/Makefile
@@ -1,3 +1,4 @@
-SCRIPTS = mkc_test_helper
+SCRIPTS = mkc_test_helper ${INSCRIPTS}
+INSCRIPTS = mkc_long_lines
.include <mkc.mk>
diff --git a/helpers/mkc_long_lines.in b/helpers/mkc_long_lines.in
new file mode 100755
index 0000000..91a07e4
--- /dev/null
+++ b/helpers/mkc_long_lines.in
@@ -0,0 +1,17 @@
+#!@AWK@ -f
+
+############################################################
+# Copyright (c) 2014 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+# processes backslash in the end of line
+
+/\\$/ {
+ printf "%s", substr($0, 1, length($0)-1)
+ next
+}
+{
+ print
+}
diff --git a/helpers/mkc_test_nm b/helpers/mkc_test_nm
new file mode 100755
index 0000000..82be0b8
--- /dev/null
+++ b/helpers/mkc_test_nm
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+: ${OPSYS:=`uname -s`}
+: ${NM:=nm}
+
+case ${OPSYS} in
+ *BSD|DragonFly)
+ ${NM} "$@" |
+ grep -Ev 'fini|init' |
+ awk '$2=="T" {print "symbol " $3}'
+ ;;
+ SunOS)
+ ${NM} -P "$@" |
+ grep -Ev 'fini|init' |
+ awk 'NF==4 && $2=="T" {print "symbol " $1}'
+ ;;
+ Linux)
+ ${NM} "$@" |
+ grep -Ev 'fini|init' |
+ awk 'NF==3 && $2 ~ /^[DT]$/ {print "symbol " $3}'
+ ;;
+esac
diff --git a/main.mk b/main.mk
index b7eff3e..45ed6a5 100644
--- a/main.mk
+++ b/main.mk
@@ -1,15 +1,20 @@
+# Copyright (c) 2014 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
.sinclude "cheusov_local_settings.mk" # for debugging
##################################################
-SUBPRJ_DFLT = custom helpers mk scripts features
-SUBPRJ = examples doc presentation ${SUBPRJ_DFLT}
+SUBPRJ_DFLT = builtins helpers mk scripts features doc
+SUBPRJ = examples presentation ${SUBPRJ_DFLT}
tests = configure_test mkinstall mkshlib mkstaticlib mkpiclib \
mkprofilelib mkdll pkg_config_0 pkg_config_1 pkg_config_1_1 pkg_config_2 \
lua_dirs rec_makefiles reqd reqd2 reqd3 reqd4 reqd_clean_cache \
intexts_cleantrg require_prototype test_subprj_dash test_mkc_vs_PROG \
test_mkc_vs_LIB test_mkc_vs_SUBDIR test_mkc_vs_SUBPRJ endianess \
- create_cachedir sys_queue predopost_targets
+ create_cachedir sys_queue predopost_targets FSRCDIR
.for t in ${tests}
SUBPRJ += tests/${t}:tests
.endfor
@@ -20,7 +25,9 @@ examples = hello_world hello_scripts hello_files hello_sizeof hello_lex \
hello_strlcpy3 hello_customtests hello_customtests2 hello_requirements \
hello_iconv hello_cxx hello_cxxlib hello_dictd hello_lua hello_lua2 \
hello_lua3 hello_superfs hello_xxzip hello_progs hello_progs2 tools \
- tools2 pkgconfig3 hello_SLIST hello_RBTREE # hello_require_tools
+ tools2 pkgconfig3 hello_SLIST hello_RBTREE hello_errwarn hello_fgetln \
+ hello_autotools hello_autoconf hello_libdeps hello_compatlib \
+ hello_require_tools
.for t in ${examples}
SUBPRJ += examples/${t}:tests
.endfor
@@ -36,7 +43,7 @@ NOEXPORT_VARNAMES = MKC_CACHEDIR
DIST_TARGETS = pdf clean-mk clean-scripts mkc_clean
INSTALL = ${.CURDIR}/scripts/mkc_install
-PATH := ${OBJDIR_custom}:${OBJDIR_helpers}:${.CURDIR}/helpers:${OBJDIR_scripts}:${.CURDIR}/scripts:${PATH}
+PATH := ${OBJDIR_builtins}:${OBJDIR_helpers}:${.CURDIR}/helpers:${OBJDIR_scripts}:${.CURDIR}/scripts:${PATH}
.export SHRTOUT INSTALL PATH
diff --git a/mk/Makefile b/mk/Makefile
index 90d43e2..567e001 100644
--- a/mk/Makefile
+++ b/mk/Makefile
@@ -1,6 +1,6 @@
-FILES = sys.mk mkc.configure.mk configure.mk mkc.mk \
- mkc.init.mk mkc_imp.intexts.mk mkc_imp.mk \
- mkc.minitest.mk mkc_imp.pkg-config.mk \
+FILES = sys.mk mkc.configure.mk mkc_imp.conf.mk mkc_imp.conf-cleanup.mk \
+ mkc.mk mkc.init.mk mkc_imp.intexts.mk mkc_imp.mk \
+ mkc.minitest.mk mkc_imp.pkg-config.mk mkc_imp.dpvars.mk \
mkc_imp.files.mk mkc_imp.inc.mk mkc_imp.info.mk mkc_imp.lib.mk \
mkc_imp.links.mk mkc_imp.man.mk mkc_imp.prog.mk \
mkc_imp.subprj.mk mkc_imp.conf-final.mk mkc_imp.rules.mk \
@@ -17,7 +17,7 @@ INFILES += mkc_imp.vars.mk
#################################################
.for i in prog_mkdep prog_nbmkdep
MKC_CHECK_CUSTOM += ${i}
-MKC_CUSTOM_FN.${i} = ${.CURDIR}/../custom/${i}
+MKC_CUSTOM_FN.${i} = ${.CURDIR}/../builtins/${i}
.endfor
MKC_CHECK_PROGS += makedepend
@@ -38,12 +38,19 @@ mkdep_type = makedepend
MKC_ERR_MSG += "mkdep(1) cannot be found"
.endif
+.if exists(/usr/xpg4/bin/nm)
+PROG.nm ?= /usr/xpg4/bin/nm
+.else
+MKC_REQUIRE_PROGS += nm
+.endif
+
makedepend_cmd ?= makedepend
INTEXTS_REPLS += mkdep_cmd ${mkdep_cmd}
INTEXTS_REPLS += makedepend_cmd ${makedepend_cmd}
INTEXTS_REPLS += mkdep_type ${mkdep_type}
INTEXTS_REPLS += featuresdir ${FEATURESDIR}
+INTEXTS_REPLS += NM ${PROG.nm}
#################################################
.include <mkc.mk>
diff --git a/mk/mkc.configure.mk b/mk/mkc.configure.mk
index f93c615..bf48c5f 100644
--- a/mk/mkc.configure.mk
+++ b/mk/mkc.configure.mk
@@ -6,7 +6,7 @@
.include <mkc_imp.preinit.mk>
.include <mkc.init.mk>
-.include <configure.mk>
+.include <mkc_imp.conf.mk>
.PHONY: configure
configure: errorcheck
diff --git a/mk/mkc.init.mk b/mk/mkc.init.mk
index 7d7339f..6f7e3cb 100644
--- a/mk/mkc.init.mk
+++ b/mk/mkc.init.mk
@@ -1,4 +1,4 @@
-# Copyright (c) 2009-2013 by Aleksey Cheusov
+# Copyright (c) 2009-2014 by Aleksey Cheusov
# Copyright (c) 1994-2009 The NetBSD Foundation, Inc.
# Copyright (c) 1988, 1989, 1993 The Regents of the University of California
# Copyright (c) 1988, 1989 by Adam de Boor
@@ -17,25 +17,6 @@ TARGET_OPSYS ?= ${OPSYS}
###########
SHORTPRJNAME ?= yes
-.ifdef DPLIBDIRS
-.for _dir in ${DPLIBDIRS}
-.ifndef DPLIBDIRS.${_dir}
-.if ${SHORTPRJNAME:tl} == "yes"
-DPLIBDIRS.${_dir} = ${OBJDIR_${_dir:T}}
-.else
-DPLIBDIRS.${_dir} = ${OBJDIR_${_dir:S,/,_,g}}
-.endif
-.if ${TARGET_OPSYS} == "HP-UX"
-LDFLAGS0 += ${CFLAGS.cctold}+b ${CFLAGS.cctold}${LIBDIR}
-.endif
-LDFLAGS0 += -L${DPLIBDIRS.${_dir}}
-.endif
-.endfor
-
-#.undef DPLIBDIRS
-
-.endif # DPLIBDIRS
-
######################################################################
.ifndef __initialized__
__initialized__ := 1
@@ -55,7 +36,7 @@ __initialized__ := 1
.for p in ${PROGS}
SRCS.${p} ?= ${p}.c
-SRCS.${p} += ${SRCS} # SRCS may be changed by mkc_imp.configure.mk
+SRCS.${p} += ${SRCS} # SRCS may be changed by mkc_imp.conf.mk
_srcsall += ${SRCS.${p}}
.endfor
@@ -64,6 +45,9 @@ PROGS ?= ${PROG}
SRCS ?= ${PROG}.c
SRCS.${PROG} ?= ${SRCS}
_srcsall += ${SRCS}
+.elif ${.CURDIR:T} == ${COMPATLIB:U}
+SRCS ?= ${FEATURESDIR}/_mkcfake.c
+_srcsall += ${SRCS}
.elif defined(LIB)
SRCS ?= ${LIB}.c
_srcsall += ${SRCS}
@@ -71,28 +55,19 @@ _srcsall += ${SRCS}
.if !empty(_srcsall:U:M*.cxx) || !empty(_srcsall:U:M*.cpp) || !empty(_srcsall:U:M*.C) || !empty(_srcsall:U:M*.cc)
src_type += cxx
-LDCOMPILER = yes
LDREAL ?= ${CXX}
.elif !empty(_srcsall:U:M*.pas) || !empty(_srcsall:U:M*.p)
src_type += pas
-LDCOMPILER = yes
LDREAL ?= ${PC}
.endif
-LDCOMPILER.Interix = yes
-LDCOMPILER.Darwin = yes
-#LDCOMPILER.HP-UX= yes
-LDCOMPILER ?= ${LDCOMPILER.${TARGET_OPSYS}:Uyes}
-
.if !empty(_srcsall:U:M*.c) || !empty(_srcsall:U:M*.l) || !empty(_srcsall:U:M*.y) || defined(MKC_SOURCE_FUNCLIBS)
src_type += c
.endif
src_type ?= 0
-.if ${LDCOMPILER:tl} == "yes"
LDREAL ?= ${CC}
-.endif
.if defined(PROGS)
LDREAL ?= ${CC}
@@ -102,7 +77,7 @@ LDREAL ?= ${LD}
MKC_CACHEDIR ?= ${.OBJDIR} # directory for cache and intermediate files
-init_make_level ?= 0 # for mkc.configure.mk
+init_make_level ?= 0 # for mkc_imp.conf.mk
.if ${.MAKE.LEVEL} == ${init_make_level}
SRCTOP ?= ${.CURDIR}
@@ -125,10 +100,10 @@ PROJECTNAME ?= ${!empty(PROG):?${PROG}:${!empty(LIB):?${LIB}:${.CURDIR:T}}}
.if defined(MAKECONF) && exists(${MAKECONF})
.include "${MAKECONF}"
+.elif defined(MKC_SYSCONFDIR) && exists(${MKC_SYSCONFDIR}/mk-c.conf)
+.include "${MKC_SYSCONFDIR}/mk-c.conf"
.elif defined(MKC_SYSCONFDIR) && exists(${MKC_SYSCONFDIR}/mk.conf)
.include "${MKC_SYSCONFDIR}/mk.conf"
-.elif exists(/etc/mk.conf)
-.include "/etc/mk.conf"
.endif
.if ${OPSYS:Ux} == "SunOS"
@@ -155,6 +130,8 @@ FILESDIR ?= ${PREFIX}/bin
LIBEXECDIR ?= ${PREFIX}/libexec
INCSDIR ?= ${PREFIX}/include
DATADIR ?= ${PREFIX}/share
+SHAREDSTATEDIR ?= ${PREFIX}/com
+VARDIR ?= ${PREFIX}/var
SYSCONFDIR ?= ${PREFIX}/etc
INFODIR ?= ${PREFIX}/info
MANDIR ?= ${PREFIX}/man
@@ -261,14 +238,22 @@ SHLIB_MINOR ?= 0
SHLIB_MAJOR ?= 1
.endif # MKDLL
-.if defined(SHLIB_MAJOR)
+INTERNALLIBS += ${COMPATLIB}
+STATICLIBS += ${INTERNALLIBS}
+
+.if defined(SHLIB_MAJOR) && empty(STATICLIBS:M${.CURDIR:T})
MKSHLIB ?= yes
.else
MKSHLIB ?= no
.endif # SHLIB_MAJOR
-MKPICLIB ?= no
-MKPROFILELIB ?= no
+.if !empty(STATICLIBS:M${.CURDIR:T})
+MKPICLIB ?= yes
+.else
+MKPICLIB ?= no
+.endif
+
+MKPROFILELIB ?= no
MKINSTALLDIRS ?= yes
@@ -325,28 +310,30 @@ MESSAGE.s ?= @${_MESSAGE} "AS: ${.IMPSRC}"
CC ?= cc
CFLAGS ?=
-COMPILE.c ?= ${_V} ${CC_PREFIX} ${CC} ${CFLAGS} ${CPPFLAGS} ${_CFLAGS.ssp} ${_CFLAGS.pie} ${CFLAGS.warns} -c
+COMPILE.c ?= ${_V} ${CC_PREFIX} ${CC} ${CFLAGS} ${_CPPFLAGS} ${_CFLAGS.ssp} ${_CFLAGS.pie} ${CFLAGS.warns} -c
MESSAGE.c ?= @${_MESSAGE} "CC: ${.IMPSRC}"
CXX ?= c++
CXXFLAGS += ${CFLAGS}
-COMPILE.cc ?= ${_V} ${CXX_PREFIX} ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${_CXXFLAGS.ssp} ${_CXXFLAGS.pie} ${CXXFLAGS.warns} -c
+COMPILE.cc ?= ${_V} ${CXX_PREFIX} ${CXX} ${CXXFLAGS} ${_CPPFLAGS} ${_CXXFLAGS.ssp} ${_CXXFLAGS.pie} ${CXXFLAGS.warns} -c
MESSAGE.cc ?= @${_MESSAGE} "CXX: ${.IMPSRC}"
OBJC ?= ${CC}
OBJCFLAGS ?= ${CFLAGS}
-COMPILE.m ?= ${_V} ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
+COMPILE.m ?= ${_V} ${OBJC} ${OBJCFLAGS} ${_CPPFLAGS} -c
MESSAGE.m ?= @${_MESSAGE} "OBJC: ${.IMPSRC}"
CPP ?= cpp
CPPFLAGS ?=
+_CPPFLAGS = ${CPPFLAGS0} ${CPPFLAGS}
+
FC ?= f77
FFLAGS ?= -O
RFLAGS ?=
COMPILE.f ?= ${_V} ${FC} ${FFLAGS} -c
MESSAGE.f ?= @${_MESSAGE} "FC: ${.IMPSRC}"
-COMPILE.F ?= ${_V} ${FC} ${FFLAGS} ${CPPFLAGS} -c
+COMPILE.F ?= ${_V} ${FC} ${FFLAGS} ${_CPPFLAGS} -c
MESSAGE.F ?= ${MESSAGE.f}
COMPILE.r ?= ${_V} ${FC} ${FFLAGS} ${RFLAGS} -c
MESSAGE.r ?= ${MESSAGE.f}
@@ -369,8 +356,13 @@ LD.OSF1 ?= /usr/bin/ld
LD ?= ${LD.${TARGET_OPSYS}:Uld}
LDFLAGS ?=
+.if ${OPSYS} == "Haiku"
+LN ?= ln -s
+LN_S ?= ln -s
+.else
LN ?= ln
LN_S ?= ${LN} -s
+.endif
LORDER ?= lorder
@@ -380,7 +372,7 @@ MKDIR ?= mkdir
PC ?= pc
PFLAGS ?=
-COMPILE.p ?= ${_V} ${PC} ${PFLAGS} ${CPPFLAGS} -c
+COMPILE.p ?= ${_V} ${PC} ${PFLAGS} ${_CPPFLAGS} -c
MESSAGE.p ?= @${_MESSAGE} "PC: ${.IMPSRC}"
SHELL ?= sh
@@ -394,6 +386,8 @@ YFLAGS ?=
YACC.y ?= ${_V} ${YACC} ${YFLAGS}
MESSAGE.y ?= @${_MESSAGE} "YACC: ${.IMPSRC}"
+MESSAGE.mkgen ?= @${_MESSAGE} "MKGEN:"
+
TAR ?= tar
GZIP ?= gzip
BZIP2 ?= bzip2
@@ -435,11 +429,11 @@ MKCHECKS = no
###########
TARGETS += all install clean cleandir depend test \
- installdirs uninstall errorcheck filelist obj
+ installdirs uninstall errorcheck filelist obj mkgen
TARGETS := ${TARGETS:O:u}
-ALLTARGETS += all install clean cleandir depend uninstall installdirs \
- bin_tar bin_targz bin_tarbz2 bin_zip bin_deb
+ALLTARGETS += errorcheck all install clean cleandir depend uninstall installdirs \
+ mkgen bin_tar bin_targz bin_tarbz2 bin_zip bin_deb
VERBOSE_ECHO ?= echo
diff --git a/mk/mkc.minitest.mk b/mk/mkc.minitest.mk
index e62be8a..168073f 100644
--- a/mk/mkc.minitest.mk
+++ b/mk/mkc.minitest.mk
@@ -5,20 +5,21 @@
TEST_PREREQS ?= all
+_tmp_out:=${.OBJDIR}/${.CURDIR:T}.test.out
+
.PHONY : test
test: ${TEST_PREREQS}
@echo 'Testing ${.CURDIR}... ' 1>&2; \
set -e; cd ${.CURDIR}; \
- tmp_out=${.OBJDIR}/${.CURDIR:T}.test.out; \
- ${RM} -f $$tmp_out; \
- ${MAKE} ${MAKEFLAGS} test_output > $$tmp_out.tmp; \
- mv $$tmp_out.tmp $$tmp_out; \
+ ${RM} -f ${_tmp_out}; \
+ ${MAKE} ${MAKEFLAGS} test_output > ${_tmp_out}.tmp; \
+ mv ${_tmp_out}.tmp ${_tmp_out}; \
if test -f ${.CURDIR}/expect.${OPSYS}.out; then \
expect=${.CURDIR}/expect.${OPSYS}.out; \
else \
expect=${.CURDIR}/expect.out; \
fi; \
- diff $$expect $$tmp_out && \
+ diff $$expect ${_tmp_out} && \
echo ' succeeded' 1>&2 || \
{ echo ' FAILED' 1>&2; false; }
diff --git a/mk/mkc_imp.conf-cleanup.mk b/mk/mkc_imp.conf-cleanup.mk
new file mode 100644
index 0000000..0a341f1
--- /dev/null
+++ b/mk/mkc_imp.conf-cleanup.mk
@@ -0,0 +1,9 @@
+# Copyright (c) 2014 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+.include <mkc_imp.conf.mk>
+
+.undef MKC_NOAUTO
+.undef MKC_NOSRCSAUTO
diff --git a/mk/mkc_imp.conf-final.mk b/mk/mkc_imp.conf-final.mk
index eeff5b1..947034e 100644
--- a/mk/mkc_imp.conf-final.mk
+++ b/mk/mkc_imp.conf-final.mk
@@ -38,9 +38,11 @@ CFLAGS += ${i}
.for i in ${MKC_LDADD}
LDADD += ${i}
.endfor
-.for i in ${MKC_SRCS}
+.if !${MKC_NOSRCSAUTO:U0}
+. for i in ${MKC_SRCS}
SRCS += ${i}
-.endfor
+. endfor
+.endif
.endif # .if MKC_AUTO
.undef MKC_CPPFLAGS
diff --git a/mk/configure.mk b/mk/mkc_imp.conf.mk
index fe1ed48..b103834 100644
--- a/mk/configure.mk
+++ b/mk/mkc_imp.conf.mk
@@ -1,4 +1,4 @@
-# Copyright (c) 2009-2013, Aleksey Cheusov <vle@gmx.net>
+# Copyright (c) 2009-2014, Aleksey Cheusov <vle@gmx.net>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -34,6 +34,11 @@ MKC_COMMON_HEADERS ?= # list of headers always #included
MKC_NOCACHE ?= # 1 or yes for disabling cache
MKC_CUSTOM_DIR ?=${.CURDIR} # directory with custom tests.c
MKC_SOURCE_DIR ?=${.CURDIR} # directory with missing strlcat.c etc.
+.if ${COMPATLIB:U} == ${.CURDIR:T}
+MKC_NOSRCSAUTO ?= 1
+.else
+MKC_NOSRCSAUTO ?= 0
+.endif
#
MKC_SOURCE_FUNCLIBS ?=
@@ -336,17 +341,20 @@ MKC_ERR_MSG += "ERROR: prototype test ${p} failed"
.undef MKC_CHECK_PROTOTYPES
.undef MKC_REQUIRE_PROTOTYPES
+.else # MKCHECKS == yes
+
+.for i in ${_MKC_SOURCE_FUNCS}
+MKC_SRCS += ${i} # for changing CLEANFILES
+.endfor
+
+.endif # MKCHECKS?
+
######################################################
-# final assignment
+# final assignments
.include <mkc_imp.conf-final.mk>
-.endif # MKCHECKS == yes
-
######################################################
######################################################
######################################################
-.for i in ${_MKC_SOURCE_FUNCS}
-CLEANFILES += ${i}.o
-.endfor
.undef MKC_SOURCE_FUNCLIBS
diff --git a/mk/mkc_imp.dep.mk b/mk/mkc_imp.dep.mk
index 85ee413..2a37767 100644
--- a/mk/mkc_imp.dep.mk
+++ b/mk/mkc_imp.dep.mk
@@ -2,7 +2,7 @@
# Copyright (c) 1994-2009 The NetBSD Foundation, Inc.
######################################################################
-.ifndef _MKC_IMP_DEP_MK
+.if !defined(_MKC_IMP_DEP_MK) && !empty(_SRCS_ALL)
_MKC_IMP_DEP_MK := 1
DISTCLEANFILES += .depend ${__DPSRCS.d} ${CLEANDEPEND}
@@ -44,22 +44,22 @@ ddash=
.if ${MKDEP_TYPE:U} == "makedepend"
MKDEP.c = ${MAKEDEPEND} -f- ${ddash} ${MKDEPFLAGS} \
- ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET}
+ ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS} > ${.TARGET}
MKDEP.m = ${MKDEP} -f- ${ddash} ${MKDEPFLAGS} \
- ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET}
+ ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS} > ${.TARGET}
MKDEP.cc = ${MKDEP} -f- ${ddash} ${MKDEPFLAGS} \
- ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET}
+ ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS} > ${.TARGET}
MKDEP.s = ${MKDEP} -f- ${ddash} ${MKDEPFLAGS} \
- ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET}
+ ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS} > ${.TARGET}
.else
MKDEP.c = ${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \
- ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS}
+ ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS}
MKDEP.m = ${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \
- ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS}
+ ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS}
MKDEP.cc = ${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \
- ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS}
+ ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS}
MKDEP.s = ${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \
- ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS}
+ ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS}
.endif
.depend: ${__DPSRCS.d}
@@ -75,7 +75,7 @@ MKDEP.s = ${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \
.c.d:
${MESSAGE.dep}
- @env CC=${MKDEP_CC} ${MKDEP.c} ${.IMPSRC}
+ @env CC=${MKDEP_CC:Q} ${MKDEP.c} ${.IMPSRC}
.m.d:
${MESSAGE.dep}
@@ -83,11 +83,11 @@ MKDEP.s = ${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \
.s.d .S.d:
${MESSAGE.dep}
- @env CC=${MKDEP_CC} ${MKDEP.s} ${.IMPSRC}
+ @env CC=${MKDEP_CC:Q} ${MKDEP.s} ${.IMPSRC}
.C.d .cc.d .cpp.d .cxx.d:
${MESSAGE.dep}
- @env CC=${MKDEP_CC} ${MKDEP.cc} ${.IMPSRC}
+ @env CC=${MKDEP_CC:Q} ${MKDEP.cc} ${.IMPSRC}
.endif # defined(SRCS)
diff --git a/mk/mkc_imp.dpvars.mk b/mk/mkc_imp.dpvars.mk
new file mode 100644
index 0000000..a76518d
--- /dev/null
+++ b/mk/mkc_imp.dpvars.mk
@@ -0,0 +1,27 @@
+# Copyright (c) 2014 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+.for i in ${DPLDADD}
+. if ( ${MKPIE:U:tl} == "yes" || defined(SHLIB_MAJOR) ) && !empty(STATICLIBS:Mlib${i})
+LDADD0 += -l${i}_pic
+. else
+LDADD0 += -l${i}
+. endif
+.endfor
+
+.for i in ${DPLIBDIRS}
+. if ${TARGET_OPSYS} == "HP-UX"
+LDFLAGS0 += ${CFLAGS.cctold}+b ${CFLAGS.cctold}${LIBDIR}
+. endif
+LDFLAGS0 += -L${i}
+.endfor
+
+.for i in ${DPINCDIRS:O:u}
+CPPFLAGS0 += -I${i}
+.endfor
+
+.undef DPLIBDIRS
+.undef DPINCDIRS
+.undef DPLDADD
diff --git a/mk/mkc_imp.foreign_autotools.mk b/mk/mkc_imp.foreign_autotools.mk
new file mode 100644
index 0000000..f3b5a2f
--- /dev/null
+++ b/mk/mkc_imp.foreign_autotools.mk
@@ -0,0 +1,79 @@
+# Copyright (c) 2014 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+.ifndef _MKC_IMP_FOREIGN_AUTOTOOLS_MK
+_MKC_IMP_FOREIGN_AUTOTOOLS_MK := 1
+
+MESSAGE.atconf ?= @${_MESSAGE} "CONFIGURE:"
+MESSAGE.autotools ?= @${_MESSAGE} "AUTOTOOLS:"
+
+MKC_REQUIRE_PROGS += autoreconf
+
+AT_USE_AUTOMAKE ?= yes
+AT_MAKE ?= ${MAKE}
+AT_AUTORECONF_ARGS ?= -is -f
+
+.if empty(FSRCDIR)
+MKC_ERR_MSG += "FSRCDIR should not be empty"
+.elif empty(FSRCDIR:M/*)
+_FSRCDIR = ${.CURDIR}/${FSRCDIR}
+.else
+_FSRCDIR = ${FSRCDIR}
+.endif
+
+.if ${.OBJDIR} == ${.CURDIR}
+.OBJDIR = ${_FSRCDIR}
+.endif
+_FOBJDIR = ${.OBJDIR}
+
+_CONFIGURE_ARGS = --prefix ${PREFIX:Q} --bindir=${BINDIR:Q} \
+ --sbindir=${SBINDIR:Q} --libexecdir=${LIBEXECDIR} \
+ --sysconfdir=${SYSCONFDIR:Q} --sharedstatedir=${SHAREDSTATEDIR:Q} \
+ --localstatedir=${VARDIR:Q} --libdir=${LIBDIR:Q} \
+ --includedir=${INCSDIR:Q} --datarootdir=${DATADIR:Q} \
+ --infodir=${INFODIR:Q} --localedir=${DATADIR:Q}/locale \
+ --mandir=${MANDIR:Q} --docdir=${DATADIR:Q}/doc/${PROJECTNAME} \
+ --srcdir=${_FSRCDIR} ${AT_CONFIGURE_ARGS}
+
+_CONFIGURE_ENV = CC=${CC:Q} CFLAGS=${CFLAGS:Q} \
+ CXX=${CXX:Q} CXXFLAGS=${CXXFLAGS:Q} \
+ CPPFLAGS=${_CPPFLAGS:Q} \
+ LDFLAGS=${LDFLAGS:Q} LIBS=${LDADD:Q} CPP=${CPP:Q} ${AT_CONFIGURE_ENV}
+
+_AT_MAKE_ENV = ${DESTDIR:DDESTDIR=${DESTDIR:Q}} ${AT_MAKE_ENV}
+
+realdo_mkgen:
+ ${MESSAGE.mkgen}
+ ${_V} ${PROG.autoreconf} ${AT_AUTORECONF_ARGS} ${_FSRCDIR}
+
+realdo_errorcheck: check_mkc_err_msg .WAIT at_do_errorcheck
+
+at_do_errorcheck: .PHONY
+ ${MESSAGE.atconf}
+ ${_V} cd ${_FOBJDIR}; env ${_CONFIGURE_ENV} ${_FSRCDIR}/configure ${_CONFIGURE_ARGS}
+
+.for i in all clean cleandir install uninstall
+realdo_${i}: at_do_${i}
+at_do_${i}: .PHONY
+ ${MESSAGE.autotools}
+ ${_V} set -e; \
+ cd ${_FOBJDIR}; \
+ if test -f Makefile; then \
+ env ${_AT_MAKE_ENV} ${AT_MAKE} ${AT_MAKEFLAGS} ${.TARGET:S/^at_do_//:S/cleandir/distclean/}; \
+ fi
+.endfor
+
+DISTCLEANDIRS += ${_FSRCDIR}/autom4te.cache
+DISTCLEANFILES += ${_FSRCDIR}/aclocal.m4 ${_FOBJDIR}/config.log \
+ ${_FOBJDIR}/config.status ${_FSRCDIR}/configure ${_FSRCDIR}/depcomp \
+ ${_FSRCDIR}/INSTALL ${_FSRCDIR}/install-sh ${_FOBJDIR}/Makefile \
+ ${_FSRCDIR}/missing ${_FSRCDIR}/compile ${_FOBJDIR}/stamp-h1
+
+.if ${AT_USE_AUTOMAKE:tl:U} == yes
+DISTCLEANFILES += ${_FSRCDIR}/Makefile.in
+MKC_REQUIRE_PROGS += automake
+.endif
+
+.endif # _MKC_IMP_FOREIGN_AUTOTOOLS_MK
diff --git a/mk/mkc_imp.inc.mk b/mk/mkc_imp.inc.mk
index 49e0f6a..d6f46ff 100644
--- a/mk/mkc_imp.inc.mk
+++ b/mk/mkc_imp.inc.mk
@@ -12,7 +12,7 @@ incinstall: .PHONY # ensure existence
.if defined(INCS)
INCSSRCDIR ?= .
-CPPFLAGS += -I${INCSSRCDIR}
+CPPFLAGS0 += -I${INCSSRCDIR}
.if ${MKINSTALL:tl} == "yes"
destination_incs = ${INCS:@I@${DESTDIR}${INCSDIR}/$I@}
diff --git a/mk/mkc_imp.intexts.mk b/mk/mkc_imp.intexts.mk
index 225b17d..f733874 100644
--- a/mk/mkc_imp.intexts.mk
+++ b/mk/mkc_imp.intexts.mk
@@ -1,4 +1,4 @@
-# Copyright (c) 2009-2010 by Aleksey Cheusov
+# Copyright (c) 2009-2014 by Aleksey Cheusov
#
# See LICENSE file in the distribution.
############################################################
@@ -22,11 +22,17 @@ INTEXTS_SED += -e 's,@sbindir@,${SBINDIR},g'
INTEXTS_SED += -e 's,@datadir@,${DATADIR},g'
INTEXTS_SED += -e 's,@mandir@,${MANDIR},g'
INTEXTS_SED += -e 's,@incsdir@,${INCSDIR},g'
-
-.if !make(clean) && !make(cleandir) && !make(distclean)
-.for _pattern _repl in ${INTEXTS_REPLS}
+INTEXTS_SED += -e 's,@vardir@,${VARDIR},g'
+INTEXTS_SED += -e 's,@sharedstatedir@,${SHAREDSTATEDIR},g'
+
+.if !make(clean) && !make(cleandir) && !make(distclean) #&& empty(MKC_ERR_MSG)
+. if !empty(INTEXTS_REPLS) && ${INTEXTS_REPLS:[\#]:M*[13579]} != ""
+MKC_ERR_MSG += "ERROR: odd number of tokens in INTEXTS_REPLS"
+. else
+. for _pattern _repl in ${INTEXTS_REPLS}
INTEXTS_SED += -e 's,@${_pattern}@,${_repl},g'
-.endfor
+. endfor
+. endif
.endif
.for i in ${INFILES}
diff --git a/mk/mkc_imp.lib.mk b/mk/mkc_imp.lib.mk
index c5ea8d4..001819e 100644
--- a/mk/mkc_imp.lib.mk
+++ b/mk/mkc_imp.lib.mk
@@ -1,4 +1,4 @@
-# Copyright (c) 2009-2010 by Aleksey Cheusov
+# Copyright (c) 2009-2014 by Aleksey Cheusov
# Copyright (c) 1994-2009 The NetBSD Foundation, Inc.
# Copyright (c) 1988, 1989, 1993 The Regents of the University of California
# Copyright (c) 1988, 1989 by Adam de Boor
@@ -110,21 +110,20 @@ ${SHLIBFN}: ${SOBJS} ${DPADD}
.endif # !commands(...)
CLEANFILES += \
- ${OBJS} ${POBJS} ${SOBJS} \
- lib${LIB}${SHLIB_EXT} lib${LIB}${SHLIB_EXT1} \
- lib${LIB}${SHLIB_EXT2} lib${LIB}${SHLIB_EXT3} ${SHLIBFN}
+ ${OBJS} ${POBJS} ${SOBJS}
.if !target(libinstall)
# Make sure it gets defined
libinstall::
+CLEANFILES += lib${LIB}.a lib${LIB}_pic.a lib${LIB}_p.a
+
# MKSTATICLIB
.if ${MKSTATICLIB:tl} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a
UNINSTALLFILES.lib += ${DESTDIR}${LIBDIR}/lib${LIB}.a
-CLEANFILES += lib${LIB}.a
${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
.endif
@@ -135,21 +134,16 @@ libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
UNINSTALLFILES.lib += ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
-CLEANFILES += lib${LIB}_p.a
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
.endif
# MKPICLIB
.if ${MKPICLIB:tl} != "no"
-CLEANFILES += lib${LIB}_pic.a
-.endif
-
-.if ${MKPICLIB:tl} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
-UNINSTALLFILES.lib += ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
+UNINSTALLFILES.lib += ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
.endif
@@ -163,6 +157,11 @@ UNINSTALLFILES.lib += ${DESTDIR}${LIBDIR}/${SHLIBFN}
.if ${MKDLL:tl} == "no"
UNINSTALLFILES.lib += ${DESTDIR}${LIBDIR}/lib${LIB}${SHLIB_EXT} \
${DESTDIR}${LIBDIR}/lib${LIB}${SHLIB_EXT1}
+CLEANFILES += \
+ lib${LIB}${SHLIB_EXT} lib${LIB}${SHLIB_EXT1} \
+ lib${LIB}${SHLIB_EXT2} ${SHLIB_EXT3:Dlib${LIB}${SHLIB_EXT3}}
+.else
+CLEANFILES += ${SHLIBFN}
.endif
${DESTDIR}${LIBDIR}/${SHLIBFN}: ${SHLIBFN}
diff --git a/mk/mkc_imp.lua.mk b/mk/mkc_imp.lua.mk
index 0c8f6d8..7e7fa48 100644
--- a/mk/mkc_imp.lua.mk
+++ b/mk/mkc_imp.lua.mk
@@ -36,7 +36,6 @@ LUA_CMODDIR ?= ${PKG_CONFIG.var.lua.INSTALL_CMOD}
LIB = ${LUA_CMODULE:S|.|/|:T}
SRCS ?= ${LUA_CMODULE:S/./_/g}.c
MKDLL = Only
-LDCOMPILER = Yes
DLL_EXT = .so
LIBDIR = ${LUA_CMODDIR}/${LUA_CMODULE:S|.|/|g:H}
.endif # defined(LUA_CMODULES)
diff --git a/mk/mkc_imp.mk b/mk/mkc_imp.mk
index def92ea..5a34007 100644
--- a/mk/mkc_imp.mk
+++ b/mk/mkc_imp.mk
@@ -1,4 +1,4 @@
-# Copyright (c) 2009-2013 by Aleksey Cheusov
+# Copyright (c) 2009-2014 by Aleksey Cheusov
#
# See LICENSE file in the distribution.
############################################################
@@ -9,17 +9,51 @@ SUBPRJ = ${SUBDIR}
.endif
.ifdef SUBPRJS
-SUBPRJ += ${SUBPRJS} # for backward compatility only, use SUBPRJ!
+SUBPRJ += ${SUBPRJS} # for backward compatibility only, use SUBPRJ!
.endif # defined(SUBPRJS)
+.include <mkc_imp.lua.mk>
+.include <mkc_imp.pod.mk>
+.include <mkc.init.mk>
+
+.ifdef AXCIENT_LIBDEPS # This feature was proposed by axcient.com developers
+all_deps != mkc_get_deps ${.CURDIR:S,^${SUBPRJSRCTOP}/,,}
+. for p in ${all_deps}
+_mkfile = ${SUBPRJSRCTOP}/${p}/linkme.mk
+. if exists(${_mkfile})
+. include "${_mkfile}"
+. endif
+DPLDADD ?= ${p:T:S/^lib//}
+DPLIBDIRS ?= ${OBJDIR_${p:S,/,_,g}}
+DPINCDIRS ?= ${SRCDIR_${p:S,/,_,g}} ${OBJDIR_${p:S,/,_,g}}
+. include <mkc_imp.dpvars.mk>
+. endfor
+.endif
+
+.ifdef DPLIBDIRS
+.warning "This way of using DPLIBDIRS is deprecated since 2014-08-21"
+_DPLIBDIRS := ${DPLIBDIRS}
+. for _dir in ${_DPLIBDIRS}
+DPLIBDIRS = ${OBJDIR_${_dir:S,^${SUBPRJSRCTOP}/,,:S,/,_,g}}
+. include <mkc_imp.dpvars.mk>
+. endfor
+. undef _DPLIBDIRS
+. undef DPLIBDIRS
+.endif
+
+.if defined(LIBDEPS)
+SUBPRJ += ${LIBDEPS} # library dependencies
+AXCIENT_LIBDEPS := ${LIBDEPS}
+EXPORT_VARNAMES += AXCIENT_LIBDEPS
+.endif # defined(LIBDEPS)
+
.if !defined(LIB) && !defined(SUBPRJ)
_use_prog := 1
.endif
-.include <mkc_imp.lua.mk>
-.include <mkc_imp.pod.mk>
-
-.include <mkc.init.mk>
+.ifdef FOREIGN
+.include <mkc_imp.foreign_${FOREIGN}.mk>
+.endif
.include <mkc_imp.rules.mk>
.include <mkc_imp.obj.mk>
@@ -56,22 +90,20 @@ test:
.endif # SUBPRJ
###########
-.PHONY : print-values
-print-values :
+.PHONY : print_values
+print_values :
.for v in ${VARS}
@printf "%s=%s\n" ${v} ${${v}:Q}
.endfor
-.PHONY : print-values2
-print-values2 :
+.PHONY : print_values2
+print_values2 :
.for v in ${VARS}
@printf "%s\n" ${${v}:Q}
.endfor
###########
-.PHONY: realerrorcheck
-
-__errorcheck: .USE
+check_mkc_err_msg:
@if test -n '${MKC_ERR_MSG}'; then \
for msg in '' ${MKC_ERR_MSG}; do \
fn=`printf '%s\n' "$$msg" | sed -n 's/^%%%: //p'`; \
@@ -83,17 +115,17 @@ __errorcheck: .USE
exit $$ex; \
fi
-do_all : realerrorcheck
-realerrorcheck: __errorcheck
+all: pre_errorcheck .WAIT do_errorcheck .WAIT post_errorcheck .WAIT pre_all .WAIT do_all .WAIT post_all
+realdo_errorcheck: check_mkc_err_msg
.include <mkc_imp.checkprogs.mk>
-.include <configure.mk>
+.include <mkc_imp.conf-cleanup.mk>
# features
.for f in ${MKC_FEATURES}
.include <mkc_imp.f_${f}.mk>
.endfor
-.include <configure.mk>
+.include <mkc_imp.conf-cleanup.mk>
CFLAGS += ${MKC_FEATURES:D-I${FEATURESDIR}}
.if !defined(MKC_ERR_MSG) || make(clean) || make(cleandir) || make(distclean)
diff --git a/mk/mkc_imp.objdir.mk b/mk/mkc_imp.objdir.mk
index 37ebf5c..8e8636a 100644
--- a/mk/mkc_imp.objdir.mk
+++ b/mk/mkc_imp.objdir.mk
@@ -16,17 +16,17 @@ j:=${i:S,/,_,g}
.if empty(j:U:M*[.]*)
EXPORT_VARNAMES += OBJDIR_${i:S,/,_,g}
. if ${MKRELOBJDIR:tl} == "yes"
-OBJDIR_${j} = ${.OBJDIR}/${i}
+OBJDIR_${j} := ${.OBJDIR}/${i}
. elif defined(MAKEOBJDIRPREFIX)
-OBJDIR_${j} = ${MAKEOBJDIRPREFIX}${.CURDIR}
+OBJDIR_${j} := ${MAKEOBJDIRPREFIX}${.CURDIR}
. elif defined(MAKEOBJDIR)
-OBJDIR_${j} = ${MAKEOBJDIR}
+OBJDIR_${j} := ${MAKEOBJDIR}
. elif defined(_OBJ_MACHINE_DIR)
-OBJDIR_${j} = ${.CURDIR}/obj.${MACHINE}
+OBJDIR_${j} := ${.CURDIR}/obj.${MACHINE}
. elif defined(_OBJ_DIR)
-OBJDIR_${j} = ${.CURDIR}/obj
+OBJDIR_${j} := ${.CURDIR}/obj
. else
-OBJDIR_${j} = ${.CURDIR}/${i}
+OBJDIR_${j} := ${.CURDIR}/${i}
. endif # MAKEOBJDIRPREFIX...
. if ${SHORTPRJNAME:tl} == "yes" && ${i} != ${j}
OBJDIR_${i:T} := ${OBJDIR_${j}}
diff --git a/mk/mkc_imp.pkg-config.mk b/mk/mkc_imp.pkg-config.mk
index 85d5417..8edd88b 100644
--- a/mk/mkc_imp.pkg-config.mk
+++ b/mk/mkc_imp.pkg-config.mk
@@ -12,7 +12,7 @@ MKC_CHECK_PKGCONFIG += ${MKC_REQUIRE_PKGCONFIG}
.if defined(MKC_CHECK_PKGCONFIG) && !make(clean) && !make(cleandir) && !make(distclean)
MKC_REQUIRE_PROGS+= pkg-config
-.include <configure.mk>
+.include <mkc_imp.conf-cleanup.mk>
.if ${HAVE_PROG.pkg-config}
diff --git a/mk/mkc_imp.platform.sys.mk b/mk/mkc_imp.platform.sys.mk
index 90fee7f..7fb81c4 100644
--- a/mk/mkc_imp.platform.sys.mk
+++ b/mk/mkc_imp.platform.sys.mk
@@ -320,11 +320,13 @@ LDFLAGS.soname.sunpro = ${LDFLAGS.soname.sunld}
.if ${TARGET_OPSYS:Unone} == "Darwin"
.if ${MKDLL:U} == "no"
LDFLAGS.shared.gcc.Darwin = -dynamiclib -install_name ${LIBDIR}/lib${LIB}${SHLIB_EXTFULL}
+LDFLAGS.shared.clang.Darwin = -dynamiclib -install_name ${LIBDIR}/lib${LIB}${SHLIB_EXTFULL}
SHLIB_MAJORp1 != expr 1 + ${SHLIB_MAJOR:U0}
LDFLAGS.soname.gcc = -current_version ${SHLIB_MAJORp1}${SHLIB_MINOR:D.${SHLIB_MINOR}}${SHLIB_TEENY:D.${SHLIB_TEENY}}
LDFLAGS.soname.gcc += -compatibility_version ${SHLIB_MAJORp1}
.else
LDFLAGS.shared.gcc.Darwin = -flat_namespace -bundle -undefined suppress
+LDFLAGS.shared.clang.Darwin = -flat_namespace -bundle -undefined suppress
.endif
.elif ${TARGET_OPSYS:Unone} == "OSF1" && defined(LIB)
CLEANFILES += ${.OBJDIR}/${LIB}_so_locations
@@ -371,7 +373,7 @@ LDFLAGS.relro := ${LDFLAGS.relro:S/^/-Wl,/g}
.if ${TARGET_OPSYS:Unone} == "Darwin"
COMPILE.s ?= ${AS} ${AFLAGS}
-COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c
+COMPILE.S ?= ${CC} ${AFLAGS} ${_CPPFLAGS} -c
.if ${MKDLL:U} != "no"
diff --git a/mk/mkc_imp.subprj.mk b/mk/mkc_imp.subprj.mk
index 4eb491e..73c5649 100644
--- a/mk/mkc_imp.subprj.mk
+++ b/mk/mkc_imp.subprj.mk
@@ -10,6 +10,8 @@
.if !defined(_MKC_IMP_SUBPRJ_MK)
_MKC_IMP_SUBPRJ_MK := 1
+EXPORT_VARNAMES += STATICLIBS COMPATLIB
+
.for dir in ${SUBPRJ:S/:/ /g}
.if empty(NOSUBDIR:U:M${dir})
__REALSUBPRJ += ${dir}
@@ -19,6 +21,11 @@ __REALSUBPRJ += ${dir}
.for dir in ${NOSUBDIR}
NODEPS += *-${dir}:* *:*-${dir} *-*/${dir}:* *:*-*/${dir}
.endfor
+.for dir in ${INTERNALLIBS}
+NODEPS += install-${dir}:* install-*/${dir}:* \
+ uninstall-${dir}:* uninstall-*/${dir}:* \
+ installdirs-${dir}:* installdirs-*/${dir}:*
+.endfor
.ifndef SUBDIR
__REALSUBPRJ := ${__REALSUBPRJ:O:u}
@@ -121,6 +128,9 @@ __recurse: .USE
esac
###########
+SUBPRJSRCTOP = ${.CURDIR}
+.export SUBPRJSRCTOP
+###########
.include <mkc_imp.objdir.mk>
diff --git a/mk/mkc_imp.vars.mk.in b/mk/mkc_imp.vars.mk.in
index 2d8c60f..28af702 100644
--- a/mk/mkc_imp.vars.mk.in
+++ b/mk/mkc_imp.vars.mk.in
@@ -6,3 +6,4 @@ MKC_SYSCONFDIR = @sysconfdir@
MKDEP = @mkdep_cmd@
MKDEP_TYPE = @mkdep_type@
MAKEDEPEND = @makedepend_cmd@
+NM = @NM@
diff --git a/presentation/_mkc_prog_awk.err b/presentation/_mkc_prog_awk.err
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/presentation/_mkc_prog_awk.err
diff --git a/presentation/_mkc_prog_awk.res b/presentation/_mkc_prog_awk.res
new file mode 100644
index 0000000..36178d1
--- /dev/null
+++ b/presentation/_mkc_prog_awk.res
@@ -0,0 +1 @@
+/usr/bin/awk
diff --git a/presentation/presentation.pdf b/presentation/presentation.pdf
index 31e6676..8037e2d 100644
--- a/presentation/presentation.pdf
+++ b/presentation/presentation.pdf
Binary files differ
diff --git a/scripts/Makefile b/scripts/Makefile
index c651993..4ecb5e8 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -7,7 +7,7 @@ SCRIPTS = mkc_check_funclib mkc_check_header \
mkc_check_prog mkc_check_custom \
mkc_which mkc_check_compiler \
mkc_install ${INSCRIPTS}
-INSCRIPTS += mkc_check_version mkcmake
+INSCRIPTS += mkc_check_version mkcmake mkc_get_deps
MAN = mkc_check_funclib.1 mkc_check_header.1 \
mkc_check_sizeof.1 mkc_check_decl.1 \
diff --git a/scripts/mk-configure.7.in b/scripts/mk-configure.7.in
index e9579a5..ab6c9da 100644
--- a/scripts/mk-configure.7.in
+++ b/scripts/mk-configure.7.in
@@ -18,7 +18,7 @@
.sp
..
.\" ------------------------------------------------------------------
-.TH MK-CONFIGURE 7 "Dec 1, 2013" "" ""
+.TH MK-CONFIGURE 7 "Aug 21, 2014" "" ""
.SH NAME
mk-configure \- lightweight replacement for GNU autotools
.SH DESCRIPTION
@@ -27,11 +27,48 @@ is a collection of include files for bmake (portable version of
NetBSD make) and a number of executables. It is intended to simplify
crossplatform development and software building.
.P
-To get system-specific configuration parameters, mkc.*.mk include
-files try to include the file specified by the "MAKECONF"
-variable. If MAKECONF is not set, or no such file exists, the system
-make configuration file, @sysconfdir@/mk.conf or /etc/mk.conf, is
-included. If "${SRCTOP}/Makefile.common" file exists it is also included
+There are only a few top-level makefiles:
+.BR mkc.init.mk ", " mkc.mk ", " mkc.configure.mk ", " mkc.minitest.mk .
+Everything else
+.RB ( mkc_imp.*.mk " files)"
+is included implicitely. Do not use
+.B mkc_imp.*.mk
+files directly! If you do, I cannot guarantee backward compatibility.
+.B mkc.configure.mk
+is included automatically by
+.BR mkc.mk ,
+but can be included explicitely.
+.B mkc.minitest.mk
+provides a trivial support for regression tests and should be included explicitely.
+Usually mk-c makefiles consist of variables assignments
+and inclusion of
+.B mkc.mk
+in the and.
+One can also use
+.BR mkc.prog.mk ", " mkc.lib.mk ", " mkc.files.mk ", " mkc.subdir.mk " and " mkc.subprj.mk
+instead of
+.BR mkc.mk .
+The latter activates
+.B mkc.lib.mk
+if variable LIB is set,
+.B mkc.prog.mk
+if variables PROG or PROGS are set,
+.B mkc.subprj.mk
+if variable SUBPRJ is set,
+.B mkc.subdir.mk
+if variable SUBDIR is set,
+and
+.B mkc.files.mk
+otherwise.
+.B
+.P
+To get system-wide configuration parameters, mkc.init.mk loads
+"${MAKECONF}" file if it exists.
+Otherwise, it loads
+@sysconfdir@/mk-c.conf if it exists.
+If neither ${MAKECONF} nor @sysconfdir@/mk-c.conf exist,
+it tries to load @sysconfdir@/mk.conf file.
+If "${SRCTOP}/Makefile.common" file exists it is also included
by all subprojects.
Unless SRCTOP variable is set, "../Makefile.inc"
is also included if exists.
@@ -51,8 +88,7 @@ means "May be set or changed in project's Makefile" and
.I Mu
means "May be set in project's Makefile but may be initialized or overriden by user".
.SS "Targets"
-.BR mkc.prog.mk ", " mkc.lib.mk ", " mkc.files.mk ", " mkc.subdir.mk ", and " mkc.subprj.mk
-include files provide the following targets:
+Mk-configure provides the following targets:
.IP all
build everything.
.IP clean
@@ -86,6 +122,9 @@ output a list of destination files of the project, one per line, e.g.
if MKOBJDIR is "yes", creates object directories (${.OBJDIR}) according
to MAKEOBJDIR and MAKEOBJPREFIX variables. Current umask is used for
this.
+.VE
+.IP mkgen
+.RB See " mkc_imp.foreign_autotools.mk" .
.IP "bin_tar, bin_targz, bin_tarbz2, bin_zip, bin_deb"
build software, install it to a temporary directory (using DESTDIR)
and create .tar/.tar.gz/.tar.bz2/.zip/.deb archive
@@ -104,8 +143,12 @@ in Makefile override the standard behaviour.
All targets in this list have
.IR pre\_* ", " do\_* " and " post\_*
counterparts. See ALLTARGETS for details.
-.SS "Common variables"
-The following variables control how various files are compiled/built.
+.SS "mkc.init.mk"
+This file is included by
+.BR mkc.mk " and " mkc.configure.mk
+automatically but can be used by users directly.
+.B mkc.init.mk
+uses the following variables.
.IP AR
Create, modify, and extract from archives.
.RI < Iu >
@@ -176,6 +219,10 @@ Additional flags to the C pre-processor.
.IP CPPFLAGS_<project>
Similar to CPPFLAGS but for project ${PROJECTNAME}.
.RI < "U" >
+.IP CPPFLAGS0
+The same as CPPFLAGS but CPPFLAGS0 are passed to the compiler before CPPFLAGS.
+Normally, CPPFLAGS0 should be modified in makefiles and should not
+be set from environment by user.
.IP FC
Fortran compiler.
.RI < Iu >
@@ -370,6 +417,18 @@ Target directory for system utilities.
Target directory for architecture-independent text files.
.RI < "Iu" >
.RI [ ${PREFIX}/share ]
+.IP SHAREDSTATEDIR
+Target directory for modifiable architecture-independent data files.
+.RI < "Iu" >
+.RI [ ${PREFIX}/com ]
+.IP VARDIR
+Target directory for modifiable single-machine data files.
+.RI < "Iu" >
+.RI [ ${PREFIX}/var ]
+.IP INCSDIR
+Target directory for header files.
+.RI < "Iu" >
+.RI [ ${PREFIX}/include ]
.IP SYSCONFDIR
Target directory for configuration files.
.RI < "Iu" >
@@ -551,17 +610,12 @@ will be translated to
Top-level object directory which
defaults to ${.OBJDIR} if ${.MAKE.LEVEL} is 0.
.RI < I >
-.SS "mkc.init.mk"
-This file sets most important mk-configure variables, for example,
-OPSYS, PREFIX, CC_TYPE etc. and is included automatically by
-.BR mkc.files.mk ", " mkc.lib.mk ", " mkc.prog.mk ", " mkc.subdir.mk " and " mkc.subprj.mk
.SS "mkc.files.mk"
The include file
.B mkc.files.mk
-handles the FILES variables and is included
+handles the FILES variable and is included
from
.BR mkc.lib.mk " and " mkc.prog.mk .
-.B mkc_imp.files.mk
List of supported variables:
.IP FILES
The list of files to install.
@@ -709,7 +763,7 @@ Additional linker flags. Often used for specifying library directories.
Similar to LDFLAGS but for project ${PROJECTNAME}.
.IP LDFLAGS0
The same as LDFLAGS but LDFLAGS0 and LDADD0 are passed to the linker before LDFLAGS and LDADD.
-Normally LDFLAGS0 and LDADD0 should be modified in makefiles and should not
+Normally, LDFLAGS0 and LDADD0 should be modified in makefiles and should not
be set from environment by user.
.RI < "M" >
.IP "BINDIR, BINMODE, BINOWN and BINGRP"
@@ -740,6 +794,15 @@ objects), otherwise only symbols referenced by some object file will
be exported.
.RI < "M" >
.RI [ no ]
+.IP DPINCDIRS
+See LIBDEPS in section
+.BR mk.subprj.mk .
+.IP DPLIBDIRS
+See LIBDEPS in section
+.BR mk.subprj.mk .
+.IP DPLDADD
+See LIBDEPS in section
+.BR mk.subprj.mk .
.PP
.B mkc.prog.mk
includes
@@ -748,8 +811,7 @@ and therefore supports all variables supported by it.
.SS "mkc.lib.mk"
The include file
.B mkc.lib.mk
-has support for building a static or dynanic library. It has a
-limited number of suffixes.
+has support for building a static and dynanic library or DLL.
.B mkc.lib.mk
uses the following variables:
.IP LIB
@@ -824,11 +886,6 @@ List of source files to build the library. Suffix types
.\"
.\" It has rules for building profiled objects; profiled libraries are
.\" built by default.
-.IP LDCOMPILER
-If "yes", ${CC} is used for linking instead of ${LD}.
-For C++ sources ${CXX} is used for linking.
-.RI < "Iu" >
-.RI [ yes ]
.IP MKSHLIB
If not "no", build and install shared library provided that SHLIB_MAJOR is defined.
.RI < "IMu" >
@@ -857,6 +914,15 @@ exported. This variable has no effect on some platforms. By default
all symbols are exported.
.RI < "M" >
[]
+.IP DPINCDIRS
+See LIBDEPS in section
+.BR mk.subprj.mk .
+.IP DPLIBDIRS
+See LIBDEPS in section
+.BR mk.subprj.mk .
+.IP DPLDADD
+See LIBDEPS in section
+.BR mk.subprj.mk .
.\" .IP "COPTS.lib<lib> OBJCCOPTS.lib<lib> LDADD.lib<lib> CPPFLAGS.lib<lib> CXXFLAGS.lib<lib>"
.\" These provide a way to specify additions to the associated
.\" variables in a way that applies only to a particular
@@ -925,6 +991,46 @@ List of subprojects (subdirectories) and dependencies. If the
subdirectory doesn't exist the subproject becomes "virtual" and may be
used to group several subprojects into a new virtual one.
.RI < "M" >
+.IP LIBDEPS
+A list of library dependencies. Each token is a colon-separated pair.
+Its first component is a library subproject (dependency), the second
+one is the subproject for library or executable. The value of this
+variable is automatically added to SUBPRJ. Library dependencies listed
+in LIBDEPS automatically change CPPFLAGS0, LDFLAGS0 and LDADD0 of
+approptiate subprojects.
+.RI < "M" >
+Suppose, we have <library:program> pair in LIBDEPS, also suppose that variable
+.B library
+is set to "library" subdirectory and variable
+.B program
+is set to "program" subdirectory.
+${SRCDIR_library}/linkme.mk file is automatically included from
+${SRCDIR_program}/Makefile if it exists. In this file
+.RI "DPLDADD [" "${library:T:S/^lib//}" "],"
+.RI "DPLIBDIRS [" "${OBJDIR_${library:S,/,_,g}}" "] and"
+.RI "DPINCDIRS [" "${SRCDIR_${library:S,/,_,g}} ${OBJDIR_${library:S,/,_,g}}" "],"
+may be set to non-default values. These three variables then changes
+LDADD0, LDFLAGS0 and CPPFLAGS0 respectively in subproject "program".
+The dependency graph specified by variable LIBDEPS is available to all
+subproject via environment.
+.IP STATICLIBS
+A list of subprojects (basenames) with static libraries. If dependency is
+mentioned in this variable, the suffix _pic is automatically added
+for PIE-executables or shared libraries that depend on this library.
+This variable is automatically passed to subprojects via environment.
+.RI < Mu >
+.RI [ "" ]
+.IP INTERNALLIBS
+A list of subprojects (basenames) with internal libraries.
+These libraries are static and not installed by target "install".
+.RI < M >
+.RI [ "" ]
+.IP COMPATLIB
+Subproject's basename for compatibility library.
+If this variable is set, MKC_SOURCE_FUNCLIBS and FEATURES
+do not change SRCS for subprojects other than ${COMPATLIB}.
+.RI < M >
+.RI [ "" ]
.IP SUBPRJ_DFLT
List of projects built and installed by default.
The default is all projects listed in SUBPRJ.
@@ -993,6 +1099,10 @@ are used. Unlike MAKEOBJDIRPREFIX object directories do not contain
top-level ${.CURDIR} in paths.
.RI < "Iu" >
.RI [ no ]
+.IP SUBPRJSRCTOP
+This variables contains ${.CURDIR} directory and is passed to subprojects.
+.RI < "I" >
+.RI [ ${.CURDIR} ]
.P
.B mkc.subprj.mk
provides the following targets:
@@ -1326,10 +1436,11 @@ Checks listed in MKC_CHECK_BUILTINS will be run.
.RS
Avalable values:
.TP
-.BR prog_flex ", " prog_bison ", " prog_gawk ", " prog_gm4
-Find flex, bison, GNU awk or GNU m4 by analysing program's help and/or
-version messages. If found, BUILTIN.prog_<progname> is set to a path,
-otherwise it is set to an empty string. Note that
+.BR prog_flex ", " prog_bison ", " prog_gawk ", " prog_gm4 ", " prog_gmake
+Find flex, bison, GNU awk, GNU m4 or GNU make respectively
+by analysing program's help and/or
+version messages. If found, BUILTIN.prog_<progname> is set to the path,
+otherwise it is set to empty string. Note that
.I gawk
may be found as
.IR awk ,
@@ -1338,11 +1449,13 @@ as
.IR yacc ,
.I gm4
as
-.IR m4
-and
+.IR m4 ,
.I flex
as
-.IR lex .
+.IR lex " and"
+.I gmake
+as
+.IR make .
.TP
.BR prog_mkdep ", " prog_nbmkdep
Find traditional BSD mkdep(1) or recent NetBSD version of it respectively.
@@ -1500,7 +1613,7 @@ mk-configure is added to SRCS and declaration is provided in
mkc_strlcat.h header.
.TP
.B strlcpy
-The same as strlcat.
+Similar to strlcat.
.TP
.B getline
This feature corresponds to getline(3) function which is a part of POSIX2008
@@ -1511,6 +1624,19 @@ implementation is available in libc. If not, getline.c provided by
mk-configure is added to SRCS and declaration is provided in
mkc_getline.h header.
.TP
+.B progname
+This feature provides getprogname(3) and setprogname(3) functions
+available in *BSD.
+.TP
+.B fgetln
+This feature provides fgetln(3) BSD-ism.
+.TP
+.B err
+This feature provides err(3), errx(3), verr(3) and verrx(3) BSD-isms.
+.TP
+.B warn
+This feature provides warn(3), warnx(3), vwarn(3) and vwarnx(3) BSD-isms.
+.TP
.B libm
This feature checks whether libm is available and if yes, adds -lm to
LDADD. Most UNIX-like systems have libm but Haiku, for example, does
@@ -1660,6 +1786,8 @@ expanding the following @@ patterns:
.RI @ "" "datadir@ ${DATADIR}"
.RI @ "" "sysconfdir@ ${SYSCONFDIR}"
.RI @ "" "incsdir@ ${INCSDIR}"
+.RI @ "" "vardir@ ${VARDIR}"
+.RI @ "" "sharedstate@ ${SHAREDSTATEDIR}"
.VE
The following variables are provided:
.IP INFILES
@@ -1777,9 +1905,8 @@ Do not use it directly!
This module provides installation of header files and provides
the following variables:
.IP INCSDIR
-Target directory for includes.
-.RI < "Iu" >
-.RI [ ${PREFIX}/include ]
+See
+.BR mkc.init.mk .
.IP INCS
The list of include files.
.RI < "M" >
@@ -1900,6 +2027,41 @@ dependencies, but are not needed in ${SRCS}.
Compiler passed to mkdep(1).
.RI < "Iu" >
.RI [ "${CC}" ].
+.SS "mkc_imp.foreign_autotools.mk"
+This module is activated if variable FOREIGN is set to "autotools" and provides
+support for building external projects using autotools.
+It also provides a recursive target
+.B mkgen
+for generating "configure" script, "Makefile.in" file etc. using
+.BR autoreconf(1) " utility."
+The following variables are provided:
+.IP FSRCDIR
+Relative (to ${.CURDIR}) or absolute directory to autotools-based sources.
+.IP AT_MAKE
+Make(1)-like utility for the project.
+.RI < "Imu" >
+.RI [ "${MAKE}" ].
+.IP AT_USE_AUTOMAKE
+If "yes",
+.B automake(1)
+is used.
+.RI < "M" >
+.RI [ yes ].
+.IP AT_CONFIGURE_ARGS
+Extra arguments passed to "configure" script set in addition to
+standard ones (--prefix, --bindir etc.).
+.RI < "Mu" >
+.RI [ "" ].
+.IP AT_CONFIGURE_ENV
+Environment variables for "configure" script set in addition to
+standard ones (CC, CFLAGS etc.).
+.RI < "Mu" >
+.RI [ "" ].
+.IP AT_AUTORECONF_ARGS
+Arguments passed to
+.BR autoreconf(1) .
+.RI < "U" >
+.RI [ "-sif" ].
.SH "CROSS COMPILATION"
The following variables are used for compiling software using cross-tools.
.IP MACHINE_GNU_PLATFORM
@@ -1928,9 +2090,7 @@ See SYSROOT.
Path to mk.conf file .include-ed by mkc.*.mk files
.SH "FILES"
.IP @sysconfdir@/mk.conf
- .include-ed by mkc.*.mk if exists
-.IP /etc/mk.conf
- .include-ed by mkc.*.mk if exists
+ .include-ed by mkc.init.mk if exists
.SH "BUGS"
Target
.IR errorcheck " (" configure ")"
diff --git a/scripts/mkc_check_custom b/scripts/mkc_check_custom
index 46f751c..e0d32d1 100755
--- a/scripts/mkc_check_custom
+++ b/scripts/mkc_check_custom
@@ -1,7 +1,7 @@
#!/bin/sh
############################################################
-# Copyright (c) 2009-2010 by Aleksey Cheusov
+# Copyright (c) 2009-2014 by Aleksey Cheusov
#
# See LICENSE file in the distribution.
############################################################
diff --git a/scripts/mkc_get_deps.in b/scripts/mkc_get_deps.in
new file mode 100755
index 0000000..74c8092
--- /dev/null
+++ b/scripts/mkc_get_deps.in
@@ -0,0 +1,43 @@
+#!@AWK@ -f
+
+# Usage: mkc_get_deps
+# $1 -- project name
+# ENVIRON ["AXCIENT_LIBDEPS"] -- dep1:prj1 dep2:prj2 ...
+
+function print_all_deps (prj, i,next_prj){
+ if (prj in processed)
+ return
+
+ processed [prj]=1
+
+ for (i=1; i <= count [prj]; ++i){
+ next_prj = graph[prj, i]
+ print_all_deps(next_prj)
+ }
+
+ if (topprj != prj)
+ result [++result_sz] = prj
+}
+
+BEGIN {
+ topprj = ARGV [1]
+ if (!topprj)
+ exit(10)
+
+ cnt = split(ENVIRON ["AXCIENT_LIBDEPS"], deps, / +|:/)
+ if (int(cnt/2)*2 != cnt)
+ exit(11)
+
+ for (i=1; i <= cnt; i += 2){
+ from = deps [i]
+ to = deps [i+1]
+ graph[to, ++count [to]] = from
+ }
+
+ print_all_deps(topprj)
+
+ for (i=result_sz; i >= 1; --i)
+ print result [i]
+
+ print "" # for bmake
+}
diff --git a/tests/FSRCDIR/Makefile b/tests/FSRCDIR/Makefile
new file mode 100644
index 0000000..76e9392
--- /dev/null
+++ b/tests/FSRCDIR/Makefile
@@ -0,0 +1,5 @@
+FOREIGN = autotools
+TEST_PREREQS =
+
+.include "test.mk"
+.include <mkc.mk>
diff --git a/tests/FSRCDIR/expect.out b/tests/FSRCDIR/expect.out
new file mode 100644
index 0000000..3f29ee1
--- /dev/null
+++ b/tests/FSRCDIR/expect.out
@@ -0,0 +1,3 @@
+=========== all ============
+FSRCDIR should not be empty
+*** Error code 1
diff --git a/tests/FSRCDIR/test.mk b/tests/FSRCDIR/test.mk
new file mode 100644
index 0000000..6059c8f
--- /dev/null
+++ b/tests/FSRCDIR/test.mk
@@ -0,0 +1,10 @@
+.PHONY : test_output
+test_output :
+ @set -e; \
+ \
+ echo =========== all ============; \
+ ${MAKE} ${MAKEFLAGS} all 2>&1 | head -n 2; \
+ \
+ ${MAKE} ${MAKEFLAGS} cleandir > /dev/null
+
+.include <mkc.minitest.mk>
diff --git a/tests/mkdll/Makefile b/tests/mkdll/Makefile
index 7239e82..c3cc464 100644
--- a/tests/mkdll/Makefile
+++ b/tests/mkdll/Makefile
@@ -1,6 +1,6 @@
.PATH: ../../examples/hello_cxxlib/cxxlib
-MKDLL= yes
+MKDLL = only
.include "../../examples/hello_cxxlib/cxxlib/Makefile"
.include "../mkpiclib/test.mk"
diff --git a/tests/mkdll/expect.out b/tests/mkdll/expect.out
index af084bd..c1c93eb 100644
--- a/tests/mkdll/expect.out
+++ b/tests/mkdll/expect.out
@@ -1,16 +1,19 @@
=========== all ============
/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
/objdir/_mkc_cxx_type.err
/objdir/_mkc_cxx_type.res
+/objdir/_mkc_funclib_dummy.c
+/objdir/_mkc_funclib_dummy.err
+/objdir/_mkc_funclib_dummy.res
/objdir/_mkc_prog_cxx.err
/objdir/_mkc_prog_cxx.res
/objdir/cxxlib.so
+/objdir/dummy.os
/objdir/expect.out
-/objdir/hello_msg1.o
/objdir/hello_msg1.os
-/objdir/hello_msg2.o
/objdir/hello_msg2.os
-/objdir/libcxxlib.a
/objdir/mkdll.test.out.tmp
========= install ==========
/objdir/prefix
@@ -21,16 +24,40 @@
/objdir/prefix/include/impl/hello_msg2.h
/objdir/prefix/lib
/objdir/prefix/lib/cxxlib.so
-/objdir/prefix/lib/libcxxlib.a
======== uninstall =========
========== clean ===========
/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
/objdir/_mkc_cxx_type.err
/objdir/_mkc_cxx_type.res
+/objdir/_mkc_funclib_dummy.c
+/objdir/_mkc_funclib_dummy.err
+/objdir/_mkc_funclib_dummy.res
/objdir/_mkc_prog_cxx.err
/objdir/_mkc_prog_cxx.res
/objdir/expect.out
/objdir/mkdll.test.out.tmp
+======= CLEANFILES ==========
+/objdir/mkdll.test.out
+cxxlib.so
+dummy.o
+dummy.op
+dummy.os
+hello_msg1.o
+hello_msg1.op
+hello_msg1.os
+hello_msg2.o
+hello_msg2.op
+hello_msg2.os
+libcxxlib.a
+libcxxlib_p.a
+libcxxlib_pic.a
+======= UNINSTALLFILES ==========
+/prefix/include/hello_msg.h
+/prefix/include/impl/hello_msg1.h
+/prefix/include/impl/hello_msg2.h
+/prefix/lib/cxxlib.so
======= distclean ==========
/objdir/Makefile
/objdir/expect.out
diff --git a/tests/mkpiclib/expect.out b/tests/mkpiclib/expect.out
index f3a8f4d..9ec67cf 100644
--- a/tests/mkpiclib/expect.out
+++ b/tests/mkpiclib/expect.out
@@ -1,9 +1,15 @@
=========== all ============
/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
/objdir/_mkc_cxx_type.err
/objdir/_mkc_cxx_type.res
+/objdir/_mkc_funclib_dummy.c
+/objdir/_mkc_funclib_dummy.err
+/objdir/_mkc_funclib_dummy.res
/objdir/_mkc_prog_cxx.err
/objdir/_mkc_prog_cxx.res
+/objdir/dummy.os
/objdir/expect.out
/objdir/hello_msg1.os
/objdir/hello_msg2.os
@@ -22,13 +28,37 @@
======== uninstall =========
========== clean ===========
/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
/objdir/_mkc_cxx_type.err
/objdir/_mkc_cxx_type.res
+/objdir/_mkc_funclib_dummy.c
+/objdir/_mkc_funclib_dummy.err
+/objdir/_mkc_funclib_dummy.res
/objdir/_mkc_prog_cxx.err
/objdir/_mkc_prog_cxx.res
/objdir/expect.out
/objdir/mkpiclib.test.out.tmp
/objdir/test.mk
+======= CLEANFILES ==========
+/objdir/mkpiclib.test.out
+dummy.o
+dummy.op
+dummy.os
+hello_msg1.o
+hello_msg1.op
+hello_msg1.os
+hello_msg2.o
+hello_msg2.op
+hello_msg2.os
+libcxxlib.a
+libcxxlib_p.a
+libcxxlib_pic.a
+======= UNINSTALLFILES ==========
+/prefix/include/hello_msg.h
+/prefix/include/impl/hello_msg1.h
+/prefix/include/impl/hello_msg2.h
+/prefix/lib/libcxxlib_pic.a
======= distclean ==========
/objdir/Makefile
/objdir/expect.out
diff --git a/tests/mkpiclib/test.mk b/tests/mkpiclib/test.mk
index cc6ecc8..a4856dd 100644
--- a/tests/mkpiclib/test.mk
+++ b/tests/mkpiclib/test.mk
@@ -25,6 +25,14 @@ test_output:
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
+ echo ======= CLEANFILES ==========; \
+ ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \
+ awk '{for(i=1; i<=NF; ++i) print $$i}' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ echo ======= UNINSTALLFILES ==========; \
+ ${MAKE} ${MAKEFLAGS} print_values2 VARS='UNINSTALLFILES' MKCHECKS=no | \
+ awk '{for(i=1; i<=NF; ++i) print $$i}' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
echo ======= distclean ==========; \
${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR} -type f | \
diff --git a/tests/mkprofilelib/expect.out b/tests/mkprofilelib/expect.out
index 46af6f2..041e2e3 100644
--- a/tests/mkprofilelib/expect.out
+++ b/tests/mkprofilelib/expect.out
@@ -1,9 +1,17 @@
=========== all ============
/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
/objdir/_mkc_cxx_type.err
/objdir/_mkc_cxx_type.res
+/objdir/_mkc_funclib_dummy.c
+/objdir/_mkc_funclib_dummy.err
+/objdir/_mkc_funclib_dummy.res
/objdir/_mkc_prog_cxx.err
/objdir/_mkc_prog_cxx.res
+/objdir/dummy.o
+/objdir/dummy.op
+/objdir/dummy.os
/objdir/expect.out
/objdir/hello_msg1.o
/objdir/hello_msg1.op
@@ -31,12 +39,44 @@
======== uninstall =========
========== clean ===========
/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
/objdir/_mkc_cxx_type.err
/objdir/_mkc_cxx_type.res
+/objdir/_mkc_funclib_dummy.c
+/objdir/_mkc_funclib_dummy.err
+/objdir/_mkc_funclib_dummy.res
/objdir/_mkc_prog_cxx.err
/objdir/_mkc_prog_cxx.res
/objdir/expect.out
/objdir/mkprofilelib.test.out.tmp
+======= CLEANFILES ==========
+/objdir/mkprofilelib.test.out
+dummy.o
+dummy.op
+dummy.os
+hello_msg1.o
+hello_msg1.op
+hello_msg1.os
+hello_msg2.o
+hello_msg2.op
+hello_msg2.os
+libcxxlib.a
+libcxxlib.so
+libcxxlib.so.1
+libcxxlib.so.1.0
+libcxxlib.so.1.0.5
+libcxxlib_p.a
+libcxxlib_pic.a
+======= UNINSTALLFILES ==========
+/prefix/include/hello_msg.h
+/prefix/include/impl/hello_msg1.h
+/prefix/include/impl/hello_msg2.h
+/prefix/lib/libcxxlib.a
+/prefix/lib/libcxxlib.so
+/prefix/lib/libcxxlib.so.1
+/prefix/lib/libcxxlib.so.1.0.5
+/prefix/lib/libcxxlib_p.a
======= distclean ==========
/objdir/Makefile
/objdir/expect.out
diff --git a/tests/mkshlib/expect.out b/tests/mkshlib/expect.out
index bfeaee9..caad11d 100644
--- a/tests/mkshlib/expect.out
+++ b/tests/mkshlib/expect.out
@@ -1,9 +1,15 @@
=========== all ============
/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
/objdir/_mkc_cxx_type.err
/objdir/_mkc_cxx_type.res
+/objdir/_mkc_funclib_dummy.c
+/objdir/_mkc_funclib_dummy.err
+/objdir/_mkc_funclib_dummy.res
/objdir/_mkc_prog_cxx.err
/objdir/_mkc_prog_cxx.res
+/objdir/dummy.o
/objdir/expect.out
/objdir/hello_msg1.o
/objdir/hello_msg2.o
@@ -21,12 +27,36 @@
======== uninstall =========
========== clean ===========
/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
/objdir/_mkc_cxx_type.err
/objdir/_mkc_cxx_type.res
+/objdir/_mkc_funclib_dummy.c
+/objdir/_mkc_funclib_dummy.err
+/objdir/_mkc_funclib_dummy.res
/objdir/_mkc_prog_cxx.err
/objdir/_mkc_prog_cxx.res
/objdir/expect.out
/objdir/mkshlib.test.out.tmp
+======= CLEANFILES ==========
+/objdir/mkshlib.test.out
+dummy.o
+dummy.op
+dummy.os
+hello_msg1.o
+hello_msg1.op
+hello_msg1.os
+hello_msg2.o
+hello_msg2.op
+hello_msg2.os
+libcxxlib.a
+libcxxlib_p.a
+libcxxlib_pic.a
+======= UNINSTALLFILES ==========
+/prefix/include/hello_msg.h
+/prefix/include/impl/hello_msg1.h
+/prefix/include/impl/hello_msg2.h
+/prefix/lib/libcxxlib.a
======= distclean ==========
/objdir/Makefile
/objdir/expect.out
diff --git a/tests/mkstaticlib/expect.out b/tests/mkstaticlib/expect.out
index e0e55a0..db17b35 100644
--- a/tests/mkstaticlib/expect.out
+++ b/tests/mkstaticlib/expect.out
@@ -1,9 +1,15 @@
=========== all ============
/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
/objdir/_mkc_cxx_type.err
/objdir/_mkc_cxx_type.res
+/objdir/_mkc_funclib_dummy.c
+/objdir/_mkc_funclib_dummy.err
+/objdir/_mkc_funclib_dummy.res
/objdir/_mkc_prog_cxx.err
/objdir/_mkc_prog_cxx.res
+/objdir/dummy.os
/objdir/expect.out
/objdir/hello_msg1.os
/objdir/hello_msg2.os
@@ -23,12 +29,42 @@
======== uninstall =========
========== clean ===========
/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
/objdir/_mkc_cxx_type.err
/objdir/_mkc_cxx_type.res
+/objdir/_mkc_funclib_dummy.c
+/objdir/_mkc_funclib_dummy.err
+/objdir/_mkc_funclib_dummy.res
/objdir/_mkc_prog_cxx.err
/objdir/_mkc_prog_cxx.res
/objdir/expect.out
/objdir/mkstaticlib.test.out.tmp
+======= CLEANFILES ==========
+/objdir/mkstaticlib.test.out
+dummy.o
+dummy.op
+dummy.os
+hello_msg1.o
+hello_msg1.op
+hello_msg1.os
+hello_msg2.o
+hello_msg2.op
+hello_msg2.os
+libcxxlib.a
+libcxxlib.so
+libcxxlib.so.1
+libcxxlib.so.1.0
+libcxxlib.so.1.0.5
+libcxxlib_p.a
+libcxxlib_pic.a
+======= UNINSTALLFILES ==========
+/prefix/include/hello_msg.h
+/prefix/include/impl/hello_msg1.h
+/prefix/include/impl/hello_msg2.h
+/prefix/lib/libcxxlib.so
+/prefix/lib/libcxxlib.so.1
+/prefix/lib/libcxxlib.so.1.0.5
======= distclean ==========
/objdir/Makefile
/objdir/expect.out
diff --git a/tests/predopost_targets/Makefile.inc b/tests/predopost_targets/Makefile.inc
index 02da702..3f66516 100644
--- a/tests/predopost_targets/Makefile.inc
+++ b/tests/predopost_targets/Makefile.inc
@@ -1,5 +1,5 @@
.ifndef REAL_TARGETS
-.for i in clean cleandir install all uninstall installdirs depend \
+.for i in errorcheck clean cleandir install all uninstall installdirs depend \
bin_tar bin_targz bin_tarbz2 bin_zip bin_deb
pre_${i} do_${i} post_${i}:
@echo "fake target ${.TARGET}"
diff --git a/tests/predopost_targets/expect.out b/tests/predopost_targets/expect.out
index e5bbcaf..4315220 100644
--- a/tests/predopost_targets/expect.out
+++ b/tests/predopost_targets/expect.out
@@ -1,5 +1,20 @@
=========== {pre,do,post}_recursive ============
==================================================
+errorcheck ===> tests/predopost_targets/lib
+fake target pre_errorcheck
+fake target do_errorcheck
+fake target post_errorcheck
+==================================================
+errorcheck ===> tests/predopost_targets/others
+fake target pre_errorcheck
+fake target do_errorcheck
+fake target post_errorcheck
+==================================================
+errorcheck ===> tests/predopost_targets/lua
+fake target pre_errorcheck
+fake target do_errorcheck
+fake target post_errorcheck
+==================================================
clean ===> tests/predopost_targets/lib
fake target pre_clean
fake target do_clean
@@ -57,16 +72,25 @@ fake target do_install
fake target post_install
==================================================
all ===> tests/predopost_targets/lib
+fake target pre_errorcheck
+fake target do_errorcheck
+fake target post_errorcheck
fake target pre_all
fake target do_all
fake target post_all
==================================================
all ===> tests/predopost_targets/others
+fake target pre_errorcheck
+fake target do_errorcheck
+fake target post_errorcheck
fake target pre_all
fake target do_all
fake target post_all
==================================================
all ===> tests/predopost_targets/lua
+fake target pre_errorcheck
+fake target do_errorcheck
+fake target post_errorcheck
fake target pre_all
fake target do_all
fake target post_all
diff --git a/tests/predopost_targets/test.mk b/tests/predopost_targets/test.mk
index 5db4de1..6ec1c09 100644
--- a/tests/predopost_targets/test.mk
+++ b/tests/predopost_targets/test.mk
@@ -4,7 +4,7 @@ test_output :
\
{ \
echo '=========== {pre,do,post}_recursive ============'; \
- for t in clean cleandir install all uninstall installdirs depend; do \
+ for t in errorcheck clean cleandir install all uninstall installdirs depend; do \
${MAKE} ${MAKEFLAGS} -j1 $$t | \
grep -v checking; \
done ; \
diff --git a/tests/reqd/expect.out b/tests/reqd/expect.out
index 9e1a280..2cf1c41 100644
--- a/tests/reqd/expect.out
+++ b/tests/reqd/expect.out
@@ -1 +1 @@
-ERROR: We need mk-configure v.999.0.0 while 0.27.0 is detected
+ERROR: We need mk-configure v.999.0.0 while 0.28.0 is detected
diff --git a/tests/reqd2/expect.out b/tests/reqd2/expect.out
index 9e1a280..2cf1c41 100644
--- a/tests/reqd2/expect.out
+++ b/tests/reqd2/expect.out
@@ -1 +1 @@
-ERROR: We need mk-configure v.999.0.0 while 0.27.0 is detected
+ERROR: We need mk-configure v.999.0.0 while 0.28.0 is detected
diff --git a/tests/reqd3/expect.out b/tests/reqd3/expect.out
index 9e1a280..2cf1c41 100644
--- a/tests/reqd3/expect.out
+++ b/tests/reqd3/expect.out
@@ -1 +1 @@
-ERROR: We need mk-configure v.999.0.0 while 0.27.0 is detected
+ERROR: We need mk-configure v.999.0.0 while 0.28.0 is detected
diff --git a/tests/reqd4/expect.out b/tests/reqd4/expect.out
index 5e1cb98..0cb180a 100644
--- a/tests/reqd4/expect.out
+++ b/tests/reqd4/expect.out
@@ -1,4 +1,4 @@
-ERROR: We need mk-configure v.999.0.0 while 0.27.0 is detected
+ERROR: We need mk-configure v.999.0.0 while 0.28.0 is detected
"bmake-20110606 or newer is required"
=========== all ============
/objdir/Makefile
diff --git a/tests/sys_queue/Makefile b/tests/sys_queue/Makefile
index b50aa77..96a92bf 100644
--- a/tests/sys_queue/Makefile
+++ b/tests/sys_queue/Makefile
@@ -8,4 +8,5 @@ MKC_FEATURES = CIRCLEQ LIST SIMPLEQ SLIST STAILQ TAILQ
MKC_REQD = 0.26.0
test: all
+.include "test.mk"
.include <mkc.prog.mk>
diff --git a/tests/sys_queue/test.mk b/tests/sys_queue/test.mk
new file mode 100644
index 0000000..d6a56ab
--- /dev/null
+++ b/tests/sys_queue/test.mk
@@ -0,0 +1,3 @@
+test:
+ @set -e; \
+ ${MAKE} ${MAKEFLAGS} cleandir > /dev/null