summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAndrew Shadura <andrew@shadura.me>2015-07-25 14:44:21 +0200
committerAndrew Shadura <andrew@shadura.me>2015-07-25 14:44:21 +0200
commit1d3d0bb1e461a81bc1a9cd4520958bd2b1db4c7f (patch)
tree1aa5b654ab4ab52e936550463aac7e4da0aad722 /examples
Imported Upstream version 0.24.0
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile41
-rw-r--r--examples/Makefile.inc1
-rw-r--r--examples/hello_calc2/Makefile30
-rw-r--r--examples/hello_calc2/expect.out59
-rw-r--r--examples/hello_calc2/expressions.txt8
-rw-r--r--examples/hello_calc2/lex.l24
-rw-r--r--examples/hello_calc2/parser.y53
-rw-r--r--examples/hello_calc2/test.mk32
-rw-r--r--examples/hello_compilers/Makefile31
-rw-r--r--examples/hello_compilers/compiler_test.c52
-rw-r--r--examples/hello_compilers/expect.out76
-rw-r--r--examples/hello_compilers/test.mk32
-rw-r--r--examples/hello_customtests/Makefile29
-rw-r--r--examples/hello_customtests/custom_tests/alloca_in_alloca_h.c9
-rw-r--r--examples/hello_customtests/custom_tests/alloca_in_stdlib_h.c9
-rw-r--r--examples/hello_customtests/custom_tests/cxx_with_templates.cc15
-rwxr-xr-xexamples/hello_customtests/custom_tests/shtest5
-rwxr-xr-xexamples/hello_customtests/custom_tests/true_is_available3
-rw-r--r--examples/hello_customtests/expect.out77
-rw-r--r--examples/hello_customtests/hello_customtests.c38
-rw-r--r--examples/hello_customtests/test.mk34
-rw-r--r--examples/hello_customtests2/Makefile13
-rw-r--r--examples/hello_customtests2/expect.out43
-rw-r--r--examples/hello_customtests2/hello_customtests2.c17
-rw-r--r--examples/hello_customtests2/test.mk34
-rw-r--r--examples/hello_cxx/Makefile12
-rw-r--r--examples/hello_cxx/expect.out41
-rw-r--r--examples/hello_cxx/hello_msg.cc6
-rw-r--r--examples/hello_cxx/hello_msg.h1
-rw-r--r--examples/hello_cxx/main.cc7
-rw-r--r--examples/hello_cxx/test.mk32
-rw-r--r--examples/hello_cxxlib/Makefile8
-rw-r--r--examples/hello_cxxlib/cxxapp/Makefile8
-rw-r--r--examples/hello_cxxlib/cxxapp/cxxapp.cc11
-rw-r--r--examples/hello_cxxlib/cxxlib/Makefile15
-rw-r--r--examples/hello_cxxlib/cxxlib/hello_msg1.cpp6
-rw-r--r--examples/hello_cxxlib/cxxlib/hello_msg2.cpp10
-rw-r--r--examples/hello_cxxlib/cxxlib/include/hello_msg.h7
-rw-r--r--examples/hello_cxxlib/cxxlib/include/impl/hello_msg1.h6
-rw-r--r--examples/hello_cxxlib/cxxlib/include/impl/hello_msg2.h8
-rw-r--r--examples/hello_cxxlib/cxxlib/linkme.mk5
-rw-r--r--examples/hello_cxxlib/expect.out75
-rw-r--r--examples/hello_cxxlib/test.mk35
-rw-r--r--examples/hello_dictd/Makefile17
-rw-r--r--examples/hello_dictd/Makefile.inc11
-rw-r--r--examples/hello_dictd/dict/Makefile9
-rw-r--r--examples/hello_dictd/dict/dict.113
-rw-r--r--examples/hello_dictd/dict/dict.c18
-rw-r--r--examples/hello_dictd/dictd/Makefile9
-rw-r--r--examples/hello_dictd/dictd/dictd.813
-rw-r--r--examples/hello_dictd/dictd/dictd.c18
-rw-r--r--examples/hello_dictd/dictfmt/Makefile9
-rw-r--r--examples/hello_dictd/dictfmt/dictfmt.113
-rw-r--r--examples/hello_dictd/dictfmt/dictfmt.c18
-rw-r--r--examples/hello_dictd/dictzip/Makefile10
-rw-r--r--examples/hello_dictd/dictzip/dictzip.113
-rw-r--r--examples/hello_dictd/dictzip/dictzip.c20
-rw-r--r--examples/hello_dictd/doc/Makefile6
-rw-r--r--examples/hello_dictd/doc/doc.txt1
-rw-r--r--examples/hello_dictd/expect.out549
-rw-r--r--examples/hello_dictd/libcommon/Makefile10
-rw-r--r--examples/hello_dictd/libcommon/iswalnum.c6
-rw-r--r--examples/hello_dictd/libcommon/linkme.mk5
-rw-r--r--examples/hello_dictd/libcommon/str.c6
-rw-r--r--examples/hello_dictd/libdz/Makefile15
-rw-r--r--examples/hello_dictd/libdz/dz.c14
-rw-r--r--examples/hello_dictd/libdz/export.sym1
-rw-r--r--examples/hello_dictd/libdz/linkme.mk5
-rw-r--r--examples/hello_dictd/libmaa/Makefile14
-rw-r--r--examples/hello_dictd/libmaa/export.sym3
-rw-r--r--examples/hello_dictd/libmaa/linkme.mk5
-rw-r--r--examples/hello_dictd/libmaa/log.c14
-rw-r--r--examples/hello_dictd/libmaa/prime.c6
-rw-r--r--examples/hello_dictd/libmaa/set.c6
-rw-r--r--examples/hello_dictd/test.mk119
-rw-r--r--examples/hello_files/DEBIAN/control8
-rw-r--r--examples/hello_files/Makefile32
-rw-r--r--examples/hello_files/expect.NetBSD.out94
-rw-r--r--examples/hello_files/expect.out90
-rw-r--r--examples/hello_files/shell_func.715
-rw-r--r--examples/hello_files/shell_func.texinfo38
-rw-r--r--examples/hello_files/shell_func13
-rw-r--r--examples/hello_files/shell_func23
-rw-r--r--examples/hello_files/shell_func33
-rw-r--r--examples/hello_files/test.mk54
-rw-r--r--examples/hello_glib2/Makefile11
-rw-r--r--examples/hello_glib2/expect.out53
-rw-r--r--examples/hello_glib2/hello_glib2.c16
-rw-r--r--examples/hello_glib2/test.mk32
-rw-r--r--examples/hello_lex/Makefile5
-rw-r--r--examples/hello_lex/expect.out49
-rw-r--r--examples/hello_lex/hello_lex.l16
-rw-r--r--examples/hello_lex/input.txt2
-rw-r--r--examples/hello_lex/test.mk37
-rw-r--r--examples/hello_lua/Makefile9
-rw-r--r--examples/hello_lua/bar.lua5
-rw-r--r--examples/hello_lua/baz.c13
-rw-r--r--examples/hello_lua/expect.out124
-rw-r--r--examples/hello_lua/foo.lua5
-rwxr-xr-xexamples/hello_lua/foobar7
-rw-r--r--examples/hello_lua/test.mk46
-rw-r--r--examples/hello_lua2/Makefile5
-rw-r--r--examples/hello_lua2/bar.lua5
-rw-r--r--examples/hello_lua2/expect.out66
-rw-r--r--examples/hello_lua2/foo.lua5
-rwxr-xr-xexamples/hello_lua2/foobar6
-rw-r--r--examples/hello_lua2/test.mk44
-rw-r--r--examples/hello_lua3/Makefile7
-rw-r--r--examples/hello_lua3/expect.out79
-rw-r--r--examples/hello_lua3/socket_bar.lua5
-rw-r--r--examples/hello_lua3/socket_baz.c13
-rw-r--r--examples/hello_lua3/socket_foo.lua5
-rw-r--r--examples/hello_lua3/test.mk32
-rw-r--r--examples/hello_plugins/Makefile4
-rw-r--r--examples/hello_plugins/app/Makefile7
-rw-r--r--examples/hello_plugins/app/app.c47
-rw-r--r--examples/hello_plugins/expect.out81
-rw-r--r--examples/hello_plugins/plugin1/Makefile5
-rw-r--r--examples/hello_plugins/plugin1/plugin1.c8
-rw-r--r--examples/hello_plugins/plugin2/Makefile5
-rw-r--r--examples/hello_plugins/plugin2/plugin2.c8
-rw-r--r--examples/hello_plugins/test.mk36
-rw-r--r--examples/hello_plugins2/Makefile4
-rw-r--r--examples/hello_plugins2/app/Makefile9
-rw-r--r--examples/hello_plugins2/app/app.c47
-rw-r--r--examples/hello_plugins2/expect.out69
-rw-r--r--examples/hello_plugins2/plugin1/Makefile5
-rw-r--r--examples/hello_plugins2/plugin1/plugin1.c7
-rw-r--r--examples/hello_plugins2/plugin2/Makefile5
-rw-r--r--examples/hello_plugins2/plugin2/plugin2.c7
-rw-r--r--examples/hello_plugins2/test.mk32
-rw-r--r--examples/hello_progs/Makefile8
-rw-r--r--examples/hello_progs/client.c7
-rw-r--r--examples/hello_progs/client_puts.c9
-rw-r--r--examples/hello_progs/expect.out82
-rw-r--r--examples/hello_progs/server.c7
-rw-r--r--examples/hello_progs/server_puts.c9
-rw-r--r--examples/hello_progs/test.mk45
-rw-r--r--examples/hello_progs2/Makefile9
-rw-r--r--examples/hello_progs2/client.c7
-rw-r--r--examples/hello_progs2/common.c8
-rw-r--r--examples/hello_progs2/expect.out76
-rw-r--r--examples/hello_progs2/server.c7
-rw-r--r--examples/hello_progs2/test.mk45
-rw-r--r--examples/hello_require_tools/Makefile11
-rw-r--r--examples/hello_require_tools/fake0
-rw-r--r--examples/hello_requirements/Makefile20
-rw-r--r--examples/hello_requirements/custom_check1.c7
-rw-r--r--examples/hello_requirements/custom_check2.c3
-rw-r--r--examples/hello_requirements/expect.out40
-rw-r--r--examples/hello_requirements/hello_world.c7
-rw-r--r--examples/hello_requirements/test.mk12
-rw-r--r--examples/hello_scripts/Makefile21
-rw-r--r--examples/hello_scripts/expect.out92
-rw-r--r--examples/hello_scripts/hello_world.113
-rwxr-xr-xexamples/hello_scripts/hello_world23
-rwxr-xr-xexamples/hello_scripts/hello_world36
-rw-r--r--examples/hello_scripts/main.c9
-rwxr-xr-xexamples/hello_scripts/more_scripts/script13
-rwxr-xr-xexamples/hello_scripts/more_scripts/script23
-rwxr-xr-xexamples/hello_scripts/more_scripts/script33
-rw-r--r--examples/hello_scripts/msg.c1
-rw-r--r--examples/hello_scripts/test.mk45
-rw-r--r--examples/hello_sizeof/Makefile9
-rw-r--r--examples/hello_sizeof/expect.out68
-rw-r--r--examples/hello_sizeof/sizeof_test.c20
-rw-r--r--examples/hello_sizeof/test.mk32
-rw-r--r--examples/hello_strlcpy/Makefile12
-rw-r--r--examples/hello_strlcpy/expect.out74
-rw-r--r--examples/hello_strlcpy/hello.c25
-rw-r--r--examples/hello_strlcpy/input.in23
-rw-r--r--examples/hello_strlcpy/strlcpy.c51
-rw-r--r--examples/hello_strlcpy/test.mk33
-rw-r--r--examples/hello_subdirs/Makefile3
-rw-r--r--examples/hello_subdirs/Makefile.inc1
-rw-r--r--examples/hello_subdirs/prog1/Makefile14
-rw-r--r--examples/hello_subdirs/prog1/expect.out36
-rwxr-xr-xexamples/hello_subdirs/prog1/prog1.awk6
-rw-r--r--examples/hello_subdirs/prog1/prog1.c7
-rwxr-xr-xexamples/hello_subdirs/prog1/prog1.sh3
-rw-r--r--examples/hello_subdirs/prog1/test.mk37
-rw-r--r--examples/hello_subdirs/prog2/Makefile9
-rw-r--r--examples/hello_subdirs/prog2/expect.out26
-rw-r--r--examples/hello_subdirs/prog2/prog2.c7
-rw-r--r--examples/hello_subdirs/prog2/test.mk35
-rw-r--r--examples/hello_superfs/Makefile10
-rw-r--r--examples/hello_superfs/Makefile.inc1
-rw-r--r--examples/hello_superfs/docs/LICENSE1
-rw-r--r--examples/hello_superfs/docs/Makefile6
-rw-r--r--examples/hello_superfs/docs/NEWS1
-rw-r--r--examples/hello_superfs/docs/README1
-rw-r--r--examples/hello_superfs/expect.out127
-rw-r--r--examples/hello_superfs/fsck_superfs/Makefile6
-rw-r--r--examples/hello_superfs/fsck_superfs/fsck_superfs.815
-rw-r--r--examples/hello_superfs/fsck_superfs/fsck_superfs.c7
-rw-r--r--examples/hello_superfs/mkfs_superfs/Makefile6
-rw-r--r--examples/hello_superfs/mkfs_superfs/mkfs_superfs.815
-rw-r--r--examples/hello_superfs/mkfs_superfs/mkfs_superfs.c7
-rw-r--r--examples/hello_superfs/test.mk48
-rw-r--r--examples/hello_world/COPYRIGHT2
-rw-r--r--examples/hello_world/Makefile13
-rw-r--r--examples/hello_world/README9
-rw-r--r--examples/hello_world/expect.out80
-rw-r--r--examples/hello_world/hello_world.c7
-rw-r--r--examples/hello_world/test.mk54
-rw-r--r--examples/hello_xxzip/Makefile30
-rw-r--r--examples/hello_xxzip/expect.out76
-rw-r--r--examples/hello_xxzip/test.mk34
-rw-r--r--examples/hello_xxzip/tutorial.pod17
-rw-r--r--examples/hello_xxzip/xxzip.c7
-rw-r--r--examples/hello_xxzip/xxzip.pod44
-rw-r--r--examples/hello_yacc/Makefile6
-rw-r--r--examples/hello_yacc/calc.y49
-rw-r--r--examples/hello_yacc/expect.out49
-rw-r--r--examples/hello_yacc/input.txt4
-rw-r--r--examples/hello_yacc/test.mk37
-rw-r--r--examples/subprojects/Makefile16
-rw-r--r--examples/subprojects/expect.out270
-rw-r--r--examples/subprojects/hello/Makefile24
-rw-r--r--examples/subprojects/hello/hello_subprojects.1.in19
-rw-r--r--examples/subprojects/hello/hello_subprojects.c10
-rwxr-xr-xexamples/subprojects/hello/hello_subprojects2.in5
-rw-r--r--examples/subprojects/hello/test.mk2
-rw-r--r--examples/subprojects/libhello1/Makefile9
-rw-r--r--examples/subprojects/libhello1/hello1.c3
-rw-r--r--examples/subprojects/libhello1/hello1.h6
-rw-r--r--examples/subprojects/libhello1/linkme.mk5
-rw-r--r--examples/subprojects/libhello2/Makefile14
-rw-r--r--examples/subprojects/libhello2/hello2.313
-rw-r--r--examples/subprojects/libhello2/hello2.c3
-rw-r--r--examples/subprojects/libhello2/include/hello2.h14
-rw-r--r--examples/subprojects/libhello2/linkme.mk5
-rw-r--r--examples/subprojects/test.mk83
-rw-r--r--examples/subprojects/version.mk1
-rw-r--r--examples/tools/Makefile6
-rw-r--r--examples/tools/expect.out209
-rw-r--r--examples/tools/libs/bar/Makefile7
-rw-r--r--examples/tools/libs/bar/bar.c6
-rw-r--r--examples/tools/libs/bar/bar.h1
-rw-r--r--examples/tools/libs/bar/linkme.mk5
-rw-r--r--examples/tools/libs/foo/Makefile7
-rw-r--r--examples/tools/libs/foo/foo.c6
-rw-r--r--examples/tools/libs/foo/foo.h1
-rw-r--r--examples/tools/libs/foo/linkme.mk5
-rw-r--r--examples/tools/test.mk72
-rw-r--r--examples/tools/tools/prog1/Makefile9
-rw-r--r--examples/tools/tools/prog1/prog1.c10
-rw-r--r--examples/tools/tools/prog2/Makefile9
-rw-r--r--examples/tools/tools/prog2/prog2.c10
-rw-r--r--examples/tools/tools/prog3/Makefile11
-rw-r--r--examples/tools/tools/prog3/prog3.c14
251 files changed, 6270 insertions, 0 deletions
diff --git a/examples/Makefile b/examples/Makefile
new file mode 100644
index 0000000..cc8dba9
--- /dev/null
+++ b/examples/Makefile
@@ -0,0 +1,41 @@
+# for regression tests
+NOEXPORT_VARNAMES = MKC_CACHEDIR
+
+_THISDIR_ =
+.export _THISDIR_
+
+# examples
+SUBDIR+= hello_world
+SUBDIR+= hello_scripts
+SUBDIR+= hello_files
+SUBDIR+= hello_sizeof
+SUBDIR+= hello_lex
+SUBDIR+= hello_yacc
+SUBDIR+= hello_calc2
+SUBDIR+= subprojects
+SUBDIR+= hello_compilers
+SUBDIR+= hello_plugins
+SUBDIR+= hello_plugins2
+SUBDIR+= hello_glib2
+SUBDIR+= hello_subdirs
+SUBDIR+= hello_strlcpy
+SUBDIR+= hello_customtests
+SUBDIR+= hello_customtests2
+SUBDIR+= hello_requirements
+SUBDIR+= hello_cxx
+SUBDIR+= hello_cxxlib
+SUBDIR+= hello_dictd
+SUBDIR+= hello_lua
+SUBDIR+= hello_lua2
+SUBDIR+= hello_lua3
+SUBDIR+= hello_superfs
+SUBDIR+= hello_xxzip
+SUBDIR+= hello_progs
+SUBDIR+= hello_progs2
+SUBDIR+= tools
+
+.ifdef WITH_require_tools
+SUBDIR+= hello_require_tools
+.endif
+
+.include <mkc.mk>
diff --git a/examples/Makefile.inc b/examples/Makefile.inc
new file mode 100644
index 0000000..32e2d30
--- /dev/null
+++ b/examples/Makefile.inc
@@ -0,0 +1 @@
+CLEANDIRS+= ${.CURDIR}/usr ${.CURDIR}/opt
diff --git a/examples/hello_calc2/Makefile b/examples/hello_calc2/Makefile
new file mode 100644
index 0000000..098b5af
--- /dev/null
+++ b/examples/hello_calc2/Makefile
@@ -0,0 +1,30 @@
+PROG = calc
+
+SRCS = lex.l parser.y
+
+YHEADER = 1
+YPREFIX = calc_
+LPREFIX = calc_
+
+MKC_CHECK_BUILTINS = prog_bison prog_flex
+
+YACC = ${BUILTIN.prog_bison} -y
+LEX = ${BUILTIN.prog_flex}
+LEXLIB = -lfl
+
+lex.o: parser.h
+
+.include <mkc.configure.mk>
+
+.if empty(BUILTIN.prog_flex)
+MKC_ERR_MSG += "Cannot find flex, good bye!"
+.endif
+
+.if empty(BUILTIN.prog_bison)
+MKC_ERR_MSG += "Cannot find bison, good bye!"
+.endif
+
+LDADD += -lm
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_calc2/expect.out b/examples/hello_calc2/expect.out
new file mode 100644
index 0000000..a50aab6
--- /dev/null
+++ b/examples/hello_calc2/expect.out
@@ -0,0 +1,59 @@
+4
+45
+-1
+45
+460
+484
+27
+73
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_custom_prog_bison.err
+/objdir/_mkc_custom_prog_bison.res
+/objdir/_mkc_custom_prog_flex.err
+/objdir/_mkc_custom_prog_flex.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/calc
+/objdir/expect.out
+/objdir/expressions.txt
+/objdir/hello_calc2.test.out.tmp
+/objdir/lex.c
+/objdir/lex.l
+/objdir/lex.o
+/objdir/parser.c
+/objdir/parser.h
+/objdir/parser.o
+/objdir/parser.y
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/calc
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_custom_prog_bison.err
+/objdir/_mkc_custom_prog_bison.res
+/objdir/_mkc_custom_prog_flex.err
+/objdir/_mkc_custom_prog_flex.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/expect.out
+/objdir/expressions.txt
+/objdir/hello_calc2.test.out.tmp
+/objdir/lex.l
+/objdir/parser.y
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/expressions.txt
+/objdir/hello_calc2.test.out.tmp
+/objdir/lex.l
+/objdir/parser.y
+/objdir/test.mk
diff --git a/examples/hello_calc2/expressions.txt b/examples/hello_calc2/expressions.txt
new file mode 100644
index 0000000..357aa2f
--- /dev/null
+++ b/examples/hello_calc2/expressions.txt
@@ -0,0 +1,8 @@
+1+3
+5*9
+5-6
+(3+2)*(2+7)
+(12+34)*10
+(12-34)^2
+10+34/2
+3^2+4^3
diff --git a/examples/hello_calc2/lex.l b/examples/hello_calc2/lex.l
new file mode 100644
index 0000000..eb58f23
--- /dev/null
+++ b/examples/hello_calc2/lex.l
@@ -0,0 +1,24 @@
+
+%{
+#include <stdio.h>
+
+#define yylval calc_lval
+
+#include "parser.h"
+%}
+
+%option noyywrap
+
+digit [0-9]
+number {digit}+\.?|{digit}*\.{digit}+
+id [a-zA-Z]+
+
+%%
+
+[ ] { /* Skip spaces. */ }
+{number} { sscanf (yytext, "%lf", &yylval.value); return NUMBER; }
+\n|[-+\/*^()] { return yytext[0]; }
+
+%%
+
+YYSTYPE calc_lval;
diff --git a/examples/hello_calc2/parser.y b/examples/hello_calc2/parser.y
new file mode 100644
index 0000000..67bef50
--- /dev/null
+++ b/examples/hello_calc2/parser.y
@@ -0,0 +1,53 @@
+
+%{
+#include <stdio.h>
+#include <math.h>
+%}
+
+%union {
+ double value;
+ char* name;
+}
+
+%token <value> NUMBER
+
+%type <value> expr
+
+%left '+' '-'
+%right SQRT
+%left '*' '/'
+%right '^'
+%right UMINUS
+
+%%
+lines: lines expr '\n' { printf("%.10g\n", $2); }
+ | lines '\n'
+ | error '\n' { printf("Please re-enter last line: ");
+ yyerrok; }
+ |
+ ;
+
+expr: expr '+' expr { $$ = $1 + $3; }
+ | expr '-' expr { $$ = $1 - $3; }
+ | expr '*' expr { $$ = $1 * $3; }
+ | expr '/' expr { $$ = $1 / $3; }
+ | expr '^' expr { $$ = pow($1, $3); }
+ | '(' expr ')' { $$ = $2; }
+ | '-' expr %prec UMINUS { $$ = -$2; }
+ | NUMBER
+ ;
+
+%%
+#include <ctype.h>
+#include <stdio.h>
+
+int main (int argc, char **argv)
+{
+ return yyparse ();
+}
+
+int yyerror (char* errstr)
+{
+ printf ("Error: %s\n", errstr);
+ return 1;
+}
diff --git a/examples/hello_calc2/test.mk b/examples/hello_calc2/test.mk
new file mode 100644
index 0000000..cf8cf2f
--- /dev/null
+++ b/examples/hello_calc2/test.mk
@@ -0,0 +1,32 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ ${.OBJDIR}/calc < ${.CURDIR}/expressions.txt; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_compilers/Makefile b/examples/hello_compilers/Makefile
new file mode 100644
index 0000000..6f9563a
--- /dev/null
+++ b/examples/hello_compilers/Makefile
@@ -0,0 +1,31 @@
+MKC_CHECK_DEFINES += __INTEL_COMPILER __GNUC__ _MSC_VER __PCC__ __SUNPRO_C
+MKC_CHECK_DEFINES += __DECC _COMPILER_VERSION
+
+PROG = compiler_test
+
+MKC_REQD = 0.10.0
+
+WARNS = 4
+
+.include <mkc.configure.mk>
+
+.if ${HAVE_DEFINE._MSC_VER:U0}
+msg = Microsoft C Compiler
+.elif ${HAVE_DEFINE.__INTEL_COMPILER:U0}
+msg = Intel C Compiler
+.elif ${HAVE_DEFINE.__PCC__:U0}
+msg = Portable C Compiler
+.elif ${HAVE_DEFINE.__GNUC__:U1}
+msg = GNU C Compiler
+.elif ${HAVE_DEFINE.__SUNPRO_C:U1}
+msg = SunPro C Compiler
+.elif ${HAVE_DEFINE._COMPILER_VERSION:U1}
+msg = SGI MIPSPro C Compiler
+.else
+msg = Unknown compiler
+.endif
+
+CFLAGS += -DMSG='"${msg}"'
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_compilers/compiler_test.c b/examples/hello_compilers/compiler_test.c
new file mode 100644
index 0000000..30bd714
--- /dev/null
+++ b/examples/hello_compilers/compiler_test.c
@@ -0,0 +1,52 @@
+#include <stdio.h>
+#include <string.h>
+
+#if defined(HAVE_DEFINE__COMPILER_VERSION) && defined(HAVE_DEFINE___GNUC__)
+#undef HAVE_DEFINE__COMPILER_VERSION
+#endif
+
+
+
+#ifndef HAVE_DEFINE__MSC_VER
+#define HAVE_DEFINE__MSC_VER 0
+#endif
+
+#ifndef HAVE_DEFINE___GNUC__
+#define HAVE_DEFINE___GNUC__ 0
+#endif
+
+#ifndef HAVE_DEFINE___INTEL_COMPILER
+#define HAVE_DEFINE___INTEL_COMPILER 0
+#else
+#undef HAVE_DEFINE___GNUC__
+#define HAVE_DEFINE___GNUC__ 0
+#endif
+
+#ifndef HAVE_DEFINE___PCC__
+#define HAVE_DEFINE___PCC__ 0
+#endif
+
+#ifndef HAVE_DEFINE___SUNPRO_C
+#define HAVE_DEFINE___SUNPRO_C 0
+#endif
+
+#ifndef HAVE_DEFINE___DECC
+#define HAVE_DEFINE___DECC 0
+#endif
+
+#ifndef HAVE_DEFINE__COMPILER_VERSION
+#define HAVE_DEFINE__COMPILER_VERSION 0
+#endif
+
+char msg [] = "Compiled by " MSG;
+
+int main (int argc, char **argv)
+{
+ printf ("%d\n", (strlen (MSG) > 0) +
+ HAVE_DEFINE__MSC_VER + HAVE_DEFINE___INTEL_COMPILER +
+ HAVE_DEFINE___PCC__ + HAVE_DEFINE___GNUC__ +
+ HAVE_DEFINE___SUNPRO_C + HAVE_DEFINE___DECC +
+ HAVE_DEFINE__COMPILER_VERSION);
+
+ return 0;
+}
diff --git a/examples/hello_compilers/expect.out b/examples/hello_compilers/expect.out
new file mode 100644
index 0000000..f2c9e71
--- /dev/null
+++ b/examples/hello_compilers/expect.out
@@ -0,0 +1,76 @@
+2
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_define__COMPILER_VERSION.c
+/objdir/_mkc_define__COMPILER_VERSION.err
+/objdir/_mkc_define__COMPILER_VERSION.res
+/objdir/_mkc_define__MSC_VER.c
+/objdir/_mkc_define__MSC_VER.err
+/objdir/_mkc_define__MSC_VER.res
+/objdir/_mkc_define___DECC.c
+/objdir/_mkc_define___DECC.err
+/objdir/_mkc_define___DECC.res
+/objdir/_mkc_define___GNUC__.c
+/objdir/_mkc_define___GNUC__.err
+/objdir/_mkc_define___GNUC__.res
+/objdir/_mkc_define___INTEL_COMPILER.c
+/objdir/_mkc_define___INTEL_COMPILER.err
+/objdir/_mkc_define___INTEL_COMPILER.res
+/objdir/_mkc_define___PCC__.c
+/objdir/_mkc_define___PCC__.err
+/objdir/_mkc_define___PCC__.res
+/objdir/_mkc_define___SUNPRO_C.c
+/objdir/_mkc_define___SUNPRO_C.err
+/objdir/_mkc_define___SUNPRO_C.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/compiler_test
+/objdir/compiler_test.c
+/objdir/compiler_test.o
+/objdir/expect.out
+/objdir/hello_compilers.test.out.tmp
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/compiler_test
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_define__COMPILER_VERSION.c
+/objdir/_mkc_define__COMPILER_VERSION.err
+/objdir/_mkc_define__COMPILER_VERSION.res
+/objdir/_mkc_define__MSC_VER.c
+/objdir/_mkc_define__MSC_VER.err
+/objdir/_mkc_define__MSC_VER.res
+/objdir/_mkc_define___DECC.c
+/objdir/_mkc_define___DECC.err
+/objdir/_mkc_define___DECC.res
+/objdir/_mkc_define___GNUC__.c
+/objdir/_mkc_define___GNUC__.err
+/objdir/_mkc_define___GNUC__.res
+/objdir/_mkc_define___INTEL_COMPILER.c
+/objdir/_mkc_define___INTEL_COMPILER.err
+/objdir/_mkc_define___INTEL_COMPILER.res
+/objdir/_mkc_define___PCC__.c
+/objdir/_mkc_define___PCC__.err
+/objdir/_mkc_define___PCC__.res
+/objdir/_mkc_define___SUNPRO_C.c
+/objdir/_mkc_define___SUNPRO_C.err
+/objdir/_mkc_define___SUNPRO_C.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/compiler_test.c
+/objdir/expect.out
+/objdir/hello_compilers.test.out.tmp
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/compiler_test.c
+/objdir/expect.out
+/objdir/hello_compilers.test.out.tmp
+/objdir/test.mk
diff --git a/examples/hello_compilers/test.mk b/examples/hello_compilers/test.mk
new file mode 100644
index 0000000..d917440
--- /dev/null
+++ b/examples/hello_compilers/test.mk
@@ -0,0 +1,32 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ ${.OBJDIR}/compiler_test; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_customtests/Makefile b/examples/hello_customtests/Makefile
new file mode 100644
index 0000000..169bbad
--- /dev/null
+++ b/examples/hello_customtests/Makefile
@@ -0,0 +1,29 @@
+PROG = hello_customtests
+
+WARNS = 4
+
+MKC_CHECK_CUSTOM = alloca_in_stdlib_h # C lang check
+MKC_CHECK_CUSTOM += alloca_in_alloca_h # C lang check
+MKC_CHECK_CUSTOM += cxx_with_templates # C++ lang check
+MKC_CHECK_CUSTOM += true_is_available # script-based check
+MKC_CHECK_CUSTOM += shtest # script-based check
+
+MKC_CUSTOM_FN.alloca_in_stdlib_h = custom_tests/alloca_in_stdlib_h.c
+MKC_CUSTOM_FN.alloca_in_alloca_h = custom_tests/alloca_in_alloca_h.c
+MKC_CUSTOM_FN.cxx_with_templates = custom_tests/cxx_with_templates.cc
+MKC_CUSTOM_FN.true_is_available = custom_tests/true_is_available
+MKC_CUSTOM_FN.shtest = custom_tests/shtest
+
+MKC_CHECK_BUILTINS += endianess
+
+MKC_REQD = 0.12.0
+
+.include <mkc.configure.mk>
+
+BUILTIN.endianess ?=
+.if ${BUILTIN.endianess} != little && ${BUILTIN.endianess} != big
+MKC_ERR_MSG = "Do you run PDP-11?"
+.endif
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_customtests/custom_tests/alloca_in_alloca_h.c b/examples/hello_customtests/custom_tests/alloca_in_alloca_h.c
new file mode 100644
index 0000000..4ff3f19
--- /dev/null
+++ b/examples/hello_customtests/custom_tests/alloca_in_alloca_h.c
@@ -0,0 +1,9 @@
+#include <alloca.h>
+
+int main (int argc, char **argv)
+{
+#ifndef alloca
+ void *p = &alloca;
+#endif
+ return 0;
+}
diff --git a/examples/hello_customtests/custom_tests/alloca_in_stdlib_h.c b/examples/hello_customtests/custom_tests/alloca_in_stdlib_h.c
new file mode 100644
index 0000000..9b1e7a1
--- /dev/null
+++ b/examples/hello_customtests/custom_tests/alloca_in_stdlib_h.c
@@ -0,0 +1,9 @@
+#include <stdlib.h>
+
+int main (int argc, char **argv)
+{
+#ifndef alloca
+ void *p = &alloca;
+#endif
+ return 0;
+}
diff --git a/examples/hello_customtests/custom_tests/cxx_with_templates.cc b/examples/hello_customtests/custom_tests/cxx_with_templates.cc
new file mode 100644
index 0000000..f580a29
--- /dev/null
+++ b/examples/hello_customtests/custom_tests/cxx_with_templates.cc
@@ -0,0 +1,15 @@
+#include <iostream>
+
+template <typename T>
+T ident (T v)
+{
+ return v;
+}
+
+int main (int argc, char **argv)
+{
+ std::cout << ident (123);
+ std::cout << ident ("string");
+
+ return 0;
+}
diff --git a/examples/hello_customtests/custom_tests/shtest b/examples/hello_customtests/custom_tests/shtest
new file mode 100755
index 0000000..ad9ee24
--- /dev/null
+++ b/examples/hello_customtests/custom_tests/shtest
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Just a test
+foo_bar_baz
+echo 0
diff --git a/examples/hello_customtests/custom_tests/true_is_available b/examples/hello_customtests/custom_tests/true_is_available
new file mode 100755
index 0000000..51f40e7
--- /dev/null
+++ b/examples/hello_customtests/custom_tests/true_is_available
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo 1
diff --git a/examples/hello_customtests/expect.out b/examples/hello_customtests/expect.out
new file mode 100644
index 0000000..92f48f1
--- /dev/null
+++ b/examples/hello_customtests/expect.out
@@ -0,0 +1,77 @@
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_custom_alloca_in_alloca_h.err
+/objdir/_mkc_custom_alloca_in_alloca_h.res
+/objdir/_mkc_custom_alloca_in_stdlib_h.err
+/objdir/_mkc_custom_alloca_in_stdlib_h.res
+/objdir/_mkc_custom_cxx_with_templates.err
+/objdir/_mkc_custom_cxx_with_templates.res
+/objdir/_mkc_custom_endianess.err
+/objdir/_mkc_custom_endianess.res
+/objdir/_mkc_custom_shtest.err
+/objdir/_mkc_custom_shtest.res
+/objdir/_mkc_custom_true_is_available.err
+/objdir/_mkc_custom_true_is_available.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/custom_tests/alloca_in_alloca_h.c
+/objdir/custom_tests/alloca_in_stdlib_h.c
+/objdir/custom_tests/cxx_with_templates.cc
+/objdir/custom_tests/shtest
+/objdir/custom_tests/true_is_available
+/objdir/expect.out
+/objdir/hello_customtests
+/objdir/hello_customtests.c
+/objdir/hello_customtests.o
+/objdir/hello_customtests.test.out.tmp
+/objdir/test.mk
+=========== run ============
+alloca(3) succeeded
+We have C++ compiler with working templates: YES
+We have a working 'true' in bourne shell: YES
+shtest is good: NO
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/hello_customtests
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_custom_alloca_in_alloca_h.err
+/objdir/_mkc_custom_alloca_in_alloca_h.res
+/objdir/_mkc_custom_alloca_in_stdlib_h.err
+/objdir/_mkc_custom_alloca_in_stdlib_h.res
+/objdir/_mkc_custom_cxx_with_templates.err
+/objdir/_mkc_custom_cxx_with_templates.res
+/objdir/_mkc_custom_endianess.err
+/objdir/_mkc_custom_endianess.res
+/objdir/_mkc_custom_shtest.err
+/objdir/_mkc_custom_shtest.res
+/objdir/_mkc_custom_true_is_available.err
+/objdir/_mkc_custom_true_is_available.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/custom_tests/alloca_in_alloca_h.c
+/objdir/custom_tests/alloca_in_stdlib_h.c
+/objdir/custom_tests/cxx_with_templates.cc
+/objdir/custom_tests/shtest
+/objdir/custom_tests/true_is_available
+/objdir/expect.out
+/objdir/hello_customtests.c
+/objdir/hello_customtests.test.out.tmp
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/custom_tests/alloca_in_alloca_h.c
+/objdir/custom_tests/alloca_in_stdlib_h.c
+/objdir/custom_tests/cxx_with_templates.cc
+/objdir/custom_tests/shtest
+/objdir/custom_tests/true_is_available
+/objdir/expect.out
+/objdir/hello_customtests.c
+/objdir/hello_customtests.test.out.tmp
+/objdir/test.mk
diff --git a/examples/hello_customtests/hello_customtests.c b/examples/hello_customtests/hello_customtests.c
new file mode 100644
index 0000000..a801f4f
--- /dev/null
+++ b/examples/hello_customtests/hello_customtests.c
@@ -0,0 +1,38 @@
+#include <stdio.h>
+
+#if CUSTOM_ALLOCA_IN_STDLIB_H
+#include <stdlib.h>
+#elif CUSTOM_ALLOCA_IN_ALLOCA_H
+#include <alloca.h>
+#endif
+
+#ifndef CUSTOM_SHTEST
+#define CUSTOM_SHTEST 0
+#endif
+
+#ifndef CUSTOM_CXX_WITH_TEMPLATES
+#define CUSTOM_CXX_WITH_TEMPLATES 0
+#endif
+
+#ifndef CUSTOM_TRUE_IS_AVAILABLE
+#define CUSTOM_TRUE_IS_AVAILABLE 0
+#endif
+
+int main (int argc, char** argv)
+{
+ if (alloca (100))
+ puts ("alloca(3) succeeded");
+ else
+ puts ("alloca(3) failed");
+
+ printf ("We have C++ compiler with working templates: %s\n",
+ (CUSTOM_CXX_WITH_TEMPLATES ? "YES" : "NO"));
+
+ printf ("We have a working 'true' in bourne shell: %s\n",
+ (CUSTOM_TRUE_IS_AVAILABLE ? "YES" : "NO"));
+
+ printf ("shtest is good: %s\n",
+ (CUSTOM_SHTEST ? "YES" : "NO"));
+
+ return 0;
+}
diff --git a/examples/hello_customtests/test.mk b/examples/hello_customtests/test.mk
new file mode 100644
index 0000000..99e946e
--- /dev/null
+++ b/examples/hello_customtests/test.mk
@@ -0,0 +1,34 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo =========== run ============; \
+ ${.OBJDIR}/hello_customtests; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_customtests2/Makefile b/examples/hello_customtests2/Makefile
new file mode 100644
index 0000000..98d8732
--- /dev/null
+++ b/examples/hello_customtests2/Makefile
@@ -0,0 +1,13 @@
+PROG = hello_customtests2
+
+WARNS = 4
+
+MKC_CUSTOM_DIR = ${.CURDIR}/../hello_customtests/custom_tests
+
+MKC_CHECK_CUSTOM = alloca_in_stdlib_h
+MKC_CHECK_CUSTOM += alloca_in_alloca_h
+
+MKC_REQD = 0.11.0
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_customtests2/expect.out b/examples/hello_customtests2/expect.out
new file mode 100644
index 0000000..bbf1f24
--- /dev/null
+++ b/examples/hello_customtests2/expect.out
@@ -0,0 +1,43 @@
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_custom_alloca_in_alloca_h.err
+/objdir/_mkc_custom_alloca_in_alloca_h.res
+/objdir/_mkc_custom_alloca_in_stdlib_h.err
+/objdir/_mkc_custom_alloca_in_stdlib_h.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/expect.out
+/objdir/hello_customtests2
+/objdir/hello_customtests2.c
+/objdir/hello_customtests2.o
+/objdir/hello_customtests2.test.out.tmp
+/objdir/test.mk
+=========== run ============
+alloca(3) succeeded
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/hello_customtests2
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_custom_alloca_in_alloca_h.err
+/objdir/_mkc_custom_alloca_in_alloca_h.res
+/objdir/_mkc_custom_alloca_in_stdlib_h.err
+/objdir/_mkc_custom_alloca_in_stdlib_h.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/expect.out
+/objdir/hello_customtests2.c
+/objdir/hello_customtests2.test.out.tmp
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/hello_customtests2.c
+/objdir/hello_customtests2.test.out.tmp
+/objdir/test.mk
diff --git a/examples/hello_customtests2/hello_customtests2.c b/examples/hello_customtests2/hello_customtests2.c
new file mode 100644
index 0000000..410e634
--- /dev/null
+++ b/examples/hello_customtests2/hello_customtests2.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+#if CUSTOM_ALLOCA_IN_STDLIB_H
+#include <stdlib.h>
+#elif CUSTOM_ALLOCA_IN_ALLOCA_H
+#include <alloca.h>
+#endif
+
+int main (int argc, char** argv)
+{
+ if (alloca (100))
+ puts ("alloca(3) succeeded");
+ else
+ puts ("alloca(3) failed");
+
+ return 0;
+}
diff --git a/examples/hello_customtests2/test.mk b/examples/hello_customtests2/test.mk
new file mode 100644
index 0000000..438e4ab
--- /dev/null
+++ b/examples/hello_customtests2/test.mk
@@ -0,0 +1,34 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo =========== run ============; \
+ ${.OBJDIR}/hello_customtests2; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_cxx/Makefile b/examples/hello_cxx/Makefile
new file mode 100644
index 0000000..f9a1a11
--- /dev/null
+++ b/examples/hello_cxx/Makefile
@@ -0,0 +1,12 @@
+PROG = hello_cxx
+
+WARNS = 4
+
+CPPFLAGS += -I.
+
+SRCS = hello_msg.cc main.cc
+
+MKC_REQD = 0.12.9
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_cxx/expect.out b/examples/hello_cxx/expect.out
new file mode 100644
index 0000000..626ff9f
--- /dev/null
+++ b/examples/hello_cxx/expect.out
@@ -0,0 +1,41 @@
+Hello world!
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_cxx_type.err
+/objdir/_mkc_cxx_type.res
+/objdir/_mkc_prog_cxx.err
+/objdir/_mkc_prog_cxx.res
+/objdir/expect.out
+/objdir/hello_cxx
+/objdir/hello_cxx.test.out.tmp
+/objdir/hello_msg.cc
+/objdir/hello_msg.h
+/objdir/hello_msg.o
+/objdir/main.cc
+/objdir/main.o
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/hello_cxx
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_cxx_type.err
+/objdir/_mkc_cxx_type.res
+/objdir/_mkc_prog_cxx.err
+/objdir/_mkc_prog_cxx.res
+/objdir/expect.out
+/objdir/hello_cxx.test.out.tmp
+/objdir/hello_msg.cc
+/objdir/hello_msg.h
+/objdir/main.cc
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/hello_cxx.test.out.tmp
+/objdir/hello_msg.cc
+/objdir/hello_msg.h
+/objdir/main.cc
+/objdir/test.mk
diff --git a/examples/hello_cxx/hello_msg.cc b/examples/hello_cxx/hello_msg.cc
new file mode 100644
index 0000000..72976ef
--- /dev/null
+++ b/examples/hello_cxx/hello_msg.cc
@@ -0,0 +1,6 @@
+#include <iostream>
+
+void hello_msg ()
+{
+ std::cout << "Hello world!\n";
+}
diff --git a/examples/hello_cxx/hello_msg.h b/examples/hello_cxx/hello_msg.h
new file mode 100644
index 0000000..944c11f
--- /dev/null
+++ b/examples/hello_cxx/hello_msg.h
@@ -0,0 +1 @@
+void hello_msg ();
diff --git a/examples/hello_cxx/main.cc b/examples/hello_cxx/main.cc
new file mode 100644
index 0000000..4b93a98
--- /dev/null
+++ b/examples/hello_cxx/main.cc
@@ -0,0 +1,7 @@
+#include "hello_msg.h"
+
+int main (int argc, char **argv)
+{
+ hello_msg ();
+ return 0;
+}
diff --git a/examples/hello_cxx/test.mk b/examples/hello_cxx/test.mk
new file mode 100644
index 0000000..f930d66
--- /dev/null
+++ b/examples/hello_cxx/test.mk
@@ -0,0 +1,32 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ ${.OBJDIR}/hello_cxx; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_cxxlib/Makefile b/examples/hello_cxxlib/Makefile
new file mode 100644
index 0000000..2469051
--- /dev/null
+++ b/examples/hello_cxxlib/Makefile
@@ -0,0 +1,8 @@
+PROJECTNAME = hello_cxx
+
+SUBDIR += cxxlib
+SUBDIR += .WAIT
+SUBDIR += cxxapp
+
+.include "test.mk"
+.include <mkc.subdir.mk>
diff --git a/examples/hello_cxxlib/cxxapp/Makefile b/examples/hello_cxxlib/cxxapp/Makefile
new file mode 100644
index 0000000..2bada12
--- /dev/null
+++ b/examples/hello_cxxlib/cxxapp/Makefile
@@ -0,0 +1,8 @@
+PROG = cxxapp
+SRCS = cxxapp.cc
+
+WARNS = 4
+
+.include "../cxxlib/linkme.mk"
+
+.include <mkc.prog.mk>
diff --git a/examples/hello_cxxlib/cxxapp/cxxapp.cc b/examples/hello_cxxlib/cxxapp/cxxapp.cc
new file mode 100644
index 0000000..0284107
--- /dev/null
+++ b/examples/hello_cxxlib/cxxapp/cxxapp.cc
@@ -0,0 +1,11 @@
+#include <iostream>
+
+#include "hello_msg.h"
+
+int main (int argc, char **)
+{
+ hello_msg1 ();
+ std::cout << hello_msg2 () << '\n';
+
+ return 0;
+}
diff --git a/examples/hello_cxxlib/cxxlib/Makefile b/examples/hello_cxxlib/cxxlib/Makefile
new file mode 100644
index 0000000..a9f974a
--- /dev/null
+++ b/examples/hello_cxxlib/cxxlib/Makefile
@@ -0,0 +1,15 @@
+LIB = cxxlib
+
+WARNS = 4
+
+SHLIB_MAJOR = 1
+SHLIB_MINOR = 0
+SHLIB_TEENY = 5
+
+INCS = hello_msg.h impl/hello_msg1.h impl/hello_msg2.h
+
+INCSSRCDIR = include
+
+SRCS = hello_msg1.cpp hello_msg2.cpp
+
+.include <mkc.lib.mk>
diff --git a/examples/hello_cxxlib/cxxlib/hello_msg1.cpp b/examples/hello_cxxlib/cxxlib/hello_msg1.cpp
new file mode 100644
index 0000000..3271d8c
--- /dev/null
+++ b/examples/hello_cxxlib/cxxlib/hello_msg1.cpp
@@ -0,0 +1,6 @@
+#include <iostream>
+
+void hello_msg1 ()
+{
+ std::cout << "Hello world 1!\n";
+}
diff --git a/examples/hello_cxxlib/cxxlib/hello_msg2.cpp b/examples/hello_cxxlib/cxxlib/hello_msg2.cpp
new file mode 100644
index 0000000..a65f897
--- /dev/null
+++ b/examples/hello_cxxlib/cxxlib/hello_msg2.cpp
@@ -0,0 +1,10 @@
+#include <iostream>
+#include <string>
+
+std::string hello_msg2 ()
+{
+ std::string ret = "hello";
+ ret += " world";
+ ret += " 2!";
+ return ret;
+}
diff --git a/examples/hello_cxxlib/cxxlib/include/hello_msg.h b/examples/hello_cxxlib/cxxlib/include/hello_msg.h
new file mode 100644
index 0000000..5ab617d
--- /dev/null
+++ b/examples/hello_cxxlib/cxxlib/include/hello_msg.h
@@ -0,0 +1,7 @@
+#ifndef _HELLO_H_
+#define _HELLO_H_
+
+#include "impl/hello_msg1.h"
+#include "impl/hello_msg2.h"
+
+#endif // _HELLO_H_
diff --git a/examples/hello_cxxlib/cxxlib/include/impl/hello_msg1.h b/examples/hello_cxxlib/cxxlib/include/impl/hello_msg1.h
new file mode 100644
index 0000000..fa6cc7a
--- /dev/null
+++ b/examples/hello_cxxlib/cxxlib/include/impl/hello_msg1.h
@@ -0,0 +1,6 @@
+#ifndef _HELLO_MSG1_H_
+#define _HELLO_MSG1_H_
+
+void hello_msg1 ();
+
+#endif // _HELLO_MSG1_H_
diff --git a/examples/hello_cxxlib/cxxlib/include/impl/hello_msg2.h b/examples/hello_cxxlib/cxxlib/include/impl/hello_msg2.h
new file mode 100644
index 0000000..5a39f30
--- /dev/null
+++ b/examples/hello_cxxlib/cxxlib/include/impl/hello_msg2.h
@@ -0,0 +1,8 @@
+#ifndef _HELLO_MSG2_H_
+#define _HELLO_MSG2_H_
+
+#include <string>
+
+std::string hello_msg2 ();
+
+#endif // _HELLO_MSG2_H_
diff --git a/examples/hello_cxxlib/cxxlib/linkme.mk b/examples/hello_cxxlib/cxxlib/linkme.mk
new file mode 100644
index 0000000..8b9206e
--- /dev/null
+++ b/examples/hello_cxxlib/cxxlib/linkme.mk
@@ -0,0 +1,5 @@
+PATH.cxxlib := ${.PARSEDIR}
+
+CPPFLAGS += -I${PATH.cxxlib}/include
+DPLIBDIRS += ${PATH.cxxlib}
+LDADD += -lcxxlib
diff --git a/examples/hello_cxxlib/expect.out b/examples/hello_cxxlib/expect.out
new file mode 100644
index 0000000..e961c75
--- /dev/null
+++ b/examples/hello_cxxlib/expect.out
@@ -0,0 +1,75 @@
+Hello world 1!
+hello world 2!
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_cxx_type.err
+/objdir/_mkc_cxx_type.res
+/objdir/_mkc_prog_cxx.err
+/objdir/_mkc_prog_cxx.res
+/objdir/cxxapp/Makefile
+/objdir/cxxapp/cxxapp
+/objdir/cxxapp/cxxapp.cc
+/objdir/cxxapp/cxxapp.o
+/objdir/cxxlib/Makefile
+/objdir/cxxlib/hello_msg1.cpp
+/objdir/cxxlib/hello_msg1.o
+/objdir/cxxlib/hello_msg1.os
+/objdir/cxxlib/hello_msg2.cpp
+/objdir/cxxlib/hello_msg2.o
+/objdir/cxxlib/hello_msg2.os
+/objdir/cxxlib/include/hello_msg.h
+/objdir/cxxlib/include/impl/hello_msg1.h
+/objdir/cxxlib/include/impl/hello_msg2.h
+/objdir/cxxlib/libcxxlib.a
+/objdir/cxxlib/libcxxlib.so.1.0.5
+/objdir/cxxlib/linkme.mk
+/objdir/expect.out
+/objdir/hello_cxxlib.test.out.tmp
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/cxxapp
+/objdir/prefix/include
+/objdir/prefix/include/hello_msg.h
+/objdir/prefix/include/impl
+/objdir/prefix/include/impl/hello_msg1.h
+/objdir/prefix/include/impl/hello_msg2.h
+/objdir/prefix/lib
+/objdir/prefix/lib/libcxxlib.a
+/objdir/prefix/lib/libcxxlib.so
+/objdir/prefix/lib/libcxxlib.so.1
+/objdir/prefix/lib/libcxxlib.so.1.0.5
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_cxx_type.err
+/objdir/_mkc_cxx_type.res
+/objdir/_mkc_prog_cxx.err
+/objdir/_mkc_prog_cxx.res
+/objdir/cxxapp/Makefile
+/objdir/cxxapp/cxxapp.cc
+/objdir/cxxlib/Makefile
+/objdir/cxxlib/hello_msg1.cpp
+/objdir/cxxlib/hello_msg2.cpp
+/objdir/cxxlib/include/hello_msg.h
+/objdir/cxxlib/include/impl/hello_msg1.h
+/objdir/cxxlib/include/impl/hello_msg2.h
+/objdir/cxxlib/linkme.mk
+/objdir/expect.out
+/objdir/hello_cxxlib.test.out.tmp
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/cxxapp/Makefile
+/objdir/cxxapp/cxxapp.cc
+/objdir/cxxlib/Makefile
+/objdir/cxxlib/hello_msg1.cpp
+/objdir/cxxlib/hello_msg2.cpp
+/objdir/cxxlib/include/hello_msg.h
+/objdir/cxxlib/include/impl/hello_msg1.h
+/objdir/cxxlib/include/impl/hello_msg2.h
+/objdir/cxxlib/linkme.mk
+/objdir/expect.out
+/objdir/hello_cxxlib.test.out.tmp
+/objdir/test.mk
diff --git a/examples/hello_cxxlib/test.mk b/examples/hello_cxxlib/test.mk
new file mode 100644
index 0000000..c0db93a
--- /dev/null
+++ b/examples/hello_cxxlib/test.mk
@@ -0,0 +1,35 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ 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; \
+ ${.CURDIR}/cxxapp/cxxapp; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_dictd/Makefile b/examples/hello_dictd/Makefile
new file mode 100644
index 0000000..fe7e319
--- /dev/null
+++ b/examples/hello_dictd/Makefile
@@ -0,0 +1,17 @@
+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
+
+# Subproject "doc" has no dependencies
+SUBPRJ += doc
+# and is not built by default
+SUBPRJ_DFLT = dict dictd dictzip dictfmt
+
+.include "test.mk"
+.include <mkc.subprj.mk>
diff --git a/examples/hello_dictd/Makefile.inc b/examples/hello_dictd/Makefile.inc
new file mode 100644
index 0000000..82ca367
--- /dev/null
+++ b/examples/hello_dictd/Makefile.inc
@@ -0,0 +1,11 @@
+# Create Position Independent Executables (PIE)
+MKPIE ?= yes
+
+# Enable SSP
+USE_SSP ?= yes
+
+# Enable RELRO
+USE_RELRO ?= yes
+
+# Fortify sources
+USE_FORT ?= yes
diff --git a/examples/hello_dictd/dict/Makefile b/examples/hello_dictd/dict/Makefile
new file mode 100644
index 0000000..b7e3e1c
--- /dev/null
+++ b/examples/hello_dictd/dict/Makefile
@@ -0,0 +1,9 @@
+PROG = dict
+MAN = dict.1
+
+WARNS = 4
+
+.include "../libcommon/linkme.mk"
+.include "../libmaa/linkme.mk"
+
+.include <mkc.prog.mk>
diff --git a/examples/hello_dictd/dict/dict.1 b/examples/hello_dictd/dict/dict.1
new file mode 100644
index 0000000..deb00c5
--- /dev/null
+++ b/examples/hello_dictd/dict/dict.1
@@ -0,0 +1,13 @@
+.\" Written by by Aleksey Cheusov (vle@gmx.net)
+.\" ------------------------------------------------------------------
+.TH DICT 1 "May 16, 2010" "" ""
+.SH NAME
+dict \- dictionary protocol client
+.SH SYNOPSIS
+.B "dict"
+.br
+.SH DESCRIPTION
+.B dict
+is just a fake application
+.SH AUTHOR
+Aleksey Cheusov <vle@gmx.net>
diff --git a/examples/hello_dictd/dict/dict.c b/examples/hello_dictd/dict/dict.c
new file mode 100644
index 0000000..554f4da
--- /dev/null
+++ b/examples/hello_dictd/dict/dict.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+
+int fake1 (void);
+int fake2 (void);
+int fake4 (void);
+int fake5 (void);
+int fake6 (void);
+
+int main (int argc, char **argv)
+{
+ printf ("dict: fake1=%d\n", fake1 ());
+ printf ("dict: fake2=%d\n", fake2 ());
+ printf ("dict: fake4=%d\n", fake4 ());
+ printf ("dict: fake5=%d\n", fake5 ());
+ printf ("dict: fake6=%d\n", fake6 ());
+
+ return 0;
+}
diff --git a/examples/hello_dictd/dictd/Makefile b/examples/hello_dictd/dictd/Makefile
new file mode 100644
index 0000000..1f3d8ca
--- /dev/null
+++ b/examples/hello_dictd/dictd/Makefile
@@ -0,0 +1,9 @@
+PROG = dictd
+MAN = dictd.8
+
+WARNS = 4
+
+.include "../libcommon/linkme.mk"
+.include "../libmaa/linkme.mk"
+
+.include <mkc.prog.mk>
diff --git a/examples/hello_dictd/dictd/dictd.8 b/examples/hello_dictd/dictd/dictd.8
new file mode 100644
index 0000000..cc73511
--- /dev/null
+++ b/examples/hello_dictd/dictd/dictd.8
@@ -0,0 +1,13 @@
+.\" Written by by Aleksey Cheusov (vle@gmx.net)
+.\" ------------------------------------------------------------------
+.TH DICTD 1 "May 16, 2010" "" ""
+.SH NAME
+dictd \- dictionary protocol server
+.SH SYNOPSIS
+.B "dictd"
+.br
+.SH DESCRIPTION
+.B dictd
+is just a fake application
+.SH AUTHOR
+Aleksey Cheusov <vle@gmx.net>
diff --git a/examples/hello_dictd/dictd/dictd.c b/examples/hello_dictd/dictd/dictd.c
new file mode 100644
index 0000000..bcabcc7
--- /dev/null
+++ b/examples/hello_dictd/dictd/dictd.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+
+int fake1 (void);
+int fake2 (void);
+int fake4 (void);
+int fake5 (void);
+int fake6 (void);
+
+int main (int argc, char **argv)
+{
+ printf ("dictd: fake1=%d\n", fake1 ());
+ printf ("dictd: fake2=%d\n", fake2 ());
+ printf ("dictd: fake4=%d\n", fake4 ());
+ printf ("dictd: fake5=%d\n", fake5 ());
+ printf ("dictd: fake6=%d\n", fake6 ());
+
+ return 0;
+}
diff --git a/examples/hello_dictd/dictfmt/Makefile b/examples/hello_dictd/dictfmt/Makefile
new file mode 100644
index 0000000..a34d541
--- /dev/null
+++ b/examples/hello_dictd/dictfmt/Makefile
@@ -0,0 +1,9 @@
+PROG = dictfmt
+MAN = dictfmt.1
+
+WARNS = 4
+
+.include "../libcommon/linkme.mk"
+.include "../libmaa/linkme.mk"
+
+.include <mkc.prog.mk>
diff --git a/examples/hello_dictd/dictfmt/dictfmt.1 b/examples/hello_dictd/dictfmt/dictfmt.1
new file mode 100644
index 0000000..a83c712
--- /dev/null
+++ b/examples/hello_dictd/dictfmt/dictfmt.1
@@ -0,0 +1,13 @@
+.\" Written by by Aleksey Cheusov (vle@gmx.net)
+.\" ------------------------------------------------------------------
+.TH DICTFMT 1 "May 16, 2010" "" ""
+.SH NAME
+dictfmt \- dictionary formatting utility
+.SH SYNOPSIS
+.B "dictfmt"
+.br
+.SH DESCRIPTION
+.B dictfmt
+is just a fake application
+.SH AUTHOR
+Aleksey Cheusov <vle@gmx.net>
diff --git a/examples/hello_dictd/dictfmt/dictfmt.c b/examples/hello_dictd/dictfmt/dictfmt.c
new file mode 100644
index 0000000..6ef96fe
--- /dev/null
+++ b/examples/hello_dictd/dictfmt/dictfmt.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+
+int fake1 (void);
+int fake2 (void);
+int fake4 (void);
+int fake5 (void);
+int fake6 (void);
+
+int main (int argc, char **argv)
+{
+ printf ("dictfmt: fake1=%d\n", fake1 ());
+ printf ("dictfmt: fake2=%d\n", fake2 ());
+ printf ("dictfmt: fake4=%d\n", fake4 ());
+ printf ("dictfmt: fake5=%d\n", fake5 ());
+ printf ("dictfmt: fake6=%d\n", fake6 ());
+
+ return 0;
+}
diff --git a/examples/hello_dictd/dictzip/Makefile b/examples/hello_dictd/dictzip/Makefile
new file mode 100644
index 0000000..db50d14
--- /dev/null
+++ b/examples/hello_dictd/dictzip/Makefile
@@ -0,0 +1,10 @@
+PROG = dictzip
+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/dictzip/dictzip.1 b/examples/hello_dictd/dictzip/dictzip.1
new file mode 100644
index 0000000..8534683
--- /dev/null
+++ b/examples/hello_dictd/dictzip/dictzip.1
@@ -0,0 +1,13 @@
+.\" Written by by Aleksey Cheusov (vle@gmx.net)
+.\" ------------------------------------------------------------------
+.TH DICTZIP 1 "May 16, 2010" "" ""
+.SH NAME
+dictd \- dictionary protocol server
+.SH SYNOPSIS
+.B "dictzip"
+.br
+.SH DESCRIPTION
+.B dictzip
+is just a fake application
+.SH AUTHOR
+Aleksey Cheusov <vle@gmx.net>
diff --git a/examples/hello_dictd/dictzip/dictzip.c b/examples/hello_dictd/dictzip/dictzip.c
new file mode 100644
index 0000000..09f057f
--- /dev/null
+++ b/examples/hello_dictd/dictzip/dictzip.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+
+int fake1 (void);
+int fake2 (void);
+int fake3 (void);
+int fake4 (void);
+int fake5 (void);
+int fake6 (void);
+
+int main (int argc, char **argv)
+{
+ printf ("dictzip: fake1=%d\n", fake1 ());
+ printf ("dictzip: fake2=%d\n", fake2 ());
+ printf ("dictzip: fake3=%d\n", fake3 ());
+ printf ("dictzip: fake4=%d\n", fake4 ());
+ printf ("dictzip: fake5=%d\n", fake5 ());
+ printf ("dictzip: fake6=%d\n", fake6 ());
+
+ return 0;
+}
diff --git a/examples/hello_dictd/doc/Makefile b/examples/hello_dictd/doc/Makefile
new file mode 100644
index 0000000..e2fc936
--- /dev/null
+++ b/examples/hello_dictd/doc/Makefile
@@ -0,0 +1,6 @@
+FILES = doc.txt
+FILESDIR = ${DOCDIR}
+
+DOCDIR ?= ${DATADIR}/doc/dict
+
+.include <mkc.files.mk>
diff --git a/examples/hello_dictd/doc/doc.txt b/examples/hello_dictd/doc/doc.txt
new file mode 100644
index 0000000..cd591db
--- /dev/null
+++ b/examples/hello_dictd/doc/doc.txt
@@ -0,0 +1 @@
+bla bla bla
diff --git a/examples/hello_dictd/expect.out b/examples/hello_dictd/expect.out
new file mode 100644
index 0000000..bdcbe32
--- /dev/null
+++ b/examples/hello_dictd/expect.out
@@ -0,0 +1,549 @@
+dict: fake1=1
+dict: fake2=2
+dict: fake4=4
+dict: fake5=5
+dict: fake6=6
+dictd: fake1=1
+dictd: fake2=2
+dictd: fake4=4
+dictd: fake5=5
+dictd: fake6=6
+dictfmt: fake1=1
+dictfmt: fake2=2
+dictfmt: fake4=4
+dictfmt: fake5=5
+dictfmt: fake6=6
+dictzip: fake1=1
+dictzip: fake2=2
+dictzip: fake3=3
+dictzip: fake4=4
+dictzip: fake5=5
+dictzip: fake6=6
+=========== nm ============
+libmaa fake4
+libmaa fake5
+libmaa fake6
+libdz fake3
+=========== all ============
+/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/libcommon.a
+/objdir/libcommon/linkme.mk
+/objdir/libcommon/str.c
+/objdir/libcommon/str.o
+/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/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
+========= installdirs ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/lib
+/objdir/prefix/man
+/objdir/prefix/man/cat1
+/objdir/prefix/man/cat8
+/objdir/prefix/man/man1
+/objdir/prefix/man/man8
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/dict
+/objdir/prefix/bin/dictd
+/objdir/prefix/bin/dictfmt
+/objdir/prefix/bin/dictzip
+/objdir/prefix/lib
+/objdir/prefix/lib/libdz.a
+/objdir/prefix/lib/libdz.so
+/objdir/prefix/lib/libdz.so.1
+/objdir/prefix/lib/libdz.so.1.0
+/objdir/prefix/lib/libmaa.a
+/objdir/prefix/lib/libmaa.so
+/objdir/prefix/lib/libmaa.so.1
+/objdir/prefix/lib/libmaa.so.1.2.0
+/objdir/prefix/man
+/objdir/prefix/man/cat1
+/objdir/prefix/man/cat1/dict.0
+/objdir/prefix/man/cat1/dictfmt.0
+/objdir/prefix/man/cat1/dictzip.0
+/objdir/prefix/man/cat8
+/objdir/prefix/man/cat8/dictd.0
+/objdir/prefix/man/man1
+/objdir/prefix/man/man1/dict.1
+/objdir/prefix/man/man1/dictfmt.1
+/objdir/prefix/man/man1/dictzip.1
+/objdir/prefix/man/man8
+/objdir/prefix/man/man8/dictd.8
+======== uninstall =========
+========== nodeps-cleandir-dictfmt subdir-clean-dictzip ===========
+/objdir/Makefile
+/objdir/Makefile.inc
+/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.1
+/objdir/dictfmt/dictfmt.c
+/objdir/dictzip/Makefile
+/objdir/dictzip/dictzip.1
+/objdir/dictzip/dictzip.c
+/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/libcommon.a
+/objdir/libcommon/linkme.mk
+/objdir/libcommon/str.c
+/objdir/libcommon/str.o
+/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/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
+========== clean ===========
+/objdir/Makefile
+/objdir/Makefile.inc
+/objdir/dict/Makefile
+/objdir/dict/dict.1
+/objdir/dict/dict.c
+/objdir/dictd/Makefile
+/objdir/dictd/dictd.8
+/objdir/dictd/dictd.c
+/objdir/dictfmt/Makefile
+/objdir/dictfmt/dictfmt.1
+/objdir/dictfmt/dictfmt.c
+/objdir/dictzip/Makefile
+/objdir/dictzip/dictzip.1
+/objdir/dictzip/dictzip.c
+/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/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
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/Makefile.inc
+/objdir/dict/Makefile
+/objdir/dict/dict.1
+/objdir/dict/dict.c
+/objdir/dictd/Makefile
+/objdir/dictd/dictd.8
+/objdir/dictd/dictd.c
+/objdir/dictfmt/Makefile
+/objdir/dictfmt/dictfmt.1
+/objdir/dictfmt/dictfmt.c
+/objdir/dictzip/Makefile
+/objdir/dictzip/dictzip.1
+/objdir/dictzip/dictzip.c
+/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/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
+/objdir/test.mk
+======= errorcheck ==========
+/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.1
+/objdir/dict/dict.c
+/objdir/dictd/Makefile
+/objdir/dictd/dictd.8
+/objdir/dictd/dictd.c
+/objdir/dictfmt/Makefile
+/objdir/dictfmt/dictfmt.1
+/objdir/dictfmt/dictfmt.c
+/objdir/dictzip/Makefile
+/objdir/dictzip/dictzip.1
+/objdir/dictzip/dictzip.c
+/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/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
+/objdir/test.mk
+======= all-dict ==========
+/objdir/Makefile
+/objdir/Makefile.inc
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.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.8
+/objdir/dictd/dictd.c
+/objdir/dictfmt/Makefile
+/objdir/dictfmt/dictfmt.1
+/objdir/dictfmt/dictfmt.c
+/objdir/dictzip/Makefile
+/objdir/dictzip/dictzip.1
+/objdir/dictzip/dictzip.c
+/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/libcommon.a
+/objdir/libcommon/linkme.mk
+/objdir/libcommon/str.c
+/objdir/libcommon/str.o
+/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
+========= installdirs-dict ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/lib
+/objdir/prefix/man
+/objdir/prefix/man/cat1
+/objdir/prefix/man/man1
+========= install-dict ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/dict
+/objdir/prefix/lib
+/objdir/prefix/lib/libmaa.a
+/objdir/prefix/lib/libmaa.so
+/objdir/prefix/lib/libmaa.so.1
+/objdir/prefix/lib/libmaa.so.1.2.0
+/objdir/prefix/man
+/objdir/prefix/man/cat1
+/objdir/prefix/man/cat1/dict.0
+/objdir/prefix/man/man1
+/objdir/prefix/man/man1/dict.1
+======= uninstall-dict ==========
+========== clean-dict ===========
+/objdir/Makefile
+/objdir/Makefile.inc
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/dict/Makefile
+/objdir/dict/dict.1
+/objdir/dict/dict.c
+/objdir/dictd/Makefile
+/objdir/dictd/dictd.8
+/objdir/dictd/dictd.c
+/objdir/dictfmt/Makefile
+/objdir/dictfmt/dictfmt.1
+/objdir/dictfmt/dictfmt.c
+/objdir/dictzip/Makefile
+/objdir/dictzip/dictzip.1
+/objdir/dictzip/dictzip.c
+/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/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
+/objdir/test.mk
+======= cleandir-dict ==========
+/objdir/Makefile
+/objdir/Makefile.inc
+/objdir/dict/Makefile
+/objdir/dict/dict.1
+/objdir/dict/dict.c
+/objdir/dictd/Makefile
+/objdir/dictd/dictd.8
+/objdir/dictd/dictd.c
+/objdir/dictfmt/Makefile
+/objdir/dictfmt/dictfmt.1
+/objdir/dictfmt/dictfmt.c
+/objdir/dictzip/Makefile
+/objdir/dictzip/dictzip.1
+/objdir/dictzip/dictzip.c
+/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/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
+/objdir/test.mk
+========= installdirs-doc ==========
+/objdir/prefix
+/objdir/prefix/share
+/objdir/prefix/share/doc
+/objdir/prefix/share/doc/dict
+========= install-doc ==========
+/objdir/prefix
+/objdir/prefix/share
+/objdir/prefix/share/doc
+/objdir/prefix/share/doc/dict
+/objdir/prefix/share/doc/dict/doc.txt
+======= uninstall-doc ==========
+=========== all with NOSUBDIR ============
+/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.1
+/objdir/dictfmt/dictfmt.c
+/objdir/dictzip/Makefile
+/objdir/dictzip/dictzip.1
+/objdir/dictzip/dictzip.c
+/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/libcommon.a
+/objdir/libcommon/linkme.mk
+/objdir/libcommon/str.c
+/objdir/libcommon/str.o
+/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/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
diff --git a/examples/hello_dictd/libcommon/Makefile b/examples/hello_dictd/libcommon/Makefile
new file mode 100644
index 0000000..33e4167
--- /dev/null
+++ b/examples/hello_dictd/libcommon/Makefile
@@ -0,0 +1,10 @@
+# internal static library that implements functions common for dict, dictd etc.
+
+LIB = common
+SRCS = str.c iswalnum.c # and others
+
+WARNS = 4
+
+MKINSTALL = no
+
+.include <mkc.lib.mk>
diff --git a/examples/hello_dictd/libcommon/iswalnum.c b/examples/hello_dictd/libcommon/iswalnum.c
new file mode 100644
index 0000000..7d8962a
--- /dev/null
+++ b/examples/hello_dictd/libcommon/iswalnum.c
@@ -0,0 +1,6 @@
+int fake2 (void);
+
+int fake2 (void)
+{
+ return 2;
+}
diff --git a/examples/hello_dictd/libcommon/linkme.mk b/examples/hello_dictd/libcommon/linkme.mk
new file mode 100644
index 0000000..d574ea8
--- /dev/null
+++ b/examples/hello_dictd/libcommon/linkme.mk
@@ -0,0 +1,5 @@
+PATH.common := ${.PARSEDIR}
+
+CPPFLAGS += -I${PATH.common}
+DPLIBDIRS += ${PATH.common}
+LDADD += -lcommon
diff --git a/examples/hello_dictd/libcommon/str.c b/examples/hello_dictd/libcommon/str.c
new file mode 100644
index 0000000..34972d1
--- /dev/null
+++ b/examples/hello_dictd/libcommon/str.c
@@ -0,0 +1,6 @@
+int fake1 (void);
+
+int fake1 (void)
+{
+ return 1;
+}
diff --git a/examples/hello_dictd/libdz/Makefile b/examples/hello_dictd/libdz/Makefile
new file mode 100644
index 0000000..0b462f2
--- /dev/null
+++ b/examples/hello_dictd/libdz/Makefile
@@ -0,0 +1,15 @@
+# library that implements compression routines for dict.dz format
+
+LIB = dz
+SRCS = dz.c
+
+WARNS = 4
+
+EXPORT_SYMBOLS = export.sym
+
+MKC_REQUIRE_HEADERS = zlib.h
+MKC_REQUIRE_FUNCLIBS = deflate:z
+
+SHLIB_MAJOR = 1
+
+.include <mkc.lib.mk>
diff --git a/examples/hello_dictd/libdz/dz.c b/examples/hello_dictd/libdz/dz.c
new file mode 100644
index 0000000..1fbe98e
--- /dev/null
+++ b/examples/hello_dictd/libdz/dz.c
@@ -0,0 +1,14 @@
+int fake3 (void);
+
+int fake3 (void)
+{
+ return 3;
+}
+
+/* fake must not be exported */
+int fake2 (void);
+
+int fake2 (void)
+{
+ return 2;
+}
diff --git a/examples/hello_dictd/libdz/export.sym b/examples/hello_dictd/libdz/export.sym
new file mode 100644
index 0000000..d084e3a
--- /dev/null
+++ b/examples/hello_dictd/libdz/export.sym
@@ -0,0 +1 @@
+fake3
diff --git a/examples/hello_dictd/libdz/linkme.mk b/examples/hello_dictd/libdz/linkme.mk
new file mode 100644
index 0000000..44bbeb5
--- /dev/null
+++ b/examples/hello_dictd/libdz/linkme.mk
@@ -0,0 +1,5 @@
+PATH.dz := ${.PARSEDIR}
+
+CPPFLAGS += -I${PATH.dz}
+DPLIBDIRS += ${PATH.dz}
+LDADD += -ldz
diff --git a/examples/hello_dictd/libmaa/Makefile b/examples/hello_dictd/libmaa/Makefile
new file mode 100644
index 0000000..68753e2
--- /dev/null
+++ b/examples/hello_dictd/libmaa/Makefile
@@ -0,0 +1,14 @@
+# libmaa library
+
+LIB = maa
+SRCS = set.c prime.c log.c # etc.
+
+EXPORT_SYMBOLS = export.sym
+
+SHLIB_MAJOR = 1
+SHLIB_MINOR = 2
+SHLIB_TEENY = 0
+
+WARNS ?= 4
+
+.include <mkc.lib.mk>
diff --git a/examples/hello_dictd/libmaa/export.sym b/examples/hello_dictd/libmaa/export.sym
new file mode 100644
index 0000000..ee9bd7c
--- /dev/null
+++ b/examples/hello_dictd/libmaa/export.sym
@@ -0,0 +1,3 @@
+fake4
+fake5
+fake6
diff --git a/examples/hello_dictd/libmaa/linkme.mk b/examples/hello_dictd/libmaa/linkme.mk
new file mode 100644
index 0000000..f2b6180
--- /dev/null
+++ b/examples/hello_dictd/libmaa/linkme.mk
@@ -0,0 +1,5 @@
+PATH.maa := ${.PARSEDIR}
+
+CPPFLAGS += -I${PATH.maa}
+DPLIBDIRS += ${PATH.maa}
+LDADD += -lmaa
diff --git a/examples/hello_dictd/libmaa/log.c b/examples/hello_dictd/libmaa/log.c
new file mode 100644
index 0000000..8cd210b
--- /dev/null
+++ b/examples/hello_dictd/libmaa/log.c
@@ -0,0 +1,14 @@
+int fake4 (void);
+
+int fake4 (void)
+{
+ return 4;
+}
+
+/* fake must not be exported */
+int fake2 (void);
+
+int fake2 (void)
+{
+ return 2;
+}
diff --git a/examples/hello_dictd/libmaa/prime.c b/examples/hello_dictd/libmaa/prime.c
new file mode 100644
index 0000000..c7cc6eb
--- /dev/null
+++ b/examples/hello_dictd/libmaa/prime.c
@@ -0,0 +1,6 @@
+int fake5 (void);
+
+int fake5 (void)
+{
+ return 5;
+}
diff --git a/examples/hello_dictd/libmaa/set.c b/examples/hello_dictd/libmaa/set.c
new file mode 100644
index 0000000..e374c6c
--- /dev/null
+++ b/examples/hello_dictd/libmaa/set.c
@@ -0,0 +1,6 @@
+int fake6 (void);
+
+int fake6 (void)
+{
+ return 6;
+}
diff --git a/examples/hello_dictd/test.mk b/examples/hello_dictd/test.mk
new file mode 100644
index 0000000..ae6492f
--- /dev/null
+++ b/examples/hello_dictd/test.mk
@@ -0,0 +1,119 @@
+.PHONY : test_output
+test_output :
+ @set -e; \
+ 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; \
+ ${.CURDIR}/dict/dict; \
+ ${.CURDIR}/dictd/dictd; \
+ ${.CURDIR}/dictfmt/dictfmt; \
+ ${.CURDIR}/dictzip/dictzip; \
+ \
+ echo =========== nm ============; \
+ case ${OPSYS} in \
+ *BSD|Linux) \
+ ${NM} ${.CURDIR}/libmaa/libmaa*.so | awk '$$2 == "T" {print "libmaa " $$3}'; \
+ ${NM} ${.CURDIR}/libdz/libdz*.so | awk '$$2 == "T" {print "libdz " $$3}';; \
+ SunOS) \
+ ${NM} -P ${.CURDIR}/libmaa/libmaa*.so | awk '$$2 == "T" {print "libmaa " $$1}'; \
+ ${NM} -P ${.CURDIR}/libdz/libdz*.so | awk '$$2 == "T" {print "libdz " $$1}';; \
+ *) \
+ printf 'libmaa fake4\nlibmaa fake5\nlibmaa fake6\nlibdz fake3\n';; \
+ esac; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= installdirs ==========; \
+ ${MAKE} ${MAKEFLAGS} installdirs DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== nodeps-cleandir-dictfmt subdir-clean-dictzip ===========; \
+ ${MAKE} ${MAKEFLAGS} nodeps-cleandir-dictfmt nodeps-clean-dictzip > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ echo ======= errorcheck ==========; \
+ ${MAKE} ${MAKEFLAGS} errorcheck > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ ${MAKE} ${MAKEFLAGS} cleandir > /dev/null; \
+ echo ======= all-dict ==========; \
+ ${MAKE} ${MAKEFLAGS} all-dict > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ echo ========= installdirs-dict ==========; \
+ ${MAKE} ${MAKEFLAGS} installdirs-dict DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install-dict ==========; \
+ ${MAKE} ${MAKEFLAGS} install-dict DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======= uninstall-dict ==========; \
+ ${MAKE} ${MAKEFLAGS} uninstall-dict DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean-dict ===========; \
+ ${MAKE} ${MAKEFLAGS} clean-dict > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= cleandir-dict ==========; \
+ ${MAKE} ${MAKEFLAGS} cleandir-dict > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= installdirs-doc ==========; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ ${MAKE} ${MAKEFLAGS} installdirs-doc DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install-doc ==========; \
+ ${MAKE} ${MAKEFLAGS} install-doc DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======= uninstall-doc ==========; \
+ ${MAKE} ${MAKEFLAGS} uninstall-doc DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo =========== all with NOSUBDIR ============; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
+ NOSUBDIR='dictfmt dictzip'; export NOSUBDIR; \
+ ${MAKE} ${MAKEFLAGS} all > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ true =========== cleandir ============; \
+ unset NOSUBDIR || true; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_files/DEBIAN/control b/examples/hello_files/DEBIAN/control
new file mode 100644
index 0000000..35c8b6a
--- /dev/null
+++ b/examples/hello_files/DEBIAN/control
@@ -0,0 +1,8 @@
+Package: hello-files
+Version: 0.1.0-1
+Architecture: all
+Depends:
+Maintainer: Aleksey Cheusov <vle@gmx.net>
+Description: Collection of fake scripts
+ This is a demo of mk-configure project.
+
diff --git a/examples/hello_files/Makefile b/examples/hello_files/Makefile
new file mode 100644
index 0000000..7db72fb
--- /dev/null
+++ b/examples/hello_files/Makefile
@@ -0,0 +1,32 @@
+STRANGEDIR1 ?= ${PREFIX}/share/files1
+STRANGEDIR2 ?= ${PREFIX}/share/files2
+STRANGEDIR3 ?= ${PREFIX}/share/files3
+
+FILES = shell_func1 shell_func2 shell_func3
+
+FILESDIR = ${BINDIR}
+FILESDIR_shell_func3 = ${LIBEXECDIR}
+
+LINKS = ${BINDIR}/shell_func1 ${STRANGEDIR1}/shell_func1.sh
+LINKS += ${BINDIR}/shell_func2 ${STRANGEDIR2}/shell_func2.sh
+
+SYMLINKS = ${LIBEXECDIR}/shell_func3 ${STRANGEDIR3}/shell_func3.sh
+
+MAN = shell_func.7
+TEXINFO = shell_func.texinfo # for .info file
+
+# The following line is for regression test only.
+# We will not create and update dir file
+INSTALL_INFO = :
+
+# The following lines are for regression test only.
+# We will build .html from man page only under NetBSD
+OPSYS != uname -s
+.if ${OPSYS} != "NetBSD"
+MKHTML = no
+.endif
+
+MKC_REQD = 0.11.0
+
+.include "test.mk"
+.include <mkc.files.mk>
diff --git a/examples/hello_files/expect.NetBSD.out b/examples/hello_files/expect.NetBSD.out
new file mode 100644
index 0000000..ca8f78e
--- /dev/null
+++ b/examples/hello_files/expect.NetBSD.out
@@ -0,0 +1,94 @@
+=========== all ============
+/objdir/DEBIAN/control
+/objdir/Makefile
+/objdir/expect.NetBSD.out
+/objdir/expect.out
+/objdir/hello_files.test.out.tmp
+/objdir/shell_func.7
+/objdir/shell_func.cat7
+/objdir/shell_func.info
+/objdir/shell_func.texinfo
+/objdir/shell_func1
+/objdir/shell_func2
+/objdir/shell_func3
+/objdir/test.mk
+======== all+html ==========
+/objdir/DEBIAN/control
+/objdir/Makefile
+/objdir/expect.NetBSD.out
+/objdir/expect.out
+/objdir/hello_files.test.out.tmp
+/objdir/shell_func.7
+/objdir/shell_func.cat7
+/objdir/shell_func.html7
+/objdir/shell_func.info
+/objdir/shell_func.texinfo
+/objdir/shell_func1
+/objdir/shell_func2
+/objdir/shell_func3
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/shell_func1
+/objdir/prefix/bin/shell_func2
+/objdir/prefix/info
+/objdir/prefix/info/shell_func.info
+/objdir/prefix/libexec
+/objdir/prefix/libexec/shell_func3
+/objdir/prefix/man
+/objdir/prefix/man/cat7
+/objdir/prefix/man/cat7/shell_func.0
+/objdir/prefix/man/html7
+/objdir/prefix/man/html7/shell_func.html
+/objdir/prefix/man/man7
+/objdir/prefix/man/man7/shell_func.7
+/objdir/prefix/share
+/objdir/prefix/share/files1
+/objdir/prefix/share/files1/shell_func1.sh
+/objdir/prefix/share/files2
+/objdir/prefix/share/files2/shell_func2.sh
+/objdir/prefix/share/files3
+/objdir/prefix/share/files3/shell_func3.sh
+======== uninstall =========
+========== clean ===========
+/objdir/DEBIAN/control
+/objdir/Makefile
+/objdir/expect.NetBSD.out
+/objdir/expect.out
+/objdir/hello_files.test.out.tmp
+/objdir/shell_func.7
+/objdir/shell_func.texinfo
+/objdir/shell_func1
+/objdir/shell_func2
+/objdir/shell_func3
+/objdir/test.mk
+======= distclean ==========
+/objdir/DEBIAN/control
+/objdir/Makefile
+/objdir/expect.NetBSD.out
+/objdir/expect.out
+/objdir/hello_files.test.out.tmp
+/objdir/shell_func.7
+/objdir/shell_func.texinfo
+/objdir/shell_func1
+/objdir/shell_func2
+/objdir/shell_func3
+/objdir/test.mk
+==== install MKINSTALL=no ====
+/objdir/DEBIAN/control
+/objdir/Makefile
+/objdir/expect.NetBSD.out
+/objdir/expect.out
+/objdir/hello_files.test.out.tmp
+/objdir/shell_func.7
+/objdir/shell_func.cat7
+/objdir/shell_func.html7
+/objdir/shell_func.info
+/objdir/shell_func.texinfo
+/objdir/shell_func1
+/objdir/shell_func2
+/objdir/shell_func3
+/objdir/test.mk
+==== SHRTOUT=yes ====
+TEXINFO: shell_func.info
diff --git a/examples/hello_files/expect.out b/examples/hello_files/expect.out
new file mode 100644
index 0000000..932f5b8
--- /dev/null
+++ b/examples/hello_files/expect.out
@@ -0,0 +1,90 @@
+=========== all ============
+/objdir/DEBIAN/control
+/objdir/Makefile
+/objdir/expect.NetBSD.out
+/objdir/expect.out
+/objdir/hello_files.test.out.tmp
+/objdir/shell_func.7
+/objdir/shell_func.cat7
+/objdir/shell_func.info
+/objdir/shell_func.texinfo
+/objdir/shell_func1
+/objdir/shell_func2
+/objdir/shell_func3
+/objdir/test.mk
+======== all+html ==========
+/objdir/DEBIAN/control
+/objdir/Makefile
+/objdir/expect.NetBSD.out
+/objdir/expect.out
+/objdir/hello_files.test.out.tmp
+/objdir/shell_func.7
+/objdir/shell_func.cat7
+/objdir/shell_func.info
+/objdir/shell_func.texinfo
+/objdir/shell_func1
+/objdir/shell_func2
+/objdir/shell_func3
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/shell_func1
+/objdir/prefix/bin/shell_func2
+/objdir/prefix/info
+/objdir/prefix/info/shell_func.info
+/objdir/prefix/libexec
+/objdir/prefix/libexec/shell_func3
+/objdir/prefix/man
+/objdir/prefix/man/cat7
+/objdir/prefix/man/cat7/shell_func.0
+/objdir/prefix/man/man7
+/objdir/prefix/man/man7/shell_func.7
+/objdir/prefix/share
+/objdir/prefix/share/files1
+/objdir/prefix/share/files1/shell_func1.sh
+/objdir/prefix/share/files2
+/objdir/prefix/share/files2/shell_func2.sh
+/objdir/prefix/share/files3
+/objdir/prefix/share/files3/shell_func3.sh
+======== uninstall =========
+========== clean ===========
+/objdir/DEBIAN/control
+/objdir/Makefile
+/objdir/expect.NetBSD.out
+/objdir/expect.out
+/objdir/hello_files.test.out.tmp
+/objdir/shell_func.7
+/objdir/shell_func.texinfo
+/objdir/shell_func1
+/objdir/shell_func2
+/objdir/shell_func3
+/objdir/test.mk
+======= distclean ==========
+/objdir/DEBIAN/control
+/objdir/Makefile
+/objdir/expect.NetBSD.out
+/objdir/expect.out
+/objdir/hello_files.test.out.tmp
+/objdir/shell_func.7
+/objdir/shell_func.texinfo
+/objdir/shell_func1
+/objdir/shell_func2
+/objdir/shell_func3
+/objdir/test.mk
+==== install MKINSTALL=no ====
+/objdir/DEBIAN/control
+/objdir/Makefile
+/objdir/expect.NetBSD.out
+/objdir/expect.out
+/objdir/hello_files.test.out.tmp
+/objdir/shell_func.7
+/objdir/shell_func.cat7
+/objdir/shell_func.info
+/objdir/shell_func.texinfo
+/objdir/shell_func1
+/objdir/shell_func2
+/objdir/shell_func3
+/objdir/test.mk
+==== SHRTOUT=yes ====
+TEXINFO: shell_func.info
diff --git a/examples/hello_files/shell_func.7 b/examples/hello_files/shell_func.7
new file mode 100644
index 0000000..393c158
--- /dev/null
+++ b/examples/hello_files/shell_func.7
@@ -0,0 +1,15 @@
+.\" $NetBSD$
+.\"
+.\" Copyright (c) 2008 by Aleksey Cheusov (vle@gmx.net)
+.\" Absolutely no warranty.
+.\"
+.TH SHELL_FUNCS 7 "Aug 29, 2008"
+.SH NAME
+shell_funcs \- collection of function written in shell
+.SH DESCRIPTION
+.B shell_funcs
+is a collection...
+.SH SEE ALSO
+.BR sh(1) ,
+.SH AUTHOR
+Aleksey Cheusov <vle@gmx.net>
diff --git a/examples/hello_files/shell_func.texinfo b/examples/hello_files/shell_func.texinfo
new file mode 100644
index 0000000..dd335be
--- /dev/null
+++ b/examples/hello_files/shell_func.texinfo
@@ -0,0 +1,38 @@
+\input texinfo @c -*-texinfo-*-
+@setfilename shell_func.info
+@settitle shell_func shell functions
+@setchapternewpage odd
+
+@ifinfo
+@dircategory Libraries
+@direntry
+* Shell_func: (shell_func). Info page for shell_func.
+@end direntry
+
+This is fake!
+
+@end ifinfo
+
+@titlepage
+@title shell_func info page
+@subtitle Edition @value{EDITION}, Version @value{VERSION}.
+@subtitle @value{UPDATE-MONTH}
+@author Aleksey Cheusov
+
+@page
+foobar
+
+@vskip 0pt plus 1filll
+Copyright @copyright{} 2009 Aleksey Cheusov
+@end titlepage
+
+@ifinfo
+@node Top
+@top shell_func fake!
+
+This is fake too!
+
+@end ifinfo
+
+@contents
+@bye
diff --git a/examples/hello_files/shell_func1 b/examples/hello_files/shell_func1
new file mode 100644
index 0000000..018150f
--- /dev/null
+++ b/examples/hello_files/shell_func1
@@ -0,0 +1,3 @@
+func1 (){
+ echo 1
+}
diff --git a/examples/hello_files/shell_func2 b/examples/hello_files/shell_func2
new file mode 100644
index 0000000..884281c
--- /dev/null
+++ b/examples/hello_files/shell_func2
@@ -0,0 +1,3 @@
+func2 (){
+ echo 2
+}
diff --git a/examples/hello_files/shell_func3 b/examples/hello_files/shell_func3
new file mode 100644
index 0000000..5c8fd2f
--- /dev/null
+++ b/examples/hello_files/shell_func3
@@ -0,0 +1,3 @@
+func3 (){
+ echo 3
+}
diff --git a/examples/hello_files/test.mk b/examples/hello_files/test.mk
new file mode 100644
index 0000000..72afde2
--- /dev/null
+++ b/examples/hello_files/test.mk
@@ -0,0 +1,54 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ MKHTML=yes; export MKHTML; \
+ \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== all+html ==========; \
+ ${MAKE} ${MAKEFLAGS} all \
+ > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ==== install MKINSTALL=no ====; \
+ MKINSTALL=no; export MKINSTALL; \
+ ${MAKE} ${MAKEFLAGS} all installdirs install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ==== SHRTOUT=yes ====; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
+ env MKCATPAGES=no MKHTML=no SHRTOUT=yes ${MAKE} ${MAKEFLAGS} all 2>&1 |\
+ mkc_test_helper2; \
+ \
+ true ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_glib2/Makefile b/examples/hello_glib2/Makefile
new file mode 100644
index 0000000..68ac803
--- /dev/null
+++ b/examples/hello_glib2/Makefile
@@ -0,0 +1,11 @@
+PROG = hello_glib2
+
+PKG_CONFIG_DEPS = glib-2.0>=2.1
+
+CFLAGS += -DG_DISABLE_DEPRECATED=1
+CFLAGS += -DG_DISABLE_SINGLE_INCLUDES
+
+MKC_REQD = 0.11.0
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_glib2/expect.out b/examples/hello_glib2/expect.out
new file mode 100644
index 0000000..8d37a48
--- /dev/null
+++ b/examples/hello_glib2/expect.out
@@ -0,0 +1,53 @@
+Hello World!
+glib_major_version=N
+glib_minor_version=N
+glib_micro_version=N
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_pkgconfig_glib-2.0_ge_2.1.err
+/objdir/_mkc_pkgconfig_glib-2.0_ge_2.1.res
+/objdir/_mkc_pkgconfig_glib-2.0_ge_2.1_cflags.err
+/objdir/_mkc_pkgconfig_glib-2.0_ge_2.1_cflags.res
+/objdir/_mkc_pkgconfig_glib-2.0_ge_2.1_libs.err
+/objdir/_mkc_pkgconfig_glib-2.0_ge_2.1_libs.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/_mkc_prog_pkg-config.err
+/objdir/_mkc_prog_pkg-config.res
+/objdir/expect.out
+/objdir/hello_glib2
+/objdir/hello_glib2.c
+/objdir/hello_glib2.o
+/objdir/hello_glib2.test.out.tmp
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/hello_glib2
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_pkgconfig_glib-2.0_ge_2.1.err
+/objdir/_mkc_pkgconfig_glib-2.0_ge_2.1.res
+/objdir/_mkc_pkgconfig_glib-2.0_ge_2.1_cflags.err
+/objdir/_mkc_pkgconfig_glib-2.0_ge_2.1_cflags.res
+/objdir/_mkc_pkgconfig_glib-2.0_ge_2.1_libs.err
+/objdir/_mkc_pkgconfig_glib-2.0_ge_2.1_libs.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/_mkc_prog_pkg-config.err
+/objdir/_mkc_prog_pkg-config.res
+/objdir/expect.out
+/objdir/hello_glib2.c
+/objdir/hello_glib2.test.out.tmp
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/hello_glib2.c
+/objdir/hello_glib2.test.out.tmp
+/objdir/test.mk
diff --git a/examples/hello_glib2/hello_glib2.c b/examples/hello_glib2/hello_glib2.c
new file mode 100644
index 0000000..ce59fe7
--- /dev/null
+++ b/examples/hello_glib2/hello_glib2.c
@@ -0,0 +1,16 @@
+#include <glib.h>
+#include <locale.h>
+#include <stdio.h>
+
+int main (int argc, char** argv)
+{
+ setlocale (LC_ALL, "");
+
+ puts ("Hello World!");
+
+ printf ("glib_major_version=%i\n", (int) glib_major_version);
+ printf ("glib_minor_version=%i\n", (int) glib_minor_version);
+ printf ("glib_micro_version=%i\n", (int) glib_micro_version);
+
+ return 0;
+}
diff --git a/examples/hello_glib2/test.mk b/examples/hello_glib2/test.mk
new file mode 100644
index 0000000..da83e2f
--- /dev/null
+++ b/examples/hello_glib2/test.mk
@@ -0,0 +1,32 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ ${.OBJDIR}/hello_glib2 | sed 's,[0-9][0-9]*,N,'; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_lex/Makefile b/examples/hello_lex/Makefile
new file mode 100644
index 0000000..211e442
--- /dev/null
+++ b/examples/hello_lex/Makefile
@@ -0,0 +1,5 @@
+PROG = hello_lex
+SRCS = hello_lex.l
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_lex/expect.out b/examples/hello_lex/expect.out
new file mode 100644
index 0000000..4862fd7
--- /dev/null
+++ b/examples/hello_lex/expect.out
@@ -0,0 +1,49 @@
+# of lines = 2, # of chars = 26
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/_mkc_prog_lex.err
+/objdir/_mkc_prog_lex.res
+/objdir/expect.out
+/objdir/hello_lex
+/objdir/hello_lex.c
+/objdir/hello_lex.l
+/objdir/hello_lex.o
+/objdir/hello_lex.test.out.tmp
+/objdir/input.txt
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/hello_lex
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/_mkc_prog_lex.err
+/objdir/_mkc_prog_lex.res
+/objdir/expect.out
+/objdir/hello_lex.l
+/objdir/hello_lex.test.out.tmp
+/objdir/input.txt
+/objdir/test.mk
+==== SHRTOUT=yes ====
+checking for compiler mmm... nnn
+checking for program mmm... nnn
+checking for program mmm... nnn
+LEX: hello_lex.l
+CC: hello_lex.c
+LD: hello_lex
+======= distclean ==========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/hello_lex.l
+/objdir/hello_lex.test.out.tmp
+/objdir/input.txt
+/objdir/test.mk
diff --git a/examples/hello_lex/hello_lex.l b/examples/hello_lex/hello_lex.l
new file mode 100644
index 0000000..376eeaf
--- /dev/null
+++ b/examples/hello_lex/hello_lex.l
@@ -0,0 +1,16 @@
+ static int num_lines = 0;
+ static int num_chars = 0;
+
+%%
+
+\n { ++num_lines; ++num_chars; }
+. ++num_chars;
+
+%%
+
+int main (int argc, char **argv)
+{
+ yylex ();
+ printf ("# of lines = %d, # of chars = %d\n", num_lines, num_chars);
+ return 0;
+}
diff --git a/examples/hello_lex/input.txt b/examples/hello_lex/input.txt
new file mode 100644
index 0000000..93dc73c
--- /dev/null
+++ b/examples/hello_lex/input.txt
@@ -0,0 +1,2 @@
+Hello World!
+Foo Bar Baz!
diff --git a/examples/hello_lex/test.mk b/examples/hello_lex/test.mk
new file mode 100644
index 0000000..ad62ff6
--- /dev/null
+++ b/examples/hello_lex/test.mk
@@ -0,0 +1,37 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ ${.OBJDIR}/hello_lex < ${.CURDIR}/input.txt; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ==== SHRTOUT=yes ====; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
+ env MKCATPAGES=no MKHTML=no SHRTOUT=yes ${MAKE} ${MAKEFLAGS} all 2>&1 |\
+ mkc_test_helper2; \
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /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
new file mode 100644
index 0000000..faba9c7
--- /dev/null
+++ b/examples/hello_lua/Makefile
@@ -0,0 +1,9 @@
+PROJECTNAME = hello_lua
+
+LUA_LMODULES = foo.lua bar.lua
+LUA_CMODULE = baz
+
+SCRIPTS = foobar
+
+.include "test.mk"
+.include <mkc.lib.mk>
diff --git a/examples/hello_lua/bar.lua b/examples/hello_lua/bar.lua
new file mode 100644
index 0000000..2b0d8dc
--- /dev/null
+++ b/examples/hello_lua/bar.lua
@@ -0,0 +1,5 @@
+module ("bar")
+
+function get ()
+ return "bar"
+end
diff --git a/examples/hello_lua/baz.c b/examples/hello_lua/baz.c
new file mode 100644
index 0000000..4ba942e
--- /dev/null
+++ b/examples/hello_lua/baz.c
@@ -0,0 +1,13 @@
+#include <lua.h>
+
+static int baz (lua_State *L)
+{
+ lua_pushstring(L, "baz");
+ return 1;
+}
+
+int luaopen_baz (lua_State *L)
+{
+ lua_register(L, "baz", baz);
+ return 0;
+}
diff --git a/examples/hello_lua/expect.out b/examples/hello_lua/expect.out
new file mode 100644
index 0000000..df5630c
--- /dev/null
+++ b/examples/hello_lua/expect.out
@@ -0,0 +1,124 @@
+PROJECTNAME=hello_lua
+foobarbaz
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_header_lua_h.c
+/objdir/_mkc_header_lua_h.err
+/objdir/_mkc_header_lua_h.res
+/objdir/_mkc_pkgconfig_lua.err
+/objdir/_mkc_pkgconfig_lua.res
+/objdir/_mkc_pkgconfig_lua_INSTALL_CMOD.err
+/objdir/_mkc_pkgconfig_lua_INSTALL_CMOD.res
+/objdir/_mkc_pkgconfig_lua_INSTALL_LMOD.err
+/objdir/_mkc_pkgconfig_lua_INSTALL_LMOD.res
+/objdir/_mkc_pkgconfig_lua_cflags.err
+/objdir/_mkc_pkgconfig_lua_cflags.res
+/objdir/_mkc_pkgconfig_lua_libs.err
+/objdir/_mkc_pkgconfig_lua_libs.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/_mkc_prog_pkg-config.err
+/objdir/_mkc_prog_pkg-config.res
+/objdir/bar.lua
+/objdir/baz.c
+/objdir/baz.os
+/objdir/baz.so
+/objdir/expect.out
+/objdir/foo.lua
+/objdir/foobar
+/objdir/hello_lua.test.out.tmp
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/foobar
+/objdir/prefix/lib
+/objdir/prefix/lib/lua
+/objdir/prefix/lib/lua/X.Y
+/objdir/prefix/lib/lua/X.Y/baz.so
+/objdir/prefix/share
+/objdir/prefix/share/lua
+/objdir/prefix/share/lua/X.Y
+/objdir/prefix/share/lua/X.Y/bar.lua
+/objdir/prefix/share/lua/X.Y/foo.lua
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_header_lua_h.c
+/objdir/_mkc_header_lua_h.err
+/objdir/_mkc_header_lua_h.res
+/objdir/_mkc_pkgconfig_lua.err
+/objdir/_mkc_pkgconfig_lua.res
+/objdir/_mkc_pkgconfig_lua_INSTALL_CMOD.err
+/objdir/_mkc_pkgconfig_lua_INSTALL_CMOD.res
+/objdir/_mkc_pkgconfig_lua_INSTALL_LMOD.err
+/objdir/_mkc_pkgconfig_lua_INSTALL_LMOD.res
+/objdir/_mkc_pkgconfig_lua_cflags.err
+/objdir/_mkc_pkgconfig_lua_cflags.res
+/objdir/_mkc_pkgconfig_lua_libs.err
+/objdir/_mkc_pkgconfig_lua_libs.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/_mkc_prog_pkg-config.err
+/objdir/_mkc_prog_pkg-config.res
+/objdir/bar.lua
+/objdir/baz.c
+/objdir/expect.out
+/objdir/foo.lua
+/objdir/foobar
+/objdir/hello_lua.test.out.tmp
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/bar.lua
+/objdir/baz.c
+/objdir/expect.out
+/objdir/foo.lua
+/objdir/foobar
+/objdir/hello_lua.test.out.tmp
+/objdir/test.mk
+========= install2 ==========
+/objdir
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_header_lua_h.c
+/objdir/_mkc_header_lua_h.err
+/objdir/_mkc_header_lua_h.res
+/objdir/_mkc_pkgconfig_lua.err
+/objdir/_mkc_pkgconfig_lua.res
+/objdir/_mkc_pkgconfig_lua_cflags.err
+/objdir/_mkc_pkgconfig_lua_cflags.res
+/objdir/_mkc_pkgconfig_lua_libs.err
+/objdir/_mkc_pkgconfig_lua_libs.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/_mkc_prog_pkg-config.err
+/objdir/_mkc_prog_pkg-config.res
+/objdir/bar.lua
+/objdir/baz.c
+/objdir/baz.os
+/objdir/baz.so
+/objdir/expect.out
+/objdir/foo.lua
+/objdir/foobar
+/objdir/hello_lua.test.out.tmp
+/objdir/home
+/objdir/home/cheusov
+/objdir/home/cheusov/local
+/objdir/home/cheusov/local/bin
+/objdir/home/cheusov/local/bin/foobar
+/objdir/home/cheusov/local/lib
+/objdir/home/cheusov/local/lib/lua
+/objdir/home/cheusov/local/lib/lua/X.Y
+/objdir/home/cheusov/local/lib/lua/X.Y/baz.so
+/objdir/home/cheusov/local/share
+/objdir/home/cheusov/local/share/lua
+/objdir/home/cheusov/local/share/lua/X.Y
+/objdir/home/cheusov/local/share/lua/X.Y/bar.lua
+/objdir/home/cheusov/local/share/lua/X.Y/foo.lua
+/objdir/test.mk
diff --git a/examples/hello_lua/foo.lua b/examples/hello_lua/foo.lua
new file mode 100644
index 0000000..58f1ecb
--- /dev/null
+++ b/examples/hello_lua/foo.lua
@@ -0,0 +1,5 @@
+module ("foo")
+
+function get ()
+ return "foo"
+end
diff --git a/examples/hello_lua/foobar b/examples/hello_lua/foobar
new file mode 100755
index 0000000..249feb3
--- /dev/null
+++ b/examples/hello_lua/foobar
@@ -0,0 +1,7 @@
+#!/usr/bin/env lua
+
+require "foo"
+require "bar"
+require "baz"
+
+io.write (foo.get () .. bar.get () .. baz () .. "\n")
diff --git a/examples/hello_lua/test.mk b/examples/hello_lua/test.mk
new file mode 100644
index 0000000..cc8b0df
--- /dev/null
+++ b/examples/hello_lua/test.mk
@@ -0,0 +1,46 @@
+CLEANDIRS += ${.OBJDIR}/home
+
+.PHONY : test_output
+test_output:
+ @set -e; \
+ rm -rf ${.OBJDIR}/usr ${.OBJDIR}/opt; \
+ echo PROJECTNAME=${PROJECTNAME}; \
+ ./foobar; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}/usr -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}" | uniq; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}/usr -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install2 ==========; \
+ env PREFIX=/home/cheusov/local \
+ LUA_LMODDIR=/home/cheusov/local/share/lua/5.1 \
+ LUA_CMODDIR=/home/cheusov/local/lib/lua/5.1 \
+ ${MAKE} ${MAKEFLAGS} all install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}" | uniq; \
+ rm -rf ${.OBJDIR}/home; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_lua2/Makefile b/examples/hello_lua2/Makefile
new file mode 100644
index 0000000..04d6cad
--- /dev/null
+++ b/examples/hello_lua2/Makefile
@@ -0,0 +1,5 @@
+LUA_LMODULES = foo.lua bar.lua
+SCRIPTS = foobar
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_lua2/bar.lua b/examples/hello_lua2/bar.lua
new file mode 100644
index 0000000..2b0d8dc
--- /dev/null
+++ b/examples/hello_lua2/bar.lua
@@ -0,0 +1,5 @@
+module ("bar")
+
+function get ()
+ return "bar"
+end
diff --git a/examples/hello_lua2/expect.out b/examples/hello_lua2/expect.out
new file mode 100644
index 0000000..3af692c
--- /dev/null
+++ b/examples/hello_lua2/expect.out
@@ -0,0 +1,66 @@
+foobar
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_pkgconfig_lua.err
+/objdir/_mkc_pkgconfig_lua.res
+/objdir/_mkc_pkgconfig_lua_INSTALL_LMOD.err
+/objdir/_mkc_pkgconfig_lua_INSTALL_LMOD.res
+/objdir/_mkc_prog_pkg-config.err
+/objdir/_mkc_prog_pkg-config.res
+/objdir/bar.lua
+/objdir/expect.out
+/objdir/foo.lua
+/objdir/foobar
+/objdir/hello_lua2.test.out.tmp
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/foobar
+/objdir/prefix/share
+/objdir/prefix/share/lua
+/objdir/prefix/share/lua/X.Y
+/objdir/prefix/share/lua/X.Y/bar.lua
+/objdir/prefix/share/lua/X.Y/foo.lua
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_pkgconfig_lua.err
+/objdir/_mkc_pkgconfig_lua.res
+/objdir/_mkc_pkgconfig_lua_INSTALL_LMOD.err
+/objdir/_mkc_pkgconfig_lua_INSTALL_LMOD.res
+/objdir/_mkc_prog_pkg-config.err
+/objdir/_mkc_prog_pkg-config.res
+/objdir/bar.lua
+/objdir/expect.out
+/objdir/foo.lua
+/objdir/foobar
+/objdir/hello_lua2.test.out.tmp
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/bar.lua
+/objdir/expect.out
+/objdir/foo.lua
+/objdir/foobar
+/objdir/hello_lua2.test.out.tmp
+/objdir/test.mk
+========= install2 ==========
+/objdir
+/objdir/Makefile
+/objdir/bar.lua
+/objdir/expect.out
+/objdir/foo.lua
+/objdir/foobar
+/objdir/hello_lua2.test.out.tmp
+/objdir/home
+/objdir/home/cheusov
+/objdir/home/cheusov/local
+/objdir/home/cheusov/local/bin
+/objdir/home/cheusov/local/bin/foobar
+/objdir/home/cheusov/local/share
+/objdir/home/cheusov/local/share/lua
+/objdir/home/cheusov/local/share/lua/X.Y
+/objdir/home/cheusov/local/share/lua/X.Y/bar.lua
+/objdir/home/cheusov/local/share/lua/X.Y/foo.lua
+/objdir/test.mk
diff --git a/examples/hello_lua2/foo.lua b/examples/hello_lua2/foo.lua
new file mode 100644
index 0000000..58f1ecb
--- /dev/null
+++ b/examples/hello_lua2/foo.lua
@@ -0,0 +1,5 @@
+module ("foo")
+
+function get ()
+ return "foo"
+end
diff --git a/examples/hello_lua2/foobar b/examples/hello_lua2/foobar
new file mode 100755
index 0000000..150da72
--- /dev/null
+++ b/examples/hello_lua2/foobar
@@ -0,0 +1,6 @@
+#!/usr/bin/env lua
+
+require "foo"
+require "bar"
+
+io.write (foo.get () .. bar.get () .. "\n")
diff --git a/examples/hello_lua2/test.mk b/examples/hello_lua2/test.mk
new file mode 100644
index 0000000..9d1ec03
--- /dev/null
+++ b/examples/hello_lua2/test.mk
@@ -0,0 +1,44 @@
+CLEANDIRS += ${.OBJDIR}/home
+
+.PHONY : test_output
+test_output:
+ @set -e; \
+ rm -rf ${.OBJDIR}/usr; \
+ ./foobar; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}/usr -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}" | uniq; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}/usr -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install2 ==========; \
+ env PREFIX=/home/cheusov/local \
+ LUA_LMODDIR=/home/cheusov/local/share/lua/5.1 \
+ ${MAKE} ${MAKEFLAGS} all install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}" | uniq; \
+ rm -rf ${.OBJDIR}/home; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_lua3/Makefile b/examples/hello_lua3/Makefile
new file mode 100644
index 0000000..a2a712b
--- /dev/null
+++ b/examples/hello_lua3/Makefile
@@ -0,0 +1,7 @@
+PROJECTNAME = hello_lua3
+
+LUA_MODULES = socket.foo socket.bar
+LUA_CMODULE = socket.baz
+
+.include "test.mk"
+.include <mkc.mk>
diff --git a/examples/hello_lua3/expect.out b/examples/hello_lua3/expect.out
new file mode 100644
index 0000000..e30135a
--- /dev/null
+++ b/examples/hello_lua3/expect.out
@@ -0,0 +1,79 @@
+PROJECTNAME=hello_lua3
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_header_lua_h.c
+/objdir/_mkc_header_lua_h.err
+/objdir/_mkc_header_lua_h.res
+/objdir/_mkc_pkgconfig_lua.err
+/objdir/_mkc_pkgconfig_lua.res
+/objdir/_mkc_pkgconfig_lua_INSTALL_CMOD.err
+/objdir/_mkc_pkgconfig_lua_INSTALL_CMOD.res
+/objdir/_mkc_pkgconfig_lua_INSTALL_LMOD.err
+/objdir/_mkc_pkgconfig_lua_INSTALL_LMOD.res
+/objdir/_mkc_pkgconfig_lua_cflags.err
+/objdir/_mkc_pkgconfig_lua_cflags.res
+/objdir/_mkc_pkgconfig_lua_libs.err
+/objdir/_mkc_pkgconfig_lua_libs.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/_mkc_prog_pkg-config.err
+/objdir/_mkc_prog_pkg-config.res
+/objdir/baz.so
+/objdir/expect.out
+/objdir/hello_lua3.test.out.tmp
+/objdir/socket_bar.lua
+/objdir/socket_baz.c
+/objdir/socket_baz.os
+/objdir/socket_foo.lua
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/lib
+/objdir/prefix/lib/lua
+/objdir/prefix/lib/lua/X.Y
+/objdir/prefix/lib/lua/X.Y/socket
+/objdir/prefix/lib/lua/X.Y/socket/baz.so
+/objdir/prefix/share
+/objdir/prefix/share/lua
+/objdir/prefix/share/lua/X.Y
+/objdir/prefix/share/lua/X.Y/socket
+/objdir/prefix/share/lua/X.Y/socket/bar.lua
+/objdir/prefix/share/lua/X.Y/socket/foo.lua
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_header_lua_h.c
+/objdir/_mkc_header_lua_h.err
+/objdir/_mkc_header_lua_h.res
+/objdir/_mkc_pkgconfig_lua.err
+/objdir/_mkc_pkgconfig_lua.res
+/objdir/_mkc_pkgconfig_lua_INSTALL_CMOD.err
+/objdir/_mkc_pkgconfig_lua_INSTALL_CMOD.res
+/objdir/_mkc_pkgconfig_lua_INSTALL_LMOD.err
+/objdir/_mkc_pkgconfig_lua_INSTALL_LMOD.res
+/objdir/_mkc_pkgconfig_lua_cflags.err
+/objdir/_mkc_pkgconfig_lua_cflags.res
+/objdir/_mkc_pkgconfig_lua_libs.err
+/objdir/_mkc_pkgconfig_lua_libs.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/_mkc_prog_pkg-config.err
+/objdir/_mkc_prog_pkg-config.res
+/objdir/expect.out
+/objdir/hello_lua3.test.out.tmp
+/objdir/socket_bar.lua
+/objdir/socket_baz.c
+/objdir/socket_foo.lua
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/hello_lua3.test.out.tmp
+/objdir/socket_bar.lua
+/objdir/socket_baz.c
+/objdir/socket_foo.lua
+/objdir/test.mk
diff --git a/examples/hello_lua3/socket_bar.lua b/examples/hello_lua3/socket_bar.lua
new file mode 100644
index 0000000..2b0d8dc
--- /dev/null
+++ b/examples/hello_lua3/socket_bar.lua
@@ -0,0 +1,5 @@
+module ("bar")
+
+function get ()
+ return "bar"
+end
diff --git a/examples/hello_lua3/socket_baz.c b/examples/hello_lua3/socket_baz.c
new file mode 100644
index 0000000..4ba942e
--- /dev/null
+++ b/examples/hello_lua3/socket_baz.c
@@ -0,0 +1,13 @@
+#include <lua.h>
+
+static int baz (lua_State *L)
+{
+ lua_pushstring(L, "baz");
+ return 1;
+}
+
+int luaopen_baz (lua_State *L)
+{
+ lua_register(L, "baz", baz);
+ return 0;
+}
diff --git a/examples/hello_lua3/socket_foo.lua b/examples/hello_lua3/socket_foo.lua
new file mode 100644
index 0000000..58f1ecb
--- /dev/null
+++ b/examples/hello_lua3/socket_foo.lua
@@ -0,0 +1,5 @@
+module ("foo")
+
+function get ()
+ return "foo"
+end
diff --git a/examples/hello_lua3/test.mk b/examples/hello_lua3/test.mk
new file mode 100644
index 0000000..fdf2745
--- /dev/null
+++ b/examples/hello_lua3/test.mk
@@ -0,0 +1,32 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ rm -rf ${.OBJDIR}/usr ${.OBJDIR}/opt; \
+ echo PROJECTNAME=${PROJECTNAME}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}/usr -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}" | uniq; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}/usr -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_plugins/Makefile b/examples/hello_plugins/Makefile
new file mode 100644
index 0000000..c387e69
--- /dev/null
+++ b/examples/hello_plugins/Makefile
@@ -0,0 +1,4 @@
+SUBPRJ = app plugin1 plugin2
+
+.include "test.mk"
+.include <mkc.subprj.mk>
diff --git a/examples/hello_plugins/app/Makefile b/examples/hello_plugins/app/Makefile
new file mode 100644
index 0000000..5ee8501
--- /dev/null
+++ b/examples/hello_plugins/app/Makefile
@@ -0,0 +1,7 @@
+MKC_REQUIRE_FUNCLIBS += dlopen:dl
+
+PROG = app
+
+WARNS = 4
+
+.include <mkc.prog.mk>
diff --git a/examples/hello_plugins/app/app.c b/examples/hello_plugins/app/app.c
new file mode 100644
index 0000000..56a3139
--- /dev/null
+++ b/examples/hello_plugins/app/app.c
@@ -0,0 +1,47 @@
+#include <dlfcn.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+typedef void (*plugin_func_t) (void);
+
+int main (int argc, char **argv)
+{
+ void *p [10];
+ plugin_func_t s [10];
+ int i;
+
+ --argc; ++argv;
+
+ if (argc >= 10){
+ argc = 10;
+ }
+
+ for (i=0; i < argc; ++i){
+ p [i] = dlopen (argv [i], RTLD_LAZY);
+ if (p [i]){
+ printf ("dlopen(3) returned address: %p\n", p [i]);
+ }else{
+ fprintf (stderr, "dlopen(3) failed: %s\n", dlerror ());
+ return 1;
+ }
+ }
+ puts ("");
+
+ for (i=0; i < argc; ++i){
+ s [i] = (plugin_func_t) dlsym (p [i], "hello_message");
+ if (s [i]){
+ printf ("dlsym(3) returned address: %p\n", s [i]);
+ s [i] ();
+ }else{
+ fprintf (stderr, "dlsym(3) failed: %s\n", dlerror ());
+ return 1;
+ }
+ }
+ puts ("");
+
+ for (i=0; i < argc; ++i){
+ s [i] ();
+ }
+
+ return 0;
+}
diff --git a/examples/hello_plugins/expect.out b/examples/hello_plugins/expect.out
new file mode 100644
index 0000000..6cf181a
--- /dev/null
+++ b/examples/hello_plugins/expect.out
@@ -0,0 +1,81 @@
+dlopen(3) returned address: 0xF00DBEAF
+dlopen(3) returned address: 0xF00DBEAF
+
+dlsym(3) returned address: 0xF00DBEAF
+Plugin1 sucessfully activated
+dlsym(3) returned address: 0xF00DBEAF
+Plugin1 sucessfully activated
+
+Plugin1 sucessfully activated
+Plugin1 sucessfully activated
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_funclib_dlopen.c
+/objdir/_mkc_funclib_dlopen.err
+/objdir/_mkc_funclib_dlopen.res
+/objdir/_mkc_funclib_dlopen_dl.c
+/objdir/_mkc_funclib_dlopen_dl.err
+/objdir/_mkc_funclib_dlopen_dl.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/app/Makefile
+/objdir/app/app
+/objdir/app/app.c
+/objdir/app/app.o
+/objdir/expect.out
+/objdir/hello_plugins.test.out.tmp
+/objdir/plugin1/Makefile
+/objdir/plugin1/plugin1.c
+/objdir/plugin1/plugin1.os
+/objdir/plugin1/plugin1.so
+/objdir/plugin2/Makefile
+/objdir/plugin2/plugin2.c
+/objdir/plugin2/plugin2.os
+/objdir/plugin2/plugin2.so
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/app
+/objdir/prefix/lib
+/objdir/prefix/lib/plugin1.so
+/objdir/prefix/lib/plugin2.so
+======== uninstall =========
+======== filelist ==========
+/usr/local/bin/app
+/usr/local/lib/plugin1.so
+/usr/local/lib/plugin2.so
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_funclib_dlopen.c
+/objdir/_mkc_funclib_dlopen.err
+/objdir/_mkc_funclib_dlopen.res
+/objdir/_mkc_funclib_dlopen_dl.c
+/objdir/_mkc_funclib_dlopen_dl.err
+/objdir/_mkc_funclib_dlopen_dl.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/app/Makefile
+/objdir/app/app.c
+/objdir/expect.out
+/objdir/hello_plugins.test.out.tmp
+/objdir/plugin1/Makefile
+/objdir/plugin1/plugin1.c
+/objdir/plugin2/Makefile
+/objdir/plugin2/plugin2.c
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/app/Makefile
+/objdir/app/app.c
+/objdir/expect.out
+/objdir/hello_plugins.test.out.tmp
+/objdir/plugin1/Makefile
+/objdir/plugin1/plugin1.c
+/objdir/plugin2/Makefile
+/objdir/plugin2/plugin2.c
+/objdir/test.mk
diff --git a/examples/hello_plugins/plugin1/Makefile b/examples/hello_plugins/plugin1/Makefile
new file mode 100644
index 0000000..e0ae7b9
--- /dev/null
+++ b/examples/hello_plugins/plugin1/Makefile
@@ -0,0 +1,5 @@
+LIB = plugin1
+
+MKDLL = only
+
+.include <mkc.lib.mk>
diff --git a/examples/hello_plugins/plugin1/plugin1.c b/examples/hello_plugins/plugin1/plugin1.c
new file mode 100644
index 0000000..6281410
--- /dev/null
+++ b/examples/hello_plugins/plugin1/plugin1.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+void hello_message (void);
+
+void hello_message (void)
+{
+ puts ("Plugin1 sucessfully activated");
+}
diff --git a/examples/hello_plugins/plugin2/Makefile b/examples/hello_plugins/plugin2/Makefile
new file mode 100644
index 0000000..bf870b3
--- /dev/null
+++ b/examples/hello_plugins/plugin2/Makefile
@@ -0,0 +1,5 @@
+LIB = plugin2
+
+MKDLL = only
+
+.include <mkc.lib.mk>
diff --git a/examples/hello_plugins/plugin2/plugin2.c b/examples/hello_plugins/plugin2/plugin2.c
new file mode 100644
index 0000000..6e9a026
--- /dev/null
+++ b/examples/hello_plugins/plugin2/plugin2.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+void hello_message (void);
+
+void hello_message (void)
+{
+ puts ("Plugin2 sucessfully activated");
+}
diff --git a/examples/hello_plugins/test.mk b/examples/hello_plugins/test.mk
new file mode 100644
index 0000000..edcf9a7
--- /dev/null
+++ b/examples/hello_plugins/test.mk
@@ -0,0 +1,36 @@
+.PHONY : test_output
+test_output:
+ @set -e; LC_ALL=C; export LC_ALL; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ app/app plugin1/plugin1${DLL_EXT} plugin1/plugin1${DLL_EXT} | \
+ awk '$$3 == "address:" {$$4 = "0xF00DBEAF"} {print}'; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======== filelist ==========; \
+ ${MAKE} ${MAKEFLAGS} filelist | sed 's/[.]bundle/.so/'; \
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_plugins2/Makefile b/examples/hello_plugins2/Makefile
new file mode 100644
index 0000000..c387e69
--- /dev/null
+++ b/examples/hello_plugins2/Makefile
@@ -0,0 +1,4 @@
+SUBPRJ = app plugin1 plugin2
+
+.include "test.mk"
+.include <mkc.subprj.mk>
diff --git a/examples/hello_plugins2/app/Makefile b/examples/hello_plugins2/app/Makefile
new file mode 100644
index 0000000..728d04a
--- /dev/null
+++ b/examples/hello_plugins2/app/Makefile
@@ -0,0 +1,9 @@
+MKC_REQUIRE_FUNCLIBS += dlopen:dl
+
+PROG = app
+
+WARNS = 4
+
+EXPORT_DYNAMIC = yes
+
+.include <mkc.prog.mk>
diff --git a/examples/hello_plugins2/app/app.c b/examples/hello_plugins2/app/app.c
new file mode 100644
index 0000000..caa41a6
--- /dev/null
+++ b/examples/hello_plugins2/app/app.c
@@ -0,0 +1,47 @@
+#include <dlfcn.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+typedef void (*plugin_func_t) (void);
+
+/* Function "putter" is for plugins only, it is not used by
+ application. On some platforms it is not exported by default, this
+ is why EXPORT_DYNAMIC is set to "yes"
+*/
+void putter (char *s);
+void putter (char *s)
+{
+ printf ("%s\n", s);
+}
+
+int main (int argc, char **argv)
+{
+ void *pd;
+ plugin_func_t f;
+ int i;
+
+ --argc; ++argv;
+
+ for (i=0; i < argc; ++i){
+ pd = dlopen (argv [i], RTLD_LAZY);
+ if (!pd){
+ fprintf (stderr, "dlopen(3) failed: %s\n", dlerror ());
+ return 1;
+ }
+
+ f = (plugin_func_t) dlsym (pd, "print_message");
+ if (!f){
+ fprintf (stderr, "dlsym(3) failed: %s\n", dlerror ());
+ return 1;
+ }
+
+ f ();
+
+ if (dlclose (pd)){
+ fprintf (stderr, "dlclose(3) failed: %s\n", dlerror ());
+ return 1;
+ }
+ }
+
+ return 0;
+}
diff --git a/examples/hello_plugins2/expect.out b/examples/hello_plugins2/expect.out
new file mode 100644
index 0000000..6ae1873
--- /dev/null
+++ b/examples/hello_plugins2/expect.out
@@ -0,0 +1,69 @@
+Plugin1 sucessfully activated
+Plugin2 sucessfully activated
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_funclib_dlopen.c
+/objdir/_mkc_funclib_dlopen.err
+/objdir/_mkc_funclib_dlopen.res
+/objdir/_mkc_funclib_dlopen_dl.c
+/objdir/_mkc_funclib_dlopen_dl.err
+/objdir/_mkc_funclib_dlopen_dl.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/app/Makefile
+/objdir/app/app
+/objdir/app/app.c
+/objdir/app/app.o
+/objdir/expect.out
+/objdir/hello_plugins2.test.out.tmp
+/objdir/plugin1/Makefile
+/objdir/plugin1/plugin1.c
+/objdir/plugin1/plugin1.os
+/objdir/plugin1/plugin1.so
+/objdir/plugin2/Makefile
+/objdir/plugin2/plugin2.c
+/objdir/plugin2/plugin2.os
+/objdir/plugin2/plugin2.so
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/app
+/objdir/prefix/lib
+/objdir/prefix/lib/plugin1.so
+/objdir/prefix/lib/plugin2.so
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_funclib_dlopen.c
+/objdir/_mkc_funclib_dlopen.err
+/objdir/_mkc_funclib_dlopen.res
+/objdir/_mkc_funclib_dlopen_dl.c
+/objdir/_mkc_funclib_dlopen_dl.err
+/objdir/_mkc_funclib_dlopen_dl.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/app/Makefile
+/objdir/app/app.c
+/objdir/expect.out
+/objdir/hello_plugins2.test.out.tmp
+/objdir/plugin1/Makefile
+/objdir/plugin1/plugin1.c
+/objdir/plugin2/Makefile
+/objdir/plugin2/plugin2.c
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/app/Makefile
+/objdir/app/app.c
+/objdir/expect.out
+/objdir/hello_plugins2.test.out.tmp
+/objdir/plugin1/Makefile
+/objdir/plugin1/plugin1.c
+/objdir/plugin2/Makefile
+/objdir/plugin2/plugin2.c
+/objdir/test.mk
diff --git a/examples/hello_plugins2/plugin1/Makefile b/examples/hello_plugins2/plugin1/Makefile
new file mode 100644
index 0000000..e0ae7b9
--- /dev/null
+++ b/examples/hello_plugins2/plugin1/Makefile
@@ -0,0 +1,5 @@
+LIB = plugin1
+
+MKDLL = only
+
+.include <mkc.lib.mk>
diff --git a/examples/hello_plugins2/plugin1/plugin1.c b/examples/hello_plugins2/plugin1/plugin1.c
new file mode 100644
index 0000000..8206be6
--- /dev/null
+++ b/examples/hello_plugins2/plugin1/plugin1.c
@@ -0,0 +1,7 @@
+extern void putter (const char*);
+void print_message (void);
+
+void print_message (void)
+{
+ putter ("Plugin1 sucessfully activated");
+}
diff --git a/examples/hello_plugins2/plugin2/Makefile b/examples/hello_plugins2/plugin2/Makefile
new file mode 100644
index 0000000..bf870b3
--- /dev/null
+++ b/examples/hello_plugins2/plugin2/Makefile
@@ -0,0 +1,5 @@
+LIB = plugin2
+
+MKDLL = only
+
+.include <mkc.lib.mk>
diff --git a/examples/hello_plugins2/plugin2/plugin2.c b/examples/hello_plugins2/plugin2/plugin2.c
new file mode 100644
index 0000000..2f1d75e
--- /dev/null
+++ b/examples/hello_plugins2/plugin2/plugin2.c
@@ -0,0 +1,7 @@
+extern void putter (const char*);
+void print_message (void);
+
+void print_message (void)
+{
+ putter ("Plugin2 sucessfully activated");
+}
diff --git a/examples/hello_plugins2/test.mk b/examples/hello_plugins2/test.mk
new file mode 100644
index 0000000..2944de6
--- /dev/null
+++ b/examples/hello_plugins2/test.mk
@@ -0,0 +1,32 @@
+.PHONY : test_output
+test_output:
+ @set -e; LC_ALL=C; export LC_ALL; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ app/app plugin1/plugin1${DLL_EXT} plugin2/plugin2${DLL_EXT}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_progs/Makefile b/examples/hello_progs/Makefile
new file mode 100644
index 0000000..d43cfc6
--- /dev/null
+++ b/examples/hello_progs/Makefile
@@ -0,0 +1,8 @@
+PROGS = client server
+SRCS.client = client.c client_puts.c
+SRCS.server = server.c server_puts.c
+
+WARNS = 4
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_progs/client.c b/examples/hello_progs/client.c
new file mode 100644
index 0000000..315873a
--- /dev/null
+++ b/examples/hello_progs/client.c
@@ -0,0 +1,7 @@
+void puts_stdout (const char *);
+
+int main (int argc, char **argv)
+{
+ puts_stdout ("I am a client");
+ return 0;
+}
diff --git a/examples/hello_progs/client_puts.c b/examples/hello_progs/client_puts.c
new file mode 100644
index 0000000..341b206
--- /dev/null
+++ b/examples/hello_progs/client_puts.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+void puts_stdout (const char *);
+
+void puts_stdout (const char *s)
+{
+ printf ("client: ");
+ puts (s);
+}
diff --git a/examples/hello_progs/expect.out b/examples/hello_progs/expect.out
new file mode 100644
index 0000000..925acc0
--- /dev/null
+++ b/examples/hello_progs/expect.out
@@ -0,0 +1,82 @@
+PROJECTNAME=hello_progs
+client: I am a client
+server: I am a server
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/client
+/objdir/client.c
+/objdir/client.o
+/objdir/client_puts.c
+/objdir/client_puts.o
+/objdir/expect.out
+/objdir/hello_progs.test.out.tmp
+/objdir/server
+/objdir/server.c
+/objdir/server.o
+/objdir/server_puts.c
+/objdir/server_puts.o
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/client
+/objdir/prefix/bin/server
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/client.c
+/objdir/client_puts.c
+/objdir/expect.out
+/objdir/hello_progs.test.out.tmp
+/objdir/server.c
+/objdir/server_puts.c
+/objdir/test.mk
+========== server ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/client.c
+/objdir/client_puts.c
+/objdir/expect.out
+/objdir/hello_progs.test.out.tmp
+/objdir/server
+/objdir/server.c
+/objdir/server.o
+/objdir/server_puts.c
+/objdir/server_puts.o
+/objdir/test.mk
+========== client ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/client
+/objdir/client.c
+/objdir/client.o
+/objdir/client_puts.c
+/objdir/client_puts.o
+/objdir/expect.out
+/objdir/hello_progs.test.out.tmp
+/objdir/server.c
+/objdir/server_puts.c
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/client.c
+/objdir/client_puts.c
+/objdir/expect.out
+/objdir/hello_progs.test.out.tmp
+/objdir/server.c
+/objdir/server_puts.c
+/objdir/test.mk
diff --git a/examples/hello_progs/server.c b/examples/hello_progs/server.c
new file mode 100644
index 0000000..ff29cc9
--- /dev/null
+++ b/examples/hello_progs/server.c
@@ -0,0 +1,7 @@
+void puts_stdout (const char *);
+
+int main (int argc, char **argv)
+{
+ puts_stdout ("I am a server");
+ return 0;
+}
diff --git a/examples/hello_progs/server_puts.c b/examples/hello_progs/server_puts.c
new file mode 100644
index 0000000..9649361
--- /dev/null
+++ b/examples/hello_progs/server_puts.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+void puts_stdout (const char *);
+
+void puts_stdout (const char *s)
+{
+ printf ("server: ");
+ puts (s);
+}
diff --git a/examples/hello_progs/test.mk b/examples/hello_progs/test.mk
new file mode 100644
index 0000000..bd90e8b
--- /dev/null
+++ b/examples/hello_progs/test.mk
@@ -0,0 +1,45 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ echo PROJECTNAME=${PROJECTNAME}; \
+ ${.OBJDIR}/client; \
+ ${.OBJDIR}/server; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== server ===========; \
+ ${MAKE} ${MAKEFLAGS} server > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== client ===========; \
+ ${MAKE} ${MAKEFLAGS} clean > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} client > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_progs2/Makefile b/examples/hello_progs2/Makefile
new file mode 100644
index 0000000..f1f361b
--- /dev/null
+++ b/examples/hello_progs2/Makefile
@@ -0,0 +1,9 @@
+PROGS = client server
+SRCS.client = client.c
+SRCS.server = server.c
+SRCS = common.c
+
+WARNS = 4
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_progs2/client.c b/examples/hello_progs2/client.c
new file mode 100644
index 0000000..315873a
--- /dev/null
+++ b/examples/hello_progs2/client.c
@@ -0,0 +1,7 @@
+void puts_stdout (const char *);
+
+int main (int argc, char **argv)
+{
+ puts_stdout ("I am a client");
+ return 0;
+}
diff --git a/examples/hello_progs2/common.c b/examples/hello_progs2/common.c
new file mode 100644
index 0000000..3183ce1
--- /dev/null
+++ b/examples/hello_progs2/common.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+void puts_stdout (const char *);
+
+void puts_stdout (const char *s)
+{
+ puts (s);
+}
diff --git a/examples/hello_progs2/expect.out b/examples/hello_progs2/expect.out
new file mode 100644
index 0000000..a2a37e1
--- /dev/null
+++ b/examples/hello_progs2/expect.out
@@ -0,0 +1,76 @@
+PROJECTNAME=hello_progs2
+I am a client
+I am a server
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/client
+/objdir/client.c
+/objdir/client.o
+/objdir/common.c
+/objdir/common.o
+/objdir/expect.out
+/objdir/hello_progs2.test.out.tmp
+/objdir/server
+/objdir/server.c
+/objdir/server.o
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/client
+/objdir/prefix/bin/server
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/client.c
+/objdir/common.c
+/objdir/expect.out
+/objdir/hello_progs2.test.out.tmp
+/objdir/server.c
+/objdir/test.mk
+========== server ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/client.c
+/objdir/common.c
+/objdir/common.o
+/objdir/expect.out
+/objdir/hello_progs2.test.out.tmp
+/objdir/server
+/objdir/server.c
+/objdir/server.o
+/objdir/test.mk
+========== client ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/client
+/objdir/client.c
+/objdir/client.o
+/objdir/common.c
+/objdir/common.o
+/objdir/expect.out
+/objdir/hello_progs2.test.out.tmp
+/objdir/server.c
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/client.c
+/objdir/common.c
+/objdir/expect.out
+/objdir/hello_progs2.test.out.tmp
+/objdir/server.c
+/objdir/test.mk
diff --git a/examples/hello_progs2/server.c b/examples/hello_progs2/server.c
new file mode 100644
index 0000000..ff29cc9
--- /dev/null
+++ b/examples/hello_progs2/server.c
@@ -0,0 +1,7 @@
+void puts_stdout (const char *);
+
+int main (int argc, char **argv)
+{
+ puts_stdout ("I am a server");
+ return 0;
+}
diff --git a/examples/hello_progs2/test.mk b/examples/hello_progs2/test.mk
new file mode 100644
index 0000000..bd90e8b
--- /dev/null
+++ b/examples/hello_progs2/test.mk
@@ -0,0 +1,45 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ echo PROJECTNAME=${PROJECTNAME}; \
+ ${.OBJDIR}/client; \
+ ${.OBJDIR}/server; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== server ===========; \
+ ${MAKE} ${MAKEFLAGS} server > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== client ===========; \
+ ${MAKE} ${MAKEFLAGS} clean > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} client > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_require_tools/Makefile b/examples/hello_require_tools/Makefile
new file mode 100644
index 0000000..ad4f88d
--- /dev/null
+++ b/examples/hello_require_tools/Makefile
@@ -0,0 +1,11 @@
+MKC_REQUIRE_BUILTINS += prog_gawk prog_flex prog_gm4 prog_bison
+
+SCRIPTS = fake
+
+test: error-check
+ @echo ${CUSTOM.prog_gawk}
+ @echo ${CUSTOM.prog_gm4}
+ @echo ${CUSTOM.prog_flex}
+ @echo ${CUSTOM.prog_bison}
+
+.include <mkc.prog.mk>
diff --git a/examples/hello_require_tools/fake b/examples/hello_require_tools/fake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/examples/hello_require_tools/fake
diff --git a/examples/hello_requirements/Makefile b/examples/hello_requirements/Makefile
new file mode 100644
index 0000000..242f22a
--- /dev/null
+++ b/examples/hello_requirements/Makefile
@@ -0,0 +1,20 @@
+PROG = hello_reqs
+
+WARNS = 4
+
+MKC_REQUIRE_HEADERS = foobar.h string.h unistd.h
+MKC_REQUIRE_FUNCLIBS = strcasecmp foobar barbaz:z
+MKC_REQUIRE_DEFINES = FOOBAR
+MKC_REQUIRE_TYPES = long size_t:string.h foobar_t barbaz:string.h
+MKC_REQUIRE_VARS = errno:errno.h foobar_var barbaz:unistd.h
+MKC_REQUIRE_MEMBERS = struct-tm.tm_isdst:time.h \
+ struct-bad.member:stdlib.h
+MKC_REQUIRE_FUNCS2 = strcmp:string.h foobar:stdlib.h
+MKC_REQUIRE_FUNCS9 = barbaz
+MKC_REQUIRE_PROGS = sh awk foobar_prog
+MKC_REQUIRE_CUSTOM = custom_check1 custom_check2
+
+MKC_REQD = 0.11.0
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_requirements/custom_check1.c b/examples/hello_requirements/custom_check1.c
new file mode 100644
index 0000000..975a3b3
--- /dev/null
+++ b/examples/hello_requirements/custom_check1.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main (int argc, char **argv)
+{
+ puts ("Hello World!");
+ return 0;
+}
diff --git a/examples/hello_requirements/custom_check2.c b/examples/hello_requirements/custom_check2.c
new file mode 100644
index 0000000..7c32983
--- /dev/null
+++ b/examples/hello_requirements/custom_check2.c
@@ -0,0 +1,3 @@
+#include <stdin.h>
+
+bad code here
diff --git a/examples/hello_requirements/expect.out b/examples/hello_requirements/expect.out
new file mode 100644
index 0000000..2336dad
--- /dev/null
+++ b/examples/hello_requirements/expect.out
@@ -0,0 +1,40 @@
+checking for compiler type... known ;-)
+checking for header foobar.h... no
+checking for header string.h... yes
+checking for header unistd.h... yes
+checking for function strcasecmp... yes
+checking for function foobar... no
+checking for function barbaz ( -lz )... no
+checking for function barbaz... no
+checking for define FOOBAR... no
+checking for type long... yes
+checking for type size_t ( string.h )... yes
+checking for type foobar_t... no
+checking for type barbaz ( string.h )... no
+checking for variable errno ( errno.h )... yes
+checking for variable foobar_var... no
+checking for variable barbaz ( unistd.h )... no
+checking for member struct tm.tm_isdst ( time.h )... yes
+checking for member struct bad.member ( stdlib.h )... no
+checking for func strcmp ( string.h )... yes
+checking for func foobar ( stdlib.h )... no
+checking for func barbaz... no
+checking for custom test custom_check1... 1 (yes)
+checking for custom test custom_check2... 0 (no)
+checking for program FOOBAR... /path/to/FOOBAR
+checking for program FOOBAR... /path/to/FOOBAR
+checking for program FOOBAR... NOT FOUND
+checking for program FOOBAR... /path/to/FOOBAR
+ERROR: cannot find header foobar.h
+ERROR: cannot find function foobar
+ERROR: cannot find function barbaz:z
+ERROR: cannot find declaration of define FOOBAR
+ERROR: cannot find declaration of type foobar_t
+ERROR: cannot find declaration of type barbaz:string.h
+ERROR: cannot find declaration of variable foobar_var
+ERROR: cannot find declaration of variable barbaz:unistd.h
+ERROR: cannot find member struct-bad.member:stdlib.h
+ERROR: cannot find declaration of function foobar:stdlib.h
+ERROR: cannot find declaration of function barbaz
+ERROR: custom test custom_check2 failed
+ERROR: cannot find program foobar_prog
diff --git a/examples/hello_requirements/hello_world.c b/examples/hello_requirements/hello_world.c
new file mode 100644
index 0000000..3d8f214
--- /dev/null
+++ b/examples/hello_requirements/hello_world.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main (int argc, char** argv)
+{
+ puts ("Hello World!");
+ return 0;
+}
diff --git a/examples/hello_requirements/test.mk b/examples/hello_requirements/test.mk
new file mode 100644
index 0000000..f023e14
--- /dev/null
+++ b/examples/hello_requirements/test.mk
@@ -0,0 +1,12 @@
+.PHONY : test
+test:
+ ${MAKE} distclean; \
+ ${MAKE} all 2>&1 | \
+ sed -e 's|for program .*[.][.][.]*|for program FOOBAR...|' \
+ -e 's|[.][.][.] /[^ ]*|... /path/to/FOOBAR|' \
+ -e 's/for compiler type.*$$/for compiler type... known ;-)/' | \
+ awk '/Error code/ {exit 0} {print}' >${.OBJDIR}/_output.tmp; \
+ diff ${.CURDIR}/expect.out ${.OBJDIR}/_output.tmp; \
+ ${MAKE} distclean
+
+CLEANFILES+= _output.tmp
diff --git a/examples/hello_scripts/Makefile b/examples/hello_scripts/Makefile
new file mode 100644
index 0000000..9325a85
--- /dev/null
+++ b/examples/hello_scripts/Makefile
@@ -0,0 +1,21 @@
+PROG = hello_world1
+SRCS = main.c msg.c
+
+WARNS = 4
+
+SCRIPTS = hello_world2 hello_world3
+SCRIPTS += ${:!echo more_scripts/*!:N*/CVS}
+
+SCRIPTSDIR_more_scripts_script1 = ${BINDIR}/subdir1
+
+SCRIPTSNAME_more_scripts_script2 = myscript2
+
+SCRIPTSDIR_more_scripts_script3 = ${BINDIR}/subdir3
+SCRIPTSNAME_more_scripts_script3 = myscript3
+
+MAN = hello_world.1
+
+MKC_REQD = 0.10.0
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_scripts/expect.out b/examples/hello_scripts/expect.out
new file mode 100644
index 0000000..957e6f7
--- /dev/null
+++ b/examples/hello_scripts/expect.out
@@ -0,0 +1,92 @@
+Hello World 1!
+Hello World 2!
+Hello World 3!
+=========== all ============
+/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_scripts.test.out.tmp
+/objdir/hello_world.1
+/objdir/hello_world.cat1
+/objdir/hello_world1
+/objdir/hello_world2
+/objdir/hello_world3
+/objdir/main.c
+/objdir/main.o
+/objdir/more_scripts/script1
+/objdir/more_scripts/script2
+/objdir/more_scripts/script3
+/objdir/msg.c
+/objdir/msg.o
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/hello_world1
+/objdir/prefix/bin/hello_world2
+/objdir/prefix/bin/hello_world3
+/objdir/prefix/bin/myscript2
+/objdir/prefix/bin/subdir1
+/objdir/prefix/bin/subdir1/script1
+/objdir/prefix/bin/subdir3
+/objdir/prefix/bin/subdir3/myscript3
+/objdir/prefix/man
+/objdir/prefix/man/cat1
+/objdir/prefix/man/cat1/hello_world.0
+/objdir/prefix/man/man1
+/objdir/prefix/man/man1/hello_world.1
+======== uninstall =========
+========== clean ===========
+/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_scripts.test.out.tmp
+/objdir/hello_world.1
+/objdir/hello_world2
+/objdir/hello_world3
+/objdir/main.c
+/objdir/more_scripts/script1
+/objdir/more_scripts/script2
+/objdir/more_scripts/script3
+/objdir/msg.c
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/hello_scripts.test.out.tmp
+/objdir/hello_world.1
+/objdir/hello_world2
+/objdir/hello_world3
+/objdir/main.c
+/objdir/more_scripts/script1
+/objdir/more_scripts/script2
+/objdir/more_scripts/script3
+/objdir/msg.c
+/objdir/test.mk
+==== install MKINSTALL=no ====
+/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_scripts.test.out.tmp
+/objdir/hello_world.1
+/objdir/hello_world.cat1
+/objdir/hello_world1
+/objdir/hello_world2
+/objdir/hello_world3
+/objdir/main.c
+/objdir/main.o
+/objdir/more_scripts/script1
+/objdir/more_scripts/script2
+/objdir/more_scripts/script3
+/objdir/msg.c
+/objdir/msg.o
+/objdir/test.mk
diff --git a/examples/hello_scripts/hello_world.1 b/examples/hello_scripts/hello_world.1
new file mode 100644
index 0000000..8817536
--- /dev/null
+++ b/examples/hello_scripts/hello_world.1
@@ -0,0 +1,13 @@
+.\" Written by by Aleksey Cheusov (vle@gmx.net)
+.\" ------------------------------------------------------------------
+.TH HELLO_WORLD 1 "Mar 29, 2009" "" ""
+.SH NAME
+hello\_world \- hello application
+.SH SYNOPSIS
+.B "hello_world"
+.br
+.SH DESCRIPTION
+.B hello\_world
+outputs hello world message to stdout
+.SH AUTHOR
+Aleksey Cheusov <vle@gmx.net>
diff --git a/examples/hello_scripts/hello_world2 b/examples/hello_scripts/hello_world2
new file mode 100755
index 0000000..7441be2
--- /dev/null
+++ b/examples/hello_scripts/hello_world2
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo 'Hello World 2!'
diff --git a/examples/hello_scripts/hello_world3 b/examples/hello_scripts/hello_world3
new file mode 100755
index 0000000..53bdd92
--- /dev/null
+++ b/examples/hello_scripts/hello_world3
@@ -0,0 +1,6 @@
+#!/usr/bin/awk -f
+
+BEGIN {
+ print "Hello World 3!"
+ exit 0
+}
diff --git a/examples/hello_scripts/main.c b/examples/hello_scripts/main.c
new file mode 100644
index 0000000..9e85a32
--- /dev/null
+++ b/examples/hello_scripts/main.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+extern const char *msg;
+
+int main (int argc, char **argv)
+{
+ puts (msg);
+ return 0;
+}
diff --git a/examples/hello_scripts/more_scripts/script1 b/examples/hello_scripts/more_scripts/script1
new file mode 100755
index 0000000..1e5757e
--- /dev/null
+++ b/examples/hello_scripts/more_scripts/script1
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo 'script1'
diff --git a/examples/hello_scripts/more_scripts/script2 b/examples/hello_scripts/more_scripts/script2
new file mode 100755
index 0000000..1f1db9d
--- /dev/null
+++ b/examples/hello_scripts/more_scripts/script2
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo 'script2'
diff --git a/examples/hello_scripts/more_scripts/script3 b/examples/hello_scripts/more_scripts/script3
new file mode 100755
index 0000000..2b1510e
--- /dev/null
+++ b/examples/hello_scripts/more_scripts/script3
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo 'script3'
diff --git a/examples/hello_scripts/msg.c b/examples/hello_scripts/msg.c
new file mode 100644
index 0000000..5258623
--- /dev/null
+++ b/examples/hello_scripts/msg.c
@@ -0,0 +1 @@
+const char *msg = "Hello World 1!";
diff --git a/examples/hello_scripts/test.mk b/examples/hello_scripts/test.mk
new file mode 100644
index 0000000..f33a6a7
--- /dev/null
+++ b/examples/hello_scripts/test.mk
@@ -0,0 +1,45 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ ${.OBJDIR}/hello_world1; \
+ ${.CURDIR}/hello_world2; \
+ ${.CURDIR}/hello_world3; \
+ \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ==== install MKINSTALL=no ====; \
+ MKINSTALL=no; export MKINSTALL; \
+ ${MAKE} ${MAKEFLAGS} all installdirs install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ true ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_sizeof/Makefile b/examples/hello_sizeof/Makefile
new file mode 100644
index 0000000..e9ccadb
--- /dev/null
+++ b/examples/hello_sizeof/Makefile
@@ -0,0 +1,9 @@
+MKC_CHECK_SIZEOF += int long long-long size_t:string.h void*
+
+PROG = sizeof_test
+WARNS = 4
+
+MKC_REQD = 0.10.0
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_sizeof/expect.out b/examples/hello_sizeof/expect.out
new file mode 100644
index 0000000..7820fc8
--- /dev/null
+++ b/examples/hello_sizeof/expect.out
@@ -0,0 +1,68 @@
+sizeof(int)=n
+sizeof(long)=n
+sizeof(long long)=n
+sizeof(size_t)=n
+sizeof(void*)=n
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/_mkc_sizeof_int.c
+/objdir/_mkc_sizeof_int.err
+/objdir/_mkc_sizeof_int.res
+/objdir/_mkc_sizeof_long.c
+/objdir/_mkc_sizeof_long.err
+/objdir/_mkc_sizeof_long.res
+/objdir/_mkc_sizeof_long~long.c
+/objdir/_mkc_sizeof_long~long.err
+/objdir/_mkc_sizeof_long~long.res
+/objdir/_mkc_sizeof_size_t.c
+/objdir/_mkc_sizeof_size_t.err
+/objdir/_mkc_sizeof_size_t.res
+/objdir/_mkc_sizeof_voidP.c
+/objdir/_mkc_sizeof_voidP.err
+/objdir/_mkc_sizeof_voidP.res
+/objdir/expect.out
+/objdir/hello_sizeof.test.out.tmp
+/objdir/sizeof_test
+/objdir/sizeof_test.c
+/objdir/sizeof_test.o
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/sizeof_test
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/_mkc_sizeof_int.c
+/objdir/_mkc_sizeof_int.err
+/objdir/_mkc_sizeof_int.res
+/objdir/_mkc_sizeof_long.c
+/objdir/_mkc_sizeof_long.err
+/objdir/_mkc_sizeof_long.res
+/objdir/_mkc_sizeof_long~long.c
+/objdir/_mkc_sizeof_long~long.err
+/objdir/_mkc_sizeof_long~long.res
+/objdir/_mkc_sizeof_size_t.c
+/objdir/_mkc_sizeof_size_t.err
+/objdir/_mkc_sizeof_size_t.res
+/objdir/_mkc_sizeof_voidP.c
+/objdir/_mkc_sizeof_voidP.err
+/objdir/_mkc_sizeof_voidP.res
+/objdir/expect.out
+/objdir/hello_sizeof.test.out.tmp
+/objdir/sizeof_test.c
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/hello_sizeof.test.out.tmp
+/objdir/sizeof_test.c
+/objdir/test.mk
diff --git a/examples/hello_sizeof/sizeof_test.c b/examples/hello_sizeof/sizeof_test.c
new file mode 100644
index 0000000..87a445c
--- /dev/null
+++ b/examples/hello_sizeof/sizeof_test.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+
+int main (int argc, char **argv)
+{
+ printf ("sizeof(int)=%i\n", SIZEOF_INT);
+ printf ("sizeof(long)=%i\n", SIZEOF_LONG);
+#ifdef SIZEOF_LONG_LONG
+ printf ("sizeof(long long)=%i\n", SIZEOF_LONG_LONG);
+#else
+ printf ("long long type is absent\n");
+#endif
+#ifdef SIZEOF_SIZE_T_STRING_H
+ printf ("sizeof(size_t)=%i\n", SIZEOF_SIZE_T_STRING_H);
+#else
+ printf ("size_t type is absent???\n");
+#endif
+ printf ("sizeof(void*)=%i\n", SIZEOF_VOIDP);
+
+ return 0;
+}
diff --git a/examples/hello_sizeof/test.mk b/examples/hello_sizeof/test.mk
new file mode 100644
index 0000000..174eb9d
--- /dev/null
+++ b/examples/hello_sizeof/test.mk
@@ -0,0 +1,32 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ ${.OBJDIR}/sizeof_test | tr '1248' 'nnnn'; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_strlcpy/Makefile b/examples/hello_strlcpy/Makefile
new file mode 100644
index 0000000..1ac88ee
--- /dev/null
+++ b/examples/hello_strlcpy/Makefile
@@ -0,0 +1,12 @@
+MKC_SOURCE_FUNCLIBS = strlcpy
+MKC_CHECK_FUNCS3 += strlcpy:string.h
+
+PROG = hello4
+SRCS = hello.c
+
+WARNS = 4
+
+MKC_REQD = 0.10.0
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_strlcpy/expect.out b/examples/hello_strlcpy/expect.out
new file mode 100644
index 0000000..060d314
--- /dev/null
+++ b/examples/hello_strlcpy/expect.out
@@ -0,0 +1,74 @@
+# Copyrig
+# All rig
+#
+# Redistr
+# modific
+# are met
+# 1. Redi
+# noti
+# 2. Redi
+# noti
+# docu
+#
+# THIS SO
+# ``AS IS
+# TO, THE
+# PURPOSE
+# BE LIAB
+# CONSEQU
+# SUBSTIT
+# INTERRU
+# CONTRAC
+# ARISING
+# POSSIBI
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_func3_strlcpy_string_h.c
+/objdir/_mkc_func3_strlcpy_string_h.err
+/objdir/_mkc_func3_strlcpy_string_h.res
+/objdir/_mkc_funclib_strlcpy.c
+/objdir/_mkc_funclib_strlcpy.err
+/objdir/_mkc_funclib_strlcpy.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/expect.out
+/objdir/hello.c
+/objdir/hello.o
+/objdir/hello4
+/objdir/hello_strlcpy.test.out.tmp
+/objdir/input.in
+/objdir/strlcpy.c
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/hello4
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_func3_strlcpy_string_h.c
+/objdir/_mkc_func3_strlcpy_string_h.err
+/objdir/_mkc_func3_strlcpy_string_h.res
+/objdir/_mkc_funclib_strlcpy.c
+/objdir/_mkc_funclib_strlcpy.err
+/objdir/_mkc_funclib_strlcpy.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/expect.out
+/objdir/hello.c
+/objdir/hello_strlcpy.test.out.tmp
+/objdir/input.in
+/objdir/strlcpy.c
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/hello.c
+/objdir/hello_strlcpy.test.out.tmp
+/objdir/input.in
+/objdir/strlcpy.c
+/objdir/test.mk
diff --git a/examples/hello_strlcpy/hello.c b/examples/hello_strlcpy/hello.c
new file mode 100644
index 0000000..b7dd661
--- /dev/null
+++ b/examples/hello_strlcpy/hello.c
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include <string.h>
+
+#ifndef HAVE_FUNC3_STRLCPY_STRING_H
+size_t strlcpy(char *dst, const char *src, size_t siz);
+#endif
+
+int main (int argc, char ** argv)
+{
+ char buf [2000];
+ char small_buf [10];
+
+ size_t len;
+
+ while (fgets (buf, sizeof (buf), stdin)){
+ len = strlen (buf);
+ if (len > 0 && buf [len-1] == '\n')
+ buf [len-1] = 0;
+
+ strlcpy (small_buf, buf, sizeof (small_buf));
+ puts (small_buf);
+ }
+
+ return 0;
+}
diff --git a/examples/hello_strlcpy/input.in b/examples/hello_strlcpy/input.in
new file mode 100644
index 0000000..a5a6836
--- /dev/null
+++ b/examples/hello_strlcpy/input.in
@@ -0,0 +1,23 @@
+# 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.
diff --git a/examples/hello_strlcpy/strlcpy.c b/examples/hello_strlcpy/strlcpy.c
new file mode 100644
index 0000000..c7f1fbb
--- /dev/null
+++ b/examples/hello_strlcpy/strlcpy.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE
+ * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copy src to string dst of size siz. At most siz-1 characters
+ * will be copied. Always NUL terminates (unless siz == 0).
+ * Returns strlen(src); if retval >= siz, truncation occurred.
+ */
+#include <string.h>
+
+size_t
+strlcpy(char *dst, const char *src, size_t siz);
+
+size_t
+strlcpy(char *dst, const char *src, size_t siz)
+{
+ char *d = dst;
+ const char *s = src;
+ size_t n = siz;
+
+ /* Copy as many bytes as will fit */
+ if (n != 0 && --n != 0) {
+ do {
+ if ((*d++ = *s++) == 0)
+ break;
+ } while (--n != 0);
+ }
+
+ /* Not enough room in dst, add NUL and traverse rest of src */
+ if (n == 0) {
+ if (siz != 0)
+ *d = '\0'; /* NUL-terminate dst */
+ while (*s++)
+ ;
+ }
+
+ return(s - src - 1); /* count does not include NUL */
+}
diff --git a/examples/hello_strlcpy/test.mk b/examples/hello_strlcpy/test.mk
new file mode 100644
index 0000000..ffa417d
--- /dev/null
+++ b/examples/hello_strlcpy/test.mk
@@ -0,0 +1,33 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ ${.OBJDIR}/hello4 < ${.CURDIR}/input.in; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | grep -v 'strlcpy[.]o' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ grep -v 'strlcpy[.]o' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | grep -v 'strlcpy[.]o' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | grep -v 'strlcpy[.]o' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | grep -v 'strlcpy[.]o' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_subdirs/Makefile b/examples/hello_subdirs/Makefile
new file mode 100644
index 0000000..3847c12
--- /dev/null
+++ b/examples/hello_subdirs/Makefile
@@ -0,0 +1,3 @@
+SUBDIR = prog1 prog2
+
+.include <mkc.subdir.mk>
diff --git a/examples/hello_subdirs/Makefile.inc b/examples/hello_subdirs/Makefile.inc
new file mode 100644
index 0000000..01b5f23
--- /dev/null
+++ b/examples/hello_subdirs/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/examples/hello_subdirs/prog1/Makefile b/examples/hello_subdirs/prog1/Makefile
new file mode 100644
index 0000000..d103cbe
--- /dev/null
+++ b/examples/hello_subdirs/prog1/Makefile
@@ -0,0 +1,14 @@
+PROG = prog1
+SCRIPTS = prog1.sh prog1.awk
+
+WARNS = 4
+
+# Do not set SCRIPTSNAME in project's Makefile!
+# This is just a regression test.
+SCRIPTSNAME_prog1.awk = program1.awk
+SCRIPTSNAME_prog1.sh = program1.sh
+
+SCRIPTSDIR_prog1.sh = ${PREFIX}/libexec
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_subdirs/prog1/expect.out b/examples/hello_subdirs/prog1/expect.out
new file mode 100644
index 0000000..fe11252
--- /dev/null
+++ b/examples/hello_subdirs/prog1/expect.out
@@ -0,0 +1,36 @@
+Hello World1
+Hello World1-2
+Hello World1-3
+OBJDIR_prog1=/path/to/prog1
+OBJDIR_prog2=/path/to/prog2
+=========== all ============
+/objdir/Makefile
+/objdir/expect.out
+/objdir/prog1
+/objdir/prog1.awk
+/objdir/prog1.c
+/objdir/prog1.o
+/objdir/prog1.sh
+/objdir/prog1.test.out.tmp
+/objdir/test.mk
+========= install ==========
+/objdir/prefix/bin/prog1
+/objdir/prefix/bin/program1.awk
+/objdir/prefix/libexec/program1.sh
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/prog1.awk
+/objdir/prog1.c
+/objdir/prog1.sh
+/objdir/prog1.test.out.tmp
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/prog1.awk
+/objdir/prog1.c
+/objdir/prog1.sh
+/objdir/prog1.test.out.tmp
+/objdir/test.mk
diff --git a/examples/hello_subdirs/prog1/prog1.awk b/examples/hello_subdirs/prog1/prog1.awk
new file mode 100755
index 0000000..5a03ed8
--- /dev/null
+++ b/examples/hello_subdirs/prog1/prog1.awk
@@ -0,0 +1,6 @@
+#!/usr/bin/awk -f
+
+BEGIN {
+ print "Hello World1-3"
+ exit 0
+}
diff --git a/examples/hello_subdirs/prog1/prog1.c b/examples/hello_subdirs/prog1/prog1.c
new file mode 100644
index 0000000..33fd57f
--- /dev/null
+++ b/examples/hello_subdirs/prog1/prog1.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main (int argc, char **argv)
+{
+ puts ("Hello World1");
+ return 0;
+}
diff --git a/examples/hello_subdirs/prog1/prog1.sh b/examples/hello_subdirs/prog1/prog1.sh
new file mode 100755
index 0000000..43d6573
--- /dev/null
+++ b/examples/hello_subdirs/prog1/prog1.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo Hello World1-2
diff --git a/examples/hello_subdirs/prog1/test.mk b/examples/hello_subdirs/prog1/test.mk
new file mode 100644
index 0000000..d62c501
--- /dev/null
+++ b/examples/hello_subdirs/prog1/test.mk
@@ -0,0 +1,37 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ ${.OBJDIR}/prog1; \
+ ${.OBJDIR}/prog1.sh; \
+ ${.OBJDIR}/prog1.awk; \
+ \
+ echo OBJDIR_prog1=${OBJDIR_prog1} | mkc_test_helper_paths; \
+ echo OBJDIR_prog2=${OBJDIR_prog2} | mkc_test_helper_paths; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKE_FLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKE_FLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKE_FLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKE_FLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_subdirs/prog2/Makefile b/examples/hello_subdirs/prog2/Makefile
new file mode 100644
index 0000000..ebf00fa
--- /dev/null
+++ b/examples/hello_subdirs/prog2/Makefile
@@ -0,0 +1,9 @@
+PROG = prog2
+WARNS = 4
+
+# Do not set PROGNAME in project's Makefile!
+# This is just a regression test.
+PROGNAME = program2
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_subdirs/prog2/expect.out b/examples/hello_subdirs/prog2/expect.out
new file mode 100644
index 0000000..8730e19
--- /dev/null
+++ b/examples/hello_subdirs/prog2/expect.out
@@ -0,0 +1,26 @@
+Hello World2
+OBJDIR_prog1=/path/to/prog1
+OBJDIR_prog2=/path/to/prog2
+=========== all ============
+/objdir/Makefile
+/objdir/expect.out
+/objdir/prog2
+/objdir/prog2.c
+/objdir/prog2.o
+/objdir/prog2.test.out.tmp
+/objdir/test.mk
+========= install ==========
+/objdir/prefix/bin/program2
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/prog2.c
+/objdir/prog2.test.out.tmp
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/prog2.c
+/objdir/prog2.test.out.tmp
+/objdir/test.mk
diff --git a/examples/hello_subdirs/prog2/prog2.c b/examples/hello_subdirs/prog2/prog2.c
new file mode 100644
index 0000000..314960b
--- /dev/null
+++ b/examples/hello_subdirs/prog2/prog2.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main (int argc, char **argv)
+{
+ puts ("Hello World2");
+ return 0;
+}
diff --git a/examples/hello_subdirs/prog2/test.mk b/examples/hello_subdirs/prog2/test.mk
new file mode 100644
index 0000000..e86aa9c
--- /dev/null
+++ b/examples/hello_subdirs/prog2/test.mk
@@ -0,0 +1,35 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ ${.OBJDIR}/prog2; \
+ \
+ echo OBJDIR_prog1=${OBJDIR_prog1} | mkc_test_helper_paths; \
+ echo OBJDIR_prog2=${OBJDIR_prog2} | mkc_test_helper_paths; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKE_FLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKE_FLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKE_FLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKE_FLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_superfs/Makefile b/examples/hello_superfs/Makefile
new file mode 100644
index 0000000..c58ab37
--- /dev/null
+++ b/examples/hello_superfs/Makefile
@@ -0,0 +1,10 @@
+SUBPRJ = mkfs_superfs fsck_superfs \
+ docs \
+ mkfs_superfs:tools fsck_superfs:tools
+
+SUBPRJ_DFLT = mkfs_superfs fsck_superfs docs
+
+# "tools" is a virtual subproject, there is no subdirectory for it
+
+.include "test.mk"
+.include <mkc.subprj.mk>
diff --git a/examples/hello_superfs/Makefile.inc b/examples/hello_superfs/Makefile.inc
new file mode 100644
index 0000000..d29359b
--- /dev/null
+++ b/examples/hello_superfs/Makefile.inc
@@ -0,0 +1 @@
+BINDIR?= ${SBINDIR}
diff --git a/examples/hello_superfs/docs/LICENSE b/examples/hello_superfs/docs/LICENSE
new file mode 100644
index 0000000..2aa558a
--- /dev/null
+++ b/examples/hello_superfs/docs/LICENSE
@@ -0,0 +1 @@
+License text here
diff --git a/examples/hello_superfs/docs/Makefile b/examples/hello_superfs/docs/Makefile
new file mode 100644
index 0000000..f3f0b31
--- /dev/null
+++ b/examples/hello_superfs/docs/Makefile
@@ -0,0 +1,6 @@
+FILES = LICENSE NEWS README
+FILESDIR = ${DOCDIR}
+
+DOCDIR ?= ${DATADIR}/doc/dict
+
+.include <mkc.files.mk>
diff --git a/examples/hello_superfs/docs/NEWS b/examples/hello_superfs/docs/NEWS
new file mode 100644
index 0000000..e6cfeee
--- /dev/null
+++ b/examples/hello_superfs/docs/NEWS
@@ -0,0 +1 @@
+News here
diff --git a/examples/hello_superfs/docs/README b/examples/hello_superfs/docs/README
new file mode 100644
index 0000000..62c8d0b
--- /dev/null
+++ b/examples/hello_superfs/docs/README
@@ -0,0 +1 @@
+Readme file
diff --git a/examples/hello_superfs/expect.out b/examples/hello_superfs/expect.out
new file mode 100644
index 0000000..542cf1c
--- /dev/null
+++ b/examples/hello_superfs/expect.out
@@ -0,0 +1,127 @@
+=========== all ============
+/objdir/Makefile
+/objdir/Makefile.inc
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/docs/LICENSE
+/objdir/docs/Makefile
+/objdir/docs/NEWS
+/objdir/docs/README
+/objdir/expect.out
+/objdir/fsck_superfs/Makefile
+/objdir/fsck_superfs/fsck_superfs
+/objdir/fsck_superfs/fsck_superfs.8
+/objdir/fsck_superfs/fsck_superfs.c
+/objdir/fsck_superfs/fsck_superfs.cat8
+/objdir/fsck_superfs/fsck_superfs.o
+/objdir/hello_superfs.test.out.tmp
+/objdir/mkfs_superfs/Makefile
+/objdir/mkfs_superfs/mkfs_superfs
+/objdir/mkfs_superfs/mkfs_superfs.8
+/objdir/mkfs_superfs/mkfs_superfs.c
+/objdir/mkfs_superfs/mkfs_superfs.cat8
+/objdir/mkfs_superfs/mkfs_superfs.o
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/man
+/objdir/prefix/man/cat8
+/objdir/prefix/man/cat8/fsck_superfs.0
+/objdir/prefix/man/cat8/mkfs_superfs.0
+/objdir/prefix/man/man8
+/objdir/prefix/man/man8/fsck_superfs.8
+/objdir/prefix/man/man8/mkfs_superfs.8
+/objdir/prefix/sbin
+/objdir/prefix/sbin/fsck_superfs
+/objdir/prefix/sbin/mkfs_superfs
+/objdir/prefix/share
+/objdir/prefix/share/doc
+/objdir/prefix/share/doc/dict
+/objdir/prefix/share/doc/dict/LICENSE
+/objdir/prefix/share/doc/dict/NEWS
+/objdir/prefix/share/doc/dict/README
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/Makefile.inc
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/docs/LICENSE
+/objdir/docs/Makefile
+/objdir/docs/NEWS
+/objdir/docs/README
+/objdir/expect.out
+/objdir/fsck_superfs/Makefile
+/objdir/fsck_superfs/fsck_superfs.8
+/objdir/fsck_superfs/fsck_superfs.c
+/objdir/hello_superfs.test.out.tmp
+/objdir/mkfs_superfs/Makefile
+/objdir/mkfs_superfs/mkfs_superfs.8
+/objdir/mkfs_superfs/mkfs_superfs.c
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/Makefile.inc
+/objdir/docs/LICENSE
+/objdir/docs/Makefile
+/objdir/docs/NEWS
+/objdir/docs/README
+/objdir/expect.out
+/objdir/fsck_superfs/Makefile
+/objdir/fsck_superfs/fsck_superfs.8
+/objdir/fsck_superfs/fsck_superfs.c
+/objdir/hello_superfs.test.out.tmp
+/objdir/mkfs_superfs/Makefile
+/objdir/mkfs_superfs/mkfs_superfs.8
+/objdir/mkfs_superfs/mkfs_superfs.c
+/objdir/test.mk
+======= errorcheck ==========
+/objdir/Makefile
+/objdir/Makefile.inc
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/docs/LICENSE
+/objdir/docs/Makefile
+/objdir/docs/NEWS
+/objdir/docs/README
+/objdir/expect.out
+/objdir/fsck_superfs/Makefile
+/objdir/fsck_superfs/fsck_superfs.8
+/objdir/fsck_superfs/fsck_superfs.c
+/objdir/hello_superfs.test.out.tmp
+/objdir/mkfs_superfs/Makefile
+/objdir/mkfs_superfs/mkfs_superfs.8
+/objdir/mkfs_superfs/mkfs_superfs.c
+/objdir/test.mk
+==== install MKINSTALL=no ====
+/objdir/Makefile
+/objdir/Makefile.inc
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/docs/LICENSE
+/objdir/docs/Makefile
+/objdir/docs/NEWS
+/objdir/docs/README
+/objdir/expect.out
+/objdir/fsck_superfs/Makefile
+/objdir/fsck_superfs/fsck_superfs
+/objdir/fsck_superfs/fsck_superfs.8
+/objdir/fsck_superfs/fsck_superfs.c
+/objdir/fsck_superfs/fsck_superfs.cat8
+/objdir/fsck_superfs/fsck_superfs.o
+/objdir/hello_superfs.test.out.tmp
+/objdir/mkfs_superfs/Makefile
+/objdir/mkfs_superfs/mkfs_superfs
+/objdir/mkfs_superfs/mkfs_superfs.8
+/objdir/mkfs_superfs/mkfs_superfs.c
+/objdir/mkfs_superfs/mkfs_superfs.cat8
+/objdir/mkfs_superfs/mkfs_superfs.o
+/objdir/test.mk
diff --git a/examples/hello_superfs/fsck_superfs/Makefile b/examples/hello_superfs/fsck_superfs/Makefile
new file mode 100644
index 0000000..ffc799c
--- /dev/null
+++ b/examples/hello_superfs/fsck_superfs/Makefile
@@ -0,0 +1,6 @@
+PROG = fsck_superfs
+MAN = fsck_superfs.8
+
+WARNS = 4
+
+.include <mkc.prog.mk>
diff --git a/examples/hello_superfs/fsck_superfs/fsck_superfs.8 b/examples/hello_superfs/fsck_superfs/fsck_superfs.8
new file mode 100644
index 0000000..63f0e5c
--- /dev/null
+++ b/examples/hello_superfs/fsck_superfs/fsck_superfs.8
@@ -0,0 +1,15 @@
+.\" $NetBSD$
+.\"
+.\" Copyright (c) 2010 by Aleksey Cheusov (vle@gmx.net)
+.\" Absolutely no warranty.
+.\"
+.TH FSCK_SUPERFS 8 "Jul 23, 2010"
+.SH NAME
+fsck_superfs \- fsck utility for superfs file system
+.SH DESCRIPTION
+.B fsck_superfs
+is one of mk-c examples
+.SH SEE ALSO
+.BR fsck(8) , mkfs(8)
+.SH AUTHOR
+Aleksey Cheusov <vle@gmx.net>
diff --git a/examples/hello_superfs/fsck_superfs/fsck_superfs.c b/examples/hello_superfs/fsck_superfs/fsck_superfs.c
new file mode 100644
index 0000000..d45d5b7
--- /dev/null
+++ b/examples/hello_superfs/fsck_superfs/fsck_superfs.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main (int argc, char **argv)
+{
+ puts ("fsck fake");
+ return 0;
+}
diff --git a/examples/hello_superfs/mkfs_superfs/Makefile b/examples/hello_superfs/mkfs_superfs/Makefile
new file mode 100644
index 0000000..eb7c9cb
--- /dev/null
+++ b/examples/hello_superfs/mkfs_superfs/Makefile
@@ -0,0 +1,6 @@
+PROG = mkfs_superfs
+MAN = mkfs_superfs.8
+
+WARNS = 4
+
+.include <mkc.prog.mk>
diff --git a/examples/hello_superfs/mkfs_superfs/mkfs_superfs.8 b/examples/hello_superfs/mkfs_superfs/mkfs_superfs.8
new file mode 100644
index 0000000..a0401a7
--- /dev/null
+++ b/examples/hello_superfs/mkfs_superfs/mkfs_superfs.8
@@ -0,0 +1,15 @@
+.\" $NetBSD$
+.\"
+.\" Copyright (c) 2010 by Aleksey Cheusov (vle@gmx.net)
+.\" Absolutely no warranty.
+.\"
+.TH MKFS_SUPERFS 8 "Jul 23, 2010"
+.SH NAME
+mkfs_superfs \- mkfs utility for superfs file system
+.SH DESCRIPTION
+.B mkfs_superfs
+is one of mk-c examples
+.SH SEE ALSO
+.BR mkfs(8) , fsck(8)
+.SH AUTHOR
+Aleksey Cheusov <vle@gmx.net>
diff --git a/examples/hello_superfs/mkfs_superfs/mkfs_superfs.c b/examples/hello_superfs/mkfs_superfs/mkfs_superfs.c
new file mode 100644
index 0000000..e644f6a
--- /dev/null
+++ b/examples/hello_superfs/mkfs_superfs/mkfs_superfs.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main (int argc, char **argv)
+{
+ puts ("mkfs fake");
+ return 0;
+}
diff --git a/examples/hello_superfs/test.mk b/examples/hello_superfs/test.mk
new file mode 100644
index 0000000..6ce8018
--- /dev/null
+++ b/examples/hello_superfs/test.mk
@@ -0,0 +1,48 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======= errorcheck ==========; \
+ ${MAKE} ${MAKEFLAGS} errorcheck > /dev/null 2>&1; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ ${MAKE} ${MAKEFLAGS} cleandir > /dev/null 2>&1; \
+ \
+ echo ==== install MKINSTALL=no ====; \
+ MKINSTALL=no; export MKINSTALL; \
+ ${MAKE} ${MAKEFLAGS} all installdirs install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ true ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_world/COPYRIGHT b/examples/hello_world/COPYRIGHT
new file mode 100644
index 0000000..32a633d
--- /dev/null
+++ b/examples/hello_world/COPYRIGHT
@@ -0,0 +1,2 @@
+Everything here was written by Aleksey Cheusov <vle@gmx.net>.
+Public domain.
diff --git a/examples/hello_world/Makefile b/examples/hello_world/Makefile
new file mode 100644
index 0000000..b993754
--- /dev/null
+++ b/examples/hello_world/Makefile
@@ -0,0 +1,13 @@
+DOCDIR ?= ${DATADIR}/doc/${PROG}
+
+PROG = hello_world
+
+WARNS = 4
+
+FILES = COPYRIGHT README
+FILESDIR = ${DOCDIR}
+
+MKC_REQD = 0.10.0
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_world/README b/examples/hello_world/README
new file mode 100644
index 0000000..84f435c
--- /dev/null
+++ b/examples/hello_world/README
@@ -0,0 +1,9 @@
+This is a well known "hello world" application.
+It provides "hello_world" application written in C
+and nothing else.
+
+In order to build this program run the following commands:
+
+ bmake # for bulding
+ bmake installdirs # for creating destination directories
+ bmake install # for installing files
diff --git a/examples/hello_world/expect.out b/examples/hello_world/expect.out
new file mode 100644
index 0000000..9de8b7c
--- /dev/null
+++ b/examples/hello_world/expect.out
@@ -0,0 +1,80 @@
+PROJECTNAME=hello_world
+Hello World!
+=========== all ============
+/objdir/COPYRIGHT
+/objdir/Makefile
+/objdir/README
+/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_world
+/objdir/hello_world.c
+/objdir/hello_world.o
+/objdir/hello_world.test.out.tmp
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/hello_world
+/objdir/prefix/share
+/objdir/prefix/share/doc
+/objdir/prefix/share/doc/hello_world
+/objdir/prefix/share/doc/hello_world/COPYRIGHT
+/objdir/prefix/share/doc/hello_world/README
+======== uninstall =========
+========== clean ===========
+/objdir/COPYRIGHT
+/objdir/Makefile
+/objdir/README
+/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_world.c
+/objdir/hello_world.test.out.tmp
+/objdir/test.mk
+======== bin_tar ===========
+usr
+usr/local
+usr/local/bin
+usr/local/bin/hello_world
+usr/local/share
+usr/local/share/doc
+usr/local/share/doc/hello_world
+usr/local/share/doc/hello_world/COPYRIGHT
+usr/local/share/doc/hello_world/README
+======== bin_targz ===========
+usr
+usr/local
+usr/local/bin
+usr/local/bin/hello_world
+usr/local/share
+usr/local/share/doc
+usr/local/share/doc/hello_world
+usr/local/share/doc/hello_world/COPYRIGHT
+usr/local/share/doc/hello_world/README
+======== bin_tarbz2 ===========
+usr
+usr/local
+usr/local/bin
+usr/local/bin/hello_world
+usr/local/share
+usr/local/share/doc
+usr/local/share/doc/hello_world
+usr/local/share/doc/hello_world/COPYRIGHT
+usr/local/share/doc/hello_world/README
+======= filelist ===========
+/usr/local/bin/hello_world
+/usr/local/share/doc/hello_world/COPYRIGHT
+/usr/local/share/doc/hello_world/README
+======= distclean ==========
+/objdir/COPYRIGHT
+/objdir/Makefile
+/objdir/README
+/objdir/expect.out
+/objdir/hello_world.c
+/objdir/hello_world.test.out.tmp
+/objdir/test.mk
diff --git a/examples/hello_world/hello_world.c b/examples/hello_world/hello_world.c
new file mode 100644
index 0000000..3d8f214
--- /dev/null
+++ b/examples/hello_world/hello_world.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main (int argc, char** argv)
+{
+ puts ("Hello World!");
+ return 0;
+}
diff --git a/examples/hello_world/test.mk b/examples/hello_world/test.mk
new file mode 100644
index 0000000..adc16fd
--- /dev/null
+++ b/examples/hello_world/test.mk
@@ -0,0 +1,54 @@
+DISTCLEANDIRS+= *.tar *.tar.gz *.tar.bz2
+
+tartf_cleanup= sed -e 's,^[.]/,,' -e 's,/$$,,' -e '/^[.]*$$/ d'
+
+.PHONY : test_output
+test_output:
+ @set -e; LC_ALL=C; export LC_ALL; \
+ echo PROJECTNAME=${PROJECTNAME}; \
+ ${.OBJDIR}/hello_world; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======== bin_tar ===========; \
+ ${MAKE} ${MAKEFLAGS} bin_tar > /dev/null; \
+ ${TAR} -tf ${.CURDIR:T}.tar | sort | ${tartf_cleanup}; \
+ \
+ echo ======== bin_targz ===========; \
+ ${MAKE} ${MAKEFLAGS} bin_targz > /dev/null; \
+ ${GZIP} -dc ${.CURDIR:T}.tar.gz | \
+ ${TAR} -tf - | sort | ${tartf_cleanup}; \
+ \
+ echo ======== bin_tarbz2 ===========; \
+ ${MAKE} ${MAKEFLAGS} bin_tarbz2 > /dev/null; \
+ ${BZIP2} -dc ${.CURDIR:T}.tar.bz2 | \
+ ${TAR} -tf - | sort | ${tartf_cleanup}; \
+ \
+ echo ======= filelist ===========; \
+ ${MAKE} ${MAKEFLAGS} filelist; \
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_xxzip/Makefile b/examples/hello_xxzip/Makefile
new file mode 100644
index 0000000..be0eb51
--- /dev/null
+++ b/examples/hello_xxzip/Makefile
@@ -0,0 +1,30 @@
+PROG = xxzip
+MAN = xxzip.1
+
+# manual page and tutorial will be generated from .pod documents, so
+# we need pod2man and pod2html.
+MKC_REQUIRE_PROGS = ${POD2MAN} ${POD2HTML}
+
+MKPIE ?= yes
+USE_SSP ?= yes
+USE_RELRO ?= yes
+
+WARNS = 4
+
+DOCDIR ?= ${DATADIR}/doc/${PROG}
+
+MLINKS = xxzip.1 xxunzip.1
+MLINKS += xxzip.1 xxzcat.1
+
+LINKS = ${BINDIR}/xxzip ${BINDIR}/xxunzip
+LINKS += ${BINDIR}/xxzip ${BINDIR}/xxzcat
+
+FILES = tutorial.html
+FILESDIR = ${DOCDIR}
+
+WARNS = 4
+
+CLEANFILES += xxzip.1 tutorial.html
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_xxzip/expect.out b/examples/hello_xxzip/expect.out
new file mode 100644
index 0000000..61cec79
--- /dev/null
+++ b/examples/hello_xxzip/expect.out
@@ -0,0 +1,76 @@
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/_mkc_prog_pod2html.err
+/objdir/_mkc_prog_pod2html.res
+/objdir/_mkc_prog_pod2man.err
+/objdir/_mkc_prog_pod2man.res
+/objdir/expect.out
+/objdir/hello_xxzip.test.out.tmp
+/objdir/test.mk
+/objdir/tutorial.html
+/objdir/tutorial.pod
+/objdir/xxzip
+/objdir/xxzip.1
+/objdir/xxzip.c
+/objdir/xxzip.cat1
+/objdir/xxzip.o
+/objdir/xxzip.pod
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/xxunzip
+/objdir/prefix/bin/xxzcat
+/objdir/prefix/bin/xxzip
+/objdir/prefix/man
+/objdir/prefix/man/cat1
+/objdir/prefix/man/cat1/xxunzip.0
+/objdir/prefix/man/cat1/xxzcat.0
+/objdir/prefix/man/cat1/xxzip.0
+/objdir/prefix/man/man1
+/objdir/prefix/man/man1/xxunzip.1
+/objdir/prefix/man/man1/xxzcat.1
+/objdir/prefix/man/man1/xxzip.1
+/objdir/prefix/share
+/objdir/prefix/share/doc
+/objdir/prefix/share/doc/xxzip
+/objdir/prefix/share/doc/xxzip/tutorial.html
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/_mkc_prog_pod2html.err
+/objdir/_mkc_prog_pod2html.res
+/objdir/_mkc_prog_pod2man.err
+/objdir/_mkc_prog_pod2man.res
+/objdir/expect.out
+/objdir/hello_xxzip.test.out.tmp
+/objdir/test.mk
+/objdir/tutorial.pod
+/objdir/xxzip.c
+/objdir/xxzip.pod
+======== filelist ==========
+/usr/local/bin/xxunzip
+/usr/local/bin/xxzcat
+/usr/local/bin/xxzip
+/usr/local/man/cat1/xxunzip.0
+/usr/local/man/cat1/xxzcat.0
+/usr/local/man/cat1/xxzip.0
+/usr/local/man/man1/xxunzip.1
+/usr/local/man/man1/xxzcat.1
+/usr/local/man/man1/xxzip.1
+/usr/local/share/doc/xxzip/tutorial.html
+======= distclean ==========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/hello_xxzip.test.out.tmp
+/objdir/test.mk
+/objdir/tutorial.pod
+/objdir/xxzip.c
+/objdir/xxzip.pod
diff --git a/examples/hello_xxzip/test.mk b/examples/hello_xxzip/test.mk
new file mode 100644
index 0000000..1077edd
--- /dev/null
+++ b/examples/hello_xxzip/test.mk
@@ -0,0 +1,34 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======== filelist ==========; \
+ ${MAKE} ${MAKEFLAGS} filelist; \
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_xxzip/tutorial.pod b/examples/hello_xxzip/tutorial.pod
new file mode 100644
index 0000000..1973efa
--- /dev/null
+++ b/examples/hello_xxzip/tutorial.pod
@@ -0,0 +1,17 @@
+=head1 NAME
+
+xxzip - super-puper compression utility
+
+=head1 INTRODCTION
+
+lalala
+
+=head1 STEP1
+
+bla bla bla
+
+=head1 STEP2
+
+bla bla bla
+
+=head1 BYE
diff --git a/examples/hello_xxzip/xxzip.c b/examples/hello_xxzip/xxzip.c
new file mode 100644
index 0000000..2ced760
--- /dev/null
+++ b/examples/hello_xxzip/xxzip.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main (int argc, char **argv)
+{
+ puts ("xxzip compression utility\n");
+ return 0;
+}
diff --git a/examples/hello_xxzip/xxzip.pod b/examples/hello_xxzip/xxzip.pod
new file mode 100644
index 0000000..51ab8b3
--- /dev/null
+++ b/examples/hello_xxzip/xxzip.pod
@@ -0,0 +1,44 @@
+=head1 NAME
+
+xxzip - super-puper compression utility
+
+=head1 SYNOPSIS
+
+B<xxzip> I<[options]> I<[files...]>
+
+B<xxunzip> I<[options]> I<[files...]>
+
+B<xxzcat> I<[options]> I<[files...]>
+
+=head1 DESCRIPTION
+
+bla bla bla
+
+=head1 OPTIONS
+
+=over 6
+
+=item B<-h>
+
+Display help information.
+
+=item B<-c>
+
+Output to the standard output stream
+
+=item B<-d>
+
+This option selects decompression rather than compression.
+
+=back
+
+=head1 AUTHOR
+
+Copyright (c) 2010 Aleksey Cheusov <vle@gmx.net>
+
+=head1 HOME
+
+L<http://sourceforge.net/projects/mk-configure>
+
+=head1 SEE ALSO
+L<mk-configure(7)>
diff --git a/examples/hello_yacc/Makefile b/examples/hello_yacc/Makefile
new file mode 100644
index 0000000..b9713c3
--- /dev/null
+++ b/examples/hello_yacc/Makefile
@@ -0,0 +1,6 @@
+PROG = hello_calc
+
+SRCS = calc.y
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_yacc/calc.y b/examples/hello_yacc/calc.y
new file mode 100644
index 0000000..a80fc30
--- /dev/null
+++ b/examples/hello_yacc/calc.y
@@ -0,0 +1,49 @@
+%{
+#include <ctype.h>
+#include <stdio.h>
+
+#define YYSTYPE int
+void yyerror (char const *s);
+%}
+
+%token NUMBER
+%left '+' '-'
+%right '*' '/'
+
+%%
+
+lines : lines expr '\n' { printf ("%i\n", $2); }
+ | lines '\n'
+ |
+ ;
+
+expr : expr '+' expr { $$ = $1 + $3; }
+ | expr '-' expr { $$ = $1 - $3; }
+ | expr '*' expr { $$ = $1 * $3; }
+ | expr '-' expr { $$ = $1 / $3; }
+ | '(' expr ')' { $$ = $2; }
+ | NUMBER
+ ;
+
+%%
+
+yylex (){
+ int c = getchar ();
+
+ if (c >= '0' && c <= '9'){
+ yylval = c - '0';
+ return NUMBER;
+ }
+ return c;
+}
+
+void yyerror (char const *s)
+{
+ fprintf (stderr, "%s\n", s);
+}
+
+int main (int argc, char **argv)
+{
+ yyparse ();
+ return 0;
+}
diff --git a/examples/hello_yacc/expect.out b/examples/hello_yacc/expect.out
new file mode 100644
index 0000000..6f46ee5
--- /dev/null
+++ b/examples/hello_yacc/expect.out
@@ -0,0 +1,49 @@
+4
+45
+-1
+45
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/_mkc_prog_yacc.err
+/objdir/_mkc_prog_yacc.res
+/objdir/calc.c
+/objdir/calc.o
+/objdir/calc.y
+/objdir/expect.out
+/objdir/hello_calc
+/objdir/hello_yacc.test.out.tmp
+/objdir/input.txt
+/objdir/test.mk
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/hello_calc
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/_mkc_prog_yacc.err
+/objdir/_mkc_prog_yacc.res
+/objdir/calc.y
+/objdir/expect.out
+/objdir/hello_yacc.test.out.tmp
+/objdir/input.txt
+/objdir/test.mk
+==== SHRTOUT=yes ====
+YACC: calc.y
+CC: calc.c
+LD: hello_calc
+======= distclean ==========
+/objdir/Makefile
+/objdir/calc.y
+/objdir/expect.out
+/objdir/hello_yacc.test.out.tmp
+/objdir/input.txt
+/objdir/test.mk
diff --git a/examples/hello_yacc/input.txt b/examples/hello_yacc/input.txt
new file mode 100644
index 0000000..5a5beae
--- /dev/null
+++ b/examples/hello_yacc/input.txt
@@ -0,0 +1,4 @@
+1+3
+5*9
+5-6
+(3+2)*(2+7)
diff --git a/examples/hello_yacc/test.mk b/examples/hello_yacc/test.mk
new file mode 100644
index 0000000..7617a5f
--- /dev/null
+++ b/examples/hello_yacc/test.mk
@@ -0,0 +1,37 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ ${.OBJDIR}/hello_calc < ${.CURDIR}/input.txt; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ==== SHRTOUT=yes ====; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
+ env MKCATPAGES=no MKHTML=no SHRTOUT=yes ${MAKE} ${MAKEFLAGS} \
+ all 2>/dev/null | mkc_test_helper2; \
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/subprojects/Makefile b/examples/subprojects/Makefile
new file mode 100644
index 0000000..68c291e
--- /dev/null
+++ b/examples/subprojects/Makefile
@@ -0,0 +1,16 @@
+# main code
+SUBDIR += libhello1
+SUBDIR += libhello2
+SUBDIR += .WAIT
+SUBDIR += hello
+
+MKC_REQD = 0.11.0
+
+# for regression test only
+_THISDIR_ =
+.export _THISDIR_
+
+#
+.include "test.mk"
+.include "version.mk"
+.include <mkc.subdir.mk>
diff --git a/examples/subprojects/expect.out b/examples/subprojects/expect.out
new file mode 100644
index 0000000..9331b5c
--- /dev/null
+++ b/examples/subprojects/expect.out
@@ -0,0 +1,270 @@
+PROJECTNAME=subprojects
+Hello1
+Hello v.1.2.3
+Hello2
+Hello World! version 1.2.3
+My email is vle@gmx.net
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_header_stdio_h.c
+/objdir/_mkc_header_stdio_h.err
+/objdir/_mkc_header_stdio_h.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/expect.out
+/objdir/hello/Makefile
+/objdir/hello/hello_subprojects
+/objdir/hello/hello_subprojects.1
+/objdir/hello/hello_subprojects.1.in
+/objdir/hello/hello_subprojects.c
+/objdir/hello/hello_subprojects.cat1
+/objdir/hello/hello_subprojects.o
+/objdir/hello/hello_subprojects2
+/objdir/hello/hello_subprojects2.in
+/objdir/hello/test.mk
+/objdir/libhello1/Makefile
+/objdir/libhello1/hello1.c
+/objdir/libhello1/hello1.h
+/objdir/libhello1/hello1.o
+/objdir/libhello1/hello1.os
+/objdir/libhello1/libhello1.a
+/objdir/libhello1/libhello1.so
+/objdir/libhello1/libhello1.so.1
+/objdir/libhello1/libhello1.so.1.0
+/objdir/libhello1/linkme.mk
+/objdir/libhello2/Makefile
+/objdir/libhello2/hello2.3
+/objdir/libhello2/hello2.c
+/objdir/libhello2/hello2.cat3
+/objdir/libhello2/hello2.o
+/objdir/libhello2/include/hello2.h
+/objdir/libhello2/libhello2.a
+/objdir/libhello2/linkme.mk
+/objdir/subprojects.test.out.tmp
+/objdir/test.mk
+/objdir/version.mk
+===== all SHRTOUT=yes ======
+==================================================
+all ===> libhello1
+CC: hello1.c
+AR: libhello1.a
+CC: hello1.c
+LD: libhello1.so.1.0
+==================================================
+all ===> libhello2
+CC: hello2.c
+AR: libhello2.a
+NROFF: hello2.cat3
+==================================================
+all ===> hello
+CC: hello_subprojects.c
+LD: hello_subprojects
+GEN: hello_subprojects.1
+NROFF: hello_subprojects.cat1
+GEN: hello_subprojects2
+========= installdirs ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/include
+/objdir/prefix/lib
+/objdir/prefix/man
+/objdir/prefix/man/cat1
+/objdir/prefix/man/man1
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/hello_subprojects
+/objdir/prefix/bin/hello_subprojects2
+/objdir/prefix/include
+/objdir/prefix/include/hello1.h
+/objdir/prefix/lib
+/objdir/prefix/lib/libhello1.a
+/objdir/prefix/lib/libhello1.so
+/objdir/prefix/lib/libhello1.so.1
+/objdir/prefix/lib/libhello1.so.1.0
+/objdir/prefix/man
+/objdir/prefix/man/cat1
+/objdir/prefix/man/cat1/hello_subprojects.0
+/objdir/prefix/man/man1
+/objdir/prefix/man/man1/hello_subprojects.1
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_header_stdio_h.c
+/objdir/_mkc_header_stdio_h.err
+/objdir/_mkc_header_stdio_h.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/expect.out
+/objdir/hello/Makefile
+/objdir/hello/hello_subprojects.1.in
+/objdir/hello/hello_subprojects.c
+/objdir/hello/hello_subprojects2.in
+/objdir/hello/test.mk
+/objdir/libhello1/Makefile
+/objdir/libhello1/hello1.c
+/objdir/libhello1/hello1.h
+/objdir/libhello1/linkme.mk
+/objdir/libhello2/Makefile
+/objdir/libhello2/hello2.3
+/objdir/libhello2/hello2.c
+/objdir/libhello2/include/hello2.h
+/objdir/libhello2/linkme.mk
+/objdir/subprojects.test.out.tmp
+/objdir/test.mk
+/objdir/version.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/hello/Makefile
+/objdir/hello/hello_subprojects.1.in
+/objdir/hello/hello_subprojects.c
+/objdir/hello/hello_subprojects2.in
+/objdir/hello/test.mk
+/objdir/libhello1/Makefile
+/objdir/libhello1/hello1.c
+/objdir/libhello1/hello1.h
+/objdir/libhello1/linkme.mk
+/objdir/libhello2/Makefile
+/objdir/libhello2/hello2.3
+/objdir/libhello2/hello2.c
+/objdir/libhello2/include/hello2.h
+/objdir/libhello2/linkme.mk
+/objdir/subprojects.test.out.tmp
+/objdir/test.mk
+/objdir/version.mk
+======== errorcheck ==========
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_header_stdio_h.c
+/objdir/_mkc_header_stdio_h.err
+/objdir/_mkc_header_stdio_h.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/expect.out
+/objdir/hello/Makefile
+/objdir/hello/hello_subprojects.1.in
+/objdir/hello/hello_subprojects.c
+/objdir/hello/hello_subprojects2.in
+/objdir/hello/test.mk
+/objdir/libhello1/Makefile
+/objdir/libhello1/hello1.c
+/objdir/libhello1/hello1.h
+/objdir/libhello1/linkme.mk
+/objdir/libhello2/Makefile
+/objdir/libhello2/hello2.3
+/objdir/libhello2/hello2.c
+/objdir/libhello2/include/hello2.h
+/objdir/libhello2/linkme.mk
+/objdir/subprojects.test.out.tmp
+/objdir/test.mk
+/objdir/version.mk
+========= libhello1 ==========
+/objdir
+/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
+/objdir/hello/Makefile
+/objdir/hello/hello_subprojects.1.in
+/objdir/hello/hello_subprojects.c
+/objdir/hello/hello_subprojects2.in
+/objdir/hello/test.mk
+/objdir/libhello1
+/objdir/libhello1/Makefile
+/objdir/libhello1/hello1.c
+/objdir/libhello1/hello1.h
+/objdir/libhello1/hello1.o
+/objdir/libhello1/hello1.os
+/objdir/libhello1/libhello1.a
+/objdir/libhello1/libhello1.so
+/objdir/libhello1/libhello1.so.1
+/objdir/libhello1/libhello1.so.1.0
+/objdir/libhello1/linkme.mk
+/objdir/libhello2
+/objdir/libhello2/Makefile
+/objdir/libhello2/hello2.3
+/objdir/libhello2/hello2.c
+/objdir/libhello2/include
+/objdir/libhello2/include/hello2.h
+/objdir/libhello2/linkme.mk
+/objdir/subprojects.test.out.tmp
+/objdir/test.mk
+/objdir/version.mk
+========= all-libhello2 ==========
+/objdir
+/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
+/objdir/hello/Makefile
+/objdir/hello/hello_subprojects.1.in
+/objdir/hello/hello_subprojects.c
+/objdir/hello/hello_subprojects2.in
+/objdir/hello/test.mk
+/objdir/libhello1
+/objdir/libhello1/Makefile
+/objdir/libhello1/hello1.c
+/objdir/libhello1/hello1.h
+/objdir/libhello1/hello1.o
+/objdir/libhello1/hello1.os
+/objdir/libhello1/libhello1.a
+/objdir/libhello1/libhello1.so
+/objdir/libhello1/libhello1.so.1
+/objdir/libhello1/libhello1.so.1.0
+/objdir/libhello1/linkme.mk
+/objdir/libhello2
+/objdir/libhello2/Makefile
+/objdir/libhello2/hello2.3
+/objdir/libhello2/hello2.c
+/objdir/libhello2/hello2.cat3
+/objdir/libhello2/hello2.o
+/objdir/libhello2/include
+/objdir/libhello2/include/hello2.h
+/objdir/libhello2/libhello2.a
+/objdir/libhello2/linkme.mk
+/objdir/subprojects.test.out.tmp
+/objdir/test.mk
+/objdir/version.mk
+========= cleandir-libhello1 ==========
+/objdir
+/objdir/Makefile
+/objdir/expect.out
+/objdir/hello
+/objdir/hello/Makefile
+/objdir/hello/hello_subprojects.1.in
+/objdir/hello/hello_subprojects.c
+/objdir/hello/hello_subprojects2.in
+/objdir/hello/test.mk
+/objdir/libhello1
+/objdir/libhello1/Makefile
+/objdir/libhello1/hello1.c
+/objdir/libhello1/hello1.h
+/objdir/libhello1/linkme.mk
+/objdir/libhello2
+/objdir/libhello2/Makefile
+/objdir/libhello2/hello2.3
+/objdir/libhello2/hello2.c
+/objdir/libhello2/hello2.cat3
+/objdir/libhello2/hello2.o
+/objdir/libhello2/include
+/objdir/libhello2/include/hello2.h
+/objdir/libhello2/libhello2.a
+/objdir/libhello2/linkme.mk
+/objdir/subprojects.test.out.tmp
+/objdir/test.mk
+/objdir/version.mk
+======= library dependencies =======
+Hello1
+Hello v.1.2.3
diff --git a/examples/subprojects/hello/Makefile b/examples/subprojects/hello/Makefile
new file mode 100644
index 0000000..702fcb5
--- /dev/null
+++ b/examples/subprojects/hello/Makefile
@@ -0,0 +1,24 @@
+PROG = hello_subprojects
+SRCS = hello_subprojects.c
+
+MAN = hello_subprojects.1
+
+INFILES = hello_subprojects.1
+INSCRIPTS = hello_subprojects2
+
+INTEXTS_REPLS += HELLO_VERSION ${VERSION}
+INTEXTS_REPLS += MYEMAIL vle@gmx.net
+
+MKC_CHECK_HEADERS += stdio.h
+
+SCRIPTS = ${INSCRIPTS}
+
+.include <mkc.configure.mk>
+
+.include "../libhello1/linkme.mk"
+.include "../libhello2/linkme.mk"
+
+.include "../version.mk"
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/subprojects/hello/hello_subprojects.1.in b/examples/subprojects/hello/hello_subprojects.1.in
new file mode 100644
index 0000000..1a4710f
--- /dev/null
+++ b/examples/subprojects/hello/hello_subprojects.1.in
@@ -0,0 +1,19 @@
+.\" Written by by Aleksey Cheusov (vle@gmx.net)
+.\" ------------------------------------------------------------------
+.TH HELLO_WORLD 1 "Mar 29, 2009" "" ""
+.SH NAME
+hello\_world \- hello application
+.SH SYNOPSIS
+.B "hello_world"
+.br
+.SH DESCRIPTION
+.B hello\_world
+outputs hello world message to stdout
+
+.SH "CONFIGURATION FILE"
+.TP
+The configuration file should be here
+.I @sysconfdir@/hello_world.conf
+but it is not used.
+.SH AUTHOR
+Aleksey Cheusov <vle@gmx.net>
diff --git a/examples/subprojects/hello/hello_subprojects.c b/examples/subprojects/hello/hello_subprojects.c
new file mode 100644
index 0000000..a6123c5
--- /dev/null
+++ b/examples/subprojects/hello/hello_subprojects.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+#include "hello1.h"
+#include "hello2.h"
+
+int main (int argc, char **argv)
+{
+ printf ("%s\n%s\n", msg1, msg2);
+ return 0;
+}
diff --git a/examples/subprojects/hello/hello_subprojects2.in b/examples/subprojects/hello/hello_subprojects2.in
new file mode 100755
index 0000000..f844792
--- /dev/null
+++ b/examples/subprojects/hello/hello_subprojects2.in
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+echo 'Hello2'
+echo 'Hello World! version @HELLO_VERSION@'
+echo 'My email is @MYEMAIL@'
diff --git a/examples/subprojects/hello/test.mk b/examples/subprojects/hello/test.mk
new file mode 100644
index 0000000..76a978e
--- /dev/null
+++ b/examples/subprojects/hello/test.mk
@@ -0,0 +1,2 @@
+test:
+ @echo 'This should not happen'
diff --git a/examples/subprojects/libhello1/Makefile b/examples/subprojects/libhello1/Makefile
new file mode 100644
index 0000000..e6e7747
--- /dev/null
+++ b/examples/subprojects/libhello1/Makefile
@@ -0,0 +1,9 @@
+LIB = hello1
+SRCS = hello1.c
+
+INCS = hello1.h
+
+SHLIB_MAJOR = 1
+SHLIB_MINOR = 0
+
+.include <mkc.lib.mk>
diff --git a/examples/subprojects/libhello1/hello1.c b/examples/subprojects/libhello1/hello1.c
new file mode 100644
index 0000000..4ff7965
--- /dev/null
+++ b/examples/subprojects/libhello1/hello1.c
@@ -0,0 +1,3 @@
+#include "hello1.h"
+
+const char *msg1 = "Hello1";
diff --git a/examples/subprojects/libhello1/hello1.h b/examples/subprojects/libhello1/hello1.h
new file mode 100644
index 0000000..edd7f85
--- /dev/null
+++ b/examples/subprojects/libhello1/hello1.h
@@ -0,0 +1,6 @@
+#ifndef _HELLO1_H_
+#define _HELLO1_H_
+
+extern const char *msg1;
+
+#endif // _HELLO1_H_
diff --git a/examples/subprojects/libhello1/linkme.mk b/examples/subprojects/libhello1/linkme.mk
new file mode 100644
index 0000000..b585dd2
--- /dev/null
+++ b/examples/subprojects/libhello1/linkme.mk
@@ -0,0 +1,5 @@
+PATH.hello1 := ${.PARSEDIR}
+
+CPPFLAGS += -I${PATH.hello1}
+DPLIBDIRS += ${PATH.hello1}
+LDADD += -lhello1
diff --git a/examples/subprojects/libhello2/Makefile b/examples/subprojects/libhello2/Makefile
new file mode 100644
index 0000000..8b93678
--- /dev/null
+++ b/examples/subprojects/libhello2/Makefile
@@ -0,0 +1,14 @@
+LIB = hello2
+SRCS = hello2.c
+MAN = hello2.3
+
+INCS != echo include/*.h
+
+MKINSTALL ?= no # This is internal library, do not install it.
+
+CPPFLAGS += -I${.CURDIR}/include
+CFLAGS += -DHELLO_VERSION='"${VERSION}"'
+
+.include "../version.mk"
+
+.include <mkc.lib.mk>
diff --git a/examples/subprojects/libhello2/hello2.3 b/examples/subprojects/libhello2/hello2.3
new file mode 100644
index 0000000..d13b31b
--- /dev/null
+++ b/examples/subprojects/libhello2/hello2.3
@@ -0,0 +1,13 @@
+.\" Written by by Aleksey Cheusov (vle@gmx.net)
+.\" ------------------------------------------------------------------
+.TH HELLO_WORLD 3 "May 14, 2010" "" ""
+.SH NAME
+hello2 \- C++ function
+.SH SYNOPSIS
+.B "hello2"
+.br
+.SH DESCRIPTION
+.B hello2
+fake fake fake
+.SH AUTHOR
+Aleksey Cheusov <vle@gmx.net>
diff --git a/examples/subprojects/libhello2/hello2.c b/examples/subprojects/libhello2/hello2.c
new file mode 100644
index 0000000..d3c59bc
--- /dev/null
+++ b/examples/subprojects/libhello2/hello2.c
@@ -0,0 +1,3 @@
+#include "hello2.h"
+
+const char *msg2 = "Hello v."HELLO_VERSION;
diff --git a/examples/subprojects/libhello2/include/hello2.h b/examples/subprojects/libhello2/include/hello2.h
new file mode 100644
index 0000000..bbcd5c0
--- /dev/null
+++ b/examples/subprojects/libhello2/include/hello2.h
@@ -0,0 +1,14 @@
+#ifndef _HELLO2_H_
+#define _HELLO2_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const char *msg2;
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif // _HELLO2_H_
diff --git a/examples/subprojects/libhello2/linkme.mk b/examples/subprojects/libhello2/linkme.mk
new file mode 100644
index 0000000..a7d2da7
--- /dev/null
+++ b/examples/subprojects/libhello2/linkme.mk
@@ -0,0 +1,5 @@
+PATH.hello2 := ${.PARSEDIR}
+
+CPPFLAGS += -I${PATH.hello2}/include
+DPLIBDIRS += ${PATH.hello2}
+LDADD += -lhello2
diff --git a/examples/subprojects/test.mk b/examples/subprojects/test.mk
new file mode 100644
index 0000000..1869272
--- /dev/null
+++ b/examples/subprojects/test.mk
@@ -0,0 +1,83 @@
+.PHONY : test_output
+test_output :
+ @set -e; \
+ echo PROJECTNAME=${PROJECTNAME}; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ LD_LIBRARY_PATH=${.CURDIR}/libhello1:${.CURDIR}/libhello2:$$LD_LIBRARY_PATH; \
+ DYLD_LIBRARY_PATH=${.CURDIR}/libhello1:${.CURDIR}/libhello2:$$LD_LIBRARY_PATH; \
+ MKINSTALLDIRS=no; \
+ export LD_LIBRARY_PATH DYLD_LIBRARY_PATH; \
+ ${.CURDIR}/hello/hello_subprojects; \
+ ${.CURDIR}/hello/hello_subprojects2; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ===== all SHRTOUT=yes ======; \
+ ${MAKE} ${MAKEFLAGS} clean > /dev/null; \
+ env SHRTOUT=YES \
+ ${MAKE} ${MAKEFLAGS} all 2>&1 | \
+ mkc_test_helper_paths; \
+ \
+ echo ========= installdirs ==========; \
+ ${MAKE} ${MAKEFLAGS} installdirs DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== errorcheck ==========; \
+ ${MAKE} ${MAKEFLAGS} errorcheck 2> /dev/null 1>&2; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
+ \
+ echo ========= libhello1 ==========; \
+ ${MAKE} ${MAKEFLAGS} libhello1 DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= all-libhello2 ==========; \
+ ${MAKE} ${MAKEFLAGS} all-libhello2 DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= cleandir-libhello1 ==========; \
+ ${MAKE} ${MAKEFLAGS} cleandir-libhello1 DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ \
+ echo ======= library dependencies =======; \
+ PREFIX=${.CURDIR}/usr; export PREFIX; \
+ ${MAKE} ${MAKEFLAGS} all installdirs install >&2; \
+ LD_LIBRARY_PATH=${.CURDIR}/usr/lib; \
+ DYLD_LIBRARY_PATH=${.CURDIR}/usr/lib; \
+ export LD_LIBRARY_PATH DYLD_LIBRARY_PATH; \
+ ${.CURDIR}/usr/bin/hello_subprojects; \
+ \
+ ${MAKE} ${MAKEFLAGS} cleandir > /dev/null
+
+.include <mkc.minitest.mk>
diff --git a/examples/subprojects/version.mk b/examples/subprojects/version.mk
new file mode 100644
index 0000000..92d4398
--- /dev/null
+++ b/examples/subprojects/version.mk
@@ -0,0 +1 @@
+VERSION= 1.2.3
diff --git a/examples/tools/Makefile b/examples/tools/Makefile
new file mode 100644
index 0000000..64f67a1
--- /dev/null
+++ b/examples/tools/Makefile
@@ -0,0 +1,6 @@
+SUBPRJ = libs/foo:tools/prog1
+SUBPRJ += libs/bar:tools/prog2
+SUBPRJ += libs/foo:tools/prog3 libs/bar:tools/prog3
+
+.include "test.mk"
+.include <mkc.subprj.mk>
diff --git a/examples/tools/expect.out b/examples/tools/expect.out
new file mode 100644
index 0000000..84bf5b2
--- /dev/null
+++ b/examples/tools/expect.out
@@ -0,0 +1,209 @@
+PROJECTNAME=tools
+This is a message #1
+Message #2
+This is a message #3
+Message #3
+OBJDIR_tools_prog1=/path/to/prog1
+OBJDIR_tools_prog2=/path/to/prog2
+OBJDIR_tools_prog3=/path/to/prog3
+OBJDIR_libs_foo=/path/to/foo
+OBJDIR_libs_bar=/path/to/bar
+OBJDIR_prog3=/path/to/prog3
+OBJDIR_bar=/path/to/bar
+=========== all ============
+/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/libs/bar/Makefile
+/objdir/libs/bar/bar.c
+/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/test.mk
+/objdir/tools.test.out.tmp
+/objdir/tools/prog1/Makefile
+/objdir/tools/prog1/prog1
+/objdir/tools/prog1/prog1.c
+/objdir/tools/prog1/prog1.o
+/objdir/tools/prog2/Makefile
+/objdir/tools/prog2/prog2
+/objdir/tools/prog2/prog2.c
+/objdir/tools/prog2/prog2.o
+/objdir/tools/prog3/Makefile
+/objdir/tools/prog3/prog3
+/objdir/tools/prog3/prog3.c
+/objdir/tools/prog3/prog3.o
+===== all SHRTOUT=yes ======
+==================================================
+all ===> tools/libs/bar
+CC: bar.c
+AR: libbar.a
+==================================================
+all ===> tools/libs/foo
+CC: foo.c
+AR: libfoo.a
+==================================================
+all ===> tools/tools/prog1
+CC: prog1.c
+LD: prog1
+==================================================
+all ===> tools/tools/prog2
+CC: prog2.c
+LD: prog2
+==================================================
+all ===> tools/tools/prog3
+CC: prog3.c
+LD: prog3
+========= installdirs ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/include
+/objdir/prefix/lib
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/prog1
+/objdir/prefix/bin/prog2
+/objdir/prefix/bin/prog3
+/objdir/prefix/include
+/objdir/prefix/include/bar.h
+/objdir/prefix/include/foo.h
+/objdir/prefix/lib
+/objdir/prefix/lib/libbar.a
+/objdir/prefix/lib/libfoo.a
+======== uninstall =========
+========== clean ===========
+/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/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/test.mk
+/objdir/tools.test.out.tmp
+/objdir/tools/prog1/Makefile
+/objdir/tools/prog1/prog1.c
+/objdir/tools/prog2/Makefile
+/objdir/tools/prog2/prog2.c
+/objdir/tools/prog3/Makefile
+/objdir/tools/prog3/prog3.c
+======= cleandir ==========
+/objdir/Makefile
+/objdir/expect.out
+/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/test.mk
+/objdir/tools.test.out.tmp
+/objdir/tools/prog1/Makefile
+/objdir/tools/prog1/prog1.c
+/objdir/tools/prog2/Makefile
+/objdir/tools/prog2/prog2.c
+/objdir/tools/prog3/Makefile
+/objdir/tools/prog3/prog3.c
+========= all-tools/prog1 ==========
+/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/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/test.mk
+/objdir/tools.test.out.tmp
+/objdir/tools/prog1/Makefile
+/objdir/tools/prog1/prog1
+/objdir/tools/prog1/prog1.c
+/objdir/tools/prog1/prog1.o
+/objdir/tools/prog2/Makefile
+/objdir/tools/prog2/prog2.c
+/objdir/tools/prog3/Makefile
+/objdir/tools/prog3/prog3.c
+========= all-tools/prog2 ==========
+/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/libs/bar/Makefile
+/objdir/libs/bar/bar.c
+/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/test.mk
+/objdir/tools.test.out.tmp
+/objdir/tools/prog1/Makefile
+/objdir/tools/prog1/prog1.c
+/objdir/tools/prog2/Makefile
+/objdir/tools/prog2/prog2
+/objdir/tools/prog2/prog2.c
+/objdir/tools/prog2/prog2.o
+/objdir/tools/prog3/Makefile
+/objdir/tools/prog3/prog3.c
+========= all-tools/prog3 ==========
+/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/libs/bar/Makefile
+/objdir/libs/bar/bar.c
+/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/test.mk
+/objdir/tools.test.out.tmp
+/objdir/tools/prog1/Makefile
+/objdir/tools/prog1/prog1.c
+/objdir/tools/prog2/Makefile
+/objdir/tools/prog2/prog2.c
+/objdir/tools/prog3/Makefile
+/objdir/tools/prog3/prog3
+/objdir/tools/prog3/prog3.c
+/objdir/tools/prog3/prog3.o
diff --git a/examples/tools/libs/bar/Makefile b/examples/tools/libs/bar/Makefile
new file mode 100644
index 0000000..4022796
--- /dev/null
+++ b/examples/tools/libs/bar/Makefile
@@ -0,0 +1,7 @@
+LIB = bar
+SRCS = bar.c
+INCS = bar.h
+
+WARNS = 4
+
+.include <mkc.lib.mk>
diff --git a/examples/tools/libs/bar/bar.c b/examples/tools/libs/bar/bar.c
new file mode 100644
index 0000000..8580fe7
--- /dev/null
+++ b/examples/tools/libs/bar/bar.c
@@ -0,0 +1,6 @@
+#include "bar.h"
+
+const char *get_msg2 (void)
+{
+ return "Message #";
+}
diff --git a/examples/tools/libs/bar/bar.h b/examples/tools/libs/bar/bar.h
new file mode 100644
index 0000000..a434759
--- /dev/null
+++ b/examples/tools/libs/bar/bar.h
@@ -0,0 +1 @@
+const char *get_msg2 (void);
diff --git a/examples/tools/libs/bar/linkme.mk b/examples/tools/libs/bar/linkme.mk
new file mode 100644
index 0000000..8df82aa
--- /dev/null
+++ b/examples/tools/libs/bar/linkme.mk
@@ -0,0 +1,5 @@
+PATH.bar := ${.PARSEDIR}
+
+CPPFLAGS += -I${PATH.bar}
+DPLIBDIRS += ${PATH.bar}
+LDADD += -lbar
diff --git a/examples/tools/libs/foo/Makefile b/examples/tools/libs/foo/Makefile
new file mode 100644
index 0000000..0003bee
--- /dev/null
+++ b/examples/tools/libs/foo/Makefile
@@ -0,0 +1,7 @@
+LIB = foo
+SRCS = foo.c
+INCS = foo.h
+
+WARNS = 4
+
+.include <mkc.lib.mk>
diff --git a/examples/tools/libs/foo/foo.c b/examples/tools/libs/foo/foo.c
new file mode 100644
index 0000000..1d47523
--- /dev/null
+++ b/examples/tools/libs/foo/foo.c
@@ -0,0 +1,6 @@
+#include "foo.h"
+
+const char *get_msg1 (void)
+{
+ return "This is a message #";
+}
diff --git a/examples/tools/libs/foo/foo.h b/examples/tools/libs/foo/foo.h
new file mode 100644
index 0000000..489e95b
--- /dev/null
+++ b/examples/tools/libs/foo/foo.h
@@ -0,0 +1 @@
+const char *get_msg1 (void);
diff --git a/examples/tools/libs/foo/linkme.mk b/examples/tools/libs/foo/linkme.mk
new file mode 100644
index 0000000..00b5b42
--- /dev/null
+++ b/examples/tools/libs/foo/linkme.mk
@@ -0,0 +1,5 @@
+PATH.foo := ${.PARSEDIR}
+
+CPPFLAGS += -I${PATH.foo}
+DPLIBDIRS += ${PATH.foo}
+LDADD += -lfoo
diff --git a/examples/tools/test.mk b/examples/tools/test.mk
new file mode 100644
index 0000000..ec9cff5
--- /dev/null
+++ b/examples/tools/test.mk
@@ -0,0 +1,72 @@
+.PHONY : test_output
+test_output :
+ @set -e; \
+ echo PROJECTNAME=${PROJECTNAME}; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ ${.CURDIR}/tools/prog1/prog1; \
+ ${.CURDIR}/tools/prog2/prog2; \
+ ${.CURDIR}/tools/prog3/prog3; \
+ echo OBJDIR_tools_prog1=${OBJDIR_tools_prog1} | mkc_test_helper_paths; \
+ echo OBJDIR_tools_prog2=${OBJDIR_tools_prog2} | mkc_test_helper_paths; \
+ echo OBJDIR_tools_prog3=${OBJDIR_tools_prog3} | mkc_test_helper_paths; \
+ echo OBJDIR_libs_foo=${OBJDIR_libs_foo} | mkc_test_helper_paths; \
+ echo OBJDIR_libs_bar=${OBJDIR_libs_bar} | mkc_test_helper_paths; \
+ echo OBJDIR_prog3=${OBJDIR_prog3} | mkc_test_helper_paths; \
+ echo OBJDIR_bar=${OBJDIR_bar} | mkc_test_helper_paths; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ===== all SHRTOUT=yes ======; \
+ ${MAKE} ${MAKEFLAGS} clean > /dev/null; \
+ env SHRTOUT=YES \
+ ${MAKE} ${MAKEFLAGS} all 2>&1; \
+ \
+ echo ========= installdirs ==========; \
+ ${MAKE} ${MAKEFLAGS} installdirs DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= cleandir ==========; \
+ ${MAKE} ${MAKEFLAGS} cleandir DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= all-tools/prog1 ==========; \
+ ${MAKE} ${MAKEFLAGS} all-tools/prog1 DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= all-tools/prog2 ==========; \
+ ${MAKE} ${MAKEFLAGS} cleandir DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} all-tools/prog2 DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= all-tools/prog3 ==========; \
+ ${MAKE} ${MAKEFLAGS} cleandir DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} all-tools/prog3 DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ ${MAKE} ${MAKEFLAGS} cleandir > /dev/null; \
+
+.include <mkc.minitest.mk>
diff --git a/examples/tools/tools/prog1/Makefile b/examples/tools/tools/prog1/Makefile
new file mode 100644
index 0000000..ce374a2
--- /dev/null
+++ b/examples/tools/tools/prog1/Makefile
@@ -0,0 +1,9 @@
+PROG = prog1
+
+CFLAGS += -DNUM=1
+WARNS = 4
+
+MKC_REQD = 0.10.0
+
+.include "../../libs/foo/linkme.mk"
+.include <mkc.prog.mk>
diff --git a/examples/tools/tools/prog1/prog1.c b/examples/tools/tools/prog1/prog1.c
new file mode 100644
index 0000000..87578e2
--- /dev/null
+++ b/examples/tools/tools/prog1/prog1.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+#include "foo.h"
+
+int main (int argc, char** argv)
+{
+ printf ("%s", get_msg1 ());
+ printf ("%d\n", NUM);
+ return 0;
+}
diff --git a/examples/tools/tools/prog2/Makefile b/examples/tools/tools/prog2/Makefile
new file mode 100644
index 0000000..365c990
--- /dev/null
+++ b/examples/tools/tools/prog2/Makefile
@@ -0,0 +1,9 @@
+PROG = prog2
+
+CFLAGS += -DNUM=2
+WARNS = 4
+
+MKC_REQD = 0.10.0
+
+.include "../../libs/bar/linkme.mk"
+.include <mkc.prog.mk>
diff --git a/examples/tools/tools/prog2/prog2.c b/examples/tools/tools/prog2/prog2.c
new file mode 100644
index 0000000..ed9553c
--- /dev/null
+++ b/examples/tools/tools/prog2/prog2.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+#include "bar.h"
+
+int main (int argc, char** argv)
+{
+ printf ("%s", get_msg2 ());
+ printf ("%d\n", NUM);
+ return 0;
+}
diff --git a/examples/tools/tools/prog3/Makefile b/examples/tools/tools/prog3/Makefile
new file mode 100644
index 0000000..4927386
--- /dev/null
+++ b/examples/tools/tools/prog3/Makefile
@@ -0,0 +1,11 @@
+PROG = prog3
+
+CFLAGS += -DNUM=3
+WARNS = 4
+
+MKC_REQD = 0.10.0
+
+.include "../../libs/foo/linkme.mk"
+.include "../../libs/bar/linkme.mk"
+
+.include <mkc.prog.mk>
diff --git a/examples/tools/tools/prog3/prog3.c b/examples/tools/tools/prog3/prog3.c
new file mode 100644
index 0000000..54b740b
--- /dev/null
+++ b/examples/tools/tools/prog3/prog3.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+#include "foo.h"
+#include "bar.h"
+
+int main (int argc, char** argv)
+{
+ printf ("%s", get_msg1 ());
+ printf ("%d\n", NUM);
+
+ printf ("%s", get_msg2 ());
+ printf ("%d\n", NUM);
+ return 0;
+}