summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Shadura <andrewsh@debian.org>2014-01-05 22:42:41 +0100
committerAndrew Shadura <andrew@shadura.me>2015-07-25 14:44:33 +0200
commitc8659b636be5e763c5dc028a5db7294b1af2648c (patch)
tree7dacf7580ff8c7d8c64682eaa28350bc47fbd56e
parent004c4cd3db1d9ad252eccbc1e9e6c54ec61a2927 (diff)
parentaba913436a8521abe405a04ed71388989e1d646f (diff)
Imported Debian patch 0.25.0-1
-rw-r--r--HELP!6
-rw-r--r--Makefile148
-rw-r--r--Makefile.inc30
-rw-r--r--README160
-rw-r--r--bmake.sys.mk194
-rw-r--r--custom/Makefile5
-rwxr-xr-xcustom/endianess2
-rwxr-xr-xcustom/prog_bison2
-rwxr-xr-xcustom/prog_flex2
-rwxr-xr-xcustom/prog_gawk2
-rwxr-xr-xcustom/prog_gm42
-rwxr-xr-xcustom/prog_mkdep35
-rwxr-xr-xcustom/prog_nbmkdep9
-rw-r--r--debian/changelog8
-rw-r--r--debian/control2
-rw-r--r--debian/copyright47
-rw-r--r--debian/dirs1
-rw-r--r--debian/docs6
-rw-r--r--debian/install1
-rw-r--r--debian/mkcmake.pm10
-rw-r--r--debian/patches/01-dont-fail-on-clean.patch20
-rw-r--r--debian/patches/01-lua-mk.patch13
-rw-r--r--debian/patches/02-cleanfiles-fix.patch11
-rw-r--r--debian/patches/series3
-rw-r--r--doc/FAQ (renamed from FAQ)0
-rw-r--r--doc/LICENSE (renamed from COPYRIGHT)25
-rw-r--r--doc/Makefile47
-rw-r--r--doc/NEWS (renamed from NEWS)131
-rw-r--r--doc/TODO (renamed from TODO)88
-rw-r--r--examples/Makefile1
-rw-r--r--examples/hello_TARGETS/Makefile15
-rw-r--r--examples/hello_TARGETS/Makefile.inc10
-rw-r--r--examples/hello_TARGETS/expect.out67
-rw-r--r--examples/hello_TARGETS/hello1/Makefile15
-rw-r--r--examples/hello_TARGETS/hello1/hello1.c8
-rw-r--r--examples/hello_TARGETS/hello1/hello1.pod17
-rw-r--r--examples/hello_TARGETS/hello2/Makefile10
-rw-r--r--examples/hello_TARGETS/hello2/hello2.c8
-rw-r--r--examples/hello_TARGETS/hello2/hello2.pod22
-rw-r--r--examples/hello_TARGETS/test.mk32
-rw-r--r--examples/hello_calc2/Makefile3
-rw-r--r--examples/hello_calc2/expect.out22
-rw-r--r--examples/hello_calc2/test.mk8
-rw-r--r--examples/hello_compilers/test.mk5
-rw-r--r--examples/hello_customtests/expect.out2
-rw-r--r--examples/hello_customtests/test.mk12
-rw-r--r--examples/hello_customtests2/Makefile7
-rw-r--r--examples/hello_customtests2/expect.out6
-rw-r--r--examples/hello_customtests2/test.mk12
-rw-r--r--examples/hello_cxx/test.mk5
-rw-r--r--examples/hello_cxxlib/test.mk5
-rw-r--r--examples/hello_dictd/expect.out178
-rw-r--r--examples/hello_dictd/test.mk68
-rw-r--r--examples/hello_files/shell_func.texinfo4
-rw-r--r--examples/hello_files/test.mk14
-rw-r--r--examples/hello_glib2/test.mk5
-rw-r--r--examples/hello_lex/Makefile6
-rw-r--r--examples/hello_lex/expect.out39
-rw-r--r--examples/hello_lex/test.mk20
-rw-r--r--examples/hello_lua/Makefile6
-rw-r--r--examples/hello_lua/expect.out12
-rwxr-xr-xexamples/hello_lua/foobar.in (renamed from examples/hello_lua/foobar)2
-rw-r--r--examples/hello_lua/test.mk14
-rw-r--r--examples/hello_lua2/test.mk14
-rw-r--r--examples/hello_lua3/test.mk5
-rw-r--r--examples/hello_plugins/test.mk7
-rw-r--r--examples/hello_plugins2/test.mk5
-rw-r--r--examples/hello_progs/expect.out28
-rw-r--r--examples/hello_progs/test.mk10
-rw-r--r--examples/hello_progs2/test.mk5
-rw-r--r--examples/hello_scripts/expect.out1
-rw-r--r--examples/hello_scripts/test.mk7
-rw-r--r--examples/hello_sizeof/test.mk5
-rw-r--r--examples/hello_strlcpy/Makefile6
-rw-r--r--examples/hello_strlcpy/expect.out23
-rw-r--r--examples/hello_strlcpy/getline.c49
-rw-r--r--examples/hello_strlcpy/hello.c12
-rw-r--r--examples/hello_strlcpy/test.mk27
-rw-r--r--examples/hello_superfs/Makefile4
-rw-r--r--examples/hello_superfs/expect.out26
-rw-r--r--examples/hello_superfs/test.mk13
-rw-r--r--examples/hello_world/test.mk22
-rw-r--r--examples/hello_xxzip/expect.out7
-rw-r--r--examples/hello_xxzip/test.mk13
-rw-r--r--examples/hello_yacc/Makefile5
-rw-r--r--examples/hello_yacc/expect.out16
-rw-r--r--examples/hello_yacc/test.mk15
-rw-r--r--examples/subprojects/expect.out17
-rw-r--r--examples/subprojects/hello/hello_subprojects.1.in1
-rw-r--r--examples/subprojects/test.mk16
-rw-r--r--examples/tools/Makefile10
-rw-r--r--examples/tools/expect.out219
-rw-r--r--examples/tools/libs/qux/Makefile16
-rw-r--r--examples/tools/libs/qux/linkme.mk5
-rw-r--r--examples/tools/libs/qux/qux.c6
-rw-r--r--examples/tools/libs/qux/qux.h.in4
-rw-r--r--examples/tools/test.mk56
-rw-r--r--examples/tools/tools/prog1/Makefile3
-rw-r--r--examples/tools/tools/prog2/Makefile3
-rw-r--r--examples/tools/tools/prog3/Makefile3
-rw-r--r--examples/tools/tools/prog4/Makefile11
-rw-r--r--examples/tools/tools/prog4/prog4.c9
-rw-r--r--examples/tools2/Makefile25
-rw-r--r--examples/tools2/expect.out448
-rw-r--r--examples/tools2/libs/bar/Makefile7
-rw-r--r--examples/tools2/libs/bar/bar.c6
-rw-r--r--examples/tools2/libs/bar/bar.h1
-rw-r--r--examples/tools2/libs/bar/linkme.mk5
-rw-r--r--examples/tools2/libs/foo/Makefile7
-rw-r--r--examples/tools2/libs/foo/foo.c6
-rw-r--r--examples/tools2/libs/foo/foo.h1
-rw-r--r--examples/tools2/libs/foo/linkme.mk5
-rw-r--r--examples/tools2/libs/qux/Makefile16
-rw-r--r--examples/tools2/libs/qux/linkme.mk5
-rw-r--r--examples/tools2/libs/qux/qux.c6
-rw-r--r--examples/tools2/libs/qux/qux.h.in4
-rw-r--r--examples/tools2/test.mk115
-rw-r--r--examples/tools2/tests/prog1/Makefile8
-rw-r--r--examples/tools2/tests/prog2/Makefile8
-rw-r--r--examples/tools2/tests/prog3/Makefile10
-rw-r--r--examples/tools2/tests/prog4/Makefile8
-rw-r--r--examples/tools2/tools/prog1/Makefile12
-rw-r--r--examples/tools2/tools/prog1/prog1.c10
-rw-r--r--examples/tools2/tools/prog2/Makefile12
-rw-r--r--examples/tools2/tools/prog2/prog2.c10
-rw-r--r--examples/tools2/tools/prog3/Makefile14
-rw-r--r--examples/tools2/tools/prog3/prog3.c14
-rw-r--r--examples/tools2/tools/prog4/Makefile11
-rw-r--r--examples/tools2/tools/prog4/prog4.c9
-rw-r--r--helpers/Makefile3
-rwxr-xr-xhelpers/mkc_test_helper (renamed from mkc_test_helper)18
-rwxr-xr-xhelpers/mkc_test_helper2 (renamed from mkc_test_helper2)2
-rwxr-xr-xhelpers/mkc_test_helper_paths (renamed from mkc_test_helper_paths)2
-rw-r--r--main.mk37
-rw-r--r--mk/Makefile48
-rw-r--r--mk/configure.mk (renamed from configure.mk.in)168
-rw-r--r--mk/mkc.configure.mk (renamed from mkc.configure.mk)4
-rw-r--r--mk/mkc.files.mk2
-rw-r--r--mk/mkc.init.mk674
-rw-r--r--mk/mkc.lib.mk2
-rw-r--r--mk/mkc.minitest.mk (renamed from mkc.minitest.mk)12
-rw-r--r--mk/mkc.mk21
-rw-r--r--mk/mkc.prog.mk2
-rw-r--r--mk/mkc.subdir.mk2
-rw-r--r--mk/mkc.subprj.mk2
-rw-r--r--mk/mkc_imp.arch.mk (renamed from mkc_imp.arch.mk)16
-rw-r--r--mk/mkc_imp.dep.mk96
-rw-r--r--mk/mkc_imp.files.mk (renamed from mkc_imp.files.mk)8
-rw-r--r--mk/mkc_imp.final.mk (renamed from mkc_imp.final.mk)15
-rw-r--r--mk/mkc_imp.inc.mk (renamed from mkc_imp.inc.mk)12
-rw-r--r--mk/mkc_imp.info.mk (renamed from mkc_imp.info.mk)6
-rw-r--r--mk/mkc_imp.intexts.mk (renamed from mkc_imp.intexts.mk)15
-rw-r--r--mk/mkc_imp.lib.mk (renamed from mkc_imp.lib.mk)18
-rw-r--r--mk/mkc_imp.links.mk35
-rw-r--r--mk/mkc_imp.lua.mk (renamed from mkc_imp.lua.mk)2
-rw-r--r--mk/mkc_imp.man.mk (renamed from mkc_imp.man.mk)14
-rw-r--r--mk/mkc_imp.mk (renamed from mkc.mk)44
-rw-r--r--mk/mkc_imp.obj.mk34
-rw-r--r--mk/mkc_imp.objdir.mk (renamed from mkc_imp.objdir.mk)8
-rw-r--r--mk/mkc_imp.pkg-config.mk (renamed from mkc_imp.pkg-config.mk)2
-rw-r--r--mk/mkc_imp.platform.sys.mk (renamed from mkc_imp.platform.sys.mk)25
-rw-r--r--mk/mkc_imp.pod.mk (renamed from mkc_imp.pod.mk)2
-rw-r--r--mk/mkc_imp.preinit.mk32
-rw-r--r--mk/mkc_imp.prog.mk (renamed from mkc_imp.prog.mk)6
-rw-r--r--mk/mkc_imp.scripts.mk (renamed from mkc_imp.scripts.mk)2
-rw-r--r--mk/mkc_imp.subprj.mk92
-rw-r--r--mk/mkc_imp.vars.mk.in (renamed from mkc_imp.vars.mk.in)3
-rw-r--r--mk/sys.mk (renamed from sys.mk)0
-rw-r--r--mkc.own.mk7
-rw-r--r--mkc_imp.dep.mk55
-rw-r--r--mkc_imp.init.mk256
-rw-r--r--mkc_imp.links.mk60
-rw-r--r--mkc_imp.own.mk189
-rw-r--r--mkc_imp.preinit.mk10
-rw-r--r--mkc_imp.subdir.mk49
-rw-r--r--mkc_imp.subprj.mk54
-rw-r--r--mkc_imp.sys.mk246
-rw-r--r--presentation/Makefile49
-rw-r--r--presentation/dep_graph.dot (renamed from doc/dep_graph.dot)0
-rw-r--r--presentation/my_prjs.dot (renamed from doc/my_prjs.dot)1
-rw-r--r--presentation/presentation.tex (renamed from doc/presentation.tex)0
-rw-r--r--scripts/Makefile21
-rw-r--r--scripts/mk-configure.7.in (renamed from mk-configure.7.in)207
-rw-r--r--scripts/mkc_check_common.sh (renamed from mkc_check_common.sh)24
-rwxr-xr-xscripts/mkc_check_compiler (renamed from mkc_check_compiler)11
-rwxr-xr-xscripts/mkc_check_custom (renamed from mkc_check_custom)9
-rw-r--r--scripts/mkc_check_custom.1 (renamed from mkc_check_custom.1)4
-rwxr-xr-xscripts/mkc_check_decl (renamed from mkc_check_decl)16
-rw-r--r--scripts/mkc_check_decl.1 (renamed from mkc_check_decl.1)4
-rwxr-xr-xscripts/mkc_check_funclib (renamed from mkc_check_funclib)14
-rw-r--r--scripts/mkc_check_funclib.1 (renamed from mkc_check_funclib.1)4
-rwxr-xr-xscripts/mkc_check_header (renamed from mkc_check_header)10
-rw-r--r--scripts/mkc_check_header.1 (renamed from mkc_check_header.1)4
-rwxr-xr-xscripts/mkc_check_prog (renamed from mkc_check_prog)11
-rw-r--r--scripts/mkc_check_prog.1 (renamed from mkc_check_prog.1)10
-rwxr-xr-xscripts/mkc_check_sizeof (renamed from mkc_check_sizeof)4
-rw-r--r--scripts/mkc_check_sizeof.1 (renamed from mkc_check_sizeof.1)4
-rwxr-xr-xscripts/mkc_check_version.in (renamed from mkc_check_version.in)2
-rwxr-xr-xscripts/mkc_install (renamed from mkc_install)94
-rwxr-xr-xscripts/mkc_which (renamed from mkc_which)19
-rw-r--r--scripts/mkcmake.1 (renamed from mkcmake.1)0
-rw-r--r--scripts/mkcmake.in (renamed from mkcmake.in)0
-rw-r--r--tests/Makefile18
-rw-r--r--tests/configure_test/expect.out2
-rw-r--r--tests/intexts_cleantrg/Makefile6
-rw-r--r--tests/intexts_cleantrg/expect.out29
-rw-r--r--tests/intexts_cleantrg/foo.in6
-rw-r--r--tests/intexts_cleantrg/test.mk26
-rw-r--r--tests/lua_dirs/Makefile3
-rw-r--r--tests/lua_dirs/expect.out1
-rw-r--r--tests/lua_dirs/test.mk4
-rw-r--r--tests/mkinstall/Makefile12
-rwxr-xr-xtests/mkinstall/bar3
-rw-r--r--tests/mkinstall/baz.h1
-rw-r--r--tests/mkinstall/expect.out55
-rw-r--r--tests/mkinstall/foo1
-rw-r--r--tests/mkinstall/foo.in6
-rw-r--r--tests/mkinstall/qux.115
-rw-r--r--tests/mkinstall/qux.c4
-rw-r--r--tests/mkinstall/qux.texinfo38
-rw-r--r--tests/mkinstall/test.mk47
-rw-r--r--tests/pkg_config_1/Makefile2
-rw-r--r--tests/reqd/expect.out2
-rw-r--r--tests/reqd2/expect.out2
-rw-r--r--tests/reqd3/expect.out2
-rw-r--r--tests/reqd4/Makefile9
-rw-r--r--tests/reqd4/expect.out8
-rwxr-xr-xtests/reqd4/hello.in3
-rw-r--r--tests/reqd4/test.mk18
-rw-r--r--tests/reqd_clean_cache/Makefile14
-rw-r--r--tests/reqd_clean_cache/expect.out27
-rw-r--r--tests/reqd_clean_cache/test.mk14
-rw-r--r--tests/reqd_clean_cache/test1.c1
-rw-r--r--tests/test_mkc_vs_LIB/Makefile1
-rw-r--r--tests/test_mkc_vs_LIB/expect.out1
-rw-r--r--tests/test_mkc_vs_LIB/test.mk3
-rw-r--r--tests/test_mkc_vs_PROG/Makefile1
-rw-r--r--tests/test_mkc_vs_PROG/expect.out1
-rw-r--r--tests/test_mkc_vs_PROG/test.mk3
-rw-r--r--tests/test_mkc_vs_SUBDIR/Makefile1
-rw-r--r--tests/test_mkc_vs_SUBDIR/expect.out1
-rw-r--r--tests/test_mkc_vs_SUBDIR/test.mk3
-rw-r--r--tests/test_mkc_vs_SUBPRJ/Makefile1
-rw-r--r--tests/test_mkc_vs_SUBPRJ/expect.out1
-rw-r--r--tests/test_mkc_vs_SUBPRJ/test.mk3
-rw-r--r--tests/test_subprj_dash/Makefile14
-rw-r--r--tests/test_subprj_dash/expect.out1
-rw-r--r--tests/test_subprj_dash/test.mk3
248 files changed, 4503 insertions, 2005 deletions
diff --git a/HELP! b/HELP!
deleted file mode 100644
index d92cf6b..0000000
--- a/HELP!
+++ /dev/null
@@ -1,6 +0,0 @@
-mk-configure project needs your help. Any kind of feedback is
-welcome. If you like mk-configure and have some spare time, feel free
-to send me suggestions, fixes, patches and so on. If you want to
-participate the project, you are welcome. First of all, documentation
-needs to be improved. If your English is better than mine (mine is
-just absent), and want to improve it, let me know.
diff --git a/Makefile b/Makefile
index bbdf969..0214e33 100644
--- a/Makefile
+++ b/Makefile
@@ -1,145 +1,3 @@
-.sinclude "cheusov_local_settings.mk" # for debugging
-
-##################################################
-
-MKFILESDIR?= ${PREFIX}/share/mkc-mk
-EXTRAFILESDIR?= ${PREFIX}/share/doc/mk-configure
-BUILTINSDIR?= ${PREFIX}/share/mk-configure/custom
-
-BMAKE?= bmake
-
-.if exists(/usr/xpg4/bin/awk)
-# Solaris' /usr/bin/awk is completely broken,
-# /usr/xpg4/bin/awk sucks too but sucks less.
-AWK?=/usr/xpg4/bin/awk
-.elif exists(/usr/bin/awk)
-AWK?=/usr/bin/awk
-.else
-AWK?=/bin/awk
-.endif
-
-##################################################
-.PATH: ${.CURDIR}
-
-SHRTOUT= yes
-
-PROJECTNAME= mk-configure
-
-VERSION= 0.24.0
-
-BIRTHDATE= 2009-02-21
-
-MKCHECKS= no
-
-SCRIPTS= mkc_check_funclib mkc_check_header \
- mkc_check_sizeof mkc_check_decl \
- mkc_check_prog mkc_check_custom \
- mkc_which mkc_check_version \
- mkc_test_helper mkc_check_compiler \
- mkc_install mkcmake
-
-SCRIPTS+= ${:!cd ${.CURDIR} && echo custom/*!:N*/CVS}
-
-MAN= mkc_check_funclib.1 mkc_check_header.1 \
- mkc_check_sizeof.1 mkc_check_decl.1 \
- mkc_check_prog.1 mkc_check_custom.1 \
- mk-configure.7 mkcmake.1
-
-EXTRAFILES?= README NEWS TODO COPYRIGHT FAQ
-
-FILES= sys.mk configure.mk mkc.configure.mk mkc.mk \
- mkc.own.mk mkc_imp.intexts.mk \
- mkc_check_common.sh \
- mkc.minitest.mk mkc_imp.pkg-config.mk mkc_imp.vars.mk \
- mkc_imp.files.mk mkc_imp.inc.mk mkc_imp.info.mk mkc_imp.lib.mk \
- mkc_imp.links.mk mkc_imp.man.mk mkc_imp.own.mk mkc_imp.prog.mk \
- mkc_imp.subdir.mk mkc_imp.subprj.mk mkc_imp.sys.mk \
- mkc_imp.init.mk mkc_imp.final.mk mkc_imp.scripts.mk \
- mkc_imp.platform.sys.mk mkc_imp.dep.mk mkc_imp.lua.mk \
- mkc_imp.arch.mk mkc_imp.pod.mk mkc_imp.preinit.mk \
- mkc_imp.objdir.mk
-
-FILES+= ${EXTRAFILES}
-
-.for i in ${EXTRAFILES}
-FILESDIR_${i}= ${EXTRAFILESDIR}
-.endfor
-
-FILESDIR_mkc_check_common.sh= ${BINDIR}
-
-FILESDIR= ${MKFILESDIR}
-
-.for s in ${SCRIPTS:Mcustom/*}
-SCRIPTSDIR_${s:S|/|_|}= ${BUILTINSDIR}
-.endfor
-
-SYMLINKS= mkc.subprj.mk ${MKFILESDIR}/mkc.subprjs.mk
-SYMLINKS+= mkc_imp.pkg-config.mk ${MKFILESDIR}/mkc.pkg-config.mk
-SYMLINKS+= mkc_imp.intexts.mk ${MKFILESDIR}/mkc.intexts.mk
-
-CLEANFILES+= configure.mk *.cat1 *.html1 ChangeLog
-
-INFILES+= configure.mk mkc_imp.vars.mk mk-configure.7
-INSCRIPTS+= mkc_check_version mkcmake
-INTEXTS_REPLS+= version ${VERSION}
-INTEXTS_REPLS+= AWK ${AWK}
-INTEXTS_REPLS+= BMAKE ${BMAKE}
-INTEXTS_REPLS+= mkfilesdir ${MKFILESDIR}
-INTEXTS_REPLS+= syscustomdir ${BUILTINSDIR}
-INTEXTS_REPLS+= mkc_libexecdir ${LIBEXECDIR}
-
-DIST_TARGETS= doc mkc_clean
-
-INSTALL= ${.CURDIR}/mkc_install
-
-##################################################
-.PHONY: doc
-doc: all
-doc:
- cd doc && ${MAKE} -m ${.OBJDIR} presentation.pdf clean-garbage ${MAKEFLAGS}
-
-.for i in mkc.prog.mk mkc.lib.mk mkc.subdir.mk mkc.subprj.mk mkc.files.mk
-SYMLINKS+= mkc.mk ${MKFILESDIR}/${i}
-CLEANFILES+= ${i}
-all: ${i}
-${i}:
- ln -f -s ${.CURDIR}/mkc.mk ${i}
-.endfor
-
-##################################################
-
-.PHONY: test
-test: configure.mk mkc_imp.vars.mk mkc_check_version
- @set -e; \
- PATH=${.CURDIR}:${.OBJDIR}:$$PATH; \
- BUILTINSDIR=${.CURDIR}/custom; \
- MKCATPAGES=yes; \
- NO_AUTODEP=yes; \
- export PATH BUILTINSDIR MKCATPAGES NO_AUTODEP; \
- unset MAKEOBJDIR MAKEOBJDIRPREFIX || true; \
- cd ${.CURDIR}/tests; \
- ${MAKE} -m ${.CURDIR} -m ${.OBJDIR} -m ${MKFILESDIR} ${MAKEFLAGS} test
-
-.PHONY: cleandir_tests clean_tests
-
-cleandir: cleandir_tests
-cleandir_tests: configure.mk
- PATH=${.CURDIR}:$$PATH; \
- export PATH; \
- for d in ${.CURDIR}/tests ${.CURDIR}/doc; do \
- cd $$d; \
- ${MAKE} -m ${.CURDIR} -m ${.OBJDIR} -m ${MKFILESDIR} \
- ${MAKEFLAGS} cleandir; \
- done
-clean: clean_tests
-clean_tests: configure.mk
- PATH=${.CURDIR}:$$PATH; \
- export PATH; \
- for d in ${.CURDIR}/tests ${.CURDIR}/doc; do \
- cd $$d; \
- ${MAKE} -m ${.CURDIR} -m ${.OBJDIR} -m ${MKFILESDIR} \
- ${MAKEFLAGS} clean; \
- done
-
-##################################################
-.include <mkc.mk>
+.MAIN: all
+.DEFAULT:
+ ${MAKE} ${MAKEFLAGS} -m ${.CURDIR}/mk -f main.mk ${.TARGET}
diff --git a/Makefile.inc b/Makefile.inc
new file mode 100644
index 0000000..90716ad
--- /dev/null
+++ b/Makefile.inc
@@ -0,0 +1,30 @@
+VERSION = 0.25.0
+
+BIRTHDATE = 2009-02-21
+
+MKFILESDIR ?= ${PREFIX}/share/mkc-mk
+DOCDIR ?= ${PREFIX}/share/doc/mk-configure
+BUILTINSDIR ?= ${PREFIX}/share/mk-configure/custom
+
+INTEXTS_REPLS += version ${VERSION}
+INTEXTS_REPLS += AWK ${AWK}
+INTEXTS_REPLS += BMAKE ${BMAKE}
+INTEXTS_REPLS += mkfilesdir ${MKFILESDIR}
+INTEXTS_REPLS += syscustomdir ${BUILTINSDIR}
+INTEXTS_REPLS += mkc_libexecdir ${LIBEXECDIR}
+
+.if exists(/usr/xpg4/bin/awk)
+# Solaris' /usr/bin/awk is completely broken,
+# /usr/xpg4/bin/awk sucks too but sucks less.
+AWK ?= /usr/xpg4/bin/awk
+.elif exists(/usr/bin/awk)
+AWK ?= /usr/bin/awk
+.else
+AWK ?= /bin/awk
+.endif
+
+BMAKE ?= bmake
+PS2PDF ?= ps2pdf
+DOT ?= dot
+DVIPS ?= dvips
+LATEX ?= latex
diff --git a/README b/README
index 1b137fd..11ea316 100644
--- a/README
+++ b/README
@@ -6,9 +6,9 @@ in and for bmake (portable version of NetBSD make) and UNIX tools
(shell, awk etc.). FreeBSD and OpenBSD make are not good. They are
incompatible with NetBSD bmake. GNU make is not good too.
-mk-configure provides a number of include files written in and for
-bmake and a number of standalone programs that should be installed to
-user's host for building a software.
+mk-configure provides a number of include files written in bmake and a
+number of standalone programs that should be installed to user's host
+for building a software.
mk-configure features:
@@ -54,43 +54,46 @@ GOALS OF THE PROJECT
files (bmake's libraries) and external executables to make its job.
Developers should distribute source code only, not blobs.
- - Single top level command for building a software, bmake in our
- case. Instead of running and learning
+ - Single top level command for building a program ("mkcmake").
+ Instead of running and learning
autoconf/automake/aclocal/autoreconf/config.status/autoheader and
- many other tools and the way they interact with each other you
- should learn only ONE tool, bmake.
+ many other tools, and the way they interact with each other, you
+ should learn only ONE tool, bmake (mkcmake is a trivial wrapper
+ over bmake).
- No bloat. At this time mk-configure consists of far less than 10000
lines of code (excluding examples and regression tests). Compare
this number with autotools sources and you'll see a difference.
- - Simplicity for both developers and users. The only file developer
+ - Simplicity for both developers and users. The only file developers
should be aware of during development is 'Makefile'. Users just
- run 'env <options> bmake all <options>' to build a software. The
- same for developers -- for building a software, just run 'bmake'.
+ run 'env <options> mkcmake all <options>' to build a software. The
+ same for developers -- for building a software, just run 'mkcmake'.
- Portability. At the moment the following systems and compilers are
supported:
- - NetBSD. Tested on NetBSD-5.0/x86 and NetBSD-2.0/alpha with
- gcc, pcc and clang.
+ - NetBSD. Tested on NetBSD-5.0/x86 and NetBSD-2.0/alpha and later
+ versions with gcc, pcc and clang.
- - FreeBSD. Tested on FreeBSD-6.2/x86, 7.1/spark64 and 7.1/x86
- with gcc.
+ - FreeBSD. Tested on FreeBSD-6.2/x86, 7.1/spark64, 7.1/x86 and
+ later versions with gcc.
- - OpenBSD. Tested on OpenBSD-3.8/x86 and 4.5/x86 with gcc.
+ - OpenBSD. Tested on OpenBSD-3.8/x86, 4.5/x86 and later versions
+ with gcc.
- - DragonFlyBSD. Tested on DragonFly-2.4.1-RELEASE/x86 with gcc.
+ - DragonFlyBSD. Tested on DragonFly-2.4.1-RELEASE/x86 and later
+ versions with gcc.
- - MirOS BSD. Tested on MirBSD-10/x86 with gcc.
+ - MirOS BSD. Tested on MirBSD-10/x86 and later versions with gcc.
- - Linux. Tested on Linux/{x86,x86-64} with gcc, icc, sunstudio-12.
+ - Linux. Tested on Linux/{x86,x86-64} with gcc, icc and SunStudio.
- - Solaris. Tested on Solaris-10/x86 and Solaris-10/spark64
- with sunstudio-11, sunstudio-12 and gcc.
+ - Solaris. Tested on Solaris-{10,11}/x86 and Solaris-10/spark64
+ with SunStudio-11, SunStudio-12 and gcc.
- Darwin (MacOS-X). Tested on Darwin-8.11.0/ppc (MacOS-X Tiger)
- with native gcc.
+ and later version with native gcc and clang.
- Interix. Tested on Interix-3.5/x86 with gcc.
@@ -105,8 +108,8 @@ GOALS OF THE PROJECT
"big iron" :-( .
If you don't see your favorite system/compiler here and want to
- help me to improve mk-configure, feel free to contact
- me. mk-configure needs your help! ;-)
+ help me to improve mk-configure, feel free to contact me.
+ mk-configure needs your help! ;-)
- Declarative approach in writing Makefiles. Instead of specifying
_HOW_ to build your software, you should specify source files,
@@ -116,7 +119,7 @@ GOALS OF THE PROJECT
Makefiles at all. Most useful things are already implemented in
mk-configure include files including implementation for targets
all, install, uninstall as well as support for building the shared
- libraries, installation to ${DESTDIR} etc. Usually Makefile contain
+ libraries, installation to ${DESTDIR} etc. Usually, Makefile contain
only variable assignments, .include-s and .if/.for directives.
- No heavy dependencies like Python or Perl.
@@ -129,9 +132,9 @@ HOW TO USE MK-CONFIGURE?
- Install mk-configure to your system.
- Develop your software using bmake and mkc.*.mk include files
provided by mk-configure.
- - Run 'mkcmake' or 'mkcmake all' for building your software.
+ - Run 'mkcmake' or 'mkcmake all' for building your program.
(mkcmake is a trivial wrapper over bmake).
- You need not autoconf/autoheader/automake/aclocal/config.guess/
+ You don't need autoconf/autoheader/automake/aclocal/config.guess/
/autoreconf/config.status/config.sub and blah-blah-blah
BMAKE is magic enough ;-)
@@ -139,15 +142,13 @@ HOW TO USE MK-CONFIGURE?
Users and software packagers:
- Install bmake (and optionally sys.mk) to your system.
- Install mk-configure to your system.
- - Run bmake for building a software and pass to it
+ - Run mkcmake for building a software and pass to it
the building options, e.g.
env CC=pcc CFLAGS='-O0 -g' PREFIX=/opt/software \
mkcmake all install
- (mkcmake is a wrapper for bmake)
-
- There is no need for configure script and analogs.
+ There is no need for "configure" script and analogs.
BMAKE is magic enough ;-)
@@ -166,8 +167,9 @@ WHAT'S WRONG WITH GNU AUTOTOOLS (IN SHORT)?
this goal makes development painful. Autotools is a hell for
development/developers. Too much of top-level commands: automake,
autoconf, aclocal, autoheader... All its functionality can be
- implemented using one top-level command -- bmake. Autotools is also
- a well known source of headaches for users and software packagers.
+ implemented using one top-level command -- mkcmake. Autotools is
+ also a well known source of headaches for users and software
+ packagers.
4) In theory, configure script generated by autoconf is portable
because it is written in portable shell. In practice this is not
@@ -179,17 +181,17 @@ WHAT'S WRONG WITH GNU AUTOTOOLS (IN SHORT)?
projects. In theory this can make building thousands of projects
(e.g. software packages in OS distributions) dramatically faster.
- 6) configures script generated by autoconf are too slow even on
+ 6) "configure" script generated by autoconf are too slow even on
modern hardware and systems having fast fork(2) system call
(notably *BSD and Linux).
7) Many (most?) real-life configure.ac break the cross-compiling.
- 8) In my view autotools (automake and autoconf) is BADLY designed. I
- personally dislike code generation idea because it is ... extreamly
- ugly :-/ approach even if the generated code is claimed to be
- "portable". Today it is not a problem to install any kind of
- software building tools and to them more efficiently.
+ 8) In my view autotools (automake and autoconf) are BADLY designed.
+ Personally, I dislike code generation for software build because it
+ is extremely ugly approach even if the generated code is claimed to
+ be "portable". Nowadays it is not a problem to install any kind of
+ software building tools and use them more efficiently.
-------------------------------------------------------------------------
WHAT MK-CONFIGURE CONSISTS OF?
@@ -198,14 +200,15 @@ WHAT MK-CONFIGURE CONSISTS OF?
These include files are responsible for building, installing and
uninstalling applications, static and shared libraries, scripts,
- plain files, man and info pages, hard and soft links etc...
+ text files, man and info pages, hard and soft links etc...
+
NOTE FOR *BSD USERS: unlike well known Mk files from *BSD
systems mkc.*.mk files provide the following features (this list
is not complete, see mk-configure.7 for details).
- PREFIX, BINDIR, MANDIR etc. variables default to directories
under /usr/local. By default the same variables in bsd.*.mk
- files are set to directories under /usr. This is because they
+ files are set to directories under /usr. The reason is that they
are used mainly for maintaining *BSD's own code while
mk-configure is targeted to all UNIX-like systems, not only *BSD.
@@ -236,7 +239,7 @@ WHAT MK-CONFIGURE CONSISTS OF?
set, LDFLAGS is modified accordingly. See examples/ projects.
- "cleandir" and "distclean" targets that remove all temporary
- files and mk.configure.mk's cache files.
+ files and mk-configure.mk's cache files.
- support for texinfo/info files. There is no need to .include
a special include files such as <bsd.info.mk> file.
@@ -254,7 +257,7 @@ WHAT MK-CONFIGURE CONSISTS OF?
real ${PREFIX}, ${SYSCONFDIR} etc. See examples/ subdirectory for
the samples.
-- mkc.configure.mk script which is a replacement for GNU autoconf. Its
+- mkc.configure.mk is a replacement for GNU autoconf. Its
functionality is large enough to describe here. It short, it allows
to check for presence of header files, function or variable
declarations, presence of function in a particular library, defines,
@@ -264,7 +267,7 @@ WHAT MK-CONFIGURE CONSISTS OF?
- Standalone full-functional
mkc_check_{funclib,header,sizeof,decl,prog,custom,compiler} and
- other programs that can be used without bmake and without mkc.*.mk
+ other programs that can be used without mkcmake and without mkc.*.mk
files. Read appropriate man pages.
-------------------------------------------------------------------------
@@ -273,10 +276,10 @@ DOCUMENTATION:
- Presentation about mk-configure (basic ideas and simple samples of use).
See INSTALLATION section for build instructions.
- - Instead of screenshots :-) I've prepared lots of samples under
+ - Instead of screenshots :-) I've prepared a lot of examples under
examples/ subdirectory.
- - Documentation for include files is in mk-configure(7).
+ - Documentation for mk include files is in mk-configure(7).
- Most programs (mkc_check_{decl,header,funclib,sizeof,prog,custom})
have -h option and manual pages.
@@ -284,30 +287,24 @@ DOCUMENTATION:
- Read the FAQ document. It may be helpful.
- Real life projects based on mk-configure:
- - Lightweight Modular malloc(3) debugger.
- http://sourceforge.net/projects/lmdbg/
+ - Most of my projects use mk-configure.
+ https://github.com/cheusov
- AWK interpreter from NetBSD cvs tree,
ported to Darwin, Solaris, Linux and other BSD.
http://mova.org/~cheusov/pub/mk-configure/nbawk/
- getopt_long(3) like module for Lua programming language (>=0.8.0)
- http://luaforge.net/projects/alt-getopt/
+ http://sourceforge.net/projects/lua-alt-getopt/
-------------------------------------------------------------------------
IS MK-CONFIGURE STABLE?
-"mk-configure" is currently in alpha stage of development.
-
-!!! API IS NOT STABLE YET AND MAY BE CHANGED IN THE NEXT RELEASE !!!
-
-IF YOU WANT TO HELP ME STABILIZE IT,
-SEND YOUR SUGGESTIONS AND IDEAS TO ME AS SOON AS POSSIBLE ;-)
-
-Also mk-configure is not feature-complete yet, see TODO file for details.
+Basic functionality of "mk-configure" is stable
+but it is not feature-complete yet, see TODO file for details.
-------------------------------------------------------------------------
INSTALLATION:
- 1) Install bmake to your system.
+ 1) Install bmake(1).
Sources are available here.
ftp://ftp.NetBSD.org/pub/NetBSD/misc/sjg/
@@ -318,7 +315,14 @@ INSTALLATION:
Please make sure you install stable version of bmake and
'bmake test' succeeds (see section 3 below).
- 2)
+ 2) Install NetBSD version of mkdep(1).
+ Sources are available here.
+
+ https://code.google.com/p/bmkdep/
+
+ Traditional BSD mkdep(1) is also good but NetBSD version is just better.
+
+ 3)
# cd mk-configure-X.Y.Z/
# export PREFIX=/usr/local (the default)
@@ -332,7 +336,7 @@ INSTALLATION:
Of course, you can change PREFIX, SYSCONFDIR, BINDIR etc.
to whatever you want. PREFIX defaults to /usr/local.
- 3)
+ 4)
# bmake test # For testing mk-configure, this step is optional.
# Note that testing requires lex(1), yacc(1),
# pkg-config(1), glib2 library and other things
@@ -345,17 +349,15 @@ INSTALLATION:
# e.g.
# NOSUBDIR='hello_glib2 hello_lua lua_dirs' bmake test
- 4)
+ 5)
# bmake install
or
# env DESTDIR=/tmp/temproot bmake install
- 5) You can also build a simple presentation by running either of the
+ 6) You can also build a simple presentation by running either of the
following commands:
- bmake doc
- bmake -C doc presentation.pdf
- bmake -C doc presentation.ps
+ bmake all-presentation
NOTE: I'd recommend to use the latest stable version of bmake. Old
bmake may not work, e.g., /usr/bin/make shipped with NetBSD-2.0 is
@@ -364,7 +366,7 @@ INSTALLATION:
NOTE: In order to work properly bmake needs sys.mk file that defines
default variable values and suffix rules. mk-configure doesn't
- need them, but bmake always tries to load this file. The problem
+ need it, but bmake always tries to load this file. The problem
is that different Mk-files libraries may conflict due to common
sys.mk. This is why mk-c's own mk files are installed to its own
directory (${PREFIX}/share/mkc-mk by default) and the same for
@@ -380,22 +382,14 @@ INSTALLATION:
need awk, sed, grep and some other POSIX tools too.
-------------------------------------------------------------------------
-PACKAGES
+MK-CONFIGURE BINARY PACKAGE
- If you use pkgsrc (cross platforms packaging system developped by
- NetBSD team), you may find package for latest mk-configure in
- devel/mk-configure.
-
- Debian/Ubuntu Linux users may install mk-configure by adding
- the following lines
-
- deb http://mova.org/~cheusov/pub/debian lenny main
- deb-src http://mova.org/~cheusov/pub/debian lenny main
-
- to /etc/apt/sources.list and then using apt or aptitude commands.
- Binary packages are available only for Debian/Lenny/i386.
-
- mk-configure is also packaged in FreeBSD ports (devel/mk-configure).
+ Binary packages for mk-configure are available in the following systems:
+ - NetBSD pkgsrc (devel/mk-configure).
+ - FreeBSD ports (devel/mk-configure)
+ - Debian/Ubuntu Linux (mk-configure)
+ - AltLinux (mk-configure)
+ - RHEL (mk-configure in repoforge repository)
-------------------------------------------------------------------------
FEEDBACK
@@ -408,8 +402,10 @@ For free e-mail subscription for mk-configure releases, visit
http://freshmeat.net/projects/mk-configure/
page.
+For pull requests, use github
+http://github.com/cheusov/mk-configure/
+
Feel free to notify me about spelling errors in the documentation.
-English is not my first language. If you want to participate the
-project, let me know.
+English is not my first language.
-------------------------------------------------------------------------
diff --git a/bmake.sys.mk b/bmake.sys.mk
deleted file mode 100644
index ca9681a..0000000
--- a/bmake.sys.mk
+++ /dev/null
@@ -1,194 +0,0 @@
-# Copyright (c) 1994-2009 The NetBSD Foundation, Inc.
-# Copyright (c) 1988, 1989, 1993 The Regents of the University of California
-# Copyright (c) 1988, 1989 by Adam de Boor
-# Copyright (c) 1989 by Berkeley Softworks
-
-unix ?= UNIX
-
-.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h
-.SUFFIXES: .sh .m4
-
-.LIBS: .a
-
-AR ?= ar
-ARFLAGS ?= rl
-RANLIB ?= ranlib
-
-AS ?= as
-AFLAGS ?=
-COMPILE.s ?= ${CC} ${AFLAGS} -c
-LINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS}
-COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
-LINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
-
-DBG ?=
-
-CC ?= cc
-CFLAGS ?= ${DBG}
-COMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
-LINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
-
-CXX ?= c++
-CXXFLAGS ?= ${CFLAGS}
-COMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
-LINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
-
-OBJC ?= ${CC}
-OBJCFLAGS ?= ${CFLAGS}
-COMPILE.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
-LINK.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
-
-CPP ?= cpp
-CPPFLAGS ?=
-
-FC ?= f77
-FFLAGS ?= -O
-RFLAGS ?=
-COMPILE.f ?= ${FC} ${FFLAGS} -c
-LINK.f ?= ${FC} ${FFLAGS} ${LDFLAGS}
-COMPILE.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
-LINK.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
-COMPILE.r ?= ${FC} ${FFLAGS} ${RFLAGS} -c
-LINK.r ?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
-
-INSTALL ?= install
-
-LEX ?= lex
-LFLAGS ?=
-LEX.l ?= ${LEX} ${LFLAGS}
-
-LD ?= ld
-LDFLAGS ?=
-
-LINT ?= lint
-LINTFLAGS ?= -chapbxzF
-
-LORDER ?= lorder
-
-MAKE ?= make
-
-NM ?= nm
-
-PC ?= pc
-PFLAGS ?=
-COMPILE.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
-LINK.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
-
-SHELL ?= sh
-
-SIZE ?= size
-
-TSORT ?= tsort -q
-
-YACC ?= yacc
-YFLAGS ?=
-YACC.y ?= ${YACC} ${YFLAGS}
-
-# C
-.c:
- ${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
-.c.o:
- ${COMPILE.c} ${.IMPSRC}
-.c.a:
- ${COMPILE.c} ${.IMPSRC}
- ${AR} ${ARFLAGS} $@ $*.o
- rm -f $*.o
-.c.ln:
- ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
-
-# C++
-.cc .cpp .cxx .C:
- ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
-.cc.o .cpp.o .cxx.o .C.o:
- ${COMPILE.cc} ${.IMPSRC}
-.cc.a .cpp.a .cxx.a .C.a:
- ${COMPILE.cc} ${.IMPSRC}
- ${AR} ${ARFLAGS} $@ $*.o
- rm -f $*.o
-
-# Fortran/Ratfor
-.f:
- ${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
-.f.o:
- ${COMPILE.f} ${.IMPSRC}
-.f.a:
- ${COMPILE.f} ${.IMPSRC}
- ${AR} ${ARFLAGS} $@ $*.o
- rm -f $*.o
-
-.F:
- ${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
-.F.o:
- ${COMPILE.F} ${.IMPSRC}
-.F.a:
- ${COMPILE.F} ${.IMPSRC}
- ${AR} ${ARFLAGS} $@ $*.o
- rm -f $*.o
-
-.r:
- ${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
-.r.o:
- ${COMPILE.r} ${.IMPSRC}
-.r.a:
- ${COMPILE.r} ${.IMPSRC}
- ${AR} ${ARFLAGS} $@ $*.o
- rm -f $*.o
-
-# Pascal
-.p:
- ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
-.p.o:
- ${COMPILE.p} ${.IMPSRC}
-.p.a:
- ${COMPILE.p} ${.IMPSRC}
- ${AR} ${ARFLAGS} $@ $*.o
- rm -f $*.o
-
-# Assembly
-.s:
- ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
-.s.o:
- ${COMPILE.s} ${.IMPSRC}
-.s.a:
- ${COMPILE.s} ${.IMPSRC}
- ${AR} ${ARFLAGS} $@ $*.o
- rm -f $*.o
-.S:
- ${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
-.S.o:
- ${COMPILE.S} ${.IMPSRC}
-.S.a:
- ${COMPILE.S} ${.IMPSRC}
- ${AR} ${ARFLAGS} $@ $*.o
- rm -f $*.o
-
-# Lex
-.l:
- ${LEX.l} ${.IMPSRC}
- ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
- rm -f lex.yy.c
-.l.c:
- ${LEX.l} ${.IMPSRC}
- mv lex.yy.c ${.TARGET}
-.l.o:
- ${LEX.l} ${.IMPSRC}
- ${COMPILE.c} -o ${.TARGET} lex.yy.c
- rm -f lex.yy.c
-
-# Yacc
-.y:
- ${YACC.y} ${.IMPSRC}
- ${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
- rm -f y.tab.c
-.y.c:
- ${YACC.y} ${.IMPSRC}
- mv y.tab.c ${.TARGET}
-.y.o:
- ${YACC.y} ${.IMPSRC}
- ${COMPILE.c} -o ${.TARGET} y.tab.c
- rm -f y.tab.c
-
-# Shell
-.sh:
- rm -f ${.TARGET}
- cp ${.IMPSRC} ${.TARGET}
diff --git a/custom/Makefile b/custom/Makefile
new file mode 100644
index 0000000..b64b177
--- /dev/null
+++ b/custom/Makefile
@@ -0,0 +1,5 @@
+SCRIPTS = endianess prog_bison prog_flex prog_gawk prog_gm4
+
+SCRIPTSDIR = ${BUILTINSDIR}
+
+.include <mkc.mk>
diff --git a/custom/endianess b/custom/endianess
index 0748557..3393806 100755
--- a/custom/endianess
+++ b/custom/endianess
@@ -3,7 +3,7 @@
############################################################
# Copyright (c) 2009 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
set -e
diff --git a/custom/prog_bison b/custom/prog_bison
index 319d532..dd7867f 100755
--- a/custom/prog_bison
+++ b/custom/prog_bison
@@ -3,7 +3,7 @@
############################################################
# Copyright (c) 2009 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
LC_ALL=C
diff --git a/custom/prog_flex b/custom/prog_flex
index d22a5d6..d8cc5a8 100755
--- a/custom/prog_flex
+++ b/custom/prog_flex
@@ -3,7 +3,7 @@
############################################################
# Copyright (c) 2009 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
LC_ALL=C
diff --git a/custom/prog_gawk b/custom/prog_gawk
index 9ae949b..d0403a7 100755
--- a/custom/prog_gawk
+++ b/custom/prog_gawk
@@ -3,7 +3,7 @@
############################################################
# Copyright (c) 2009 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
LC_ALL=C
diff --git a/custom/prog_gm4 b/custom/prog_gm4
index 6d006b8..e82dc55 100755
--- a/custom/prog_gm4
+++ b/custom/prog_gm4
@@ -3,7 +3,7 @@
############################################################
# Copyright (c) 2009 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
LC_ALL=C
diff --git a/custom/prog_mkdep b/custom/prog_mkdep
new file mode 100755
index 0000000..cdbea04
--- /dev/null
+++ b/custom/prog_mkdep
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+############################################################
+# Copyright (c) 2013 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+LC_ALL=C
+export LC_ALL
+
+extra_args="$*"
+
+pathpart='custom_nbmkdep'
+. mkc_check_common.sh
+
+#trap "echo $tmpc; rm $tmpc" 0
+trap "rm -f $tmpc $tmpo" 0
+
+cat > "$tmpc" <<'EOF'
+#include <stdio.h>
+EOF
+
+check_mkdep (){
+ "$1" -f "$tmpo" $extra_args -I . -I `pwd` "$tmpc"
+}
+
+for i in bmkdep nbmkdep mkdep; do
+ if test -z "`check_mkdep $i 2>&1 > /dev/null`"; then
+ mkc_which $i
+ exit 0
+ fi
+done
+
+echo ''
diff --git a/custom/prog_nbmkdep b/custom/prog_nbmkdep
new file mode 100755
index 0000000..19f2de7
--- /dev/null
+++ b/custom/prog_nbmkdep
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+############################################################
+# Copyright (c) 2013 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+${0%%/prog_nbmkdep}/prog_mkdep --
diff --git a/debian/changelog b/debian/changelog
index 8255823..9003a9b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+mk-configure (0.25.0-1) unstable; urgency=low
+
+ * New upstream release.
+ * Drop old patches.
+ * Use bmake's .ALLTARGETS feature to check for Makefile targets presence.
+
+ -- Andrew Shadura <andrewsh@debian.org> Sun, 05 Jan 2014 22:42:41 +0100
+
mk-configure (0.24.0-3) unstable; urgency=low
* Fix the clean-up of MKC_SOURCE_FUNCLIBS.
diff --git a/debian/control b/debian/control
index 46cf158..78eb9f2 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: mk-configure
Section: devel
Priority: optional
Maintainer: Andrew Shadura <andrewsh@debian.org>
-Build-Depends: debhelper (>= 9), bmake
+Build-Depends: debhelper (>= 9), bmake (>= 20131001)
Standards-Version: 3.9.4
Package: mk-configure
diff --git a/debian/copyright b/debian/copyright
index d8489bb..a5100cb 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -4,8 +4,8 @@ Upstream Author: Aleksey Cheusov <vle@gmx.net>
License: BSD (see below)
-Debian packaging in (c) 2013 Andrew Shadura <andrewsh@debian.org> and
-is licensed under the following license:
+Debian packaging in (c) 2013—2013 Andrew Shadura <andrewsh@debian.org>
+and is licensed under the following license:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -40,25 +40,7 @@ See individual files for details.
######################################################################
-File examples/hello_strlcpy/strlcpy.c is licensed as follows:
-
-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.
-
-######################################################################
-
-Copyright (c) 2009-2010 by Aleksey Cheusov
+Copyright (c) 2009-2014 by Aleksey Cheusov
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -152,6 +134,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
######################################################################
Copyright 1991 by the Massachusetts Institute of Technology
+Copyright 2013 by Aleksey Cheusov <vle@gmx.net>
Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee,
@@ -163,10 +146,20 @@ without specific, written prior permission. M.I.T. makes no
representations about the suitability of this software for any
purpose. It is provided "as is" without express or implied warranty.
-Calling this script install-sh is preferred over install.sh, to
-prevent `make' implicit rules from creating a file called install from
-it when there is no Makefile.
+######################################################################
-This script is compatible with the BSD install script, but was written
-from scratch. It can only install one file at a time, a restriction
-shared with many OS's install programs.
+File examples/hello_strlcpy/strlcpy.c is licensed as follows:
+
+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.
diff --git a/debian/dirs b/debian/dirs
deleted file mode 100644
index e772481..0000000
--- a/debian/dirs
+++ /dev/null
@@ -1 +0,0 @@
-usr/bin
diff --git a/debian/docs b/debian/docs
index 73286e9..cb66f81 100644
--- a/debian/docs
+++ b/debian/docs
@@ -1,4 +1,4 @@
-FAQ
-NEWS
+doc/FAQ
+doc/NEWS
README
-TODO
+doc/TODO
diff --git a/debian/install b/debian/install
index de4e45f..56bab38 100644
--- a/debian/install
+++ b/debian/install
@@ -1,2 +1 @@
-debian/sys.mk usr/share/mk-configure/mk
debian/*.pm usr/share/perl5/Debian/Debhelper/Buildsystem/
diff --git a/debian/mkcmake.pm b/debian/mkcmake.pm
index 016685e..3c1e83c 100644
--- a/debian/mkcmake.pm
+++ b/debian/mkcmake.pm
@@ -17,19 +17,19 @@ sub DESCRIPTION {
sub exists_make_target {
my ($this, $target) = @_;
- # Use make -n to check to see if the target would do
- # anything. There's no good way to test if a target exists.
- my @opts=("-s", "-n");
+ # Use -V .ALLTARGETS to get the list of targets; -n is
+ # needed to avoid executing anything
+ my @opts=("-n", "-V", ".ALLTARGETS");
my $buildpath = $this->get_buildpath();
unshift @opts, "-C", $buildpath if $buildpath ne ".";
open(SAVEDERR, ">&STDERR");
open(STDERR, ">/dev/null");
- open(MAKE, "-|", $this->{makecmd}, @opts, $target);
+ open(MAKE, "-|", $this->{makecmd}, @opts);
my $output=<MAKE>;
chomp $output;
close MAKE;
open(STDERR, ">&SAVEDERR");
- return defined $output && length $output;
+ return defined $output && grep(/^$target$/, split(" ",$output));
}
# Currently, we don't want parallel build with bmake.
diff --git a/debian/patches/01-dont-fail-on-clean.patch b/debian/patches/01-dont-fail-on-clean.patch
deleted file mode 100644
index c7df96b..0000000
--- a/debian/patches/01-dont-fail-on-clean.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/Makefile
-+++ b/Makefile
-@@ -129,7 +129,7 @@
- for d in ${.CURDIR}/tests ${.CURDIR}/doc; do \
- cd $$d; \
- ${MAKE} -m ${.CURDIR} -m ${.OBJDIR} -m ${MKFILESDIR} \
-- ${MAKEFLAGS} cleandir; \
-+ ${MAKEFLAGS} cleandir || true; \
- done
- clean: clean_tests
- clean_tests: configure.mk
-@@ -138,7 +138,7 @@
- for d in ${.CURDIR}/tests ${.CURDIR}/doc; do \
- cd $$d; \
- ${MAKE} -m ${.CURDIR} -m ${.OBJDIR} -m ${MKFILESDIR} \
-- ${MAKEFLAGS} clean; \
-+ ${MAKEFLAGS} clean || true; \
- done
-
- ##################################################
diff --git a/debian/patches/01-lua-mk.patch b/debian/patches/01-lua-mk.patch
new file mode 100644
index 0000000..970e812
--- /dev/null
+++ b/debian/patches/01-lua-mk.patch
@@ -0,0 +1,13 @@
+--- a/mk/mkc_imp.lua.mk
++++ b/mk/mkc_imp.lua.mk
+@@ -35,8 +35,8 @@
+ .endif
+ LIB = ${LUA_CMODULE:S|.|/|:T}
+ SRCS ?= ${LUA_CMODULE:S/./_/g}.c
+-MKDLL = Only
+-LDCOMPILER = Yes
++MKDLL = only
++LDCOMPILER = yes
+ DLL_EXT = .so
+ LIBDIR = ${LUA_CMODDIR}/${LUA_CMODULE:S|.|/|g:H}
+ .endif # defined(LUA_CMODULES)
diff --git a/debian/patches/02-cleanfiles-fix.patch b/debian/patches/02-cleanfiles-fix.patch
deleted file mode 100644
index 49b7032..0000000
--- a/debian/patches/02-cleanfiles-fix.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/mkc.mk
-+++ b/mkc.mk
-@@ -19,7 +19,7 @@
-
- .include <mkc_imp.init.mk>
-
--CLEANFILES += ${MKC_SOURCE_FUNCLIBS:D${MKC_SOURCE_FUNCLIBS}.o}
-+CLEANFILES += ${MKC_SOURCE_FUNCLIBS:D${MKC_SOURCE_FUNCLIBS:%=%.o}}
- .if ${MKCHECKS:tl} == "yes"
- .include <configure.mk>
- .endif # MKCHECKS
diff --git a/debian/patches/series b/debian/patches/series
index b54b335..b518ce1 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1 @@
-01-dont-fail-on-clean.patch
-02-cleanfiles-fix.patch
+01-lua-mk.patch
diff --git a/FAQ b/doc/FAQ
index 5d6b6d5..5d6b6d5 100644
--- a/FAQ
+++ b/doc/FAQ
diff --git a/COPYRIGHT b/doc/LICENSE
index 3872ddf..1a914f1 100644
--- a/COPYRIGHT
+++ b/doc/LICENSE
@@ -4,7 +4,7 @@ See individual files for details.
######################################################################
-Copyright (c) 2009-2010 by Aleksey Cheusov
+Copyright (c) 2009-2013 by Aleksey Cheusov
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -98,6 +98,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
######################################################################
Copyright 1991 by the Massachusetts Institute of Technology
+Copyright 2013 by Aleksey Cheusov <vle@gmx.net>
Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee,
@@ -109,10 +110,20 @@ without specific, written prior permission. M.I.T. makes no
representations about the suitability of this software for any
purpose. It is provided "as is" without express or implied warranty.
-Calling this script install-sh is preferred over install.sh, to
-prevent `make' implicit rules from creating a file called install from
-it when there is no Makefile.
+######################################################################
+
+File examples/hello_strlcpy/strlcpy.c is licensed as follows:
+
+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.
-This script is compatible with the BSD install script, but was written
-from scratch. It can only install one file at a time, a restriction
-shared with many OS's install programs.
+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.
diff --git a/doc/Makefile b/doc/Makefile
index 5f8efb0..2295297 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,45 +1,4 @@
-##################################################
+FILES = ../README NEWS TODO LICENSE FAQ
+FILESDIR = ${DOCDIR}
-all : presentation.pdf myprojects.pdf
-
-.PHONY : pdf dvi rtf
-pdf : presentation.pdf
-ps : presentation.ps
-dvi : presentation.dvi
-
-.SUFFIXES: .ps .eps .pdf .dvi .tex .dot
-
-presentation.ps presentation.pdf presentation.dvi: my_prjs.eps dep_graph.eps
-
-.ps.pdf:
- ps2pdf "$<" "$@"
-
-#.tex.pdf:
-# pdflatex "$<" && pdflatex "$<"
-
-.dot.eps:
- dot -Tps ${.IMPSRC} > ${.TARGET}
-
-.dvi.ps:
- dvips $<
-
-.tex.dvi:
- latex "${.IMPSRC}" && latex "${.IMPSRC}"
-
-.gz:
- gzip ${.IMPSRC}
-
-GARBAGE= *.dvi *.aux *.vrb *.toc *.snm *.log *.nav *.out *.eps *.ps
-CLEANFILES+= ${GARBAGE} *.pdf *.ps myprojects.tex
-
-.PHONY: clean-garbage
-clean-garbage:
- rm -f ${GARBAGE}
-
-##################################################
-myprojects.tex : presentation.tex
- awk '/^%%%begin-myprojects/, /^%%%end-myprojects/' \
- ${.ALLSRC} > ${.TARGET}
-myprojects.ps myprojects.pdf myprojects.dvi: my_prjs.eps
-
-.include <mkc.files.mk>
+.include <mkc.mk>
diff --git a/NEWS b/doc/NEWS
index 5995c08..43a0f4a 100644
--- a/NEWS
+++ b/doc/NEWS
@@ -1,4 +1,133 @@
======================================================================
+Version 0.25.0, by Aleksey Cheusov, Wed, 1 Jan 2014 19:28:55 +0300
+
+ Build infrastructure for mk-c itself was completely reimplemented.
+ Now it looks much better and is more flexible for further extensions.
+
+ NetBSD version of mkdep(1), traditional BSD mkdep(1) or
+ makedepend(1) is needed at build time.
+
+ LDCOMPILER defaults to "yes".
+
+ Variable TARGETS is now visible to users and is documented. It
+ contains all recursive targets and may be used for adding user's
+ functionality to mk-c.
+
+ FIX: Parallel installation ("mkcmake install -jN") now works
+ correctly. "installdirs" is activated before "install". Report by
+ Michael Crogan.
+
+ During build object directories are created automatically by default
+ when MAKEOBJDIR or MAKEOBJDIRPREFIX are set. New recursive target
+ "obj" and variable MKOBJDIRS were introduced.
+ Report by Michael Crogan.
+
+ New variable MKRELOBJDIR was introduced. With its help one can
+ create object directories relative to top-level object directory
+ (like MAKEOBJDIRPREFIX but without top-level ${.CURDIR} in paths).
+ Thanks to Michael Crogan.
+
+ target "depend":
+ - FIX. Original implementation relied on NetBSD version of
+ mkdep(1). So, it didn't work on Linux, FreeBSD and others with
+ original BSD mkdep(1). Type of mkdep(1) is detected at
+ mk-configure build time. Report by Michael Crogan.
+
+ New variables LN, LN_S, MKDIR, RM, CLEANFILES_CMD, CLEANDIRS_CMD,
+ UNINSTALL, MAKEDEPEND, OBJTOP, CC_PREFIX, CXX_PREFIX were
+ introduced.
+
+ New variable NODEPS was introduced. With its help one can cut off
+ the dependency graph for particular targets.
+
+ New variable BMAKE_REQD was introduced.
+
+ New variable SRCTOP was introduced. With its help
+ "mkcmake -C subdir target" may work just like "mkcmake target-subdir".
+
+ New variables CFLAGS.dflt.${CC_TYPE} and CXXFLAGS.dflt.${CXX_TYPE}
+ were introduced. They default to -Qunused-arguments
+ for clang and clang++.
+
+ mkc.init.mk can be invoked by users directly for setting all
+ required variables and further checks (CC_TYPE, LD_TYPE, OPSYS etc.).
+
+ mkc_imp.links.mk:
+ - This module was reimplemented from scratch.
+ Bug with parallel installation (LINKS and MLINKS) was fixed.
+
+ mkc.minitest.mk:
+ - new variable TEST_PREREQS was introduced.
+
+ mkc_imp.inc.mk: fix for ${INCS} installation problem happened when
+ headers are built in ${.OBJDIR}. Report by Jan Smydke.
+
+ mkc_imp.info.mk:
+ - fix for MKINSTALL=no. "installdirs" unexpectedly created target
+ directories.
+
+ mkc.configure.mk:
+ - fix issue with MKC_CHECK_CUSTOM when ${.OBJDIR} != ${.CURDIR}
+ - MKC_CHECK_PROGS: PROG.<prog> is set even if full path was
+ specified. In addition existence and executability of the
+ specified file is always checked.
+ - fix for MKC_SOURCE_FUNCLIBS. Not all objects were cleaned
+ correctly by target "clean". Now objects are added to CLEANFILES
+ unconditionally.
+ - negative results for MKC_REQUIRE_* are not cached. This gives
+ users ability to fix the problem by changing the environment
+ and try again.
+ - MKC_CHECK_BUILTINS. Additional builtin checks were added:
+ "prog_mkdep" and "prog_nbmkdep" for original BSD mkdep(1) and
+ NetBSD version of mkdep(1) respectively.
+
+ mkc_imp.intexts.mk fixes:
+ - Targets "clean" and "cleandir" do not fail anymore if INTEXTS_REPLS
+ contains empty variables.
+ - Target "all" works correctly if INFILES or INSCRIPTS contain
+ files with directories.
+
+ mkc.sub{dir,prj}.mk:
+ - ${MAKEFLAGS} is passed to recursive ${MAKE}s.
+ - {nodeps-,subdir-,}dir:T are also targets, that is, one can also
+ use the last component of subdirectory as_a_part_of/as_a_whole
+ target. If you want to disable this, set SHORTPRJNAME to "no".
+
+ mkc_imp.subdir.mk was reimplemented using mkc_imp.subprj.mk
+
+ mkc_imp.dep.mk:
+ - documentation for this module was added.
+ - support for SHRTOUT=yes
+ - new variable DPSRCS was introduced
+ - MKDEP_SUFFIXES also contains .os and .op. Report by Michael Crogan.
+ - Target "clean" does not remove .depend and .d files.
+ Target "cleandir" does. NetBSD mk files work the same way.
+ Report by Michael Crogan.
+
+ MKPIE/SHLIB_*:
+ - s/-KPIC/-xcode=pic32/ for SunStudio compilers
+
+ MKSSP=yes:
+ - Support for IBM XL Compiler was added (not tested due to lack of such iron)
+ - Support for Intel C/C++ Compiler was added
+
+ Documentation fixes, updates and improvements. A lot of new
+ examples/. A lot of new regression tests.
+
+ Tools:
+ Long option --help was removed from all utilities
+ - mkc_install:
+ - fix for problem with parallel "installdirs" (race condition).
+ - Options -t and -b were removed.
+ - mkc_check_prog: option -i is documented in man page
+ - mkc_check_compiler: workarounds for buggy SunStudio C++
+ compiler ("CC -E -" exits with error).
+
+ All test are run with MKCATPAGES=no by default.
+
+ myprojects.pdf: pipestatus also uses mk-configure.
+
+======================================================================
Version 0.24.0, by Aleksey Cheusov, Fri, 8 Mar 2013 13:18:00 +0300
mkc.sub{dir,prj}.mk:
@@ -738,7 +867,7 @@ Version 0.11.0, by Aleksey Cheusov, Sat, 5 Sep 2009 15:26:01 +0300
- MKC_REQD variable
- Makefile of mk-configure: README, NEWS, TODO, FAQ and COPYRIGHT
+ Makefile of mk-configure: README, NEWS, TODO, FAQ and LICENSE
files are also installed unless EXTRAFILES is set to an empty string.
"mkc_check_sizeof" and "mkc_check_decl type" don't create cache
diff --git a/TODO b/doc/TODO
index c0baf95..bcfa7de 100644
--- a/TODO
+++ b/doc/TODO
@@ -1,13 +1,87 @@
============================================================
Plan 0.25.0
+Some thoughts inspired by talks with Michael Crogan
+
+- During development of huge projects it may make sense to always keep
+ "installed" version of the software somewhere (FAKEPREFIX?)
+ and always keep it synced.
+ mk-configure needs a mechanism to always "install"
+ after "all" and "uninstall" before "clean". Options: develop this in
+ mk-c and make it optional feature; provide a mechanism for
+ auto-depend one target from TARGETS from another one. In the latter
+ case users will be able to implement this kind of things themself.
+ (myall -> "myall-* : all-* .WAIT install-*)
+ (myclean -> "myclean-* : uninstall-* .WAIT clean-*)
+
+- VARIANTS for libraries.
+
+- project "roundup" for testing
+
+- Better explain how "test" target works, maybe as a couple of slides
+ in the PDF presentation. With and without mkc.minitest.mk.
+- One more example/ for TARGETS, demonstrating such things as
+ "mkcmake release/debug/profile" or "mkcmake all_clang/all_gcc"
+ or "valgrind_test"/"gcov_test" etc.
+- Additional slides in PDF for virtual subprojects.
+ Notes about "virtual subproject" in examples/.
+- Notes in examples/hello_dictd and other examples based on
+ mkc.subprj.mk about what mkc.subprj.mk really does. Reference (man page)
+ is not enough for newcomers. Notes about clean-SUBPRJ, all-SUBPRJ etc.
+- Better explain ../Makefile.inc included automatically. For those who
+ are not familiar with *BSD it is not obvious how to use it.
+- "errorcheck/configure" tests should be run in parallel. Something
+ like shlock(1) or flock(1) is needed for this.
+- Example is needed for how to embed autoconf-based subproject into a
+ project based on mk-configure. The sad fact is autoconf/automake is
+ everywhere. So, it would be nice integrate mk-c into reality.
+ mkc_imp.autotools.mk is needed for this.
+- Alternative .depend generation, e.g. like it is described in GNU
+ make info files
+- Higher priority for fixing handling of dependencies between
+ libraries and programs. In addition examples/ is needed for
+ triggering rebuild of subproject if "something" was rebuild in
+ another subproject (build script for example).
+- For better extensibility it makes sense to implement user-implementable
+ pre_all, post_all, pre_install, post_install etc. targets.
+- Interdependencies between targetX-subprjA and targetY-subprjB (for
+ example all-prject1 and install-prject2). Maybe this is cool idea
+ for examples/ and slides. I need some good example for this.
+ <<<depend-project1:errorcheck-autotools_based_project2>>>!!!
+- Steal cool features from Simon Gerraty's mk files and analyse
+ "meta mode" he invented.
+- Better support for working without installation to /. -rpath, additional
+ directories for objects, binaries and libs.
+
+Some "targets" from TARGETS should set MKCHECKS to "no"
+
+ronn(1) : markdown to man pages
+
+-----------------------------------------
+gcc -L/usr/pkg/lib -R/usr/pkg/lib -o hello_lex hello_lex.o -ll
+yacc calc.y
+mv y.tab.c calc.c
+gcc -I/usr/pkg/include -c -o calc.o calc.c
+gcc -L/usr/pkg/lib -R/usr/pkg/lib -o hello_calc calc.o
+ERROR: cannot find program -y
+Cannot find bison, good bye!
+------------------------------------------
+
+ custom test failed -> exit status of mkcmake should not be zero
+ MKC_CUSTOM_ERR.qqqq -> error message before exiting just like
+
+ mkcmake configure doesn't work
+ New variable MKC_CUSTOM_ENV.xxx
+
+ Add script_check to MKC_CHECK_CUSTOM
+ Ex. MKC_CHECK_CUSTOM+= nested_funcs
+ MKC_CUSTOM_FN.nested_funcs= nested_funcs.c
+ MKC_CUSTOM_FN.script_check= checks/script_check
+
+ - BINSUBDIR, LIBSUBDIR, LIBEXECSUBDIR etc...
- Fix USE_SSP support for clang (-mllvm -stack-protector-buffer-size=1)
- @sysconfdir@/mkc.conf
- LDFLAGS vs. LDFLAGS in link.me (global paths before project's)
- - .RECURSIVE/.MAKE: -> mkc_imp.sub{dir,prj}.mk
- - "mkcmake all" ignores MKC_REQD
- - BMAKE_REQD - minimum required bmake version
- - virtual subprj - check for subprj/Makefile, not subprj
- Reimplement linkme.mk. It is not flexible enough.
- USE_RPATH
- OBJCOPTS_<proj>
@@ -22,8 +96,6 @@ Plan 1)
- Support for MKDEBUG like in NetBSD mk files
- .lua.luac:
- - disable caching for "negative" results
- for MKC_REQUIRE_xxx features.
- Implement mkc_imp.libtool.mk to build
the shared libraries using GNU libtool(1).
- MKSTRIP, STRIP, mkc_install: use STRIP, not STRIPPROG
@@ -104,14 +176,10 @@ Plan 4)
= mkc.subdir.mk:
- continue bulding even if some subprojects failed
- = mkc.subdir.mk, mkc.subprj.mk: reimplement ${dir}.${MACHINE}
-
= MKC_CHECK_CUSTOM:
- MKC_CUSTOM_FN=xxx.f
- MKC_CUSTOM_FN=xxx.objc
- = user-defined postinstall and preinstall?
-
= Implement mkc.qt.mk
= Implement mkc.doxygen.mk?
diff --git a/examples/Makefile b/examples/Makefile
index cc8dba9..0934f7b 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -33,6 +33,7 @@ SUBDIR+= hello_xxzip
SUBDIR+= hello_progs
SUBDIR+= hello_progs2
SUBDIR+= tools
+SUBDIR+= tools2
.ifdef WITH_require_tools
SUBDIR+= hello_require_tools
diff --git a/examples/hello_TARGETS/Makefile b/examples/hello_TARGETS/Makefile
new file mode 100644
index 0000000..95fcf15
--- /dev/null
+++ b/examples/hello_TARGETS/Makefile
@@ -0,0 +1,15 @@
+SUBDIR = hello1 hello2
+
+# additional recursive target
+TARGETS += codingstylechk
+
+# We want to include man pages to the distribution tarball.
+# For this we do the following:
+# mkcmake manpages; tar -cf /tmp/tarball.tar .
+TARGETS += _manpages # _manpages is a new recursive target
+.PHONY: manpages
+manpages: _manpages
+ @rm ${MKC_CACHEDIR}/_mkc*
+
+.include "test.mk"
+.include <mkc.subdir.mk>
diff --git a/examples/hello_TARGETS/Makefile.inc b/examples/hello_TARGETS/Makefile.inc
new file mode 100644
index 0000000..b3f20f7
--- /dev/null
+++ b/examples/hello_TARGETS/Makefile.inc
@@ -0,0 +1,10 @@
+CSCHK = test hello1 = '${.CURDIR:T}' # something useful should be here
+
+.if make(codingstylechk)
+MKCHECKS = no
+.endif
+
+.PHONY: codingstylechk
+codingstylechk:
+ @${_MESSAGE_V} "Coding style check for ${PROJECTNAME}"; \
+ ${CSCHK} || { echo FAILED 1>&2; false; }
diff --git a/examples/hello_TARGETS/expect.out b/examples/hello_TARGETS/expect.out
new file mode 100644
index 0000000..e88091d
--- /dev/null
+++ b/examples/hello_TARGETS/expect.out
@@ -0,0 +1,67 @@
+Hello World 1!
+Hello World 2!
+=========== 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/expect.out
+/objdir/hello1/Makefile
+/objdir/hello1/hello1
+/objdir/hello1/hello1.1
+/objdir/hello1/hello1.c
+/objdir/hello1/hello1.o
+/objdir/hello1/hello1.pod
+/objdir/hello2/Makefile
+/objdir/hello2/hello2
+/objdir/hello2/hello2.1
+/objdir/hello2/hello2.c
+/objdir/hello2/hello2.o
+/objdir/hello2/hello2.pod
+/objdir/hello_TARGETS.test.out.tmp
+/objdir/test.mk
+========= codingstylechk ==========
+==================================================
+codingstylechk ===> hello_TARGETS/hello1
+Coding style check for hello1
+==================================================
+codingstylechk ===> hello_TARGETS/hello2
+Coding style check for hello2
+FAILED
+*** Error code 1
+
+Stop.
+bmake: stopped in /objdir/hello2
+*** Error code 1
+
+Stop.
+bmake: stopped in /objdir
+cschk ex=1
+============= files ===============
+/objdir/Makefile
+/objdir/Makefile.inc
+/objdir/expect.out
+/objdir/hello1/Makefile
+/objdir/hello1/hello1.c
+/objdir/hello1/hello1.pod
+/objdir/hello2/Makefile
+/objdir/hello2/hello2.c
+/objdir/hello2/hello2.pod
+/objdir/hello_TARGETS.test.out.tmp
+/objdir/test.mk
+=========== manpages ============
+/objdir/Makefile
+/objdir/Makefile.inc
+/objdir/expect.out
+/objdir/hello1/Makefile
+/objdir/hello1/hello1.1
+/objdir/hello1/hello1.c
+/objdir/hello1/hello1.pod
+/objdir/hello2/Makefile
+/objdir/hello2/hello2.1
+/objdir/hello2/hello2.c
+/objdir/hello2/hello2.pod
+/objdir/hello_TARGETS.test.out.tmp
+/objdir/test.mk
diff --git a/examples/hello_TARGETS/hello1/Makefile b/examples/hello_TARGETS/hello1/Makefile
new file mode 100644
index 0000000..d1e6601
--- /dev/null
+++ b/examples/hello_TARGETS/hello1/Makefile
@@ -0,0 +1,15 @@
+PROG = hello1
+MAN = hello1.1
+
+WARNS = 4
+
+CLEANFILES = hello1.1
+
+_manpages: ${MAN}
+
+# the following is just a regression test for exporting TARGETS
+.if empty(TARGETS:Mcoding*)
+MKC_ERR_MSG = "qqq"
+.endif
+
+.include <mkc.mk>
diff --git a/examples/hello_TARGETS/hello1/hello1.c b/examples/hello_TARGETS/hello1/hello1.c
new file mode 100644
index 0000000..026f7e0
--- /dev/null
+++ b/examples/hello_TARGETS/hello1/hello1.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main (int argc, char **argv )
+{
+ puts ("Hello World 1!");
+ exit (0);
+}
diff --git a/examples/hello_TARGETS/hello1/hello1.pod b/examples/hello_TARGETS/hello1/hello1.pod
new file mode 100644
index 0000000..92581bb
--- /dev/null
+++ b/examples/hello_TARGETS/hello1/hello1.pod
@@ -0,0 +1,17 @@
+=head1 NAME
+
+hello1 - mk-configure example program
+
+=head1 INTRODCTION
+
+lalala
+
+=head1 STEP1
+
+bla bla bla
+
+=head1 STEP2
+
+bla bla bla
+
+=head1 BYE
diff --git a/examples/hello_TARGETS/hello2/Makefile b/examples/hello_TARGETS/hello2/Makefile
new file mode 100644
index 0000000..20ada21
--- /dev/null
+++ b/examples/hello_TARGETS/hello2/Makefile
@@ -0,0 +1,10 @@
+PROG = hello2
+MAN = hello2.1
+
+WARNS = 4
+
+CLEANFILES = hello2.1
+
+_manpages: ${MAN}
+
+.include <mkc.mk>
diff --git a/examples/hello_TARGETS/hello2/hello2.c b/examples/hello_TARGETS/hello2/hello2.c
new file mode 100644
index 0000000..95331f9
--- /dev/null
+++ b/examples/hello_TARGETS/hello2/hello2.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main (int argc, char **argv )
+{
+ puts ("Hello World 2!");
+ exit (0);
+}
diff --git a/examples/hello_TARGETS/hello2/hello2.pod b/examples/hello_TARGETS/hello2/hello2.pod
new file mode 100644
index 0000000..4479946
--- /dev/null
+++ b/examples/hello_TARGETS/hello2/hello2.pod
@@ -0,0 +1,22 @@
+=head1 NAME
+
+hello2 - mk-configure example
+
+=head1 SYNOPSIS
+
+B<hello2> I<[options]> I<[files...]>
+
+=head1 DESCRIPTION
+
+bla bla bla
+
+=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_TARGETS/test.mk b/examples/hello_TARGETS/test.mk
new file mode 100644
index 0000000..6949660
--- /dev/null
+++ b/examples/hello_TARGETS/test.mk
@@ -0,0 +1,32 @@
+# I added "codingstylechk" to "test" just for mk-configure regr. test
+
+test:
+.PHONY : test_output
+test_output :
+ @:; \
+ ${OBJDIR_hello1}/hello1; \
+ ${OBJDIR_hello2}/hello2; \
+ MKCATPAGES=yes; export MKCATPAGES; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= codingstylechk ==========; \
+ ${MAKE} ${MAKEFLAGS} cleandir 2>/dev/null 1>&2; \
+ { ${MAKE} ${MAKEFLAGS} codingstylechk 2>&1; echo cschk ex=$$?; } | \
+ env NOSORT=1 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ============= files ===============; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo =========== manpages ============; \
+ env MKCATPAGES=no ${MAKE} ${MAKEFLAGS} cleandir 2>/dev/null 1>&2; \
+ ${MAKE} ${MAKEFLAGS} manpages 2>/dev/null 1>&2; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+ \
+ ${MAKE} ${MAKEFLAGS} cleandir 2>/dev/null 1>&2
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_calc2/Makefile b/examples/hello_calc2/Makefile
index 098b5af..c425b22 100644
--- a/examples/hello_calc2/Makefile
+++ b/examples/hello_calc2/Makefile
@@ -1,7 +1,8 @@
PROG = calc
-
SRCS = lex.l parser.y
+DPSRCS = lex.c parser.c parser.h
+
YHEADER = 1
YPREFIX = calc_
LPREFIX = calc_
diff --git a/examples/hello_calc2/expect.out b/examples/hello_calc2/expect.out
index a50aab6..d98c36f 100644
--- a/examples/hello_calc2/expect.out
+++ b/examples/hello_calc2/expect.out
@@ -49,6 +49,28 @@
/objdir/lex.l
/objdir/parser.y
/objdir/test.mk
+========== depend ===========
+/objdir/.depend
+/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.c
+/objdir/lex.d
+/objdir/lex.l
+/objdir/parser.c
+/objdir/parser.d
+/objdir/parser.h
+/objdir/parser.y
+/objdir/test.mk
======= distclean ==========
/objdir/Makefile
/objdir/expect.out
diff --git a/examples/hello_calc2/test.mk b/examples/hello_calc2/test.mk
index cf8cf2f..e533b28 100644
--- a/examples/hello_calc2/test.mk
+++ b/examples/hello_calc2/test.mk
@@ -3,13 +3,14 @@ test_output:
@set -e; \
${.OBJDIR}/calc < ${.CURDIR}/expressions.txt; \
rm -rf ${.OBJDIR}${PREFIX}; \
+ MKCATPAGES=yes; export MKCATPAGES; \
\
echo =========== all ============; \
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
@@ -24,6 +25,11 @@ test_output:
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
+ echo ========== depend ===========; \
+ ${MAKE} ${MAKEFLAGS} depend -j4 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 | \
diff --git a/examples/hello_compilers/test.mk b/examples/hello_compilers/test.mk
index d917440..8709b94 100644
--- a/examples/hello_compilers/test.mk
+++ b/examples/hello_compilers/test.mk
@@ -3,19 +3,20 @@ test_output:
@set -e; \
${.OBJDIR}/compiler_test; \
rm -rf ${.OBJDIR}${PREFIX}; \
+ MKCATPAGES=yes; export MKCATPAGES; \
\
echo =========== all ============; \
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======== uninstall =========; \
- ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
diff --git a/examples/hello_customtests/expect.out b/examples/hello_customtests/expect.out
index 92f48f1..bcf94d9 100644
--- a/examples/hello_customtests/expect.out
+++ b/examples/hello_customtests/expect.out
@@ -64,6 +64,8 @@ shtest is good: NO
/objdir/hello_customtests.c
/objdir/hello_customtests.test.out.tmp
/objdir/test.mk
+======= errorcheck + MAKEOBJDIR ===========
+true_is_available=1
======= distclean ==========
/objdir/Makefile
/objdir/custom_tests/alloca_in_alloca_h.c
diff --git a/examples/hello_customtests/test.mk b/examples/hello_customtests/test.mk
index 99e946e..adfedf7 100644
--- a/examples/hello_customtests/test.mk
+++ b/examples/hello_customtests/test.mk
@@ -1,7 +1,10 @@
+CLEANDIRS += ${.CURDIR}/testdir
+
.PHONY : test_output
test_output:
@set -e; \
rm -rf ${.OBJDIR}${PREFIX}; \
+ MKCATPAGES=yes; export MKCATPAGES; \
\
echo =========== all ============; \
find ${.OBJDIR} -type f | \
@@ -11,13 +14,13 @@ test_output:
${.OBJDIR}/hello_customtests; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======== uninstall =========; \
- ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
@@ -26,6 +29,11 @@ test_output:
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
+ echo ======= errorcheck + MAKEOBJDIR ===========; \
+ mkdir ${.CURDIR}/testdir || true; \
+ ${MAKE} ${MAKEFLAGS} errorcheck MAKEOBJDIR=${.CURDIR}/testdir > /dev/null; \
+ printf 'true_is_available=%s\n' `cat ${.CURDIR}/testdir/_mkc_custom_true_is_available.res`; \
+ \
echo ======= distclean ==========; \
${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR} -type f | \
diff --git a/examples/hello_customtests2/Makefile b/examples/hello_customtests2/Makefile
index 98d8732..b3b6b9c 100644
--- a/examples/hello_customtests2/Makefile
+++ b/examples/hello_customtests2/Makefile
@@ -4,8 +4,11 @@ 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_CHECK_CUSTOM = alloca_in_stdlib_h alloca_in_alloca_h \
+ true_is_available
+
+# full path is for regression test
+MKC_CUSTOM_FN.true_is_available = ${MKC_CUSTOM_DIR}/true_is_available
MKC_REQD = 0.11.0
diff --git a/examples/hello_customtests2/expect.out b/examples/hello_customtests2/expect.out
index bbf1f24..04eecd6 100644
--- a/examples/hello_customtests2/expect.out
+++ b/examples/hello_customtests2/expect.out
@@ -6,6 +6,8 @@
/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_true_is_available.err
+/objdir/_mkc_custom_true_is_available.res
/objdir/_mkc_prog_cc.err
/objdir/_mkc_prog_cc.res
/objdir/expect.out
@@ -29,12 +31,16 @@ alloca(3) succeeded
/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_true_is_available.err
+/objdir/_mkc_custom_true_is_available.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
+======= errorcheck + MAKEOBJDIR ===========
+true_is_available=1
======= distclean ==========
/objdir/Makefile
/objdir/expect.out
diff --git a/examples/hello_customtests2/test.mk b/examples/hello_customtests2/test.mk
index 438e4ab..b3ce488 100644
--- a/examples/hello_customtests2/test.mk
+++ b/examples/hello_customtests2/test.mk
@@ -1,7 +1,10 @@
+CLEANDIRS += ${.CURDIR}/testdir
+
.PHONY : test_output
test_output:
@set -e; \
rm -rf ${.OBJDIR}${PREFIX}; \
+ MKCATPAGES=yes; export MKCATPAGES; \
\
echo =========== all ============; \
find ${.OBJDIR} -type f | \
@@ -11,13 +14,13 @@ test_output:
${.OBJDIR}/hello_customtests2; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======== uninstall =========; \
- ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
@@ -26,6 +29,11 @@ test_output:
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
+ echo ======= errorcheck + MAKEOBJDIR ===========; \
+ mkdir ${.CURDIR}/testdir || true; \
+ ${MAKE} ${MAKEFLAGS} errorcheck MAKEOBJDIR=${.CURDIR}/testdir > /dev/null; \
+ printf 'true_is_available=%s\n' `cat ${.CURDIR}/testdir/_mkc_custom_true_is_available.res`; \
+ \
echo ======= distclean ==========; \
${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR} -type f | \
diff --git a/examples/hello_cxx/test.mk b/examples/hello_cxx/test.mk
index f930d66..a961674 100644
--- a/examples/hello_cxx/test.mk
+++ b/examples/hello_cxx/test.mk
@@ -3,19 +3,20 @@ test_output:
@set -e; \
${.OBJDIR}/hello_cxx; \
rm -rf ${.OBJDIR}${PREFIX}; \
+ MKCATPAGES=yes; export MKCATPAGES; \
\
echo =========== all ============; \
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======== uninstall =========; \
- ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
diff --git a/examples/hello_cxxlib/test.mk b/examples/hello_cxxlib/test.mk
index c0db93a..ce5dd80 100644
--- a/examples/hello_cxxlib/test.mk
+++ b/examples/hello_cxxlib/test.mk
@@ -1,6 +1,7 @@
.PHONY : test_output
test_output:
@set -e; \
+ MKCATPAGES=yes; export MKCATPAGES; \
rm -rf ${.OBJDIR}${PREFIX}; \
LD_LIBRARY_PATH=${.CURDIR}/cxxlib:$$LD_LIBRARY_PATH; \
DYLD_LIBRARY_PATH=${.CURDIR}/cxxlib:$$LD_LIBRARY_PATH; \
@@ -12,13 +13,13 @@ test_output:
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 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; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
diff --git a/examples/hello_dictd/expect.out b/examples/hello_dictd/expect.out
index bdcbe32..cbed363 100644
--- a/examples/hello_dictd/expect.out
+++ b/examples/hello_dictd/expect.out
@@ -268,6 +268,114 @@ libdz fake3
/objdir/libmaa/prime.c
/objdir/libmaa/set.c
/objdir/test.mk
+=========== MKOBJDIRS=auto ============
+/objdir
+/objdir/Makefile
+/objdir/Makefile.inc
+/objdir/dict
+/objdir/dict/Makefile
+/objdir/dict/dict.1
+/objdir/dict/dict.c
+/objdir/dictd
+/objdir/dictd/Makefile
+/objdir/dictd/dictd.8
+/objdir/dictd/dictd.c
+/objdir/dictfmt
+/objdir/dictfmt/Makefile
+/objdir/dictfmt/dictfmt.1
+/objdir/dictfmt/dictfmt.c
+/objdir/dictzip
+/objdir/dictzip/Makefile
+/objdir/dictzip/dictzip.1
+/objdir/dictzip/dictzip.c
+/objdir/doc
+/objdir/doc/Makefile
+/objdir/doc/doc.txt
+/objdir/expect.out
+/objdir/hello_dictd.test.out.tmp
+/objdir/libcommon
+/objdir/libcommon/Makefile
+/objdir/libcommon/iswalnum.c
+/objdir/libcommon/linkme.mk
+/objdir/libcommon/str.c
+/objdir/libdz
+/objdir/libdz/Makefile
+/objdir/libdz/dz.c
+/objdir/libdz/export.sym
+/objdir/libdz/linkme.mk
+/objdir/libmaa
+/objdir/libmaa/Makefile
+/objdir/libmaa/export.sym
+/objdir/libmaa/linkme.mk
+/objdir/libmaa/log.c
+/objdir/libmaa/prime.c
+/objdir/libmaa/set.c
+/objdir/test.mk
+===
+/objdir/obj1/objdir
+/objdir/obj1/objdir/dict
+/objdir/obj1/objdir/dictd
+/objdir/obj1/objdir/dictfmt
+/objdir/obj1/objdir/dictzip
+/objdir/obj1/objdir/libcommon
+/objdir/obj1/objdir/libdz
+/objdir/obj1/objdir/libmaa
+=========== MKOBJDIRS=yes ============
+obj1 does not exist
+===
+/objdir
+/objdir/Makefile
+/objdir/Makefile.inc
+/objdir/dict
+/objdir/dict/Makefile
+/objdir/dict/dict.1
+/objdir/dict/dict.c
+/objdir/dictd
+/objdir/dictd/Makefile
+/objdir/dictd/dictd.8
+/objdir/dictd/dictd.c
+/objdir/dictfmt
+/objdir/dictfmt/Makefile
+/objdir/dictfmt/dictfmt.1
+/objdir/dictfmt/dictfmt.c
+/objdir/dictzip
+/objdir/dictzip/Makefile
+/objdir/dictzip/dictzip.1
+/objdir/dictzip/dictzip.c
+/objdir/doc
+/objdir/doc/Makefile
+/objdir/doc/doc.txt
+/objdir/expect.out
+/objdir/hello_dictd.test.out.tmp
+/objdir/libcommon
+/objdir/libcommon/Makefile
+/objdir/libcommon/iswalnum.c
+/objdir/libcommon/linkme.mk
+/objdir/libcommon/str.c
+/objdir/libdz
+/objdir/libdz/Makefile
+/objdir/libdz/dz.c
+/objdir/libdz/export.sym
+/objdir/libdz/linkme.mk
+/objdir/libmaa
+/objdir/libmaa/Makefile
+/objdir/libmaa/export.sym
+/objdir/libmaa/linkme.mk
+/objdir/libmaa/log.c
+/objdir/libmaa/prime.c
+/objdir/libmaa/set.c
+/objdir/test.mk
+===
+/objdir/obj2/objdir
+/objdir/obj2/objdir/dict
+/objdir/obj2/objdir/dictd
+/objdir/obj2/objdir/dictfmt
+/objdir/obj2/objdir/dictzip
+/objdir/obj2/objdir/libcommon
+/objdir/obj2/objdir/libdz
+/objdir/obj2/objdir/libmaa
+/objdir/obj3
+=========== MKOBJDIRS=no ============
======= errorcheck ==========
/objdir/Makefile
/objdir/Makefile.inc
@@ -369,6 +477,60 @@ libdz fake3
/objdir/libmaa/set.o
/objdir/libmaa/set.os
/objdir/test.mk
+======= -C dict 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/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
@@ -390,8 +552,22 @@ libdz fake3
/objdir/prefix/man/cat1/dict.0
/objdir/prefix/man/man1
/objdir/prefix/man/man1/dict.1
+========= -Cdict install ==========
+/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 ===========
+========== -C dict clean ===========
/objdir/Makefile
/objdir/Makefile.inc
/objdir/_mkc_compiler_type.err
diff --git a/examples/hello_dictd/test.mk b/examples/hello_dictd/test.mk
index ae6492f..1dd3944 100644
--- a/examples/hello_dictd/test.mk
+++ b/examples/hello_dictd/test.mk
@@ -1,6 +1,11 @@
+next_level != expr ${.MAKE.LEVEL} + 1
+
.PHONY : test_output
test_output :
@set -e; \
+ MKCATPAGES=yes; export MKCATPAGES; \
+ SRCTOP=`pwd`; export SRCTOP; \
+ \
rm -rf ${.OBJDIR}${PREFIX}; \
LD_LIBRARY_PATH=${.CURDIR}/libdz:${.CURDIR}/libmaa:$$LD_LIBRARY_PATH; \
DYLD_LIBRARY_PATH=${.CURDIR}/libdz:${.CURDIR}/libmaa:$$LD_LIBRARY_PATH; \
@@ -23,6 +28,7 @@ test_output :
esac; \
\
echo =========== all ============; \
+ ${MAKE} ${MAKEFLAGS} -j4 all > /dev/null; \
find ${.OBJDIR} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
@@ -32,12 +38,12 @@ test_output :
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} install -j3 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; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
@@ -55,15 +61,55 @@ test_output :
${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
find ${.OBJDIR} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr; \
+ echo =========== MKOBJDIRS=auto ============; \
+ env TARGETS=fake ${MAKE} ${MAKEFLAGS} fake \
+ MKCHECKS=no MAKEOBJDIRPREFIX=${.OBJDIR}/obj1 > /dev/null; \
+ find ${.OBJDIR} -type d -o -type f -o -type l | grep -v obj1 | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ echo ===; \
+ find ${.OBJDIR}/obj1/${.OBJDIR} -type d -o -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; rm -rf obj1; \
+ \
+ echo =========== MKOBJDIRS=yes ============; \
+ env TARGETS=fake ${MAKE} ${MAKEFLAGS} fake \
+ MKCHECKS=no MKOBJDIRS=yes MAKEOBJDIRPREFIX=${.OBJDIR}/obj1 > /dev/null; \
+ printf '%s' 'obj1 '; \
+ if test -d ${.OBJDIR}/obj1; then echo exists; else echo does not exist; fi; \
+ rm -rf obj1; \
+ echo ===; \
+ ${MAKE} ${MAKEFLAGS} obj MKOBJDIRS=yes MAKEOBJDIRPREFIX=${.OBJDIR}/obj2 > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} obj MKOBJDIRS=yes MAKEOBJDIR=${.OBJDIR}/obj3 > /dev/null; \
+ find ${.OBJDIR} -type d -o -type f -o -type l | grep -v 'obj[23]' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ echo ===; \
+ find ${.OBJDIR}/obj2/${.OBJDIR} ${.OBJDIR}/obj3 \
+ -type d -o -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; rm -rf obj2 obj3; \
+ \
+ echo =========== MKOBJDIRS=no ============; \
+ ${MAKE} ${MAKEFLAGS} obj MKOBJDIRS=no MAKEOBJDIRPREFIX=${.OBJDIR}/obj2 > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} obj MKOBJDIRS=no MAKEOBJDIR=${.OBJDIR}/obj3 > /dev/null; \
+ find ${.OBJDIR} -type d -o -type f -o -type l | grep 'obj[23]' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; rm -rf obj2 obj3; \
+ \
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; \
+ ${MAKE} ${MAKEFLAGS} -j4 all-dict > /dev/null; \
find ${.OBJDIR} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======= -C dict all ==========; \
+ ${MAKE} ${MAKEFLAGS} clean-dict > /dev/null; \
+ env init_make_level=${next_level} ${MAKE} ${MAKEFLAGS} -C dict all > /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 | \
@@ -74,13 +120,19 @@ test_output :
find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
+ echo ========= -Cdict install ==========; \
+ rm -rf ${.OBJDIR}${PREFIX} > /dev/null; \
+ env init_make_level=${next_level} ${MAKE} ${MAKEFLAGS} -C dict install 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; \
+ ${MAKE} ${MAKEFLAGS} -j4 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; \
+ echo ========== -C dict clean ===========; \
+ env init_make_level=${next_level} ${MAKE} ${MAKEFLAGS} -C dict clean > /dev/null; \
find ${.OBJDIR} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
@@ -101,14 +153,14 @@ test_output :
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======= uninstall-doc ==========; \
- ${MAKE} ${MAKEFLAGS} uninstall-doc DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 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; \
+ ${MAKE} ${MAKEFLAGS} -j4 all > /dev/null; \
find ${.OBJDIR} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
diff --git a/examples/hello_files/shell_func.texinfo b/examples/hello_files/shell_func.texinfo
index dd335be..fa0012e 100644
--- a/examples/hello_files/shell_func.texinfo
+++ b/examples/hello_files/shell_func.texinfo
@@ -15,8 +15,8 @@ This is fake!
@titlepage
@title shell_func info page
-@subtitle Edition @value{EDITION}, Version @value{VERSION}.
-@subtitle @value{UPDATE-MONTH}
+@subtitle Edition 1, Version 7.
+@subtitle 5
@author Aleksey Cheusov
@page
diff --git a/examples/hello_files/test.mk b/examples/hello_files/test.mk
index 72afde2..c354e53 100644
--- a/examples/hello_files/test.mk
+++ b/examples/hello_files/test.mk
@@ -1,28 +1,28 @@
.PHONY : test_output
test_output:
@set -e; \
- MKHTML=yes; export MKHTML; \
- \
+ MKCATPAGES=yes; export MKCATPAGES; \
rm -rf ${.OBJDIR}${PREFIX}; \
\
echo =========== all ============; \
+ ${MAKE} ${MAKEFLAGS} -j4 all > /dev/null; \
find ${.OBJDIR} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======== all+html ==========; \
- ${MAKE} ${MAKEFLAGS} all \
- > /dev/null; \
+ MKHTML=yes; export MKHTML; \
+ ${MAKE} ${MAKEFLAGS} -j4 all > /dev/null; \
find ${.OBJDIR} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 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; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
@@ -38,7 +38,7 @@ test_output:
\
echo ==== install MKINSTALL=no ====; \
MKINSTALL=no; export MKINSTALL; \
- ${MAKE} ${MAKEFLAGS} all installdirs install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} -j4 all installdirs install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
diff --git a/examples/hello_glib2/test.mk b/examples/hello_glib2/test.mk
index da83e2f..8604e62 100644
--- a/examples/hello_glib2/test.mk
+++ b/examples/hello_glib2/test.mk
@@ -3,19 +3,20 @@ test_output:
@set -e; \
${.OBJDIR}/hello_glib2 | sed 's,[0-9][0-9]*,N,'; \
rm -rf ${.OBJDIR}${PREFIX}; \
+ MKCATPAGES=yes; export MKCATPAGES; \
\
echo =========== all ============; \
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======== uninstall =========; \
- ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
diff --git a/examples/hello_lex/Makefile b/examples/hello_lex/Makefile
index 211e442..e21d074 100644
--- a/examples/hello_lex/Makefile
+++ b/examples/hello_lex/Makefile
@@ -1,5 +1,7 @@
-PROG = hello_lex
-SRCS = hello_lex.l
+PROG = hello_lex
+SRCS = hello_lex.l
+
+DPSRCS = hello_lex.c
.include "test.mk"
.include <mkc.prog.mk>
diff --git a/examples/hello_lex/expect.out b/examples/hello_lex/expect.out
index 4862fd7..7e6f996 100644
--- a/examples/hello_lex/expect.out
+++ b/examples/hello_lex/expect.out
@@ -33,13 +33,50 @@
/objdir/hello_lex.test.out.tmp
/objdir/input.txt
/objdir/test.mk
-==== SHRTOUT=yes ====
+========== depend ===========
+/objdir/.depend
+/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.c
+/objdir/hello_lex.d
+/objdir/hello_lex.l
+/objdir/hello_lex.test.out.tmp
+/objdir/input.txt
+/objdir/test.mk
+==== SHRTOUT=yes depend ====
checking for compiler mmm... nnn
checking for program mmm... nnn
checking for program mmm... nnn
LEX: hello_lex.l
+DEP: hello_lex.d
+DEP: .depend
+==== SHRTOUT=yes all ====
+LEX: hello_lex.l
CC: hello_lex.c
LD: hello_lex
+/objdir/.depend
+/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.d
+/objdir/hello_lex.l
+/objdir/hello_lex.o
+/objdir/hello_lex.test.out.tmp
+/objdir/input.txt
+/objdir/test.mk
======= distclean ==========
/objdir/Makefile
/objdir/expect.out
diff --git a/examples/hello_lex/test.mk b/examples/hello_lex/test.mk
index ad62ff6..53acf8e 100644
--- a/examples/hello_lex/test.mk
+++ b/examples/hello_lex/test.mk
@@ -3,19 +3,20 @@ test_output:
@set -e; \
${.OBJDIR}/hello_lex < ${.CURDIR}/input.txt; \
rm -rf ${.OBJDIR}${PREFIX}; \
+ MKCATPAGES=yes; export MKCATPAGES; \
\
echo =========== all ============; \
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======== uninstall =========; \
- ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
@@ -24,10 +25,23 @@ test_output:
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
- echo ==== SHRTOUT=yes ====; \
+ echo ========== depend ===========; \
${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} depend -j4 > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ==== SHRTOUT=yes depend ====; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
+ env SHRTOUT=yes ${MAKE} ${MAKEFLAGS} depend 2>&1 |\
+ mkc_test_helper2; \
+ \
+ echo ==== SHRTOUT=yes all ====; \
+ ${MAKE} ${MAKEFLAGS} clean > /dev/null; \
env MKCATPAGES=no MKHTML=no SHRTOUT=yes ${MAKE} ${MAKEFLAGS} all 2>&1 |\
mkc_test_helper2; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
echo ======= distclean ==========; \
${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
diff --git a/examples/hello_lua/Makefile b/examples/hello_lua/Makefile
index faba9c7..3e40bfb 100644
--- a/examples/hello_lua/Makefile
+++ b/examples/hello_lua/Makefile
@@ -3,7 +3,11 @@ PROJECTNAME = hello_lua
LUA_LMODULES = foo.lua bar.lua
LUA_CMODULE = baz
-SCRIPTS = foobar
+INSCRIPTS = foobar
+SCRIPTS = ${INSCRIPTS}
+
+INTEXTS_REPLS = LUA ${PROG.lua}
+MKC_CHECK_PROGS = lua
.include "test.mk"
.include <mkc.lib.mk>
diff --git a/examples/hello_lua/expect.out b/examples/hello_lua/expect.out
index df5630c..0e51847 100644
--- a/examples/hello_lua/expect.out
+++ b/examples/hello_lua/expect.out
@@ -19,6 +19,8 @@ foobarbaz
/objdir/_mkc_pkgconfig_lua_libs.res
/objdir/_mkc_prog_cc.err
/objdir/_mkc_prog_cc.res
+/objdir/_mkc_prog_lua.err
+/objdir/_mkc_prog_lua.res
/objdir/_mkc_prog_pkg-config.err
/objdir/_mkc_prog_pkg-config.res
/objdir/bar.lua
@@ -28,6 +30,7 @@ foobarbaz
/objdir/expect.out
/objdir/foo.lua
/objdir/foobar
+/objdir/foobar.in
/objdir/hello_lua.test.out.tmp
/objdir/test.mk
========= install ==========
@@ -63,13 +66,15 @@ foobarbaz
/objdir/_mkc_pkgconfig_lua_libs.res
/objdir/_mkc_prog_cc.err
/objdir/_mkc_prog_cc.res
+/objdir/_mkc_prog_lua.err
+/objdir/_mkc_prog_lua.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/foobar.in
/objdir/hello_lua.test.out.tmp
/objdir/test.mk
======= distclean ==========
@@ -78,7 +83,7 @@ foobarbaz
/objdir/baz.c
/objdir/expect.out
/objdir/foo.lua
-/objdir/foobar
+/objdir/foobar.in
/objdir/hello_lua.test.out.tmp
/objdir/test.mk
========= install2 ==========
@@ -97,6 +102,8 @@ foobarbaz
/objdir/_mkc_pkgconfig_lua_libs.res
/objdir/_mkc_prog_cc.err
/objdir/_mkc_prog_cc.res
+/objdir/_mkc_prog_lua.err
+/objdir/_mkc_prog_lua.res
/objdir/_mkc_prog_pkg-config.err
/objdir/_mkc_prog_pkg-config.res
/objdir/bar.lua
@@ -106,6 +113,7 @@ foobarbaz
/objdir/expect.out
/objdir/foo.lua
/objdir/foobar
+/objdir/foobar.in
/objdir/hello_lua.test.out.tmp
/objdir/home
/objdir/home/cheusov
diff --git a/examples/hello_lua/foobar b/examples/hello_lua/foobar.in
index 249feb3..dd8714a 100755
--- a/examples/hello_lua/foobar
+++ b/examples/hello_lua/foobar.in
@@ -1,4 +1,4 @@
-#!/usr/bin/env lua
+#!@LUA@
require "foo"
require "bar"
diff --git a/examples/hello_lua/test.mk b/examples/hello_lua/test.mk
index cc8b0df..8b6fc91 100644
--- a/examples/hello_lua/test.mk
+++ b/examples/hello_lua/test.mk
@@ -5,22 +5,26 @@ test_output:
@set -e; \
rm -rf ${.OBJDIR}/usr ${.OBJDIR}/opt; \
echo PROJECTNAME=${PROJECTNAME}; \
+ LUA_PATH=${.CURDIR}/?.lua; \
+ LUA_CPATH=${.OBJDIR}/?.so; \
+ export LUA_PATH LUA_CPATH; \
./foobar; \
+ MKCATPAGES=yes; export MKCATPAGES; \
\
echo =========== all ============; \
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} PREFIX=/usr/local \
> /dev/null; \
find ${.OBJDIR}/usr -type f -o -type d | \
- mkc_test_helper "${PREFIX}" "${.OBJDIR}" | uniq; \
+ mkc_test_helper /usr/local "${.OBJDIR}" | uniq; \
\
echo ======== uninstall =========; \
- ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} PREFIX=/usr/local > /dev/null; \
find ${.OBJDIR}/usr -type f | \
- mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ mkc_test_helper /usr/local "${.OBJDIR}"; \
\
echo ========== clean ===========; \
${MAKE} ${MAKEFLAGS} clean > /dev/null; \
@@ -36,7 +40,7 @@ test_output:
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} \
+ ${MAKE} ${MAKEFLAGS} all install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR} -type f -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}" | uniq; \
diff --git a/examples/hello_lua2/test.mk b/examples/hello_lua2/test.mk
index 9d1ec03..0cc6d20 100644
--- a/examples/hello_lua2/test.mk
+++ b/examples/hello_lua2/test.mk
@@ -4,22 +4,26 @@ CLEANDIRS += ${.OBJDIR}/home
test_output:
@set -e; \
rm -rf ${.OBJDIR}/usr; \
+ LUA_PATH=${.CURDIR}/?.lua; \
+ LUA_CPATH=${.OBJDIR}/?.so; \
+ export LUA_PATH LUA_CPATH; \
./foobar; \
+ MKCATPAGES=yes; export MKCATPAGES; \
\
echo =========== all ============; \
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} PREFIX=/usr/local \
> /dev/null; \
find ${.OBJDIR}/usr -type f -o -type d | \
- mkc_test_helper "${PREFIX}" "${.OBJDIR}" | uniq; \
+ mkc_test_helper /usr/local "${.OBJDIR}" | uniq; \
\
echo ======== uninstall =========; \
- ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} PREFIX=/usr/local > /dev/null; \
find ${.OBJDIR}/usr -type f | \
- mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ mkc_test_helper /usr/local "${.OBJDIR}"; \
\
echo ========== clean ===========; \
${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
@@ -34,7 +38,7 @@ test_output:
echo ========= install2 ==========; \
env PREFIX=/home/cheusov/local \
LUA_LMODDIR=/home/cheusov/local/share/lua/5.1 \
- ${MAKE} ${MAKEFLAGS} all install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} all install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR} -type f -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}" | uniq; \
diff --git a/examples/hello_lua3/test.mk b/examples/hello_lua3/test.mk
index fdf2745..dfe9e9f 100644
--- a/examples/hello_lua3/test.mk
+++ b/examples/hello_lua3/test.mk
@@ -3,19 +3,20 @@ test_output:
@set -e; \
rm -rf ${.OBJDIR}/usr ${.OBJDIR}/opt; \
echo PROJECTNAME=${PROJECTNAME}; \
+ MKCATPAGES=yes; export MKCATPAGES; \
\
echo =========== all ============; \
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 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; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}/usr -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
diff --git a/examples/hello_plugins/test.mk b/examples/hello_plugins/test.mk
index edcf9a7..9325880 100644
--- a/examples/hello_plugins/test.mk
+++ b/examples/hello_plugins/test.mk
@@ -4,24 +4,25 @@ test_output:
rm -rf ${.OBJDIR}${PREFIX}; \
app/app plugin1/plugin1${DLL_EXT} plugin1/plugin1${DLL_EXT} | \
awk '$$3 == "address:" {$$4 = "0xF00DBEAF"} {print}'; \
+ MKCATPAGES=yes; export MKCATPAGES; \
\
echo =========== all ============; \
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======== uninstall =========; \
- ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
echo ======== filelist ==========; \
- ${MAKE} ${MAKEFLAGS} filelist | sed 's/[.]bundle/.so/'; \
+ ${MAKE} ${MAKEFLAGS} PREFIX=/usr/local filelist | sed 's/[.]bundle/.so/'; \
\
echo ========== clean ===========; \
${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
diff --git a/examples/hello_plugins2/test.mk b/examples/hello_plugins2/test.mk
index 2944de6..551cb99 100644
--- a/examples/hello_plugins2/test.mk
+++ b/examples/hello_plugins2/test.mk
@@ -3,19 +3,20 @@ test_output:
@set -e; LC_ALL=C; export LC_ALL; \
rm -rf ${.OBJDIR}${PREFIX}; \
app/app plugin1/plugin1${DLL_EXT} plugin2/plugin2${DLL_EXT}; \
+ MKCATPAGES=yes; export MKCATPAGES; \
\
echo =========== all ============; \
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======== uninstall =========; \
- ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
diff --git a/examples/hello_progs/expect.out b/examples/hello_progs/expect.out
index 925acc0..8a7e171 100644
--- a/examples/hello_progs/expect.out
+++ b/examples/hello_progs/expect.out
@@ -39,23 +39,47 @@ server: I am a server
/objdir/server.c
/objdir/server_puts.c
/objdir/test.mk
+========== depend ===========
+/objdir/.depend
+/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.d
+/objdir/client_puts.c
+/objdir/client_puts.d
+/objdir/expect.out
+/objdir/hello_progs.test.out.tmp
+/objdir/server.c
+/objdir/server.d
+/objdir/server_puts.c
+/objdir/server_puts.d
+/objdir/test.mk
========== server ===========
+/objdir/.depend
/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.d
/objdir/client_puts.c
+/objdir/client_puts.d
/objdir/expect.out
/objdir/hello_progs.test.out.tmp
/objdir/server
/objdir/server.c
+/objdir/server.d
/objdir/server.o
/objdir/server_puts.c
+/objdir/server_puts.d
/objdir/server_puts.o
/objdir/test.mk
========== client ===========
+/objdir/.depend
/objdir/Makefile
/objdir/_mkc_compiler_type.err
/objdir/_mkc_compiler_type.res
@@ -63,13 +87,17 @@ server: I am a server
/objdir/_mkc_prog_cc.res
/objdir/client
/objdir/client.c
+/objdir/client.d
/objdir/client.o
/objdir/client_puts.c
+/objdir/client_puts.d
/objdir/client_puts.o
/objdir/expect.out
/objdir/hello_progs.test.out.tmp
/objdir/server.c
+/objdir/server.d
/objdir/server_puts.c
+/objdir/server_puts.d
/objdir/test.mk
======= distclean ==========
/objdir/Makefile
diff --git a/examples/hello_progs/test.mk b/examples/hello_progs/test.mk
index bd90e8b..a0741ca 100644
--- a/examples/hello_progs/test.mk
+++ b/examples/hello_progs/test.mk
@@ -5,19 +5,20 @@ test_output:
${.OBJDIR}/client; \
${.OBJDIR}/server; \
rm -rf ${.OBJDIR}${PREFIX}; \
+ MKCATPAGES=yes; export MKCATPAGES; \
\
echo =========== all ============; \
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======== uninstall =========; \
- ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
@@ -26,6 +27,11 @@ test_output:
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
+ echo ========== depend ===========; \
+ ${MAKE} ${MAKEFLAGS} depend > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
echo ========== server ===========; \
${MAKE} ${MAKEFLAGS} server > /dev/null; \
find ${.OBJDIR} -type f | \
diff --git a/examples/hello_progs2/test.mk b/examples/hello_progs2/test.mk
index bd90e8b..85cd685 100644
--- a/examples/hello_progs2/test.mk
+++ b/examples/hello_progs2/test.mk
@@ -5,19 +5,20 @@ test_output:
${.OBJDIR}/client; \
${.OBJDIR}/server; \
rm -rf ${.OBJDIR}${PREFIX}; \
+ MKCATPAGES=yes; export MKCATPAGES; \
\
echo =========== all ============; \
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======== uninstall =========; \
- ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
diff --git a/examples/hello_scripts/expect.out b/examples/hello_scripts/expect.out
index 957e6f7..72b1abb 100644
--- a/examples/hello_scripts/expect.out
+++ b/examples/hello_scripts/expect.out
@@ -10,7 +10,6 @@ Hello World 3!
/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
diff --git a/examples/hello_scripts/test.mk b/examples/hello_scripts/test.mk
index f33a6a7..5449f8a 100644
--- a/examples/hello_scripts/test.mk
+++ b/examples/hello_scripts/test.mk
@@ -5,6 +5,7 @@ test_output:
${.CURDIR}/hello_world2; \
${.CURDIR}/hello_world3; \
\
+ MKCATPAGES=yes; export MKCATPAGES; \
rm -rf ${.OBJDIR}${PREFIX}; \
\
echo =========== all ============; \
@@ -12,13 +13,13 @@ test_output:
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======== uninstall =========; \
- ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
@@ -34,7 +35,7 @@ test_output:
\
echo ==== install MKINSTALL=no ====; \
MKINSTALL=no; export MKINSTALL; \
- ${MAKE} ${MAKEFLAGS} all installdirs install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} -j4 all installdirs install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
diff --git a/examples/hello_sizeof/test.mk b/examples/hello_sizeof/test.mk
index 174eb9d..1f6b6e2 100644
--- a/examples/hello_sizeof/test.mk
+++ b/examples/hello_sizeof/test.mk
@@ -3,19 +3,20 @@ test_output:
@set -e; \
${.OBJDIR}/sizeof_test | tr '1248' 'nnnn'; \
rm -rf ${.OBJDIR}${PREFIX}; \
+ MKCATPAGES=yes; export MKCATPAGES; \
\
echo =========== all ============; \
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======== uninstall =========; \
- ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
diff --git a/examples/hello_strlcpy/Makefile b/examples/hello_strlcpy/Makefile
index 1ac88ee..f24ed5a 100644
--- a/examples/hello_strlcpy/Makefile
+++ b/examples/hello_strlcpy/Makefile
@@ -1,7 +1,7 @@
-MKC_SOURCE_FUNCLIBS = strlcpy
-MKC_CHECK_FUNCS3 += strlcpy:string.h
+MKC_SOURCE_FUNCLIBS = strlcpy getline
+MKC_CHECK_FUNCS3 += strlcpy:string.h getline:stdio.h
-PROG = hello4
+PROG = hello
SRCS = hello.c
WARNS = 4
diff --git a/examples/hello_strlcpy/expect.out b/examples/hello_strlcpy/expect.out
index 060d314..d64ce75 100644
--- a/examples/hello_strlcpy/expect.out
+++ b/examples/hello_strlcpy/expect.out
@@ -25,18 +25,25 @@
/objdir/Makefile
/objdir/_mkc_compiler_type.err
/objdir/_mkc_compiler_type.res
+/objdir/_mkc_func3_getline_stdio_h.c
+/objdir/_mkc_func3_getline_stdio_h.err
+/objdir/_mkc_func3_getline_stdio_h.res
/objdir/_mkc_func3_strlcpy_string_h.c
/objdir/_mkc_func3_strlcpy_string_h.err
/objdir/_mkc_func3_strlcpy_string_h.res
+/objdir/_mkc_funclib_getline.c
+/objdir/_mkc_funclib_getline.err
+/objdir/_mkc_funclib_getline.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/getline.c
+/objdir/hello
/objdir/hello.c
/objdir/hello.o
-/objdir/hello4
/objdir/hello_strlcpy.test.out.tmp
/objdir/input.in
/objdir/strlcpy.c
@@ -44,21 +51,28 @@
========= install ==========
/objdir/prefix
/objdir/prefix/bin
-/objdir/prefix/bin/hello4
+/objdir/prefix/bin/hello
======== uninstall =========
========== clean ===========
/objdir/Makefile
/objdir/_mkc_compiler_type.err
/objdir/_mkc_compiler_type.res
+/objdir/_mkc_func3_getline_stdio_h.c
+/objdir/_mkc_func3_getline_stdio_h.err
+/objdir/_mkc_func3_getline_stdio_h.res
/objdir/_mkc_func3_strlcpy_string_h.c
/objdir/_mkc_func3_strlcpy_string_h.err
/objdir/_mkc_func3_strlcpy_string_h.res
+/objdir/_mkc_funclib_getline.c
+/objdir/_mkc_funclib_getline.err
+/objdir/_mkc_funclib_getline.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/getline.c
/objdir/hello.c
/objdir/hello_strlcpy.test.out.tmp
/objdir/input.in
@@ -67,8 +81,13 @@
======= distclean ==========
/objdir/Makefile
/objdir/expect.out
+/objdir/getline.c
/objdir/hello.c
/objdir/hello_strlcpy.test.out.tmp
/objdir/input.in
/objdir/strlcpy.c
/objdir/test.mk
+======= CLEANFILES ==========
+strlcpy.o
+getline.o
+hello.o
diff --git a/examples/hello_strlcpy/getline.c b/examples/hello_strlcpy/getline.c
new file mode 100644
index 0000000..777f5c4
--- /dev/null
+++ b/examples/hello_strlcpy/getline.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007-2013 by Aleksey Cheusov
+ *
+ * See LICENSE file in the distribution.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "decls.h"
+
+ssize_t
+getline(char** lineptr, size_t* n, FILE* stream)
+{
+ int c;
+ size_t sz = 0;
+
+ while (c = getc (stream), c != EOF){
+ if (sz+1 >= *n){
+ /* +2 is for `c' and 0-terminator */
+ *n = *n * 3 / 2 + 2;
+ *lineptr = realloc (*lineptr, *n);
+ if (!*lineptr)
+ return -1;
+ }
+
+ (*lineptr) [sz++] = (char) c;
+ if (c == '\n')
+ break;
+ }
+
+ if (ferror (stdin))
+ return (ssize_t) -1;
+
+ if (!sz){
+ if (feof (stdin)){
+ return (ssize_t) -1;
+ }else if (!*n){
+ *lineptr = malloc (1);
+ if (!*lineptr)
+ return -1;
+
+ *n = 1;
+ }
+ }
+
+ (*lineptr) [sz] = 0;
+ return sz;
+}
diff --git a/examples/hello_strlcpy/hello.c b/examples/hello_strlcpy/hello.c
index b7dd661..177b6b5 100644
--- a/examples/hello_strlcpy/hello.c
+++ b/examples/hello_strlcpy/hello.c
@@ -5,14 +5,18 @@
size_t strlcpy(char *dst, const char *src, size_t siz);
#endif
+#ifndef HAVE_FUNC3_GETLINE_STDIO_H
+ssize_t getline(char** lineptr, size_t* n, FILE* stream);
+#endif
+
int main (int argc, char ** argv)
{
- char buf [2000];
+ char *buf = NULL;
+ size_t size = 0;
+ ssize_t len = 0;
char small_buf [10];
- size_t len;
-
- while (fgets (buf, sizeof (buf), stdin)){
+ while (len = getline (&buf, &size, stdin), len != -1){
len = strlen (buf);
if (len > 0 && buf [len-1] == '\n')
buf [len-1] = 0;
diff --git a/examples/hello_strlcpy/test.mk b/examples/hello_strlcpy/test.mk
index ffa417d..e0155bb 100644
--- a/examples/hello_strlcpy/test.mk
+++ b/examples/hello_strlcpy/test.mk
@@ -1,33 +1,38 @@
.PHONY : test_output
test_output:
@set -e; \
- ${.OBJDIR}/hello4 < ${.CURDIR}/input.in; \
+ ${.OBJDIR}/hello < ${.CURDIR}/input.in; \
rm -rf ${.OBJDIR}${PREFIX}; \
+ MKCATPAGES=yes; export MKCATPAGES; \
\
echo =========== all ============; \
- find ${.OBJDIR} -type f | grep -v 'strlcpy[.]o' | \
+ find ${.OBJDIR} -type f | grep -Ev '(strlcpy|getline)[.]o' | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type d | \
- grep -v 'strlcpy[.]o' | \
+ grep -vE '(strlcpy|getline)[.]o' | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======== uninstall =========; \
- ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
- find ${.OBJDIR}${PREFIX} -type f | grep -v 'strlcpy[.]o' | \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f | grep -vE '(strlcpy|getline)[.]o' | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========== clean ===========; \
- ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
- find ${.OBJDIR} -type f | grep -v 'strlcpy[.]o' | \
+ ${MAKE} ${MAKEFLAGS} clean > /dev/null; \
+ find ${.OBJDIR} -type f | grep -vE '(strlcpy|getline)[.]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}"
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
+ find ${.OBJDIR} -type f | grep -vE '(strlcpy|getline)[.]o' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======= CLEANFILES ==========; \
+ ${MAKE} ${MAKEFLAGS} print-values VARS='CLEANFILES' MKCHECKS=no | \
+ awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o$$/) print $$i}'
.include <mkc.minitest.mk>
diff --git a/examples/hello_superfs/Makefile b/examples/hello_superfs/Makefile
index c58ab37..81442e4 100644
--- a/examples/hello_superfs/Makefile
+++ b/examples/hello_superfs/Makefile
@@ -1,6 +1,4 @@
-SUBPRJ = mkfs_superfs fsck_superfs \
- docs \
- mkfs_superfs:tools fsck_superfs:tools
+SUBPRJ = docs mkfs_superfs:tools fsck_superfs:tools
SUBPRJ_DFLT = mkfs_superfs fsck_superfs docs
diff --git a/examples/hello_superfs/expect.out b/examples/hello_superfs/expect.out
index 542cf1c..45af717 100644
--- a/examples/hello_superfs/expect.out
+++ b/examples/hello_superfs/expect.out
@@ -14,14 +14,12 @@
/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 ==========
@@ -63,6 +61,30 @@
/objdir/mkfs_superfs/mkfs_superfs.8
/objdir/mkfs_superfs/mkfs_superfs.c
/objdir/test.mk
+========== depend ===========
+/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/.depend
+/objdir/fsck_superfs/Makefile
+/objdir/fsck_superfs/fsck_superfs.8
+/objdir/fsck_superfs/fsck_superfs.c
+/objdir/fsck_superfs/fsck_superfs.d
+/objdir/hello_superfs.test.out.tmp
+/objdir/mkfs_superfs/.depend
+/objdir/mkfs_superfs/Makefile
+/objdir/mkfs_superfs/mkfs_superfs.8
+/objdir/mkfs_superfs/mkfs_superfs.c
+/objdir/mkfs_superfs/mkfs_superfs.d
+/objdir/test.mk
======= distclean ==========
/objdir/Makefile
/objdir/Makefile.inc
diff --git a/examples/hello_superfs/test.mk b/examples/hello_superfs/test.mk
index 6ce8018..90f220d 100644
--- a/examples/hello_superfs/test.mk
+++ b/examples/hello_superfs/test.mk
@@ -1,21 +1,21 @@
.PHONY : test_output
test_output:
@set -e; \
- \
rm -rf ${.OBJDIR}${PREFIX}; \
+ MKCATPAGES=yes; export MKCATPAGES; \
\
echo =========== all ============; \
find ${.OBJDIR} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 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; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
@@ -24,6 +24,11 @@ test_output:
find ${.OBJDIR} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
+ echo ========== depend ===========; \
+ ${MAKE} ${MAKEFLAGS} depend 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 | \
@@ -37,7 +42,7 @@ test_output:
\
echo ==== install MKINSTALL=no ====; \
MKINSTALL=no; export MKINSTALL; \
- ${MAKE} ${MAKEFLAGS} all installdirs install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} all installdirs install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
diff --git a/examples/hello_world/test.mk b/examples/hello_world/test.mk
index adc16fd..6676191 100644
--- a/examples/hello_world/test.mk
+++ b/examples/hello_world/test.mk
@@ -5,6 +5,7 @@ tartf_cleanup= sed -e 's,^[.]/,,' -e 's,/$$,,' -e '/^[.]*$$/ d'
.PHONY : test_output
test_output:
@set -e; LC_ALL=C; export LC_ALL; \
+ MKCATPAGES=yes; export MKCATPAGES; \
echo PROJECTNAME=${PROJECTNAME}; \
${.OBJDIR}/hello_world; \
rm -rf ${.OBJDIR}${PREFIX}; \
@@ -14,13 +15,13 @@ test_output:
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======== uninstall =========; \
- ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
@@ -30,21 +31,24 @@ test_output:
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
echo ======== bin_tar ===========; \
- ${MAKE} ${MAKEFLAGS} bin_tar > /dev/null; \
- ${TAR} -tf ${.CURDIR:T}.tar | sort | ${tartf_cleanup}; \
+ ${MAKE} ${MAKEFLAGS} PREFIX=/usr/local bin_tar > /dev/null; \
+ ${TAR} -tf ${.CURDIR:T}.tar | \
+ sort | ${tartf_cleanup}; \
\
echo ======== bin_targz ===========; \
- ${MAKE} ${MAKEFLAGS} bin_targz > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} PREFIX=/usr/local bin_targz > /dev/null; \
${GZIP} -dc ${.CURDIR:T}.tar.gz | \
- ${TAR} -tf - | sort | ${tartf_cleanup}; \
+ ${TAR} -tf - | \
+ sort | ${tartf_cleanup}; \
\
echo ======== bin_tarbz2 ===========; \
- ${MAKE} ${MAKEFLAGS} bin_tarbz2 > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} PREFIX=/usr/local bin_tarbz2 > /dev/null; \
${BZIP2} -dc ${.CURDIR:T}.tar.bz2 | \
- ${TAR} -tf - | sort | ${tartf_cleanup}; \
+ ${TAR} -tf - | \
+ sort | ${tartf_cleanup}; \
\
echo ======= filelist ===========; \
- ${MAKE} ${MAKEFLAGS} filelist; \
+ ${MAKE} ${MAKEFLAGS} PREFIX=/usr/local filelist; \
\
echo ======= distclean ==========; \
${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
diff --git a/examples/hello_xxzip/expect.out b/examples/hello_xxzip/expect.out
index 61cec79..cb5f8cb 100644
--- a/examples/hello_xxzip/expect.out
+++ b/examples/hello_xxzip/expect.out
@@ -16,9 +16,14 @@
/objdir/xxzip
/objdir/xxzip.1
/objdir/xxzip.c
-/objdir/xxzip.cat1
/objdir/xxzip.o
/objdir/xxzip.pod
+===== all SHRTOUT=yes ======
+CC: xxzip.c
+LD: xxzip
+POD2MAN: xxzip.1
+NROFF: xxzip.cat1
+POD2HTML: tutorial.html
========= install ==========
/objdir/prefix
/objdir/prefix/bin
diff --git a/examples/hello_xxzip/test.mk b/examples/hello_xxzip/test.mk
index 1077edd..6b3fda0 100644
--- a/examples/hello_xxzip/test.mk
+++ b/examples/hello_xxzip/test.mk
@@ -1,20 +1,27 @@
.PHONY : test_output
test_output:
@set -e; \
+ MKCATPAGES=yes; export MKCATPAGES; \
+ \
rm -rf ${.OBJDIR}${PREFIX}; \
\
echo =========== all ============; \
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
+ echo ===== all SHRTOUT=yes ======; \
+ ${MAKE} ${MAKEFLAGS} clean > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} all SHRTOUT=yes 2>&1 | \
+ mkc_test_helper2; \
+ \
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======== uninstall =========; \
- ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
@@ -24,7 +31,7 @@ test_output:
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
echo ======== filelist ==========; \
- ${MAKE} ${MAKEFLAGS} filelist; \
+ ${MAKE} ${MAKEFLAGS} filelist PREFIX=/usr/local; \
\
echo ======= distclean ==========; \
${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
diff --git a/examples/hello_yacc/Makefile b/examples/hello_yacc/Makefile
index b9713c3..cfb88da 100644
--- a/examples/hello_yacc/Makefile
+++ b/examples/hello_yacc/Makefile
@@ -1,6 +1,7 @@
-PROG = hello_calc
+PROG = hello_calc
+SRCS = calc.y
-SRCS = calc.y
+DPSRCS = calc.c
.include "test.mk"
.include <mkc.prog.mk>
diff --git a/examples/hello_yacc/expect.out b/examples/hello_yacc/expect.out
index 6f46ee5..b80f1ca 100644
--- a/examples/hello_yacc/expect.out
+++ b/examples/hello_yacc/expect.out
@@ -36,6 +36,22 @@
/objdir/hello_yacc.test.out.tmp
/objdir/input.txt
/objdir/test.mk
+========== depend ===========
+/objdir/.depend
+/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.d
+/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
diff --git a/examples/hello_yacc/test.mk b/examples/hello_yacc/test.mk
index 7617a5f..71840f8 100644
--- a/examples/hello_yacc/test.mk
+++ b/examples/hello_yacc/test.mk
@@ -1,6 +1,8 @@
.PHONY : test_output
test_output:
@set -e; \
+ MKCATPAGES=yes; export MKCATPAGES; \
+ \
${.OBJDIR}/hello_calc < ${.CURDIR}/input.txt; \
rm -rf ${.OBJDIR}${PREFIX}; \
\
@@ -9,18 +11,23 @@ test_output:
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} \
> /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type d | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ======== uninstall =========; \
- ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
echo ========== clean ===========; \
- ${MAKE} ${MAKEFLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} clean > /dev/null; \
+ find ${.OBJDIR} -type f | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== depend ===========; \
+ ${MAKE} ${MAKEFLAGS} depend > /dev/null; \
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
@@ -30,7 +37,7 @@ test_output:
all 2>/dev/null | mkc_test_helper2; \
\
echo ======= distclean ==========; \
- ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
find ${.OBJDIR} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"
diff --git a/examples/subprojects/expect.out b/examples/subprojects/expect.out
index 9331b5c..d26c974 100644
--- a/examples/subprojects/expect.out
+++ b/examples/subprojects/expect.out
@@ -19,7 +19,6 @@ My email is vle@gmx.net
/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
@@ -37,7 +36,6 @@ My email is vle@gmx.net
/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
@@ -165,20 +163,17 @@ GEN: hello_subprojects2
/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
@@ -189,31 +184,26 @@ GEN: hello_subprojects2
/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
@@ -224,13 +214,11 @@ GEN: hello_subprojects2
/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
@@ -238,27 +226,22 @@ GEN: hello_subprojects2
/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
diff --git a/examples/subprojects/hello/hello_subprojects.1.in b/examples/subprojects/hello/hello_subprojects.1.in
index 1a4710f..a4fea6d 100644
--- a/examples/subprojects/hello/hello_subprojects.1.in
+++ b/examples/subprojects/hello/hello_subprojects.1.in
@@ -9,7 +9,6 @@ hello\_world \- hello application
.SH DESCRIPTION
.B hello\_world
outputs hello world message to stdout
-
.SH "CONFIGURATION FILE"
.TP
The configuration file should be here
diff --git a/examples/subprojects/test.mk b/examples/subprojects/test.mk
index 1869272..d3b88cc 100644
--- a/examples/subprojects/test.mk
+++ b/examples/subprojects/test.mk
@@ -1,6 +1,8 @@
.PHONY : test_output
test_output :
@set -e; \
+ MKCATPAGES=yes; export MKCATPAGES; \
+ \
echo PROJECTNAME=${PROJECTNAME}; \
rm -rf ${.OBJDIR}${PREFIX}; \
LD_LIBRARY_PATH=${.CURDIR}/libhello1:${.CURDIR}/libhello2:$$LD_LIBRARY_PATH; \
@@ -27,13 +29,13 @@ test_output :
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 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; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
@@ -55,24 +57,24 @@ test_output :
\
echo ========= libhello1 ==========; \
${MAKE} ${MAKEFLAGS} libhello1 DESTDIR=${.OBJDIR} > /dev/null; \
- find ${.OBJDIR} -type f -o -type l -o -type d | \
+ find ${.OBJDIR} -type f -o -type l | \
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 | \
+ ${MAKE} ${MAKEFLAGS} -j4 all-libhello2 DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
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 | \
+ find ${.OBJDIR} -type f -o -type l | \
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; \
+ ${MAKE} ${MAKEFLAGS} all installdirs install -j3 >&2; \
LD_LIBRARY_PATH=${.CURDIR}/usr/lib; \
DYLD_LIBRARY_PATH=${.CURDIR}/usr/lib; \
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH; \
diff --git a/examples/tools/Makefile b/examples/tools/Makefile
index 64f67a1..5077390 100644
--- a/examples/tools/Makefile
+++ b/examples/tools/Makefile
@@ -1,6 +1,16 @@
SUBPRJ = libs/foo:tools/prog1
SUBPRJ += libs/bar:tools/prog2
SUBPRJ += libs/foo:tools/prog3 libs/bar:tools/prog3
+SUBPRJ += libs/qux:tools/prog4
+
+# target "check" is used for testing because "test" is used by mk-configure
+TARGETS = check
+
+NODEPS += check-libs/*:check check-libs/*:check-tools/*
+
+# for regression test only
+_THISDIR_ =
+.export _THISDIR_
.include "test.mk"
.include <mkc.subprj.mk>
diff --git a/examples/tools/expect.out b/examples/tools/expect.out
index 84bf5b2..deaa7e3 100644
--- a/examples/tools/expect.out
+++ b/examples/tools/expect.out
@@ -3,19 +3,36 @@ This is a message #1
Message #2
This is a message #3
Message #3
+int_size=n
OBJDIR_tools_prog1=/path/to/prog1
OBJDIR_tools_prog2=/path/to/prog2
OBJDIR_tools_prog3=/path/to/prog3
+OBJDIR_tools_prog4=/path/to/prog4
OBJDIR_libs_foo=/path/to/foo
OBJDIR_libs_bar=/path/to/bar
OBJDIR_prog3=/path/to/prog3
OBJDIR_bar=/path/to/bar
+=========== check ============
+==================================================
+check ===> tools/prog1
+==================================================
+check ===> tools/prog2
+==================================================
+check ===> tools/prog3
+==================================================
+check ===> tools/prog4
+=========== check-tools/prog1 ============
+==================================================
+check ===> tools/prog1
=========== 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/expect.out
/objdir/libs/bar/Makefile
/objdir/libs/bar/bar.c
@@ -29,6 +46,13 @@ OBJDIR_bar=/path/to/bar
/objdir/libs/foo/foo.o
/objdir/libs/foo/libfoo.a
/objdir/libs/foo/linkme.mk
+/objdir/libs/qux/Makefile
+/objdir/libs/qux/libqux.a
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h
+/objdir/libs/qux/qux.h.in
+/objdir/libs/qux/qux.o
/objdir/test.mk
/objdir/tools.test.out.tmp
/objdir/tools/prog1/Makefile
@@ -43,27 +67,40 @@ OBJDIR_bar=/path/to/bar
/objdir/tools/prog3/prog3
/objdir/tools/prog3/prog3.c
/objdir/tools/prog3/prog3.o
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4
+/objdir/tools/prog4/prog4.c
+/objdir/tools/prog4/prog4.o
===== all SHRTOUT=yes ======
==================================================
-all ===> tools/libs/bar
+all ===> libs/bar
CC: bar.c
AR: libbar.a
==================================================
-all ===> tools/libs/foo
+all ===> libs/foo
CC: foo.c
AR: libfoo.a
==================================================
-all ===> tools/tools/prog1
+all ===> libs/qux
+GEN: qux.h
+CC: qux.c
+AR: libqux.a
+==================================================
+all ===> tools/prog1
CC: prog1.c
LD: prog1
==================================================
-all ===> tools/tools/prog2
+all ===> tools/prog2
CC: prog2.c
LD: prog2
==================================================
-all ===> tools/tools/prog3
+all ===> tools/prog3
CC: prog3.c
LD: prog3
+==================================================
+all ===> tools/prog4
+CC: prog4.c
+LD: prog4
========= installdirs ==========
/objdir/prefix
/objdir/prefix/bin
@@ -75,12 +112,15 @@ LD: prog3
/objdir/prefix/bin/prog1
/objdir/prefix/bin/prog2
/objdir/prefix/bin/prog3
+/objdir/prefix/bin/prog4
/objdir/prefix/include
/objdir/prefix/include/bar.h
/objdir/prefix/include/foo.h
+/objdir/prefix/include/qux.h
/objdir/prefix/lib
/objdir/prefix/lib/libbar.a
/objdir/prefix/lib/libfoo.a
+/objdir/prefix/lib/libqux.a
======== uninstall =========
========== clean ===========
/objdir/Makefile
@@ -88,6 +128,9 @@ LD: prog3
/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/expect.out
/objdir/libs/bar/Makefile
/objdir/libs/bar/bar.c
@@ -97,6 +140,10 @@ LD: prog3
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
/objdir/libs/foo/linkme.mk
+/objdir/libs/qux/Makefile
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h.in
/objdir/test.mk
/objdir/tools.test.out.tmp
/objdir/tools/prog1/Makefile
@@ -105,6 +152,8 @@ LD: prog3
/objdir/tools/prog2/prog2.c
/objdir/tools/prog3/Makefile
/objdir/tools/prog3/prog3.c
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4.c
======= cleandir ==========
/objdir/Makefile
/objdir/expect.out
@@ -116,6 +165,10 @@ LD: prog3
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
/objdir/libs/foo/linkme.mk
+/objdir/libs/qux/Makefile
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h.in
/objdir/test.mk
/objdir/tools.test.out.tmp
/objdir/tools/prog1/Makefile
@@ -124,6 +177,8 @@ LD: prog3
/objdir/tools/prog2/prog2.c
/objdir/tools/prog3/Makefile
/objdir/tools/prog3/prog3.c
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4.c
========= all-tools/prog1 ==========
/objdir/Makefile
/objdir/_mkc_compiler_type.err
@@ -141,6 +196,43 @@ LD: prog3
/objdir/libs/foo/foo.o
/objdir/libs/foo/libfoo.a
/objdir/libs/foo/linkme.mk
+/objdir/libs/qux/Makefile
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h.in
+/objdir/test.mk
+/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
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4.c
+========= -C tools/prog1 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/linkme.mk
+/objdir/libs/foo/Makefile
+/objdir/libs/foo/foo.c
+/objdir/libs/foo/foo.h
+/objdir/libs/foo/foo.o
+/objdir/libs/foo/libfoo.a
+/objdir/libs/foo/linkme.mk
+/objdir/libs/qux/Makefile
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h.in
/objdir/test.mk
/objdir/tools.test.out.tmp
/objdir/tools/prog1/Makefile
@@ -151,6 +243,41 @@ LD: prog3
/objdir/tools/prog2/prog2.c
/objdir/tools/prog3/Makefile
/objdir/tools/prog3/prog3.c
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4.c
+========= all-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/libs/qux/Makefile
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h.in
+/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
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4.c
========= all-tools/prog2 ==========
/objdir/Makefile
/objdir/_mkc_compiler_type.err
@@ -168,6 +295,10 @@ LD: prog3
/objdir/libs/foo/foo.c
/objdir/libs/foo/foo.h
/objdir/libs/foo/linkme.mk
+/objdir/libs/qux/Makefile
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h.in
/objdir/test.mk
/objdir/tools.test.out.tmp
/objdir/tools/prog1/Makefile
@@ -178,6 +309,41 @@ LD: prog3
/objdir/tools/prog2/prog2.o
/objdir/tools/prog3/Makefile
/objdir/tools/prog3/prog3.c
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4.c
+========= -C tools/prog2 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/linkme.mk
+/objdir/libs/qux/Makefile
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h.in
+/objdir/test.mk
+/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
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4.c
========= all-tools/prog3 ==========
/objdir/Makefile
/objdir/_mkc_compiler_type.err
@@ -197,6 +363,10 @@ LD: prog3
/objdir/libs/foo/foo.o
/objdir/libs/foo/libfoo.a
/objdir/libs/foo/linkme.mk
+/objdir/libs/qux/Makefile
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h.in
/objdir/test.mk
/objdir/tools.test.out.tmp
/objdir/tools/prog1/Makefile
@@ -207,3 +377,42 @@ LD: prog3
/objdir/tools/prog3/prog3
/objdir/tools/prog3/prog3.c
/objdir/tools/prog3/prog3.o
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4.c
+========= -C tools/prog4 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/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/libs/qux/Makefile
+/objdir/libs/qux/libqux.a
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h
+/objdir/libs/qux/qux.h.in
+/objdir/libs/qux/qux.o
+/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
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4
+/objdir/tools/prog4/prog4.c
+/objdir/tools/prog4/prog4.o
diff --git a/examples/tools/libs/qux/Makefile b/examples/tools/libs/qux/Makefile
new file mode 100644
index 0000000..345f614
--- /dev/null
+++ b/examples/tools/libs/qux/Makefile
@@ -0,0 +1,16 @@
+LIB = qux
+SRCS = qux.c
+INCS = qux.h
+
+MKC_CHECK_SIZEOF = int
+
+.include <mkc.configure.mk>
+
+INFILES = ${INCS}
+INTEXTS_REPLS = int_size ${SIZEOF.int:U4}
+
+qux.o: qux.h
+
+WARNS = 4
+
+.include <mkc.lib.mk>
diff --git a/examples/tools/libs/qux/linkme.mk b/examples/tools/libs/qux/linkme.mk
new file mode 100644
index 0000000..e81f93b
--- /dev/null
+++ b/examples/tools/libs/qux/linkme.mk
@@ -0,0 +1,5 @@
+PATH.qux := ${.PARSEDIR}
+
+CPPFLAGS += -I${PATH.qux}
+DPLIBDIRS += ${PATH.qux}
+LDADD += -lqux
diff --git a/examples/tools/libs/qux/qux.c b/examples/tools/libs/qux/qux.c
new file mode 100644
index 0000000..78786db
--- /dev/null
+++ b/examples/tools/libs/qux/qux.c
@@ -0,0 +1,6 @@
+#include "qux.h"
+
+int get_int_size (void)
+{
+ return INT_SIZE;
+}
diff --git a/examples/tools/libs/qux/qux.h.in b/examples/tools/libs/qux/qux.h.in
new file mode 100644
index 0000000..0a41ce1
--- /dev/null
+++ b/examples/tools/libs/qux/qux.h.in
@@ -0,0 +1,4 @@
+
+#define INT_SIZE @int_size@
+
+int get_int_size (void);
diff --git a/examples/tools/test.mk b/examples/tools/test.mk
index ec9cff5..b65b319 100644
--- a/examples/tools/test.mk
+++ b/examples/tools/test.mk
@@ -1,27 +1,39 @@
+next_level != expr ${.MAKE.LEVEL} + 1
+
.PHONY : test_output
test_output :
@set -e; \
+ MKCATPAGES=yes; export MKCATPAGES; \
+ SRCTOP=`pwd`; export SRCTOP; \
+ \
echo PROJECTNAME=${PROJECTNAME}; \
rm -rf ${.OBJDIR}${PREFIX}; \
${.CURDIR}/tools/prog1/prog1; \
${.CURDIR}/tools/prog2/prog2; \
${.CURDIR}/tools/prog3/prog3; \
+ ${.CURDIR}/tools/prog4/prog4 | sed 's/=[0-9]/=n/'; \
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_tools_prog4=${OBJDIR_tools_prog4} | 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 =========== check ============; \
+ ${MAKE} ${MAKEFLAGS} check 2>&1; \
+ \
+ echo =========== check-tools/prog1 ============; \
+ ${MAKE} ${MAKEFLAGS} check-tools/prog1 2>&1; \
+ \
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; \
+ env SHRTOUT=YES ${MAKE} ${MAKEFLAGS} all 2>&1; \
\
echo ========= installdirs ==========; \
${MAKE} ${MAKEFLAGS} installdirs DESTDIR=${.OBJDIR} \
@@ -30,13 +42,13 @@ test_output :
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= install ==========; \
- ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} \
+ ${MAKE} ${MAKEFLAGS} install -j3 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; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR}${PREFIX} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
\
@@ -51,19 +63,49 @@ test_output :
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========= all-tools/prog1 ==========; \
- ${MAKE} ${MAKEFLAGS} all-tools/prog1 DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 all-tools/prog1 DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= -C tools/prog1 all ==========; \
+ ${MAKE} ${MAKEFLAGS} -j4 clean-tools/prog1 DESTDIR=${.OBJDIR} > /dev/null; \
+ env init_make_level=${next_level} ${MAKE} ${MAKEFLAGS} -j4 \
+ -C `pwd`/tools/prog1 all DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= all-prog1 ==========; \
+ ${MAKE} ${MAKEFLAGS} cleandir DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} -j4 all-prog1 DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} nodeps-all-prog1 DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} subdir-all-prog1 DESTDIR=${.OBJDIR} > /dev/null; \
+ ${MAKE} ${MAKEFLAGS} 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; \
+ ${MAKE} ${MAKEFLAGS} -j4 all-tools/prog2 DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= -C tools/prog2 all ==========; \
+ ${MAKE} ${MAKEFLAGS} cleandir DESTDIR=${.OBJDIR} > /dev/null; \
+ env init_make_level=${next_level} ${MAKE} ${MAKEFLAGS} -j4 \
+ -C tools/prog2 all 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; \
+ ${MAKE} ${MAKEFLAGS} -j4 all-tools/prog3 DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= -C tools/prog4 all ==========; \
+ ${MAKE} ${MAKEFLAGS} cleandir DESTDIR=${.OBJDIR} > /dev/null; \
+ env init_make_level=${next_level} ${MAKE} ${MAKEFLAGS} \
+ -j4 all-tools/prog4 DESTDIR=${.OBJDIR} > /dev/null; \
find ${.OBJDIR} -type f -o -type l | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
diff --git a/examples/tools/tools/prog1/Makefile b/examples/tools/tools/prog1/Makefile
index ce374a2..bca4588 100644
--- a/examples/tools/tools/prog1/Makefile
+++ b/examples/tools/tools/prog1/Makefile
@@ -5,5 +5,8 @@ WARNS = 4
MKC_REQD = 0.10.0
+check:
+ @: do something useful
+
.include "../../libs/foo/linkme.mk"
.include <mkc.prog.mk>
diff --git a/examples/tools/tools/prog2/Makefile b/examples/tools/tools/prog2/Makefile
index 365c990..63ab936 100644
--- a/examples/tools/tools/prog2/Makefile
+++ b/examples/tools/tools/prog2/Makefile
@@ -5,5 +5,8 @@ WARNS = 4
MKC_REQD = 0.10.0
+check:
+ @: do something useful
+
.include "../../libs/bar/linkme.mk"
.include <mkc.prog.mk>
diff --git a/examples/tools/tools/prog3/Makefile b/examples/tools/tools/prog3/Makefile
index 4927386..b361032 100644
--- a/examples/tools/tools/prog3/Makefile
+++ b/examples/tools/tools/prog3/Makefile
@@ -5,6 +5,9 @@ WARNS = 4
MKC_REQD = 0.10.0
+check:
+ @: do something useful
+
.include "../../libs/foo/linkme.mk"
.include "../../libs/bar/linkme.mk"
diff --git a/examples/tools/tools/prog4/Makefile b/examples/tools/tools/prog4/Makefile
new file mode 100644
index 0000000..307f490
--- /dev/null
+++ b/examples/tools/tools/prog4/Makefile
@@ -0,0 +1,11 @@
+PROG = prog4
+
+WARNS = 4
+
+MKC_REQD = 0.10.0
+
+check:
+ @: do something useful
+
+.include "../../libs/qux/linkme.mk"
+.include <mkc.prog.mk>
diff --git a/examples/tools/tools/prog4/prog4.c b/examples/tools/tools/prog4/prog4.c
new file mode 100644
index 0000000..3b4d087
--- /dev/null
+++ b/examples/tools/tools/prog4/prog4.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+#include "qux.h"
+
+int main (int argc, char** argv)
+{
+ printf ("int_size=%d\n", get_int_size ());
+ return 0;
+}
diff --git a/examples/tools2/Makefile b/examples/tools2/Makefile
new file mode 100644
index 0000000..c370807
--- /dev/null
+++ b/examples/tools2/Makefile
@@ -0,0 +1,25 @@
+SUBPRJ = libs/foo:tools/prog1
+SUBPRJ += libs/bar:tools/prog2
+SUBPRJ += libs/foo:tools/prog3 libs/bar:tools/prog3
+SUBPRJ += libs/qux:tools/prog4
+
+SUBPRJ += tools/prog1:tests/prog1
+SUBPRJ += tools/prog2:tests/prog2
+SUBPRJ += tools/prog3:tests/prog3
+SUBPRJ += tools/prog4:tests/prog4
+
+NODEPS += check-*/*:check-*/* \
+ all-tests/*:all \
+ check-libs/*:check check-tools/*:check
+
+# target "check" is used for testing because "test" is used by mk-configure
+TARGETS = check
+
+SHORTPRJNAME = no
+
+# for regression test only
+_THISDIR_ =
+.export _THISDIR_
+
+.include "test.mk"
+.include <mkc.subprj.mk>
diff --git a/examples/tools2/expect.out b/examples/tools2/expect.out
new file mode 100644
index 0000000..9d2783a
--- /dev/null
+++ b/examples/tools2/expect.out
@@ -0,0 +1,448 @@
+PROJECTNAME=tools2
+This is a message #1
+Message #2
+This is a message #3
+Message #3
+int_size=n
+OBJDIR_tools_prog1=/path/to/prog1
+OBJDIR_tools_prog2=/path/to/prog2
+OBJDIR_tools_prog3=/path/to/prog3
+OBJDIR_tools_prog4=/path/to/prog4
+OBJDIR_libs_foo=/path/to/foo
+OBJDIR_libs_bar=/path/to/bar
+OBJDIR_prog3=
+OBJDIR_bar=
+=========== check ============
+==================================================
+check ===> tests/prog1
+ok
+==================================================
+check ===> tests/prog2
+ok
+==================================================
+check ===> tests/prog3
+ok
+==================================================
+check ===> tests/prog4
+ok
+=========== check-tools/prog1 ============
+==================================================
+check ===> tools/prog1
+=========== 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/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/libs/qux/Makefile
+/objdir/libs/qux/libqux.a
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h
+/objdir/libs/qux/qux.h.in
+/objdir/libs/qux/qux.o
+/objdir/test.mk
+/objdir/tests/prog1/Makefile
+/objdir/tests/prog2/Makefile
+/objdir/tests/prog3/Makefile
+/objdir/tests/prog4/Makefile
+/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
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4
+/objdir/tools/prog4/prog4.c
+/objdir/tools/prog4/prog4.o
+/objdir/tools2.test.out.tmp
+===== all SHRTOUT=yes ======
+==================================================
+all ===> libs/bar
+CC: bar.c
+AR: libbar.a
+==================================================
+all ===> libs/foo
+CC: foo.c
+AR: libfoo.a
+==================================================
+all ===> libs/qux
+GEN: qux.h
+CC: qux.c
+AR: libqux.a
+==================================================
+all ===> tools/prog1
+CC: prog1.c
+LD: prog1
+==================================================
+all ===> tools/prog2
+CC: prog2.c
+LD: prog2
+==================================================
+all ===> tools/prog3
+CC: prog3.c
+LD: prog3
+==================================================
+all ===> tools/prog4
+CC: prog4.c
+LD: prog4
+========= 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/bin/prog4
+/objdir/prefix/include
+/objdir/prefix/include/bar.h
+/objdir/prefix/include/foo.h
+/objdir/prefix/include/qux.h
+/objdir/prefix/lib
+/objdir/prefix/lib/libbar.a
+/objdir/prefix/lib/libfoo.a
+/objdir/prefix/lib/libqux.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/_mkc_sizeof_int.c
+/objdir/_mkc_sizeof_int.err
+/objdir/_mkc_sizeof_int.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/libs/qux/Makefile
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h.in
+/objdir/test.mk
+/objdir/tests/prog1/Makefile
+/objdir/tests/prog2/Makefile
+/objdir/tests/prog3/Makefile
+/objdir/tests/prog4/Makefile
+/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
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4.c
+/objdir/tools2.test.out.tmp
+======= 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/libs/qux/Makefile
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h.in
+/objdir/test.mk
+/objdir/tests/prog1/Makefile
+/objdir/tests/prog2/Makefile
+/objdir/tests/prog3/Makefile
+/objdir/tests/prog4/Makefile
+/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
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4.c
+/objdir/tools2.test.out.tmp
+========= 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/libs/qux/Makefile
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h.in
+/objdir/test.mk
+/objdir/tests/prog1/Makefile
+/objdir/tests/prog2/Makefile
+/objdir/tests/prog3/Makefile
+/objdir/tests/prog4/Makefile
+/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
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4.c
+/objdir/tools2.test.out.tmp
+========= -C tools/prog1 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/linkme.mk
+/objdir/libs/foo/Makefile
+/objdir/libs/foo/foo.c
+/objdir/libs/foo/foo.h
+/objdir/libs/foo/foo.o
+/objdir/libs/foo/libfoo.a
+/objdir/libs/foo/linkme.mk
+/objdir/libs/qux/Makefile
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h.in
+/objdir/test.mk
+/objdir/tests/prog1/Makefile
+/objdir/tests/prog2/Makefile
+/objdir/tests/prog3/Makefile
+/objdir/tests/prog4/Makefile
+/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
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4.c
+/objdir/tools2.test.out.tmp
+========= 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/libs/qux/Makefile
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h.in
+/objdir/test.mk
+/objdir/tests/prog1/Makefile
+/objdir/tests/prog2/Makefile
+/objdir/tests/prog3/Makefile
+/objdir/tests/prog4/Makefile
+/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
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4.c
+/objdir/tools2.test.out.tmp
+========= -C tools/prog2 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/linkme.mk
+/objdir/libs/qux/Makefile
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h.in
+/objdir/test.mk
+/objdir/tests/prog1/Makefile
+/objdir/tests/prog2/Makefile
+/objdir/tests/prog3/Makefile
+/objdir/tests/prog4/Makefile
+/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
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4.c
+/objdir/tools2.test.out.tmp
+========= 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/libs/qux/Makefile
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h.in
+/objdir/test.mk
+/objdir/tests/prog1/Makefile
+/objdir/tests/prog2/Makefile
+/objdir/tests/prog3/Makefile
+/objdir/tests/prog4/Makefile
+/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
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4.c
+/objdir/tools2.test.out.tmp
+========= -C tools/prog4 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/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/libs/qux/Makefile
+/objdir/libs/qux/libqux.a
+/objdir/libs/qux/linkme.mk
+/objdir/libs/qux/qux.c
+/objdir/libs/qux/qux.h
+/objdir/libs/qux/qux.h.in
+/objdir/libs/qux/qux.o
+/objdir/test.mk
+/objdir/tests/prog1/Makefile
+/objdir/tests/prog2/Makefile
+/objdir/tests/prog3/Makefile
+/objdir/tests/prog4/Makefile
+/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
+/objdir/tools/prog4/Makefile
+/objdir/tools/prog4/prog4
+/objdir/tools/prog4/prog4.c
+/objdir/tools/prog4/prog4.o
+/objdir/tools2.test.out.tmp
+========= MKRELOBJDIR ==========
+obj/_mkc_compiler_type.err
+obj/_mkc_compiler_type.res
+obj/_mkc_prog_cc.err
+obj/_mkc_prog_cc.res
+obj/_mkc_sizeof_int.c
+obj/_mkc_sizeof_int.err
+obj/_mkc_sizeof_int.res
+obj/libs/bar/bar.o
+obj/libs/bar/libbar.a
+obj/libs/foo/foo.o
+obj/libs/foo/libfoo.a
+obj/libs/qux/libqux.a
+obj/libs/qux/qux.h
+obj/libs/qux/qux.o
+obj/tools/prog1/prog1
+obj/tools/prog1/prog1.o
+obj/tools/prog2/prog2
+obj/tools/prog2/prog2.o
+obj/tools/prog3/prog3
+obj/tools/prog3/prog3.o
+obj/tools/prog4/prog4
+obj/tools/prog4/prog4.o
diff --git a/examples/tools2/libs/bar/Makefile b/examples/tools2/libs/bar/Makefile
new file mode 100644
index 0000000..4022796
--- /dev/null
+++ b/examples/tools2/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/tools2/libs/bar/bar.c b/examples/tools2/libs/bar/bar.c
new file mode 100644
index 0000000..8580fe7
--- /dev/null
+++ b/examples/tools2/libs/bar/bar.c
@@ -0,0 +1,6 @@
+#include "bar.h"
+
+const char *get_msg2 (void)
+{
+ return "Message #";
+}
diff --git a/examples/tools2/libs/bar/bar.h b/examples/tools2/libs/bar/bar.h
new file mode 100644
index 0000000..a434759
--- /dev/null
+++ b/examples/tools2/libs/bar/bar.h
@@ -0,0 +1 @@
+const char *get_msg2 (void);
diff --git a/examples/tools2/libs/bar/linkme.mk b/examples/tools2/libs/bar/linkme.mk
new file mode 100644
index 0000000..4eea0a9
--- /dev/null
+++ b/examples/tools2/libs/bar/linkme.mk
@@ -0,0 +1,5 @@
+PATH.bar := ${.PARSEDIR}
+
+CPPFLAGS += -I${PATH.bar}
+DPLIBDIRS += libs/${PATH.bar:T}
+LDADD += -lbar
diff --git a/examples/tools2/libs/foo/Makefile b/examples/tools2/libs/foo/Makefile
new file mode 100644
index 0000000..0003bee
--- /dev/null
+++ b/examples/tools2/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/tools2/libs/foo/foo.c b/examples/tools2/libs/foo/foo.c
new file mode 100644
index 0000000..1d47523
--- /dev/null
+++ b/examples/tools2/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/tools2/libs/foo/foo.h b/examples/tools2/libs/foo/foo.h
new file mode 100644
index 0000000..489e95b
--- /dev/null
+++ b/examples/tools2/libs/foo/foo.h
@@ -0,0 +1 @@
+const char *get_msg1 (void);
diff --git a/examples/tools2/libs/foo/linkme.mk b/examples/tools2/libs/foo/linkme.mk
new file mode 100644
index 0000000..ad42ee4
--- /dev/null
+++ b/examples/tools2/libs/foo/linkme.mk
@@ -0,0 +1,5 @@
+PATH.foo := ${.PARSEDIR}
+
+CPPFLAGS += -I${PATH.foo}
+DPLIBDIRS += libs/${PATH.foo:T}
+LDADD += -lfoo
diff --git a/examples/tools2/libs/qux/Makefile b/examples/tools2/libs/qux/Makefile
new file mode 100644
index 0000000..345f614
--- /dev/null
+++ b/examples/tools2/libs/qux/Makefile
@@ -0,0 +1,16 @@
+LIB = qux
+SRCS = qux.c
+INCS = qux.h
+
+MKC_CHECK_SIZEOF = int
+
+.include <mkc.configure.mk>
+
+INFILES = ${INCS}
+INTEXTS_REPLS = int_size ${SIZEOF.int:U4}
+
+qux.o: qux.h
+
+WARNS = 4
+
+.include <mkc.lib.mk>
diff --git a/examples/tools2/libs/qux/linkme.mk b/examples/tools2/libs/qux/linkme.mk
new file mode 100644
index 0000000..82f5dd6
--- /dev/null
+++ b/examples/tools2/libs/qux/linkme.mk
@@ -0,0 +1,5 @@
+PATH.qux := ${.PARSEDIR}
+
+CPPFLAGS += -I${OBJDIR_libs_qux}
+DPLIBDIRS += libs/${PATH.qux:T}
+LDADD += -lqux
diff --git a/examples/tools2/libs/qux/qux.c b/examples/tools2/libs/qux/qux.c
new file mode 100644
index 0000000..78786db
--- /dev/null
+++ b/examples/tools2/libs/qux/qux.c
@@ -0,0 +1,6 @@
+#include "qux.h"
+
+int get_int_size (void)
+{
+ return INT_SIZE;
+}
diff --git a/examples/tools2/libs/qux/qux.h.in b/examples/tools2/libs/qux/qux.h.in
new file mode 100644
index 0000000..0a41ce1
--- /dev/null
+++ b/examples/tools2/libs/qux/qux.h.in
@@ -0,0 +1,4 @@
+
+#define INT_SIZE @int_size@
+
+int get_int_size (void);
diff --git a/examples/tools2/test.mk b/examples/tools2/test.mk
new file mode 100644
index 0000000..1c630f0
--- /dev/null
+++ b/examples/tools2/test.mk
@@ -0,0 +1,115 @@
+next_level != expr ${.MAKE.LEVEL} + 1
+
+.PHONY : test_output
+test_output :
+ @set -e; \
+ MKCATPAGES=yes; export MKCATPAGES; \
+ SRCTOP=`pwd`; export SRCTOP; \
+ LC_ALL=C; export LC_ALL; \
+ \
+ echo PROJECTNAME=${PROJECTNAME}; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ ${.CURDIR}/tools/prog1/prog1; \
+ ${.CURDIR}/tools/prog2/prog2; \
+ ${.CURDIR}/tools/prog3/prog3; \
+ ${.CURDIR}/tools/prog4/prog4 | sed 's/=[0-9]/=n/'; \
+ 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_tools_prog4=${OBJDIR_tools_prog4} | 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 =========== check ============; \
+ ${MAKE} ${MAKEFLAGS} check 2>&1; \
+ \
+ echo =========== check-tools/prog1 ============; \
+ ${MAKE} ${MAKEFLAGS} check-tools/prog1 2>&1; \
+ \
+ 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 -j3 DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKEFLAGS} -j4 uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type 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} -j4 all-tools/prog1 DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= -C tools/prog1 all ==========; \
+ ${MAKE} ${MAKEFLAGS} -j4 clean-tools/prog1 DESTDIR=${.OBJDIR} > /dev/null; \
+ env init_make_level=${next_level} ${MAKE} ${MAKEFLAGS} -j4 \
+ -C `pwd`/tools/prog1 all 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} -j4 all-tools/prog2 DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= -C tools/prog2 all ==========; \
+ ${MAKE} ${MAKEFLAGS} cleandir DESTDIR=${.OBJDIR} > /dev/null; \
+ env init_make_level=${next_level} ${MAKE} ${MAKEFLAGS} -j4 \
+ -C tools/prog2 all 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} -j4 all-tools/prog3 DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= -C tools/prog4 all ==========; \
+ ${MAKE} ${MAKEFLAGS} cleandir DESTDIR=${.OBJDIR} > /dev/null; \
+ env init_make_level=${next_level} ${MAKE} ${MAKEFLAGS} \
+ -j4 all-tools/prog4 DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= MKRELOBJDIR ==========; \
+ ${MAKE} ${MAKEFLAGS} cleandir > /dev/null; \
+ MKRELOBJDIR=yes; export MKRELOBJDIR; \
+ mkdir obj; \
+ env init_make_level=${next_level} ${MAKE} ${MAKEFLAGS} \
+ -j4 all > /dev/null; \
+ find obj -type f -o -type l | sort; \
+ rm -rf obj; \
+ \
+ ${MAKE} ${MAKEFLAGS} cleandir > /dev/null; \
+
+.include <mkc.minitest.mk>
diff --git a/examples/tools2/tests/prog1/Makefile b/examples/tools2/tests/prog1/Makefile
new file mode 100644
index 0000000..157ce1c
--- /dev/null
+++ b/examples/tools2/tests/prog1/Makefile
@@ -0,0 +1,8 @@
+check:
+ @if test "`${OBJDIR_tools_prog1}/prog1`" = 'This is a message #1'; then \
+ echo ok; \
+ else \
+ echo FAILED; false; \
+ fi
+
+.include <mkc.mk>
diff --git a/examples/tools2/tests/prog2/Makefile b/examples/tools2/tests/prog2/Makefile
new file mode 100644
index 0000000..bb706b8
--- /dev/null
+++ b/examples/tools2/tests/prog2/Makefile
@@ -0,0 +1,8 @@
+check:
+ @if test "`${OBJDIR_tools_prog2}/prog2`" = 'Message #2'; then \
+ echo ok; \
+ else \
+ echo FAILED; false; \
+ fi
+
+.include <mkc.mk>
diff --git a/examples/tools2/tests/prog3/Makefile b/examples/tools2/tests/prog3/Makefile
new file mode 100644
index 0000000..c4cdad8
--- /dev/null
+++ b/examples/tools2/tests/prog3/Makefile
@@ -0,0 +1,10 @@
+check:
+ @if test "`${OBJDIR_tools_prog3}/prog3 | tr '\012' ' '`" = \
+ 'This is a message #3 Message #3 '; \
+ then \
+ echo ok; \
+ else \
+ echo FAILED; false; \
+ fi
+
+.include <mkc.mk>
diff --git a/examples/tools2/tests/prog4/Makefile b/examples/tools2/tests/prog4/Makefile
new file mode 100644
index 0000000..fb34426
--- /dev/null
+++ b/examples/tools2/tests/prog4/Makefile
@@ -0,0 +1,8 @@
+check:
+ @if test "`${OBJDIR_tools_prog4}/prog4 | tr '248' 'nnn'`" = 'int_size=n'; then \
+ echo ok; \
+ else \
+ echo FAILED; false; \
+ fi
+
+.include <mkc.mk>
diff --git a/examples/tools2/tools/prog1/Makefile b/examples/tools2/tools/prog1/Makefile
new file mode 100644
index 0000000..bca4588
--- /dev/null
+++ b/examples/tools2/tools/prog1/Makefile
@@ -0,0 +1,12 @@
+PROG = prog1
+
+CFLAGS += -DNUM=1
+WARNS = 4
+
+MKC_REQD = 0.10.0
+
+check:
+ @: do something useful
+
+.include "../../libs/foo/linkme.mk"
+.include <mkc.prog.mk>
diff --git a/examples/tools2/tools/prog1/prog1.c b/examples/tools2/tools/prog1/prog1.c
new file mode 100644
index 0000000..87578e2
--- /dev/null
+++ b/examples/tools2/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/tools2/tools/prog2/Makefile b/examples/tools2/tools/prog2/Makefile
new file mode 100644
index 0000000..63ab936
--- /dev/null
+++ b/examples/tools2/tools/prog2/Makefile
@@ -0,0 +1,12 @@
+PROG = prog2
+
+CFLAGS += -DNUM=2
+WARNS = 4
+
+MKC_REQD = 0.10.0
+
+check:
+ @: do something useful
+
+.include "../../libs/bar/linkme.mk"
+.include <mkc.prog.mk>
diff --git a/examples/tools2/tools/prog2/prog2.c b/examples/tools2/tools/prog2/prog2.c
new file mode 100644
index 0000000..ed9553c
--- /dev/null
+++ b/examples/tools2/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/tools2/tools/prog3/Makefile b/examples/tools2/tools/prog3/Makefile
new file mode 100644
index 0000000..b361032
--- /dev/null
+++ b/examples/tools2/tools/prog3/Makefile
@@ -0,0 +1,14 @@
+PROG = prog3
+
+CFLAGS += -DNUM=3
+WARNS = 4
+
+MKC_REQD = 0.10.0
+
+check:
+ @: do something useful
+
+.include "../../libs/foo/linkme.mk"
+.include "../../libs/bar/linkme.mk"
+
+.include <mkc.prog.mk>
diff --git a/examples/tools2/tools/prog3/prog3.c b/examples/tools2/tools/prog3/prog3.c
new file mode 100644
index 0000000..54b740b
--- /dev/null
+++ b/examples/tools2/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;
+}
diff --git a/examples/tools2/tools/prog4/Makefile b/examples/tools2/tools/prog4/Makefile
new file mode 100644
index 0000000..307f490
--- /dev/null
+++ b/examples/tools2/tools/prog4/Makefile
@@ -0,0 +1,11 @@
+PROG = prog4
+
+WARNS = 4
+
+MKC_REQD = 0.10.0
+
+check:
+ @: do something useful
+
+.include "../../libs/qux/linkme.mk"
+.include <mkc.prog.mk>
diff --git a/examples/tools2/tools/prog4/prog4.c b/examples/tools2/tools/prog4/prog4.c
new file mode 100644
index 0000000..3b4d087
--- /dev/null
+++ b/examples/tools2/tools/prog4/prog4.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+#include "qux.h"
+
+int main (int argc, char** argv)
+{
+ printf ("int_size=%d\n", get_int_size ());
+ return 0;
+}
diff --git a/helpers/Makefile b/helpers/Makefile
new file mode 100644
index 0000000..eccb0c6
--- /dev/null
+++ b/helpers/Makefile
@@ -0,0 +1,3 @@
+SCRIPTS = mkc_test_helper
+
+.include <mkc.mk>
diff --git a/mkc_test_helper b/helpers/mkc_test_helper
index f5c3c96..934fa72 100755
--- a/mkc_test_helper
+++ b/helpers/mkc_test_helper
@@ -3,7 +3,7 @@
############################################################
# Copyright (c) 2009-2010 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
set -e
@@ -15,10 +15,16 @@ objdir="$2"
LC_ALL=C
export LC_ALL
+if test -z "$NOSORT"; then
+ SORT_CMD=sort
+else
+ SORT_CMD=cat
+fi
+
grep -v CVS |
grep -v '~$' |
-sed -e "s,$objdir,/objdir," \
- -e "s,$prefix,/prefix," \
+sed -e "s,$objdir,/objdir,g" \
+ -e "s,$prefix,/prefix,g" \
-e "s,/usr/pkg,/prefix," \
-e "s,/usr,/prefix," \
-e "s,/opt/local,/prefix," \
@@ -31,5 +37,7 @@ sed -e "s,$objdir,/objdir," \
-e '/pod2htmd.tmp/ d' \
-e '/pod2htmi.tmp/ d' \
-e 's,lua/[0-9]*[.][0-9]*,lua/X.Y,' \
- -e 's/[.]sl/.so/' -e /so_locations/d|
-sort
+ -e 's,//,/,g' \
+ -e 's,^bmake:.*line [0-9][0-9]*: "\(.*\)".*$,\1,g' \
+ -e 's/[.]sl/.so/' -e /so_locations/d |
+$SORT_CMD
diff --git a/mkc_test_helper2 b/helpers/mkc_test_helper2
index f9c8c7a..0d23176 100755
--- a/mkc_test_helper2
+++ b/helpers/mkc_test_helper2
@@ -3,7 +3,7 @@
############################################################
# Copyright (c) 2009-2010 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
set -e
diff --git a/mkc_test_helper_paths b/helpers/mkc_test_helper_paths
index 74c5668..2feae85 100755
--- a/mkc_test_helper_paths
+++ b/helpers/mkc_test_helper_paths
@@ -3,7 +3,7 @@
############################################################
# Copyright (c) 2012 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
set -e
diff --git a/main.mk b/main.mk
new file mode 100644
index 0000000..80d6c0e
--- /dev/null
+++ b/main.mk
@@ -0,0 +1,37 @@
+.sinclude "cheusov_local_settings.mk" # for debugging
+
+##################################################
+SUBPRJ_DFLT = custom helpers mk scripts
+SUBPRJ = examples tests doc presentation ${SUBPRJ_DFLT}
+
+##################################################
+SHRTOUT = yes
+
+PROJECTNAME = mk-configure
+
+#
+NOEXPORT_VARNAMES = MKC_CACHEDIR
+
+DIST_TARGETS = pdf clean-mk clean-scripts mkc_clean
+
+INSTALL = ${.CURDIR}/scripts/mkc_install
+PATH := ${OBJDIR_custom}:${OBJDIR_helpers}:${.CURDIR}/helpers:${OBJDIR_scripts}:${.CURDIR}/scripts:${PATH}
+
+.export SHRTOUT INSTALL PATH
+
+##################################################
+.PHONY: pdf
+pdf: all-presentation
+pdf:
+ @set -e; cd presentation; \
+ ${MAKE} ${MAKEFLAGS} clean-garbage; \
+ rm -f myprojects.*
+
+##################################################
+cleandir: cleandir-tests cleandir-presentation
+clean: clean-tests clean-presentation
+test: test-tests
+
+##################################################
+.include "Makefile.inc"
+.include <mkc.mk>
diff --git a/mk/Makefile b/mk/Makefile
new file mode 100644
index 0000000..5e2b695
--- /dev/null
+++ b/mk/Makefile
@@ -0,0 +1,48 @@
+FILES = sys.mk mkc.configure.mk configure.mk mkc.mk \
+ mkc.init.mk mkc_imp.intexts.mk mkc_imp.mk \
+ mkc.minitest.mk mkc_imp.pkg-config.mk \
+ mkc_imp.files.mk mkc_imp.inc.mk mkc_imp.info.mk mkc_imp.lib.mk \
+ mkc_imp.links.mk mkc_imp.man.mk mkc_imp.prog.mk \
+ mkc_imp.subprj.mk \
+ mkc_imp.final.mk mkc_imp.scripts.mk \
+ mkc_imp.platform.sys.mk mkc_imp.dep.mk mkc_imp.lua.mk \
+ mkc_imp.arch.mk mkc_imp.pod.mk mkc_imp.preinit.mk \
+ mkc.prog.mk mkc.files.mk mkc.lib.mk mkc.subdir.mk mkc.subprj.mk \
+ mkc_imp.objdir.mk mkc_imp.obj.mk ${INFILES}
+
+FILESDIR = ${MKFILESDIR}
+
+INFILES += mkc_imp.vars.mk
+
+#################################################
+.for i in prog_mkdep prog_nbmkdep
+MKC_CHECK_CUSTOM += ${i}
+MKC_CUSTOM_FN.${i} = ${.CURDIR}/../custom/${i}
+.endfor
+
+MKC_CHECK_PROGS += makedepend
+
+.include <mkc.configure.mk>
+
+.if ${HAVE_PROG.makedepend:U0}
+makedepend_cmd = ${PROG.makedepend}
+mkdep_cmd = mkdep
+mkdep_type = makedepend
+.elif !empty(CUSTOM.prog_nbmkdep)
+mkdep_cmd = ${CUSTOM.prog_nbmkdep}
+mkdep_type = nbmkdep
+.elif !empty(CUSTOM.prog_mkdep)
+mkdep_cmd = ${CUSTOM.prog_mkdep}
+mkdep_type = mkdep
+.else
+MKC_ERR_MSG += "mkdep(1) cannot be found"
+.endif
+
+makedepend_cmd ?= makedepend
+
+INTEXTS_REPLS += mkdep_cmd ${mkdep_cmd}
+INTEXTS_REPLS += makedepend_cmd ${makedepend_cmd}
+INTEXTS_REPLS += mkdep_type ${mkdep_type}
+
+#################################################
+.include <mkc.mk>
diff --git a/configure.mk.in b/mk/configure.mk
index 300d1be..8d7571c 100644
--- a/configure.mk.in
+++ b/mk/configure.mk
@@ -1,4 +1,4 @@
-# Copyright (c) 2009-2010, Aleksey Cheusov <vle@gmx.net>
+# Copyright (c) 2009-2013, Aleksey Cheusov <vle@gmx.net>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -27,12 +27,16 @@
#
# user defined variables
-MKC_SHOW_CACHED?=0 # set it to `1' to show "...(cached)..." lines
-MKC_DELETE_TMPFILES?=0 # set it to `1' to delete temporary files
-MKC_CACHEDIR?=${.OBJDIR} # directory for cache and intermediate files
-MKC_COMMON_HEADERS?= # list of headers always #included
-MKC_NOCACHE?= # 1 or yes for disabling cache
-MKC_CUSTOM_DIR?=${.CURDIR} # directory with custom tests.c
+MKC_SHOW_CACHED ?= 0 # set it to `1' to show "...(cached)..." lines
+MKC_DELETE_TMPFILES ?= 0 # set it to `1' to delete temporary files
+MKC_CACHEDIR ?= ${.OBJDIR} # directory for cache and intermediate files
+MKC_COMMON_HEADERS ?= # list of headers always #included
+MKC_NOCACHE ?= # 1 or yes for disabling cache
+MKC_CUSTOM_DIR ?=${.CURDIR} # directory with custom tests.c
+
+#
+MKC_SOURCE_FUNCLIBS ?=
+_MKC_SOURCE_FUNCS = ${MKC_SOURCE_FUNCLIBS:C/:.*//}
# .endif for the next .if is in the end of file
.if ${MKCHECKS:Uno:tl} == "yes"
@@ -44,40 +48,32 @@ HAVE_FUNCLIB.main ?= 1
.undef MKC_LDADD
.undef MKC_CFLAGS
-#
-.ifndef OPSYS
-OPSYS!= uname -s
-.endif
-
-TARGET_OPSYS?= ${OPSYS}
.if defined(MKC_COMMON_DEFINES.${TARGET_OPSYS})
-CPPFLAGS+= ${MKC_COMMON_DEFINES.${TARGET_OPSYS}}
+CPPFLAGS += ${MKC_COMMON_DEFINES.${TARGET_OPSYS}}
.endif
.if defined(MKC_COMMON_DEFINES)
-CPPFLAGS+= ${MKC_COMMON_DEFINES}
+CPPFLAGS += ${MKC_COMMON_DEFINES}
.endif
#
-_MKC_CPPFLAGS:= ${CPPFLAGS}
-_MKC_CFLAGS:= ${CFLAGS}
-_MKC_CXXFLAGS:= ${CXXFLAGS}
-_MKC_FFLAGS:= ${FFLAGS}
-_MKC_LDFLAGS:= ${LDFLAGS}
-_MKC_LDADD:= ${LDADD}
+_MKC_CPPFLAGS := ${CPPFLAGS}
+_MKC_CFLAGS := ${CFLAGS}
+_MKC_CXXFLAGS := ${CXXFLAGS}
+_MKC_FFLAGS := ${FFLAGS}
+_MKC_LDFLAGS := ${LDFLAGS}
+_MKC_LDADD := ${LDADD}
mkc.environ=CC='${CC}' CXX='${CXX}' FC='${FC}' CPPFLAGS='${_MKC_CPPFLAGS}' CFLAGS='${_MKC_CFLAGS}' CXXFLAGS='${_MKC_CXXFLAGS}' FFLAGS='${_MKC_FFLAGS}' LDFLAGS='${_MKC_LDFLAGS}' LDADD='${_MKC_LDADD}' LEX='${LEX}' YACC='${YACC}' MKC_CACHEDIR='${MKC_CACHEDIR}' MKC_COMMON_HEADERS='${MKC_COMMON_HEADERS}' MKC_DELETE_TMPFILES='${MKC_DELETE_TMPFILES}' MKC_SHOW_CACHED='${MKC_SHOW_CACHED}' MKC_NOCACHE='${MKC_NOCACHE}' MKC_VERBOSE=1
-#
-MKC_SOURCE_FUNCLIBS ?=
-_MKC_SOURCE_FUNCS= ${MKC_SOURCE_FUNCLIBS:C/:.*//}
-
+######################################################
# checking for builtin checks
.for i in ${MKC_CHECK_BUILTINS} ${MKC_REQUIRE_BUILTINS}
-MKC_CUSTOM_FN.${i}?= ${BUILTINSDIR}/${i}
-MKC_CHECK_CUSTOM+= ${i}
-MKC_REQUIRE_CUSTOM+= ${MKC_REQUIRE_BUILTINS:M${i}}
+MKC_CUSTOM_FN.${i} ?= ${BUILTINSDIR}/${i}
+MKC_CHECK_CUSTOM += ${i}
+MKC_REQUIRE_CUSTOM += ${MKC_REQUIRE_BUILTINS:M${i}}
.endfor
+######################################################
# checking for headers
.for h in ${MKC_CHECK_HEADERS} ${MKC_REQUIRE_HEADERS}
.if !defined(HAVE_HEADER.${h:S|.|_|g:S|/|_|g})
@@ -85,44 +81,48 @@ HAVE_HEADER.${h:S|.|_|g:S|/|_|g} != env ${mkc.environ} mkc_check_header ${h}
.endif
.if ${HAVE_HEADER.${h:S|.|_|g:S|/|_|g}}
.if empty(MKC_REQUIRE_HEADERS:U:M${h})
-MKC_CFLAGS += -DHAVE_HEADER_${h:tu:S|.|_|g:S|/|_|g}=${HAVE_HEADER.${h:S|.|_|g:S|/|_|g}}
+MKC_CFLAGS += -DHAVE_HEADER_${h:tu:S|.|_|g:S|/|_|g}=${HAVE_HEADER.${h:S|.|_|g:S|/|_|g}}
.endif
.elif !empty(MKC_REQUIRE_HEADERS:U:M${h})
-MKC_ERR_MSG+= "ERROR: cannot find header ${h}"
+_fake != env ${mkc.environ} mkc_check_header -d ${h} && echo
+MKC_ERR_MSG += "ERROR: cannot find header ${h}"
.endif
.endfor
.undef MKC_CHECK_HEADERS
.undef MKC_REQUIRE_HEADERS
+######################################################
# checking for functions in libraries
.for f in ${MKC_CHECK_FUNCLIBS:U} ${MKC_SOURCE_FUNCLIBS:U} ${MKC_REQUIRE_FUNCLIBS:U}
.if !defined(HAVE_FUNCLIB.${f:S/:/./g})
-HAVE_FUNCLIB.${f:S/:/./g}!= env ${mkc.environ} mkc_check_funclib ${f:S/:/ /g}
+HAVE_FUNCLIB.${f:S/:/./g} != env ${mkc.environ} mkc_check_funclib ${f:S/:/ /g}
.endif
.if !defined(HAVE_FUNCLIB.${f:C/:.*//})
-HAVE_FUNCLIB.${f:C/:.*//}!= env ${mkc.environ} mkc_check_funclib ${f:C/:.*//}
+HAVE_FUNCLIB.${f:C/:.*//} != env ${mkc.environ} mkc_check_funclib ${f:C/:.*//}
.endif
.if ${HAVE_FUNCLIB.${f:C/:.*//}} != ${HAVE_FUNCLIB.${f:S/:/./g}}
.if empty(MKC_NOAUTO_FUNCLIBS:U:S/:/./g:M${f:S/:/./g}) && empty(MKC_NOAUTO_FUNCLIBS:U:M1) && ${HAVE_FUNCLIB.${f:S/:/./g}} && !${HAVE_FUNCLIB.${f:C/:.*//}}
-MKC_LDADD+=-l${f:C/^.*://}
+MKC_LDADD += -l${f:C/^.*://}
.endif
.endif
.if !${HAVE_FUNCLIB.${f:S/:/./g}} && !${HAVE_FUNCLIB.${f:C/:.*//}} && !empty(_MKC_SOURCE_FUNCS:M${f:C/:.*//})
-MKC_SRCS+=${f:C/:.*//}.c
+MKC_SRCS += ${f:C/:.*//}.c
.endif
.endfor # f
.for f in ${MKC_REQUIRE_FUNCLIBS:U}
.if !${HAVE_FUNCLIB.${f:S/:/./g}} && !${HAVE_FUNCLIB.${f:C/:.*//}}
-MKC_ERR_MSG+= "ERROR: cannot find function ${f}"
+_fake != env ${mkc.environ} mkc_check_funclib -d ${f:C/:.*//} && echo
+_fake != env ${mkc.environ} mkc_check_funclib -d ${f:S/:/ /g} && echo
+MKC_ERR_MSG += "ERROR: cannot find function ${f}"
.endif
.endfor # f
.undef MKC_CHECK_FUNCLIBS
-.undef MKC_SOURCE_FUNCLIBS
.undef MKC_REQUIRE_FUNCLIBS
+######################################################
# checking for sizeof(xxx)
.for t in ${MKC_CHECK_SIZEOF:U}
.if !defined(SIZEOF.${t:S|.|_|g:S|-|_|g:S|*|P|g:S|/|_|g:S|:|.|g})
@@ -135,6 +135,7 @@ MKC_CFLAGS += -DSIZEOF_${t:S/-/_/g:S| |_|g:S|*|P|g:S|:|_|g:S|.|_|g:tu}=${SIZEO
.undef MKC_CHECK_SIZEOF
+######################################################
# checking for declared #define
.for d in ${MKC_CHECK_DEFINES:U} ${MKC_REQUIRE_DEFINES:U}
.if !defined(HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g})
@@ -142,20 +143,22 @@ HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_dec
.endif
.if ${HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g}}
.if empty(MKC_REQUIRE_DEFINES:U:M${d})
-MKC_CFLAGS += -DHAVE_DEFINE_${d:tu:S/:/_/g:S/./_/g:S|/|_|g}=1
+MKC_CFLAGS += -DHAVE_DEFINE_${d:tu:S/:/_/g:S/./_/g:S|/|_|g}=1
.endif
.endif
.endfor
.for d in ${MKC_REQUIRE_DEFINES:U}
.if !${HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g}}
-MKC_ERR_MSG+= "ERROR: cannot find declaration of define ${d}"
+_fake != env ${mkc.environ} mkc_check_decl -d define ${d:S/:/ /g} && echo
+MKC_ERR_MSG += "ERROR: cannot find declaration of define ${d}"
.endif
.endfor
.undef MKC_CHECK_DEFINES
.undef MKC_REQUIRE_DEFINES
+######################################################
# checking for declared type
.for t in ${MKC_CHECK_TYPES:U} ${MKC_REQUIRE_TYPES:U}
.if !defined(HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g})
@@ -163,20 +166,22 @@ HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_decl
.endif
.if ${HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g}}
.if empty(MKC_REQUIRE_TYPES:U:M${t})
-MKC_CFLAGS += -DHAVE_TYPE_${t:tu:S/:/_/g:S/./_/g:S|/|_|g}=1
+MKC_CFLAGS += -DHAVE_TYPE_${t:tu:S/:/_/g:S/./_/g:S|/|_|g}=1
.endif
.endif
.endfor
.for t in ${MKC_REQUIRE_TYPES:U}
.if !${HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g}}
-MKC_ERR_MSG+= "ERROR: cannot find declaration of type ${t}"
+_fake != env ${mkc.environ} mkc_check_decl -d type ${t:S/:/ /g} && echo
+MKC_ERR_MSG += "ERROR: cannot find declaration of type ${t}"
.endif
.endfor
.undef MKC_CHECK_TYPES
.undef MKC_REQUIRE_TYPES
+######################################################
# checking for declared variables
.for d in ${MKC_CHECK_VARS:U} ${MKC_REQUIRE_VARS:U}
.if !defined(HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g})
@@ -184,19 +189,22 @@ HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_decl v
.endif
.if ${HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g}}
.if empty(MKC_REQUIRE_VARS:U:M${d})
-MKC_CFLAGS += -DHAVE_VAR_${d:tu:S/:/_/g:S/./_/g:S|/|_|g}=1
+MKC_CFLAGS += -DHAVE_VAR_${d:tu:S/:/_/g:S/./_/g:S|/|_|g}=1
.endif
.endif
.endfor
.for d in ${MKC_REQUIRE_VARS:U}
.if !${HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g}}
-MKC_ERR_MSG+= "ERROR: cannot find declaration of variable ${d}"
+_fake != env ${mkc.environ} mkc_check_decl -d variable ${d:S/:/ /g} && echo
+MKC_ERR_MSG += "ERROR: cannot find declaration of variable ${d}"
.endif
.endfor
+.undef MKC_CHECK_VARS
.undef MKC_REQUIRE_VARS
+######################################################
# checking for struct members
.for m in ${MKC_CHECK_MEMBERS:U} ${MKC_REQUIRE_MEMBERS:U}
.if !defined(HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g})
@@ -204,20 +212,22 @@ HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g} != env ${mkc.environ} mkc_c
.endif
.if ${HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g}}
.if empty(MKC_REQUIRE_MEMBERS:U:M${m})
-MKC_CFLAGS += -DHAVE_MEMBER_${m:tu:S/:/_/g:S/./_/g:S|/|_|g:S/-/_/g}=1
+MKC_CFLAGS += -DHAVE_MEMBER_${m:tu:S/:/_/g:S/./_/g:S|/|_|g:S/-/_/g}=1
.endif
.endif
.endfor
.for m in ${MKC_REQUIRE_MEMBERS:U}
.if !${HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g}}
-MKC_ERR_MSG+= "ERROR: cannot find member ${m}"
+_fake != env ${mkc.environ} mkc_check_decl -d member ${m:S/:/ /g} && echo
+MKC_ERR_MSG += "ERROR: cannot find member ${m}"
.endif
.endfor
.undef MKC_CHECK_MEMBERS
.undef MKC_REQUIRE_MEMBERS
+######################################################
# checking for declared functions
.for n in 0 1 2 3 4 5 6 7 8 9
@@ -227,14 +237,15 @@ HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_d
.endif
.if ${HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g}}
.if empty(MKC_REQUIRE_FUNCS${n}:U:M${d})
-MKC_CFLAGS += -DHAVE_FUNC${n}_${d:tu:S/:/_/g:S/./_/g:S|/|_|g}=1
+MKC_CFLAGS += -DHAVE_FUNC${n}_${d:tu:S/:/_/g:S/./_/g:S|/|_|g}=1
.endif
.endif
.endfor # d
.for d in ${MKC_REQUIRE_FUNCS${n}:U}
.if !${HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g}}
-MKC_ERR_MSG+= "ERROR: cannot find declaration of function ${d}"
+_fake != env ${mkc.environ} mkc_check_decl -d func${n} ${d:S/:/ /g} && echo
+MKC_ERR_MSG += "ERROR: cannot find declaration of function ${d}"
.endif
.endfor # d
@@ -243,56 +254,58 @@ MKC_ERR_MSG+= "ERROR: cannot find declaration of function ${d}"
.endfor # n
+######################################################
# custom checks
.for c in ${MKC_CHECK_CUSTOM} ${MKC_REQUIRE_CUSTOM}
.if !defined(CUSTOM.${c})
.if !defined(MKC_CUSTOM_FN.${c})
-MKC_CUSTOM_FN.${c}=${c}.c
+MKC_CUSTOM_FN.${c} = ${c}.c
+.endif
+.if empty(MKC_CUSTOM_FN.${c}:M/*)
+MKC_CUSTOM_FN.${c} := ${MKC_CUSTOM_DIR}/${MKC_CUSTOM_FN.${c}}
.endif
-CUSTOM.${c} != env ${mkc.environ} mkc_check_custom \
- ${MKC_CUSTOM_FN.${c}:H:S|^.$|${MKC_CUSTOM_DIR}|}/${MKC_CUSTOM_FN.${c}:T}
+CUSTOM.${c} != env ${mkc.environ} mkc_check_custom ${MKC_CUSTOM_FN.${c}}
.endif
.if !empty(CUSTOM.${c}) && ${CUSTOM.${c}} != 0
.if empty(MKC_REQUIRE_CUSTOM:U:M${c})
-MKC_CFLAGS += -DCUSTOM_${c:tu}=${CUSTOM.${c}}
+MKC_CFLAGS += -DCUSTOM_${c:tu}=${CUSTOM.${c}}
.endif
.endif
.endfor
.for c in ${MKC_REQUIRE_CUSTOM}
.if empty(CUSTOM.${c}) || ${CUSTOM.${c}} == 0
-MKC_ERR_MSG+= "ERROR: custom test ${c} failed"
+_fake != env ${mkc.environ} mkc_check_custom -d ${MKC_CUSTOM_FN.${c}} && echo
+MKC_ERR_MSG += "ERROR: custom test ${c} failed"
.endif
.endfor
.for c in ${MKC_CHECK_BUILTINS}
-BUILTIN.${c}= ${CUSTOM.${c}}
+BUILTIN.${c} = ${CUSTOM.${c}}
.endfor
-# checking for declared #define
+######################################################
+# checking for programs
.for p in ${MKC_CHECK_PROGS} ${MKC_REQUIRE_PROGS}
-prog_id:= ${MKC_PROG.id.${p:S|+|x|g}:U${p}:S|/|_|g}
-.if !defined(PROG.${prog_id})
-p_=${p:M/*}
-.if !empty(p_)
-. if exists(${p})
-PROG.${prog_id}=${p}
-. else
-PROG.${prog_id}=
-. endif # exists(${p})
+p_ := ${p}
+prog_id := ${MKC_PROG.id.${p:S|+|x|g}:U${p}:S|/|_|g}
+.ifdef PROG.${prog_id}
+.elif !empty(p_:M/*)
+PROG.${prog_id} = ${p}
.else
-.undef p_
PROG.${prog_id} != env ${mkc.environ} mkc_check_prog -i '${prog_id}' '${p}'
-.endif # p matches /*
.endif # !defined(PROG.${prog_id})
-.if !empty(PROG.${prog_id})
-HAVE_PROG.${prog_id}= 1
+.ifndef HAVE_PROG.${prog_id}
+.if !empty(PROG.${prog_id}) && exists(${PROG.${prog_id}})
+HAVE_PROG.${prog_id} = 1
.else
-HAVE_PROG.${prog_id}= 0
+HAVE_PROG.${prog_id} = 0
.endif
+.endif # ifndef HAVE_PROG.${prog_id}
.if !${HAVE_PROG.${prog_id}} && !empty(MKC_REQUIRE_PROGS:U1:M${p})
-MKC_ERR_MSG+= "ERROR: cannot find program ${p}"
+_fake != env ${mkc.environ} mkc_check_prog -d -i '${prog_id}' '${p}' && echo
+MKC_ERR_MSG += "ERROR: cannot find program ${p}"
.endif
.endfor # p
@@ -302,18 +315,27 @@ MKC_ERR_MSG+= "ERROR: cannot find program ${p}"
.undef MKC_CHECK_CUSTOM
.undef MKC_REQUIRE_CUSTOM
+######################################################
# final assignment
.if !${MKC_NOAUTO:U0}
.for i in ${MKC_CFLAGS}
-CFLAGS+= ${i}
+CFLAGS += ${i}
.endfor
.for i in ${MKC_LDADD}
-LDADD+= ${i}
+LDADD += ${i}
.endfor
.for i in ${MKC_SRCS}
-SRCS+= ${i}
+SRCS += ${i}
.endfor
-
.endif # .if MKC_AUTO
-.endif # !make(clean) && !make(cleandir) && !make(distclean)
+.endif # MKCHECKS == yes
+
+######################################################
+######################################################
+######################################################
+.for i in ${_MKC_SOURCE_FUNCS}
+CLEANFILES += ${i}.o
+.endfor
+
+.undef MKC_SOURCE_FUNCLIBS
diff --git a/mkc.configure.mk b/mk/mkc.configure.mk
index e557f65..f93c615 100644
--- a/mkc.configure.mk
+++ b/mk/mkc.configure.mk
@@ -1,10 +1,10 @@
# Copyright (c) 2009-2010 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
.include <mkc_imp.preinit.mk>
-.include <mkc_imp.init.mk>
+.include <mkc.init.mk>
.include <configure.mk>
diff --git a/mk/mkc.files.mk b/mk/mkc.files.mk
new file mode 100644
index 0000000..8974529
--- /dev/null
+++ b/mk/mkc.files.mk
@@ -0,0 +1,2 @@
+_top_mk := mkc.files.mk
+.include <mkc.mk>
diff --git a/mk/mkc.init.mk b/mk/mkc.init.mk
new file mode 100644
index 0000000..218f57e
--- /dev/null
+++ b/mk/mkc.init.mk
@@ -0,0 +1,674 @@
+# Copyright (c) 2009-2013 by Aleksey Cheusov
+# Copyright (c) 1994-2009 The NetBSD Foundation, Inc.
+# Copyright (c) 1988, 1989, 1993 The Regents of the University of California
+# Copyright (c) 1988, 1989 by Adam de Boor
+# Copyright (c) 1989 by Berkeley Softworks
+# Copyright (c) 2009-2010 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+.ifndef OPSYS
+OPSYS != uname -s
+OPSYS := ${OPSYS:C/^CYGWIN.*$/Cygwin/}
+.endif
+TARGET_OPSYS ?= ${OPSYS}
+
+###########
+SHORTPRJNAME ?= yes
+
+.ifdef DPLIBDIRS
+.for _dir in ${DPLIBDIRS}
+.ifndef DPLIBDIRS.${_dir}
+.if ${SHORTPRJNAME:tl} == "yes"
+DPLIBDIRS.${_dir} = ${OBJDIR_${_dir:T}}
+.else
+DPLIBDIRS.${_dir} = ${OBJDIR_${_dir:S,/,_,g}}
+.endif
+.if ${TARGET_OPSYS} == "HP-UX"
+LDFLAGS += ${CFLAGS.cctold}+b ${CFLAGS.cctold}${LIBDIR}
+.endif
+LDFLAGS += -L${DPLIBDIRS.${_dir}}
+.endif
+.endfor
+
+#.undef DPLIBDIRS
+
+.endif # DPLIBDIRS
+
+######################################################################
+.ifndef __initialized__
+__initialized__ := 1
+
+.MAIN: all
+
+###########
+.sinclude <mkc_imp.vars.mk> # .sinclude for bootstrapping
+
+#.if defined(MKC_SHELL)
+#.SHELL: name=${MKC_SHELL}
+#.elif ${OPSYS} == "SunOS"
+#.SHELL: name=/usr/xpg4/bin/sh
+#.endif
+
+###########
+
+.for p in ${PROGS}
+SRCS.${p} ?= ${p}.c
+SRCS.${p} += ${SRCS} # SRCS may be changed by mkc_imp.configure.mk
+_srcsall += ${SRCS.${p}}
+.endfor
+
+.if defined(PROG)
+PROGS ?= ${PROG}
+SRCS ?= ${PROG}.c
+SRCS.${PROG} ?= ${SRCS}
+_srcsall += ${SRCS}
+.elif defined(LIB)
+SRCS ?= ${LIB}.c
+_srcsall += ${SRCS}
+.endif # defined(PROG)
+
+.if !empty(_srcsall:U:M*.cxx) || !empty(_srcsall:U:M*.cpp) || !empty(_srcsall:U:M*.C) || !empty(_srcsall:U:M*.cc)
+src_type += cxx
+LDCOMPILER = yes
+LDREAL ?= ${CXX}
+.elif !empty(_srcsall:U:M*.pas) || !empty(_srcsall:U:M*.p)
+src_type += pas
+LDCOMPILER = yes
+LDREAL ?= ${PC}
+.endif
+
+LDCOMPILER.Interix = yes
+LDCOMPILER.Darwin = yes
+#LDCOMPILER.HP-UX= yes
+LDCOMPILER ?= ${LDCOMPILER.${TARGET_OPSYS}:Uyes}
+
+.if !empty(_srcsall:U:M*.c) || !empty(_srcsall:U:M*.l) || !empty(_srcsall:U:M*.y) || defined(MKC_SOURCE_FUNCLIBS)
+src_type += c
+.endif
+
+src_type ?= 0
+
+.if ${LDCOMPILER:tl} == "yes"
+LDREAL ?= ${CC}
+.endif
+
+.if defined(PROGS)
+LDREAL ?= ${CC}
+.else
+LDREAL ?= ${LD}
+.endif
+
+MKC_CACHEDIR ?= ${.OBJDIR} # directory for cache and intermediate files
+
+init_make_level ?= 0 # for mkc.configure.mk
+
+.if ${.MAKE.LEVEL} == ${init_make_level}
+SRCTOP ?= ${.CURDIR}
+OBJTOP ?= ${.OBJDIR}
+.endif
+
+###########
+.if exists(${.CURDIR}/Makefile.rec)
+REC_MAKEFILES += ${.CURDIR}/Makefile.rec
+.endif
+.for dir in ${REC_MAKEFILES}
+.include "${dir}"
+.endfor
+
+.if ${SRCTOP:U} != ${.CURDIR} && exists(${.CURDIR}/../Makefile.inc)
+.include "${.CURDIR}/../Makefile.inc"
+.endif
+
+###########
+
+PROJECTNAME ?= ${!empty(PROG):?${PROG}:${!empty(LIB):?${LIB}:${.CURDIR:T}}}
+
+.if defined(MAKECONF) && exists(${MAKECONF})
+.include "${MAKECONF}"
+.elif defined(MKC_SYSCONFDIR) && exists(${MKC_SYSCONFDIR}/mk.conf)
+.include "${MKC_SYSCONFDIR}/mk.conf"
+.elif exists(/etc/mk.conf)
+.include "/etc/mk.conf"
+.endif
+
+.if ${OPSYS:Ux} == "SunOS"
+_MKC_USER != /usr/xpg4/bin/id -un
+_MKC_GROUP != /usr/xpg4/bin/id -gn
+.else
+_MKC_USER != id -un
+_MKC_GROUP != id -gn
+.endif
+
+.if ${_MKC_USER} != root && ${OPSYS}${_MKC_USER} != "InterixAdministrator"
+ROOT_USER ?= ${_MKC_USER}
+ROOT_GROUP ?= ${_MKC_GROUP}
+.endif
+
+# Define MANZ to have the man pages compressed (gzip)
+#MANZ= 1
+
+PREFIX ?= /usr/local
+
+BINDIR ?= ${PREFIX}/bin
+SBINDIR ?= ${PREFIX}/sbin
+FILESDIR ?= ${PREFIX}/bin
+LIBEXECDIR ?= ${PREFIX}/libexec
+INCSDIR ?= ${PREFIX}/include
+DATADIR ?= ${PREFIX}/share
+SYSCONFDIR ?= ${PREFIX}/etc
+INFODIR ?= ${PREFIX}/info
+MANDIR ?= ${PREFIX}/man
+LIBDIR ?= ${PREFIX}/lib
+SCRIPTSDIR ?= ${BINDIR}
+
+DOCDIR? = ${DATADIR}/doc
+HTMLDOCDIR ?= ${DOCDIR}/html
+HTMLDIR ?= ${MANDIR}
+
+BINGRP ?= ${ROOT_GROUP}
+BINOWN ?= ${ROOT_USER}
+
+SHLIBMODE.HP-UX = ${BINMODE}
+SHLIBMODE.OSF1 = ${BINMODE}
+SHLIBMODE.Interix = ${BINMODE}
+SHLIBMODE ?= ${SHLIBMODE.${TARGET_OPSYS}:U${NONBINMODE}}
+
+ROOT_GROUP.NetBSD = wheel
+ROOT_GROUP.OpenBSD = wheel
+ROOT_GROUP.FreeBSD = wheel
+ROOT_GROUP.Darwin = wheel
+ROOT_GROUP.DragonFly = wheel
+ROOT_GROUP.MirBSD = wheel
+ROOT_GROUP.HP-UX = bin
+ROOT_GROUP.OSF1 = bin
+ROOT_GROUP.Interix = +Administrators
+ROOR_GROUP.Haiku = root
+
+ROOT_USER.HP-UX = bin
+ROOT_USER.OSF1 = bin
+ROOT_USER.Interix = Administrator
+ROOT_USER.Haiku = user
+
+ROOT_USER ?= ${ROOT_USER.${OPSYS}:Uroot}
+ROOT_GROUP ?= ${ROOT_GROUP.${OPSYS}:Uroot}
+
+BINMODE.Interix.Administrator = 775
+NONBINMODE.Interix.Administrator = 664
+
+BINMODE ?= ${BINMODE.${TARGET_OPSYS}.${ROOT_USER}:U755}
+NONBINMODE ?= ${BINMODE.${TARGET_OPSYS}.${ROOT_USER}:U644}
+DIRMODE ?= ${BINMODE}
+
+MANGRP ?= ${ROOT_GROUP}
+MANOWN ?= ${ROOT_USER}
+MANMODE ?= ${NONBINMODE}
+MANINSTALL ?= maninstall catinstall
+
+INFOGRP ?= ${ROOT_GROUP}
+INFOOWN ?= ${ROOT_USER}
+INFOMODE ?= ${NONBINMODE}
+
+LIBGRP ?= ${BINGRP}
+LIBOWN ?= ${BINOWN}
+LIBMODE ?= ${NONBINMODE}
+
+DOCGRP ?= ${ROOT_GROUP}
+DOCOWN ?= ${ROOT_USER}
+DOCMODE ?= ${NONBINMODE}
+
+FILESOWN ?= ${BINOWN}
+FILESGRP ?= ${BINGRP}
+FILESMODE ?= ${NONBINMODE}
+
+SCRIPTSOWN ?= ${BINOWN}
+SCRIPTSGRP ?= ${BINGRP}
+SCRIPTSMODE ?= ${BINMODE}
+
+COPY ?= -c
+PRESERVE ?=
+STRIPFLAG ?= -s
+
+MKINSTALL ?= yes
+
+MKCATPAGES ?= no
+MKHTML ?= no
+MKDOC ?= yes
+MKINFO ?= yes
+MKMAN ?= yes
+MKSHARE ?= yes
+
+#
+# MKOBJDIRS controls whether object dirs are created during "make all" or "make obj".
+#
+MKOBJDIRS ?= auto
+MKRELOBJDIR ?= no
+
+MKPIE ?= no
+USE_SSP ?= no
+USE_RELRO ?= no
+USE_FORT ?= no
+
+MKDLL ?= no
+.if ${MKDLL:tl} == "only"
+MKDLL = yes
+MKSTATICLIB ?= no
+.else
+MKSTATICLIB ?= yes
+.endif # MKDLL
+
+SHLIB_MINOR ?= 0
+.if ${MKDLL:tl} != "no"
+SHLIB_MAJOR ?= 1
+.endif # MKDLL
+
+.if defined(SHLIB_MAJOR)
+MKSHLIB ?= yes
+.else
+MKSHLIB ?= no
+.endif # SHLIB_MAJOR
+
+MKPICLIB ?= no
+MKPROFILELIB ?= no
+
+MKINSTALLDIRS ?= yes
+
+EXPORT_VARNAMES += MKC_CACHEDIR REC_MAKEFILES TARGETS SHORTPRJNAME SRCTOP OBJTOP
+
+EXPORT_DYNAMIC ?= no
+
+DISTCLEANFILES += ${MKC_CACHEDIR}/_mkc_*
+
+.include <mkc_imp.platform.sys.mk>
+
+######
+.SUFFIXES: .a .o .op .os .s .S .c .cc .cpp .cxx .C .F .f .r .m .y .l .cl .p .h
+
+.LIBS: .a
+
+.if ${MKPIE:U:tl} == "yes"
+LDFLAGS.prog += ${LDFLAGS.pie}
+CFLAGS += ${CFLAGS.pie}
+CXXFLAGS += ${CXXFLAGS.pie}
+.endif
+
+.if ${USE_SSP:U:tl} == "yes"
+CFLAGS += ${CFLAGS.ssp}
+CXXFLAGS += ${CXXFLAGS.ssp}
+.endif
+
+.if ${USE_RELRO:U:tl} == "yes"
+LDFLAGS.prog += ${LDFLAGS.relro}
+.endif
+
+.if ${USE_FORT:U:tl} == "yes"
+CPPFLAGS += -D_FORTIFY_SOURCE=2
+.endif
+
+SHRTOUT ?= no
+
+.if ${SHRTOUT:tl} != "no"
+_MESSAGE ?= echo
+_MESSAGE_V ?= :
+_V ?= @
+.else
+_MESSAGE ?= :
+_MESSAGE_V ?= echo
+_V ?=
+.endif
+
+AR ?= ar
+ARFLAGS ?= rl
+RANLIB ?= ranlib
+MESSAGE.ar ?= @${_MESSAGE} "AR: ${.TARGET}"
+
+AS ?= as
+AFLAGS ?=
+COMPILE.s ?= ${_V} ${CC_PREFIX} ${CC} ${AFLAGS} -c
+LINK.s ?= ${_V} ${CC} ${AFLAGS} ${LDFLAGS}
+MESSAGE.s ?= @${_MESSAGE} "AS: ${.IMPSRC}"
+
+CC ?= cc
+CFLAGS ?=
+COMPILE.c ?= ${_V} ${CC_PREFIX} ${CC} ${CFLAGS} ${CPPFLAGS} ${CFLAGS.warnerr} -c
+LINK.c ?= ${_V} ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} ${LDFLAGS.prog}
+MESSAGE.c ?= @${_MESSAGE} "CC: ${.IMPSRC}"
+
+CXX ?= c++
+CXXFLAGS += ${CFLAGS}
+COMPILE.cc ?= ${_V} ${CXX_PREFIX} ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${CFLAGS.warnerr} -c
+LINK.cc ?= ${_V} ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} ${LDFLAGS.prog}
+MESSAGE.cc ?= @${_MESSAGE} "CXX: ${.IMPSRC}"
+
+OBJC ?= ${CC}
+OBJCFLAGS ?= ${CFLAGS}
+COMPILE.m ?= ${_V} ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
+LINK.m ?= ${_V} ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
+MESSAGE.m ?= @${_MESSAGE} "OBJC: ${.IMPSRC}"
+
+CPP ?= cpp
+CPPFLAGS ?=
+
+FC ?= f77
+FFLAGS ?= -O
+RFLAGS ?=
+COMPILE.f ?= ${_V} ${FC} ${FFLAGS} -c
+LINK.f ?= ${_V} ${FC} ${FFLAGS} ${LDFLAGS}
+MESSAGE.f ?= @${_MESSAGE} "FC: ${.IMPSRC}"
+COMPILE.F ?= ${_V} ${FC} ${FFLAGS} ${CPPFLAGS} -c
+LINK.F ?= ${_V} ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
+MESSAGE.F ?= ${MESSAGE.f}
+COMPILE.r ?= ${_V} ${FC} ${FFLAGS} ${RFLAGS} -c
+LINK.r ?= ${_V} ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
+MESSAGE.r ?= ${MESSAGE.f}
+
+MESSAGE.ld ?= @${_MESSAGE} "LD: ${.TARGET}"
+
+CLEANFILES_CMD ?= ${RM} -f
+CLEANDIRS_CMD ?= ${RM} -rf
+
+INSTALL ?= install
+UNINSTALL ?= ${RM} -f
+
+LEX ?= lex
+LFLAGS ?=
+LEX.l ?= ${_V} ${LEX} ${LFLAGS}
+MESSAGE.l ?= @${_MESSAGE} "LEX: ${.IMPSRC}"
+
+LD.SunOS ?= /usr/ccs/bin/ld
+LD.OSF1 ?= /usr/bin/ld
+LD ?= ${LD.${TARGET_OPSYS}:Uld}
+LDFLAGS ?=
+
+LN ?= ln
+LN_S ?= ${LN} -s
+
+LORDER ?= lorder
+
+NM ?= nm
+
+MKDIR ?= mkdir
+
+PC ?= pc
+PFLAGS ?=
+COMPILE.p ?= ${_V} ${PC} ${PFLAGS} ${CPPFLAGS} -c
+LINK.p ?= ${_V} ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
+MESSAGE.p ?= @${_MESSAGE} "PC: ${.IMPSRC}"
+
+SHELL ?= sh
+
+SIZE ?= size
+
+TSORT ?= tsort -q
+
+YACC ?= yacc
+YFLAGS ?=
+YACC.y ?= ${_V} ${YACC} ${YFLAGS}
+MESSAGE.y ?= @${_MESSAGE} "YACC: ${.IMPSRC}"
+
+TAR ?= tar
+GZIP ?= gzip
+BZIP2 ?= bzip2
+ZIP ?= zip
+
+OBJCOPY ?= objcopy
+
+OBJDUMP ?= objdump
+
+STRIP ?= strip
+
+RM ?= rm
+
+#ADDR2LINE ?= addr2line
+#READELF ?= readelf
+#STRINGS ?= strings
+
+# C
+_PN = ${PROJECTNAME} # short synonym
+
+.c.o:
+ ${MESSAGE.c}
+ ${COMPILE.c} ${CPPFLAGS_${_PN}} ${CFLAGS_${_PN}} \
+ ${COPTS_${_PN}} -o ${.TARGET} ${.IMPSRC}
+.c.op:
+ ${MESSAGE.c}
+ ${COMPILE.c} -pg ${CPPFLAGS_${_PN}} ${CFLAGS_${_PN}} \
+ ${COPTS_${_PN}} -o ${.TARGET} ${.IMPSRC}
+.c.os:
+ ${MESSAGE.c}
+ ${COMPILE.c} ${CFLAGS.pic} ${CPPFLAGS_${_PN}} \
+ ${CFLAGS_${_PN}} ${COPTS_${_PN}} -o ${.TARGET} ${.IMPSRC}
+
+# C++
+.cc.o .cpp.o .cxx.o .C.o:
+ ${MESSAGE.cc}
+ ${COMPILE.cc} ${CPPFLAGS_${_PN}} ${CXXFLAGS_${_PN}} \
+ ${COPTS_${_PN}} -o ${.TARGET} ${.IMPSRC}
+.cc.op .C.op .cpp.op:
+ ${MESSAGE.cc}
+ ${COMPILE.cc} -pg ${CPPFLAGS_${_PN}} ${CXXFLAGS_${_PN}} \
+ ${COPTS_${_PN}} -o ${.TARGET} ${.IMPSRC}
+.cc.os .C.os .cpp.os:
+ ${MESSAGE.cc}
+ ${COMPILE.cc} ${CXXFLAGS.pic} ${CPPFLAGS_${_PN}} \
+ ${CXXFLAGS_${_PN}} ${COPTS_${_PN}} -o ${.TARGET} ${.IMPSRC}
+
+# Fortran/Ratfor
+.f.o:
+ ${MESSAGE.f}
+ ${COMPILE.f} ${FFLAGS_${_PN}} -o ${.TARGET} ${.IMPSRC}
+.f.op:
+ ${MESSAGE.f}
+ ${COMPILE.f} -pg ${FFLAGS_${_PN}} -o ${.TARGET} ${.IMPSRC}
+.f.os:
+ ${MESSAGE.f}
+ ${COMPILE.f} ${FFLAGS.pic} ${FFLAGS_${_PN}} -o ${.TARGET} ${.IMPSRC}
+
+#.F:
+.F.o:
+ ${MESSAGE.F}
+ ${COMPILE.F} -o ${.TARGET} ${.IMPSRC}
+
+#.r:
+.r.o:
+ ${MESSAGE.r}
+ ${COMPILE.r} -o ${.TARGET} ${.IMPSRC}
+
+# Pascal
+.p.o:
+ ${MESSAGE.p}
+ ${COMPILE.p} -o ${.TARGET} ${.IMPSRC}
+
+# Assembly
+.S.o .s.o:
+ ${MESSAGE.s}
+ ${COMPILE.s} -o ${.TARGET} ${.IMPSRC}
+.S.op .s.op:
+ ${MESSAGE.s}
+ ${COMPILE.s} -o ${.TARGET} -pg ${.IMPSRC}
+.S.os .s.os:
+ ${MESSAGE.s}
+ ${COMPILE.s} ${CAFLAGS.pic} -o ${.TARGET} ${.IMPSRC}
+
+# Objective-C
+.m.o:
+ ${MESSAGE.m}
+ ${COMPILE.m} ${.IMPSRC}
+.m.op:
+ ${MESSAGE.m}
+ ${COMPILE.m} -pg -o ${.TARGET} ${.IMPSRC}
+.m.os:
+ ${MESSAGE.m}
+ ${COMPILE.m} ${CMFLAGS.pic} -o ${.TARGET} ${.IMPSRC}
+
+# Lex
+LPREFIX ?= yy
+.if ${LPREFIX} != "yy"
+LFLAGS += -P${LPREFIX}
+.endif
+LEXLIB ?= -ll
+
+.l.c:
+ ${MESSAGE.l}
+ ${LEX.l} -t ${.IMPSRC} > ${.TARGET}
+
+# Yacc
+YFLAGS += ${YPREFIX:D-p${YPREFIX}} ${YHEADER:D-d}
+
+.y.h: ${.TARGET:R}.c
+.y.c:
+ ${MESSAGE.y}
+ ${YACC.y} ${.IMPSRC}
+ ${_V}mv y.tab.c ${.TARGET}
+.ifdef YHEADER
+ ${_V}mv y.tab.h ${.TARGET:R}.h
+.endif
+
+###########
+.include <mkc_imp.obj.mk>
+
+###########
+.if !empty(_srcsall:U:M*.y)
+MKC_REQUIRE_PROGS += ${YACC:[1]}
+MKC_PROG.id.${YACC:[1]:S/+/x/g} = yacc
+.endif
+
+.if !empty(_srcsall:U:M*.l)
+MKC_REQUIRE_PROGS += ${LEX:[1]}
+MKC_PROG.id.${LEX:[1]:S/+/x/g} = lex
+.endif
+
+.if !empty(_srcsall:U:M*.c) || !empty(_srcsall:U:M*.l) || !empty(_srcsall:U:M*.y)
+MKC_REQUIRE_PROGS += ${CC:[1]}
+MKC_PROG.id.${CC:[1]:S|+|x|g} = cc
+.endif
+
+.if !empty(_srcsall:U:M*.cc) || !empty(_srcsall:U:M*.C) || !empty(_srcsall:U:M*.cxx) || !empty(_srcsall:U:M*.cpp)
+MKC_REQUIRE_PROGS += ${CXX:[1]}
+MKC_PROG.id.${CXX:[1]:S/+/x/g} = cxx
+.endif
+
+.if !empty(_srcsall:U:M*.f)
+MKC_REQUIRE_PROGS += ${FC:[1]}
+MKC_PROG.id.${FC:[1]:S/+/x/g} = fc
+.endif
+
+.if !empty(_srcsall:U:M*.p)
+MKC_REQUIRE_PROGS += ${PC:[1]}
+MKC_PROG.id.${PC:[1]:S/+/x/g} = pc
+.endif
+
+###########
+.PHONY : print-values
+print-values :
+.for v in ${VARS}
+ @printf "%s=%s\n" ${v} ${${v}:Q}
+.endfor
+
+.PHONY : print-values2
+print-values2 :
+.for v in ${VARS}
+ @printf "%s\n" ${${v}:Q}
+.endfor
+
+###########
+.PHONY: realall realerrorcheck
+
+__errorcheck: .USE
+ @if test -n '${MKC_ERR_MSG}'; then \
+ for msg in '' ${MKC_ERR_MSG}; do \
+ fn=`printf '%s\n' "$$msg" | sed -n 's/^%%%: //p'`; \
+ if test -n "$$fn"; then \
+ awk '{print "ERROR: " $$0}' "$$fn"; ex=1; \
+ elif test -n "$$msg"; then printf '%s\n' "$$msg"; ex=1; \
+ fi; \
+ done; \
+ exit $$ex; \
+ fi
+
+realall : realerrorcheck
+realerrorcheck: __errorcheck
+
+###########
+
+.if defined(MKC_REQD) && defined(MKC_VERSION)
+_mkc_version_ok != mkc_check_version ${MKC_REQD} ${MKC_VERSION}
+.if !${_mkc_version_ok}
+MKC_ERR_MSG += "ERROR: We need mk-configure v.${MKC_REQD} while ${MKC_VERSION} is detected"
+MKCHECKS = no
+.endif
+.endif
+
+###########
+
+LDLIBS = ${LDFLAGS} ${LDADD}
+
+###########
+# skip uninstalling files and creating destination dirs for mkc.subprj.mk
+.if !defined(SUBPRJ)
+
+uninstall:
+ -${UNINSTALL} ${UNINSTALLFILES}
+
+installdirs:
+ for d in _ ${INSTALLDIRS:O:u:S|/.$||}; do \
+ test "$$d" = _ || ${INSTALL} -d -m ${DIRMODE} "$$d"; \
+ done
+
+filelist:
+ @for d in ${UNINSTALLFILES:O:u}; do \
+ echo $$d; \
+ done
+
+test:
+
+.endif # SUBPRJ
+
+TARGETS += all all install clean cleandir depend test \
+ installdirs uninstall errorcheck filelist obj
+TARGETS := ${TARGETS:O:u}
+
+# Make sure all of the standard targets are defined, even if they do nothing.
+.PHONY: ${TARGETS} realinstall realinstall2 realall
+${TARGETS} realinstall realinstall2 realall:
+
+distclean: cleandir
+
+all: realall
+
+.if ${MKINSTALLDIRS:tl} == "yes"
+install: installdirs .WAIT realinstall .WAIT realinstall2
+.else
+install: realinstall .WAIT realinstall2
+.endif
+
+
+###########
+
+VERBOSE_ECHO ?= echo
+### for mkc.subdir.mk and mkc.subprj.mk
+__recurse: .USE
+ @targ=${.TARGET:S/^nodeps-//:C/-.*$//}; \
+ dir=${.TARGET:S/^nodeps-//:C/^[^-]*-//}; \
+ if ! test -f ${.CURDIR}/$$dir/Makefile; then exit 0; fi; \
+ test "$${targ}_${MKINSTALL:tl}" = 'install_no' && exit 0; \
+ test "$${targ}_${MKINSTALL:tl}" = 'installdirs_no' && exit 0; \
+ ${export_cmd} \
+ set -e; \
+ ${VERBOSE_ECHO} ================================================== 1>&2;\
+ case "$$dir" in /*) \
+ ${VERBOSE_ECHO} "$$targ ===> $$dir" 1>&2; \
+ cd "$$dir"; \
+ env "_THISDIR_=$$dir/" ${MAKE} ${MAKEFLAGS} $$targ; \
+ ;; \
+ *) \
+ ${VERBOSE_ECHO} "$$targ ===> ${_THISDIR_}$$dir" 1>&2; \
+ cd "${.CURDIR}/$$dir"; \
+ env "_THISDIR_=${_THISDIR_}$$dir/" ${MAKE} ${MAKEFLAGS} $$targ; \
+ ;; \
+ esac
+
+###########
+
+.endif # __initialized__
diff --git a/mk/mkc.lib.mk b/mk/mkc.lib.mk
new file mode 100644
index 0000000..299adb6
--- /dev/null
+++ b/mk/mkc.lib.mk
@@ -0,0 +1,2 @@
+_top_mk := mkc.lib.mk
+.include <mkc.mk>
diff --git a/mkc.minitest.mk b/mk/mkc.minitest.mk
index f3aca16..e62be8a 100644
--- a/mkc.minitest.mk
+++ b/mk/mkc.minitest.mk
@@ -1,14 +1,16 @@
-# Copyright (c) 2009-2010 by Aleksey Cheusov
+# Copyright (c) 2009-2013 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
-.PHONY : test all
-test: all
+TEST_PREREQS ?= all
+
+.PHONY : test
+test: ${TEST_PREREQS}
@echo 'Testing ${.CURDIR}... ' 1>&2; \
set -e; cd ${.CURDIR}; \
tmp_out=${.OBJDIR}/${.CURDIR:T}.test.out; \
- rm -f $$tmp_out; \
+ ${RM} -f $$tmp_out; \
${MAKE} ${MAKEFLAGS} test_output > $$tmp_out.tmp; \
mv $$tmp_out.tmp $$tmp_out; \
if test -f ${.CURDIR}/expect.${OPSYS}.out; then \
diff --git a/mk/mkc.mk b/mk/mkc.mk
new file mode 100644
index 0000000..3528e5a
--- /dev/null
+++ b/mk/mkc.mk
@@ -0,0 +1,21 @@
+# Copyright (c) 2013 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+.ifndef _MKC_MK
+_MKC_MK := 1
+
+init_make_level ?= 0
+
+.if defined(SRCTOP) && ${SRCTOP:U} != ${.CURDIR} && ${.MAKE.LEVEL} == ${init_make_level}
+MKC_CACHEDIR ?= ${SRCTOP}
+.export MKC_CACHEDIR
+.MAIN: all
+.DEFAULT:
+ @set -e; cd ${SRCTOP}; ${MAKE} ${MAKEFLAGS} ${.TARGET}-${.CURDIR:S,${SRCTOP}/,,}
+.else
+.include <mkc_imp.mk>
+.endif #SRCTOP
+
+.endif # _MKC_MK
diff --git a/mk/mkc.prog.mk b/mk/mkc.prog.mk
new file mode 100644
index 0000000..ee33237
--- /dev/null
+++ b/mk/mkc.prog.mk
@@ -0,0 +1,2 @@
+_top_mk := mkc.prog.mk
+.include <mkc.mk>
diff --git a/mk/mkc.subdir.mk b/mk/mkc.subdir.mk
new file mode 100644
index 0000000..d13879d
--- /dev/null
+++ b/mk/mkc.subdir.mk
@@ -0,0 +1,2 @@
+_top_mk := mkc.subdir.mk
+.include <mkc.mk>
diff --git a/mk/mkc.subprj.mk b/mk/mkc.subprj.mk
new file mode 100644
index 0000000..ef6e0b2
--- /dev/null
+++ b/mk/mkc.subprj.mk
@@ -0,0 +1,2 @@
+_top_mk := mkc.subprj.mk
+.include <mkc.mk>
diff --git a/mkc_imp.arch.mk b/mk/mkc_imp.arch.mk
index 81774b2..fda3999 100644
--- a/mkc_imp.arch.mk
+++ b/mk/mkc_imp.arch.mk
@@ -1,6 +1,6 @@
# Copyright (c) 2010 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
.ifndef _MKC_IMP_ARCH_MK
@@ -13,12 +13,12 @@ basefile = ${.CURDIR}/${PROJECTNAME}
.PHONY: bin_cleanup bin_tar bin_targz bin_tarbz2
bin_cleanup:
- set -e; rm -rf ${destdir}; mkdir -m 0700 ${destdir}; \
+ set -e; ${RM} -rf ${destdir}; ${MKDIR} -m 0700 ${destdir}; \
${MAKE} ${MAKEFLAGS} all install DESTDIR=${destdir}
bin_tar: bin_cleanup
- set -e; rm -f ${basefile}.tar; cd ${destdir}; \
- ${TAR} -cf ${basefile}.tar .; cd /; rm -rf ${destdir}
+ set -e; ${RM} -f ${basefile}.tar; cd ${destdir}; \
+ ${TAR} -cf ${basefile}.tar .; cd /; ${RM} -rf ${destdir}
bin_targz: bin_tar
${GZIP} ${basefile}.tar
@@ -27,12 +27,12 @@ bin_tarbz2: bin_tar
${BZIP2} ${basefile}.tar
bin_zip: bin_cleanup
- set -e; rm -f ${basefile}.zip; cd ${destdir}; \
- ${ZIP} -r ${basefile}.zip .; rm -rf ${destdir}
+ set -e; ${RM} -f ${basefile}.zip; cd ${destdir}; \
+ ${ZIP} -r ${basefile}.zip .; ${RM} -rf ${destdir}
bin_deb: DEBIAN/control bin_cleanup
- set -e; cp -rp DEBIAN ${destdir}; rm -rf ${destdir}/DEBIAN/CVS; \
+ set -e; cp -rp DEBIAN ${destdir}; ${RM} -rf ${destdir}/DEBIAN/CVS; \
dpkg-deb -b ${destdir} ${.CURDIR:T:S/_/-/g}.deb; \
- rm -rf ${destdir}
+ ${RM} -rf ${destdir}
.endif # _MKC_IMP_ARCH_MK
diff --git a/mk/mkc_imp.dep.mk b/mk/mkc_imp.dep.mk
new file mode 100644
index 0000000..bf5c512
--- /dev/null
+++ b/mk/mkc_imp.dep.mk
@@ -0,0 +1,96 @@
+# Copyright (c) 2010-1013 by Aleksey Cheusov
+# Copyright (c) 1994-2009 The NetBSD Foundation, Inc.
+
+######################################################################
+.ifndef _MKC_IMP_DEP_MK
+_MKC_IMP_DEP_MK := 1
+
+DISTCLEANFILES += .depend ${__DPSRCS.d} ${CLEANDEPEND}
+
+##### Basic targets
+.PHONY: _beforedepend depend
+_beforedepend .depend: # ensure existence
+
+.ORDER: _beforedepend .depend
+depend: _beforedepend .depend
+
+##### Default values
+MKDEP ?= mkdep
+MKDEP_SUFFIXES ?= .o .os .op
+
+##### Build rules
+# some of the rules involve .h sources, so remove them from mkdep line
+
+.if defined(_SRCS_ALL)
+__DPSRCS.all = ${_SRCS_ALL:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \
+ ${DPSRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/}
+__DPSRCS.d = ${__DPSRCS.all:O:u:M*.d}
+__DPSRCS.notd = ${__DPSRCS.all:O:u:N*.d}
+
+_beforedepend: ${DPSRCS}
+
+MESSAGE.dep ?= @${_MESSAGE} "DEP: ${.TARGET}"
+
+.NOPATH: .depend ${__DPSRCS.d}
+
+.if !empty(__DPSRCS.d)
+${__DPSRCS.d}: ${__DPSRCS.notd} ${DPSRCS}
+.endif # __DPSRCS.d
+
+.if ${MKDEP_TYPE:U} == "nbmkdep"
+ddash=--
+.else
+ddash=
+.endif
+
+.if ${MKDEP_TYPE:U} == "makedepend"
+MKDEP.c = @${MAKEDEPEND} -f- ${ddash} ${MKDEPFLAGS} \
+ ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET}
+MKDEP.m = @${MKDEP} -f- ${ddash} ${MKDEPFLAGS} \
+ ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET}
+MKDEP.cc = @${MKDEP} -f- ${ddash} ${MKDEPFLAGS} \
+ ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET}
+MKDEP.s = @${MKDEP} -f- ${ddash} ${MKDEPFLAGS} \
+ ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET}
+.else
+MKDEP.c = @${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \
+ ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS}
+MKDEP.m = @${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \
+ ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS}
+MKDEP.cc = @${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \
+ ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS}
+MKDEP.s = @${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \
+ ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS}
+.endif
+
+.depend: ${__DPSRCS.d}
+ ${MESSAGE.dep}
+ @${RM} -f ${.TARGET}
+.if ${MKDEP_TYPE:U} == "nbmkdep"
+ @${MKDEP} -d -f ${.TARGET} -s ${MKDEP_SUFFIXES:Q} ${__DPSRCS.d}
+.else
+ @sed 's/^\([^ ]*\)[.]o\(.*\)$$/${MKDEP_SUFFIXES:C,^,\\\\1,}\2/' ${__DPSRCS.d} > ${.TARGET}
+.endif
+
+.SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m
+
+.c.d:
+ ${MESSAGE.dep}
+ @${MKDEP.c} ${.IMPSRC}
+
+.m.d:
+ ${MESSAGE.dep}
+ @${MKDEP.m} ${.IMPSRC}
+
+.s.d .S.d:
+ ${MESSAGE.dep}
+ @${MKDEP.s} ${.IMPSRC}
+
+.C.d .cc.d .cpp.d .cxx.d:
+ ${MESSAGE.dep}
+ @${MKDEP.cc} ${.IMPSRC}
+
+.endif # defined(SRCS)
+
+######################################################################
+.endif # _MKC_IMP_DEP_MK
diff --git a/mkc_imp.files.mk b/mk/mkc_imp.files.mk
index 6dd3109..e1cb16f 100644
--- a/mkc_imp.files.mk
+++ b/mk/mkc_imp.files.mk
@@ -4,13 +4,13 @@
# Copyright (c) 1988, 1989 by Adam de Boor
# Copyright (c) 1989 by Berkeley Softworks
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
.if !defined(_BSD_FILES_MK)
_BSD_FILES_MK := 1
-.include <mkc_imp.init.mk>
+.include <mkc.init.mk>
.PHONY: filesinstall
realinstall: filesinstall
@@ -22,7 +22,7 @@ realall: ${FILES}
.if ${MKINSTALL:tl} == "yes"
destination_files = ${FILES:@F@${DESTDIR}${FILESDIR_${F}:U${FILESDIR}}/${FILESNAME_${F}:U${FILESNAME:U${F:T}}}@}
-filesinstall:: ${destination_files}
+filesinstall: ${destination_files}
.PRECIOUS: ${destination_files}
.PHONY: ${destination_files}
@@ -43,7 +43,7 @@ INSTALLDIRS += ${destination_files:H}
.endif # FILES
.if !target(filesinstall)
-filesinstall::
+filesinstall:
.endif
.endif # _BSD_FILES_MK
diff --git a/mkc_imp.final.mk b/mk/mkc_imp.final.mk
index 0c1e957..e7fdb49 100644
--- a/mkc_imp.final.mk
+++ b/mk/mkc_imp.final.mk
@@ -1,6 +1,6 @@
# Copyright (c) 2009-2012 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
.ifndef MKC_IMP.FINAL.MK
@@ -21,6 +21,11 @@ export_cmd += ${i}=${${i}:Q}; export ${i};
.endif
.endfor
+.if ${MKRELOBJDIR} == "yes" && defined(SRCTOP)
+export_cmd += MAKEOBJDIR=${.OBJDIR}/${.TARGET:C/^.*-//}; \
+ export MAKEOBJDIR; ${MKDIR} -p $${MAKEOBJDIR};
+.endif
+
##########
.if !commands(clean)
clean: mkc_clean
@@ -28,10 +33,10 @@ clean: mkc_clean
mkc_clean:
.if ${CLEANFILES:U} != ""
- -rm -f ${CLEANFILES} 2>/dev/null
+ -${CLEANFILES_CMD} ${CLEANFILES}
.endif
.if ${CLEANDIRS:U} != ""
- -rm -rf ${CLEANDIRS} 2>/dev/null
+ -${CLEANDIRS_CMD} ${CLEANDIRS}
.endif
#####
@@ -42,10 +47,10 @@ cleandir: mkc_cleandir
mkc_cleandir:
.if ${CLEANFILES:U} != "" || ${DISTCLEANFILES:U} != ""
- -rm -f ${DISTCLEANFILES} ${CLEANFILES} 2>/dev/null
+ -${CLEANFILES_CMD} ${DISTCLEANFILES} ${CLEANFILES}
.endif
.if ${CLEANDIRS:U} != "" || ${DISTCLEANDIRS:U} != ""
- -rm -rf ${DISTCLEANDIRS} ${CLEANDIRS} 2>/dev/null
+ -${CLEANDIRS_CMD} ${DISTCLEANDIRS} ${CLEANDIRS}
.endif
##########
diff --git a/mkc_imp.inc.mk b/mk/mkc_imp.inc.mk
index c0c2c2c..0f0a8ba 100644
--- a/mkc_imp.inc.mk
+++ b/mk/mkc_imp.inc.mk
@@ -4,11 +4,12 @@
# Copyright (c) 1988, 1989 by Adam de Boor
# Copyright (c) 1989 by Berkeley Softworks
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
.PHONY: incinstall
realinstall: incinstall
+incinstall: # ensure existence
.if defined(INCS)
INCSSRCDIR ?= .
@@ -17,7 +18,7 @@ CPPFLAGS += -I${INCSSRCDIR}
.if ${MKINSTALL:tl} == "yes"
destination_incs = ${INCS:@I@${DESTDIR}${INCSDIR}/$I@}
-incinstall:: ${destination_incs}
+incinstall: ${destination_incs}
.PRECIOUS: ${destination_incs}
.PHONY: ${destination_incs}
@@ -27,15 +28,10 @@ __incinstall: .USE
-g ${BINGRP} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}
.for I in ${INCS:O:u}
-realall: ${INCSSRCDIR}/${I}
-${DESTDIR}${INCSDIR}/$I: ${INCSSRCDIR}/$I __incinstall
+${DESTDIR}${INCSDIR}/$I: ${"${INCSSRCDIR}" != ".":?${INCSSRCDIR}/$I:$I} __incinstall
.endfor
UNINSTALLFILES += ${destination_incs}
INSTALLDIRS += ${destination_incs:H}
.endif # MKINSTALL
.endif # INCS
-
-.if !target(incinstall)
-incinstall::
-.endif
diff --git a/mkc_imp.info.mk b/mk/mkc_imp.info.mk
index 4e54bc0..3a97ca5 100644
--- a/mkc_imp.info.mk
+++ b/mk/mkc_imp.info.mk
@@ -4,13 +4,13 @@
# Copyright (c) 1988, 1989 by Adam de Boor
# Copyright (c) 1989 by Berkeley Softworks
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
.if !defined(_MKC_IMP_INFO_MK) && defined(TEXINFO)
_MKC_IMP_INFO_MK := 1
-.include <mkc_imp.init.mk>
+.include <mkc.init.mk>
MAKEINFO ?= makeinfo
INFOFLAGS ?=
@@ -56,10 +56,10 @@ realinstall: infoinstall
.for F in ${INFOFILES:O:u}
${DESTDIR}${INFODIR_${F}:U${INFODIR}}/${INFONAME_${F}:U${INFONAME:U${F:T}}}: ${F} __infoinstall
.endfor # F
-.endif # MKINSTALL
UNINSTALLFILES += ${destination_infos}
INSTALLDIRS += ${destination_infos:H}
+.endif # MKINSTALL
.endif # MKINFO
.endif # TEXINFO
diff --git a/mkc_imp.intexts.mk b/mk/mkc_imp.intexts.mk
index 4ccdefb..cdfb2a4 100644
--- a/mkc_imp.intexts.mk
+++ b/mk/mkc_imp.intexts.mk
@@ -1,6 +1,6 @@
# Copyright (c) 2009-2010 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
# Given a list of files in INFILES or INSCRIPTS mkc.intexts.mk
@@ -23,27 +23,30 @@ INTEXTS_SED += -e 's,@datadir@,${DATADIR},g'
INTEXTS_SED += -e 's,@mandir@,${MANDIR},g'
INTEXTS_SED += -e 's,@incsdir@,${INCSDIR},g'
+.if !make(clean) && !make(cleandir) && !make(distclean)
.for _pattern _repl in ${INTEXTS_REPLS}
INTEXTS_SED += -e 's,@${_pattern}@,${_repl},g'
.endfor
-
-CLEANFILES += ${INSCRIPTS} ${INFILES}
+.endif
.for i in ${INFILES}
-${i} : ${i}.in
+.NOPATH: ${i:T}
+${i:T} : ${i}.in
${MESSAGE.gen}
${_V} sed ${INTEXTS_SED} ${.ALLSRC} > ${.TARGET} && \
chmod 0644 ${.TARGET}
.endfor
.for i in ${INSCRIPTS}
-${i} : ${i}.in
+.NOPATH: ${i:T}
+${i:T} : ${i}.in
${MESSAGE.gen}
${_V} sed ${INTEXTS_SED} ${.ALLSRC} > ${.TARGET} && \
chmod 0755 ${.TARGET}
.endfor
-all : ${INSCRIPTS} ${INFILES}
+CLEANFILES += ${INSCRIPTS:T} ${INFILES:T}
+realall: ${INSCRIPTS:T} ${INFILES:T}
######################################################################
.endif # _MKC_IMP_INTEXTS_MK
diff --git a/mkc_imp.lib.mk b/mk/mkc_imp.lib.mk
index 1b84b5e..b7977f6 100644
--- a/mkc_imp.lib.mk
+++ b/mk/mkc_imp.lib.mk
@@ -4,7 +4,7 @@
# Copyright (c) 1988, 1989 by Adam de Boor
# Copyright (c) 1989 by Berkeley Softworks
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
.if !defined(_MKC_IMP_LIB_MK)
@@ -65,8 +65,10 @@ _LIBS += ${SHLIBFN}
realall: ${SRCS} ${_LIBS}
+_SRCS_ALL = ${SRCS}
+
__archivebuild: .USE
- @rm -f ${.TARGET}
+ @${RM} -f ${.TARGET}
${MESSAGE.ar}
${_V} ${AR} cq ${.TARGET} ${.ALLSRC}; \
${RANLIB} ${.TARGET}
@@ -93,17 +95,17 @@ lib${LIB}_pic.a:: ${SOBJS} __archivebuild
${SHLIBFN}: ${SOBJS} ${DPADD}
.if !commands(${SHLIBFN})
@${_MESSAGE_V} building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\)
- @rm -f ${.TARGET}
+ @${RM} -f ${.TARGET}
@${_MESSAGE} "LD: ${.TARGET}"
${_V} $(LDREAL) ${LDFLAGS.shlib} -o ${.TARGET} \
${SOBJS} ${LDFLAGS} ${LDADD}
.if ${OBJECT_FMT} == "ELF" && ${MKDLL:tl} == "no"
- @ln -sf ${SHLIBFN} lib${LIB}${SHLIB_EXT}
- @ln -sf ${SHLIBFN} lib${LIB}${SHLIB_EXT1}
+ @${LN_S} -f ${SHLIBFN} lib${LIB}${SHLIB_EXT}
+ @${LN_S} -f ${SHLIBFN} lib${LIB}${SHLIB_EXT1}
.endif # ELF
.endif # !commands(...)
-CLEANFILES += a.out [Ee]rrs mklog core *.core \
+CLEANFILES += \
${OBJS} ${POBJS} ${SOBJS} \
lib${LIB}${SHLIB_EXT} lib${LIB}${SHLIB_EXT1} \
lib${LIB}${SHLIB_EXT2} lib${LIB}${SHLIB_EXT3} ${SHLIBFN}
@@ -166,9 +168,9 @@ ${DESTDIR}${LIBDIR}/${SHLIBFN}: ${SHLIBFN}
/sbin/ldconfig -m ${LIBDIR}
.endif
.if ${OBJECT_FMT} == "ELF" && ${MKDLL:tl} == "no"
- ln -sf ${SHLIBFN} \
+ ${LN_S} -f ${SHLIBFN} \
${DESTDIR}${LIBDIR}/lib${LIB}${SHLIB_EXT1}
- ln -sf ${SHLIBFN} \
+ ${LN_S} -f ${SHLIBFN} \
${DESTDIR}${LIBDIR}/lib${LIB}${SHLIB_EXT}
.endif
.endif
diff --git a/mk/mkc_imp.links.mk b/mk/mkc_imp.links.mk
new file mode 100644
index 0000000..c9f6eb3
--- /dev/null
+++ b/mk/mkc_imp.links.mk
@@ -0,0 +1,35 @@
+# Copyright (c) 2009-2013 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+.if !defined(_MKC_IMP_LINKS_MK)
+_MKC_IMP_LINKS_MK := 1
+
+.PHONY: linksinstall
+linksinstall:
+
+realinstall2: linksinstall
+
+.if ${MKINSTALL:tl} == "yes"
+
+linksinstall:
+.for l r in ${LINKS}
+ ${RM} -f ${DESTDIR}${r}; ${LN} ${DESTDIR}${l} ${DESTDIR}${r}
+.endfor
+.for l r in ${SYMLINKS}
+ ${RM} -f ${DESTDIR}${r}; ${LN_S} ${l} ${DESTDIR}${r}
+.endfor
+
+.for l r in ${LINKS}
+UNINSTALLFILES += ${DESTDIR}${r}
+INSTALLDIRS += ${DESTDIR}${r:H}
+.endfor
+
+.for l r in ${SYMLINKS}
+UNINSTALLFILES += ${DESTDIR}${r}
+INSTALLDIRS += ${DESTDIR}${r:H}
+.endfor
+
+.endif # MKINSTALL=yes
+.endif # _MKC_IMP_LINKS_MK
diff --git a/mkc_imp.lua.mk b/mk/mkc_imp.lua.mk
index bf60c5d..0c8f6d8 100644
--- a/mkc_imp.lua.mk
+++ b/mk/mkc_imp.lua.mk
@@ -1,6 +1,6 @@
# Copyright (c) 2010 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
.for i in ${LUA_LMODULES}
diff --git a/mkc_imp.man.mk b/mk/mkc_imp.man.mk
index 7837e2e..15203d4 100644
--- a/mkc_imp.man.mk
+++ b/mk/mkc_imp.man.mk
@@ -4,7 +4,7 @@
# Copyright (c) 1988, 1989 by Adam de Boor
# Copyright (c) 1989 by Berkeley Softworks
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
.if !defined(_MKC_IMP_MAN_MK)
@@ -31,8 +31,6 @@ MKCATPAGES = no
.undef MANZ
.endif
-.include <mkc_imp.init.mk>
-
.PHONY: catinstall maninstall catpages manpages catlinks \
manlinks html installhtml
.if ${MKMAN:tl} != "no"
@@ -52,21 +50,21 @@ TBL ?= tbl
${MESSAGE.nroff}
.if !defined(USETBL)
${_V} ${NROFF} ${NROFF_MAN2CAT} ${.IMPSRC} > ${.TARGET} || \
- (rm -f ${.TARGET}; false)
+ (${RM} -f ${.TARGET}; false)
.else
${_V} ${TBL} ${.IMPSRC} | ${NROFF} ${NROFF_MAN2CAT} > ${.TARGET} || \
- (rm -f ${.TARGET}; false)
+ (${RM} -f ${.TARGET}; false)
.endif
.9.html9 .8.html8 .7.html7 .6.html6 .5.html5 .4.html4 .3.html3 .2.html2 .1.html1:
.if !defined(USETBL)
@echo "${GROFF} -Tascii -mdoc2html -P-b -P-u -P-o ${.IMPSRC} > ${.TARGET}"
@${GROFF} -Tascii -mdoc2html -P-b -P-u -P-o ${.IMPSRC} > ${.TARGET} || \
- (rm -f ${.TARGET}; false)
+ (${RM} -f ${.TARGET}; false)
.else
@echo "${TBL} ${.IMPSRC} | ${GROFF} -mdoc2html -P-b -P-u -P-o > ${.TARGET}"
@cat ${.IMPSRC} | ${GROFF} -mdoc2html -P-b -P-u -P-o > ${.TARGET} || \
- (rm -f ${.TARGET}; false)
+ (${RM} -f ${.TARGET}; false)
.endif
.if defined(MAN) && !empty(MAN)
@@ -92,7 +90,7 @@ maninstall: manlinks
__installpage: .USE
.if defined(MCOMPRESS) && !empty(MCOMPRESS)
- @rm -f ${.TARGET}
+ @${RM} -f ${.TARGET}
${MCOMPRESS} ${.ALLSRC} > ${.TARGET}
@chown ${MANOWN}:${MANGRP} ${.TARGET}
@chmod ${MANMODE} ${.TARGET}
diff --git a/mkc.mk b/mk/mkc_imp.mk
index 9fce0dd..eee09fd 100644
--- a/mkc.mk
+++ b/mk/mkc_imp.mk
@@ -1,14 +1,18 @@
-# Copyright (c) 2009-2010 by Aleksey Cheusov
+# Copyright (c) 2009-2013 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
.include <mkc_imp.preinit.mk>
-.if defined(SUBPRJS)
+.ifdef SUBDIR
+SUBPRJ = ${SUBDIR}
+.endif
+
+.ifdef SUBPRJS
SUBPRJ += ${SUBPRJS} # for backward compatility only, use SUBPRJ!
.endif # defined(SUBPRJS)
-.if !defined(LIB) && !defined(SUBDIR) && !defined(SUBPRJ)
+.if !defined(LIB) && !defined(SUBPRJ)
_use_prog := 1
.endif
@@ -17,12 +21,9 @@ _use_prog := 1
.include <mkc_imp.pod.mk>
.endif # _use_prog || LIB
-.include <mkc_imp.init.mk>
+.include <mkc.init.mk>
-CLEANFILES += ${MKC_SOURCE_FUNCLIBS:D${MKC_SOURCE_FUNCLIBS}.o}
-.if ${MKCHECKS:tl} == "yes"
.include <configure.mk>
-.endif # MKCHECKS
.if !defined(MKC_ERR_MSG) || make(clean) || make(cleandir) || make(distclean)
@@ -35,42 +36,29 @@ CLEANFILES += ${MKC_SOURCE_FUNCLIBS:D${MKC_SOURCE_FUNCLIBS}.o}
.if defined(_use_prog) || defined(LIB)
.include <mkc_imp.man.mk>
.include <mkc_imp.info.mk>
-.include <mkc_imp.files.mk>
-.include <mkc_imp.scripts.mk>
.include <mkc_imp.inc.mk>
-.include <mkc_imp.links.mk>
.include <mkc_imp.intexts.mk>
.include <mkc_imp.pkg-config.mk>
.include <mkc_imp.dep.mk>
-.include <mkc_imp.sys.mk>
+.include <mkc_imp.files.mk>
+.include <mkc_imp.scripts.mk>
+.include <mkc_imp.links.mk>
.endif # _use_prog || LIB
########################################
-.if defined(SUBDIR)
-.include <mkc_imp.subdir.mk>
-
-#
-.PHONY: subdir-clean subdir-distclean
-clean: subdir-clean
-subdir-clean:
- -rm -f ${CLEANFILES} 2>/dev/null
-cleandir: subdir-distclean
-subdir-distclean:
- -rm -f ${DISTCLEANFILES} 2>/dev/null
-####################
-.elif defined(SUBPRJ)
+.if defined(SUBPRJ)
.include <mkc_imp.subprj.mk>
#
.PHONY: subprj-clean subprj-distclean
clean: subprj-clean
subprj-clean:
- -rm -f ${CLEANFILES} 2>/dev/null
+ -${CLEANFILES_CMD} -f ${CLEANFILES}
cleandir: subprj-distclean
subprj-distclean:
- -rm -f ${DISTCLEANFILES} 2>/dev/null
+ -${CLEANFILES_CMD} ${DISTCLEANFILES}
-.endif # SUBDIR || SUBPRJ
+.endif # SUBPRJ
########################################
.include <mkc_imp.arch.mk>
diff --git a/mk/mkc_imp.obj.mk b/mk/mkc_imp.obj.mk
new file mode 100644
index 0000000..77d6f44
--- /dev/null
+++ b/mk/mkc_imp.obj.mk
@@ -0,0 +1,34 @@
+# Copyright (c) 2013 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+.ifndef _MKC_IMP_OBJ_MK
+_MKC_IMP_OBJ_MK := 1
+
+obj: # ensure existence
+
+.ifdef MAKEOBJDIRPREFIX
+__objdir := ${MAKEOBJDIRPREFIX}${.CURDIR}
+.elif defined(MAKEOBJDIR)
+__objdir := ${MAKEOBJDIR}
+.endif # defined(MAKEOBJDIRPREFIX)
+
+.if defined(__objdir)
+
+.if ${MKOBJDIRS:tl} == "yes"
+.if !defined(SUBPRJ)
+obj:
+ @${MKDIR} -p ${__objdir}
+.endif # !defined(SUBPRJ)
+.elif ${MKOBJDIRS:tl} == "auto" && !exists(${__objdir}/)
+__objdir_made != if ${MKDIR} -p ${__objdir}; then echo 1; else echo 0; fi
+
+.if !${__objdir_made}
+.error could not create ${__objdir}
+.endif # ${__objdir_made}
+
+.endif # MKOBJDIRS
+
+.endif # defined(__objdir)...
+.endif # _MKC_IMP_OBJ_MK
diff --git a/mkc_imp.objdir.mk b/mk/mkc_imp.objdir.mk
index 8f2f375..98c8039 100644
--- a/mkc_imp.objdir.mk
+++ b/mk/mkc_imp.objdir.mk
@@ -1,6 +1,6 @@
# Copyright (c) 2012 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
.if !defined(_MKC_IMP_OBJDIR_MK)
_MKC_IMP_OBJDIR_MK := 1
@@ -16,7 +16,9 @@ _MKC_IMP_OBJDIR_MK := 1
j:=${i:S,/,_,g}
.if empty(j:U:M*[.]*)
EXPORT_VARNAMES += OBJDIR_${i:S,/,_,g}
-. if defined(MAKEOBJDIRPREFIX)
+. if ${MKRELOBJDIR:tl} == "yes"
+OBJDIR_${j} = ${.OBJDIR}/${i}
+. elif defined(MAKEOBJDIRPREFIX)
OBJDIR_${j} = ${MAKEOBJDIRPREFIX}${.CURDIR}
. elif defined(MAKEOBJDIR)
OBJDIR_${j} = ${MAKEOBJDIR}
@@ -27,7 +29,7 @@ OBJDIR_${j} = ${.CURDIR}/obj
. else
OBJDIR_${j} = ${.CURDIR}/${i}
. endif # MAKEOBJDIRPREFIX...
-. if ${i} != ${j}
+. if ${SHORTPRJNAME:tl} == "yes" && ${i} != ${j}
OBJDIR_${i:T} := ${OBJDIR_${j}}
EXPORT_VARNAMES += OBJDIR_${i:T}
. endif
diff --git a/mkc_imp.pkg-config.mk b/mk/mkc_imp.pkg-config.mk
index 157b963..60190b9 100644
--- a/mkc_imp.pkg-config.mk
+++ b/mk/mkc_imp.pkg-config.mk
@@ -1,6 +1,6 @@
# Copyright (c) 2009-2010 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
#
diff --git a/mkc_imp.platform.sys.mk b/mk/mkc_imp.platform.sys.mk
index fe5c9ae..0fb511f 100644
--- a/mkc_imp.platform.sys.mk
+++ b/mk/mkc_imp.platform.sys.mk
@@ -4,7 +4,7 @@
# Copyright (c) 1988, 1989 by Adam de Boor
# Copyright (c) 1989 by Berkeley Softworks
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
.ifndef _MKC_PLATFORM_MK
@@ -137,6 +137,19 @@ CC_TYPE ?= unknown
CXX_TYPE ?= unknown
####################
+# Default compiler-specific options
+
+# C
+CFLAGS.dflt.clang = -Qunused-arguments
+
+CFLAGS += ${CFLAGS.dflt.${CC_TYPE}}
+
+# C++
+CXXFLAGS.dflt.clang = ${CFLAGS.dflt.clang}
+
+CXXFLAGS += ${CXXFLAGS.dflt.${CXX_TYPE}}
+
+####################
# Warnings as error
CFLAGS.warnerr.gcc = -Werror
CFLAGS.warnerr.icc = -Werror
@@ -226,7 +239,7 @@ CFLAGS.pic.icc = -fPIC -DPIC
CFLAGS.pic.clang = -fPIC -DPIC
CFLAGS.pic.pcc = -k -DPIC
CFLAGS.pic.mipspro = -KPIC
-CFLAGS.pic.sunpro = -KPIC # -xcode=pic32
+CFLAGS.pic.sunpro = -xcode=pic32 # -KPIC
CFLAGS.pic.hpc = +Z # +z
CFLAGS.pic.ibmc = -qpic=large # -qpic=small
CFLAGS.pic.decc = # ?
@@ -245,6 +258,8 @@ CXXFLAGS.pie ?= ${CFLAGS.pie.${CC_TYPE}.${TARGET_OPSYS}:U${CFLAGS.pie.${CC_TYPE}
####################
CFLAGS.ssp.gcc = -fstack-protector -Wstack-protector --param ssp-buffer-size=1
+CFLAGS.ssp.icc = -fstack-security-check
+CFLAGS.ssp.ibmc = -qstackprotect
CFLAGS.ssp.clang = ${CFLAGS.ssp.gcc}
CFLAGS.ssp ?= ${CFLAGS.ssp.${CC_TYPE}.${TARGET_OPSYS}:U${CFLAGS.ssp.${CC_TYPE}:U}}
@@ -436,14 +451,12 @@ lib${LIB}${SHLIB_EXTFULL}: ${EXPORT_SYMBOLS}.tmp
${EXPORT_SYMBOLS}.tmp: ${EXPORT_SYMBOLS}
awk 'BEGIN {print "{ global:"} \
{print $$0 ";"} \
- END {print "local: *; };"}' ${.ALLSRC} > ${.TARGET}.tmp && \
- mv ${.TARGET}.tmp ${.TARGET}
+ END {print "local: *; };"}' ${.ALLSRC} > ${.TARGET}
.elif ${LD_TYPE} == "darwinld"
CLEANFILES += ${EXPORT_SYMBOLS}.tmp
lib${LIB}${SHLIB_EXTFULL}: ${EXPORT_SYMBOLS}.tmp
${EXPORT_SYMBOLS}.tmp: ${EXPORT_SYMBOLS}
- awk '{print "_" $$0}' ${.ALLSRC} > ${.TARGET}.tmp && \
- mv ${.TARGET}.tmp ${.TARGET}
+ awk '{print "_" $$0}' ${.ALLSRC} > ${.TARGET}
.endif # sunld or darwinld
LDFLAGS.expsym.gnuld = --version-script ${EXPORT_SYMBOLS}.tmp
diff --git a/mkc_imp.pod.mk b/mk/mkc_imp.pod.mk
index 352b29a..5a4fb32 100644
--- a/mkc_imp.pod.mk
+++ b/mk/mkc_imp.pod.mk
@@ -1,6 +1,6 @@
# Copyright (c) 2010-2013 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
.if !defined(_MKC_IMP_POD_MK)
diff --git a/mk/mkc_imp.preinit.mk b/mk/mkc_imp.preinit.mk
new file mode 100644
index 0000000..81cdc1f
--- /dev/null
+++ b/mk/mkc_imp.preinit.mk
@@ -0,0 +1,32 @@
+# Copyright (c) 2010 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+####################
+BMAKE_REQD ?= 20110606
+
+.ifdef MAKE_VERSION
+_bmake_ok != test ${MAKE_VERSION} -ge ${BMAKE_REQD} && echo 1 || echo 0
+.else
+_bmake_ok = 0
+.endif
+
+.if !${_bmake_ok}
+.error "bmake-${BMAKE_REQD} or newer is required"
+.endif
+
+.ifdef _top_mk
+.for i in SUBDIR SUBPRJ PROG LIB
+.if defined(${i}) && ${_top_mk} != "mkc.${i:tl}.mk"
+.error "${i} is not allowed for ${_top_mk}"
+.endif
+.endfor
+.endif
+
+####################
+.if !make(clean) && !make(cleandir) && !make(distclean) && !make(obj)
+MKCHECKS ?= yes
+.else
+MKCHECKS ?= no
+.endif # clean/cleandir/distclean
diff --git a/mkc_imp.prog.mk b/mk/mkc_imp.prog.mk
index 48bbc0d..65db125 100644
--- a/mkc_imp.prog.mk
+++ b/mk/mkc_imp.prog.mk
@@ -4,7 +4,7 @@
# Copyright (c) 1988, 1989 by Adam de Boor
# Copyright (c) 1989 by Berkeley Softworks
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
.if !defined(_MKC_IMP_PROG_MK)
@@ -22,6 +22,8 @@ __proginstall: .USE
.for p in ${PROGS}
realinstall: proginstall
+_SRCS_ALL += ${SRCS.${p}}
+
DPSRCS.${p} = ${SRCS.${p}:M*.l:.l=.c} ${SRCS.${p}:M*.y:.y=.c}
CLEANFILES += ${DPSRCS.${p}}
.if defined(YHEADER)
@@ -66,6 +68,6 @@ CLEANFILES += ${OBJS.${p}}
realall: ${PROGS}
-CLEANFILES += a.out [Ee]rrs mklog core *.core ${PROGS}
+CLEANFILES += ${PROGS}
.endif # _MKC_IMP_PROG_MK
diff --git a/mkc_imp.scripts.mk b/mk/mkc_imp.scripts.mk
index 1372bd8..f066275 100644
--- a/mkc_imp.scripts.mk
+++ b/mk/mkc_imp.scripts.mk
@@ -4,7 +4,7 @@
# Copyright (c) 1988, 1989 by Adam de Boor
# Copyright (c) 1989 by Berkeley Softworks
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
.if !defined(_MKC_IMP_SCRIPTS_MK)
diff --git a/mk/mkc_imp.subprj.mk b/mk/mkc_imp.subprj.mk
new file mode 100644
index 0000000..df94d6d
--- /dev/null
+++ b/mk/mkc_imp.subprj.mk
@@ -0,0 +1,92 @@
+# Copyright (c) 2010-2013 by Aleksey Cheusov
+# Copyright (c) 1994-2009 The NetBSD Foundation, Inc.
+# Copyright (c) 1988, 1989, 1993 The Regents of the University of California
+# Copyright (c) 1988, 1989 by Adam de Boor
+# Copyright (c) 1989 by Berkeley Softworks
+#
+# See LICENSE file in the distribution.
+############################################################
+
+.if !defined(_MKC_IMP_SUBPRJ_MK)
+_MKC_IMP_SUBPRJ_MK := 1
+
+.for dir in ${SUBPRJ:S/:/ /g}
+.if empty(NOSUBDIR:U:M${dir})
+__REALSUBPRJ += ${dir}
+.endif
+.endfor
+
+.ifndef SUBDIR
+__REALSUBPRJ := ${__REALSUBPRJ:O:u}
+.endif
+
+.if !empty(__REALSUBPRJ:M*-*)
+.error "Dash symbol is not allowed inside subdir (${__REALSUBPRJ:M*-*})"
+.endif
+
+SUBPRJ_DFLT ?= ${__REALSUBPRJ}
+
+.for targ in ${TARGETS}
+.for dir in ${__REALSUBPRJ:N.WAIT}
+.PHONY: nodeps-${targ}-${dir} subdir-${targ}-${dir} ${targ}-${dir}
+nodeps-${targ}-${dir}: .MAKE __recurse
+ ${targ}-${dir}: .MAKE __recurse
+subdir-${targ}-${dir}: .MAKE __recurse
+.if ${SHORTPRJNAME:tl} == "yes" && ${dir} != ${dir:T}
+.PHONY: nodeps-${targ}-${dir:T} subdir-${targ}-${dir:T} ${targ}-${dir:T}
+nodeps-${targ}-${dir:T}: nodeps-${targ}-${dir}
+ ${targ}-${dir:T}: ${targ}-${dir}
+subdir-${targ}-${dir:T}: subdir-${targ}-${dir}
+.endif
+.endfor # dir
+
+.if !commands(${targ})
+. for dir in ${SUBPRJ_DFLT}
+dir_ = ${dir}
+. if ${dir_} == ".WAIT"
+_SUBDIR_${targ} += .WAIT
+. else
+_SUBDIR_${targ} += ${targ}-${dir}:${targ}
+. endif # .WAIT
+. endfor # dir
+.for excl in ${NODEPS}
+_SUBDIR_${targ} := ${_SUBDIR_${targ}:N${excl}}
+.endfor # excl
+_ALLTARGDEPS2 += ${_SUBDIR_${targ}}
+${targ}: ${_SUBDIR_${targ}:S/:${targ}$//}
+.endif #!command(${targ})
+
+.for dep prj in ${SUBPRJ:M*\:*:S/:/ /}
+_ALLTARGDEPS += ${targ}-${dep}:${targ}-${prj}
+.endfor
+
+.endfor # targ
+
+.for dir in ${__REALSUBPRJ}
+.if ${SHORTPRJNAME:tl} == "yes" && ${dir:T} != ${dir}
+_ALLTARGDEPS += all-${dir}:${dir:T}
+.endif
+_ALLTARGDEPS += all-${dir}:${dir}
+.endfor # dir
+
+.for excl in ${NODEPS}
+_ALLTARGDEPS := ${_ALLTARGDEPS:N${excl}}
+.endfor # excl
+
+.for deptarg prjtarg in ${_ALLTARGDEPS:S/:/ /}
+.PHONY: ${prjtarg} ${deptarg}
+${prjtarg}: ${deptarg}
+.endfor
+
+# Make sure all of the standard targets are defined, even if they do nothing.
+${TARGETS}:
+
+.PHONY: output_deps
+output_deps:
+.for i in ${_ALLTARGDEPS} ${_ALLTARGDEPS2}
+ @echo ${i}
+.endfor
+
+.include <mkc_imp.objdir.mk>
+
+.endif # _MKC_IMP_SUBPRJ_MK
diff --git a/mkc_imp.vars.mk.in b/mk/mkc_imp.vars.mk.in
index 173d133..2e642e3 100644
--- a/mkc_imp.vars.mk.in
+++ b/mk/mkc_imp.vars.mk.in
@@ -2,3 +2,6 @@ MKC_VERSION = @version@
BUILTINSDIR ?= @syscustomdir@
MKC_LIBEXECDIR = @libexecdir@
MKC_SYSCONFDIR = @sysconfdir@
+MKDEP = @mkdep_cmd@
+MKDEP_TYPE = @mkdep_type@
+MAKEDEPEND = @makedepend_cmd@
diff --git a/sys.mk b/mk/sys.mk
index 0e6f63e..0e6f63e 100644
--- a/sys.mk
+++ b/mk/sys.mk
diff --git a/mkc.own.mk b/mkc.own.mk
deleted file mode 100644
index 79fc235..0000000
--- a/mkc.own.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright (c) 2009-2010 by Aleksey Cheusov
-#
-# See COPYRIGHT file in the distribution.
-############################################################
-
-.include <mkc_imp.init.mk>
-.include <mkc_imp.own.mk>
diff --git a/mkc_imp.dep.mk b/mkc_imp.dep.mk
deleted file mode 100644
index ef7a24f..0000000
--- a/mkc_imp.dep.mk
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright (c) 2010 by Aleksey Cheusov
-# Copyright (c) 1994-2009 The NetBSD Foundation, Inc.
-
-CLEANFILES += .depend ${__DPSRCS.d} ${CLEANDEPEND}
-
-##### Basic targets
-depend: .depend
-.depend:
-
-##### Default values
-MKDEP ?= mkdep
-MKDEP_SUFFIXES ?= .o
-
-##### Build rules
-# some of the rules involve .h sources, so remove them from mkdep line
-
-.if defined(SRCS)
-__DPSRCS.all = ${SRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \
- ${DPSRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/}
-__DPSRCS.d = ${__DPSRCS.all:O:u:M*.d}
-__DPSRCS.notd = ${__DPSRCS.all:O:u:N*.d}
-
-.NOPATH: .depend ${__DPSRCS.d}
-
-.if !empty(__DPSRCS.d)
-${__DPSRCS.d}: ${__DPSRCS.notd} ${DPSRCS}
-.endif # __DPSRCS.d
-
-.depend: ${__DPSRCS.d}
- rm -f .depend
- ${MKDEP} -d -f ${.TARGET} -s ${MKDEP_SUFFIXES:Q} ${__DPSRCS.d}
-
-.SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m
-
-.c.d:
- ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
- ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
- ${CPPFLAGS} ${.IMPSRC}
-
-.m.d:
- ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
- ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
- ${CPPFLAGS} ${.IMPSRC}
-
-.s.d .S.d:
- ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
- ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
- ${CPPFLAGS} ${.IMPSRC}
-
-.C.d .cc.d .cpp.d .cxx.d:
- ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
- ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
- ${CPPFLAGS} ${.IMPSRC}
-
-.endif # defined(SRCS)
diff --git a/mkc_imp.init.mk b/mkc_imp.init.mk
deleted file mode 100644
index 9deba03..0000000
--- a/mkc_imp.init.mk
+++ /dev/null
@@ -1,256 +0,0 @@
-# Copyright (c) 2009-2010 by Aleksey Cheusov
-#
-# See COPYRIGHT file in the distribution.
-############################################################
-
-.ifndef OPSYS
-OPSYS != uname -s
-OPSYS := ${OPSYS:C/^CYGWIN.*$/Cygwin/}
-.endif
-TARGET_OPSYS ?= ${OPSYS}
-
-###########
-.ifdef DPLIBDIRS
-.for _dir in ${DPLIBDIRS}
-.ifndef DPLIBDIRS.${_dir:T}
-DPLIBDIRS.${_dir:T} = ${OBJDIR_${_dir:T}}
-.if ${TARGET_OPSYS} == "HP-UX"
-LDFLAGS += ${CFLAGS.cctold}+b ${CFLAGS.cctold}${LIBDIR}
-.endif
-LDFLAGS += -L${DPLIBDIRS.${_dir:T}}
-.endif
-.endfor
-
-.undef DPLIBDIRS
-
-.endif # DPLIBDIRS
-
-######################################################################
-.ifndef __initialized__
-__initialized__ := 1
-
-.MAIN: all
-
-###########
-.if ${PROJECTNAME:U1} == "mk-configure"
-.sinclude <mkc_imp.vars.mk>
-.else
-.include <mkc_imp.vars.mk>
-.endif
-
-#.if defined(MKC_SHELL)
-#.SHELL: name=${MKC_SHELL}
-#.elif ${OPSYS} == "SunOS"
-#.SHELL: name=/usr/xpg4/bin/sh
-#.endif
-
-###########
-
-.for p in ${PROGS}
-SRCS.${p} ?= ${p}.c
-SRCS.${p} += ${SRCS} # SRCS may be changed by mkc_imp.configure.mk
-_srcsall += ${SRCS.${p}}
-.endfor
-
-.if defined(PROG)
-PROGS ?= ${PROG}
-SRCS ?= ${PROG}.c
-SRCS.${PROG} ?= ${SRCS}
-_srcsall += ${SRCS}
-.elif defined(LIB)
-SRCS ?= ${LIB}.c
-_srcsall += ${SRCS}
-.endif # defined(PROG)
-
-.if !empty(_srcsall:U:M*.cxx) || !empty(_srcsall:U:M*.cpp) || !empty(_srcsall:U:M*.C) || !empty(_srcsall:U:M*.cc)
-src_type += cxx
-LDCOMPILER = yes
-LDREAL ?= ${CXX}
-.elif !empty(_srcsall:U:M*.pas) || !empty(_srcsall:U:M*.p)
-src_type += pas
-LDCOMPILER = yes
-LDREAL ?= ${PC}
-.endif
-
-LDCOMPILER.Interix = yes
-LDCOMPILER.Darwin = yes
-#LDCOMPILER.HP-UX= yes
-LDCOMPILER ?= ${LDCOMPILER.${TARGET_OPSYS}:Uno}
-
-.if !empty(_srcsall:U:M*.c) || !empty(_srcsall:U:M*.l) || !empty(_srcsall:U:M*.y) || defined(MKC_SOURCE_FUNCLIBS)
-src_type += c
-.endif
-
-src_type ?= 0
-
-.if ${LDCOMPILER:tl} == "yes"
-LDREAL ?= ${CC}
-.endif
-
-.if defined(PROGS)
-LDREAL ?= ${CC}
-.else
-LDREAL ?= ${LD}
-.endif
-
-MKC_CACHEDIR ?= ${.OBJDIR} # directory for cache and intermediate files
-
-###########
-.if exists(${.CURDIR}/Makefile.rec)
-REC_MAKEFILES += ${.CURDIR}/Makefile.rec
-.endif
-.for dir in ${REC_MAKEFILES}
-.include "${dir}"
-.endfor
-
-.if exists(${.CURDIR}/../Makefile.inc)
-.include "${.CURDIR}/../Makefile.inc"
-.endif
-
-###########
-
-.include <mkc_imp.own.mk>
-
-###########
-.if !empty(_srcsall:U:M*.y)
-MKC_REQUIRE_PROGS += ${YACC:[1]}
-MKC_PROG.id.${YACC:[1]:S/+/x/g} = yacc
-.endif
-
-.if !empty(_srcsall:U:M*.l)
-MKC_REQUIRE_PROGS += ${LEX:[1]}
-MKC_PROG.id.${LEX:[1]:S/+/x/g} = lex
-.endif
-
-.if !empty(_srcsall:U:M*.c) || !empty(_srcsall:U:M*.l) || !empty(_srcsall:U:M*.y)
-MKC_REQUIRE_PROGS += ${CC:[1]}
-MKC_PROG.id.${CC:[1]:S|+|x|g} = cc
-.endif
-
-.if !empty(_srcsall:U:M*.cc) || !empty(_srcsall:U:M*.C) || !empty(_srcsall:U:M*.cxx) || !empty(_srcsall:U:M*.cpp)
-MKC_REQUIRE_PROGS += ${CXX:[1]}
-MKC_PROG.id.${CXX:[1]:S/+/x/g} = cxx
-.endif
-
-.if !empty(_srcsall:U:M*.f)
-MKC_REQUIRE_PROGS += ${FC:[1]}
-MKC_PROG.id.${FC:[1]:S/+/x/g} = fc
-.endif
-
-.if !empty(_srcsall:U:M*.p)
-MKC_REQUIRE_PROGS += ${PC:[1]}
-MKC_PROG.id.${PC:[1]:S/+/x/g} = pc
-.endif
-
-###########
-.PHONY : print-values
-print-values :
-.for v in ${VARS}
- @printf "%s=%s\n" ${v} ${${v}:Q}
-.endfor
-
-.PHONY : print-values2
-print-values2 :
-.for v in ${VARS}
- @printf "%s\n" ${${v}:Q}
-.endfor
-
-###########
-.PHONY: realall do_errorcheck
-
-__errorcheck: .USE
- @if test -n '${MKC_ERR_MSG}'; then \
- for msg in '' ${MKC_ERR_MSG}; do \
- fn=`printf '%s\n' "$$msg" | sed -n 's/^%%%: //p'`; \
- if test -n "$$fn"; then \
- awk '{print "ERROR: " $$0}' "$$fn"; ex=1; \
- elif test -n "$$msg"; then printf '%s\n' "$$msg"; ex=1; \
- fi; \
- done; \
- exit $$ex; \
- fi
-
-.if defined(SUBPRJ) || defined(SUBDIR)
-realall : do_errorcheck
-do_errorcheck: .MAKE __errorcheck
-.else
-realall : errorcheck
-errorcheck: .MAKE __errorcheck
-.endif
-
-###########
-
-.if defined(MKC_REQD) && defined(MKC_VERSION)
-_mkc_version_ok != mkc_check_version ${MKC_REQD} ${MKC_VERSION}
-.if !${_mkc_version_ok}
-MKC_ERR_MSG += "ERROR: We need mk-configure v.${MKC_REQD} while ${MKC_VERSION} is detected"
-.endif
-.endif
-
-###########
-
-LDLIBS = ${LDFLAGS} ${LDADD}
-
-###########
-# skip uninstalling files and creating destination dirs
-# for mkc.subdir.mk and mkc.subprj.mk
-.if !defined(SUBDIR) && !defined(SUBPRJ)
-
-uninstall:
- -rm -f ${UNINSTALLFILES} 2>/dev/null
-
-installdirs:
- for d in _ ${INSTALLDIRS:O:u:S|/.$||}; do \
- test "$$d" = _ || ${INSTALL} -d -m ${DIRMODE} "$$d"; \
- done
-
-filelist:
- @for d in ${UNINSTALLFILES:O:u}; do \
- echo $$d; \
- done
-
-test:
-
-.endif # SUBDIR
-
-.if ${MKINSTALLDIRS:tl} == "yes"
-realinstall: installdirs
-.endif
-
-.ORDER: installdirs install
-
-TARGETS += all install clean cleandir depend test \
- installdirs uninstall errorcheck filelist
-
-# Make sure all of the standard targets are defined, even if they do nothing.
-.PHONY: ${TARGETS}
-${TARGETS}:
-
-###########
-
-VERBOSE_ECHO ?= echo
-### for mkc.subdir.mk and mkc.subprj.mk
-__recurse: .USE
- @targ=${.TARGET:S/^nodeps-//:C/-.*$//}; \
- dir=${.TARGET:S/^nodeps-//:C/^[^-]*-//}; \
- if ! test -d ${.CURDIR}/$$dir; then exit 0; fi; \
- test "$${targ}_${MKINSTALL:tl}" = 'install_no' && exit 0; \
- test "$${targ}_${MKINSTALL:tl}" = 'installdirs_no' && exit 0; \
- ${export_cmd} \
- set -e; \
- ${VERBOSE_ECHO} ================================================== 1>&2;\
- case "$$dir" in /*) \
- ${VERBOSE_ECHO} "$$targ ===> $$dir" 1>&2; \
- cd "$$dir"; \
- env "_THISDIR_=$$dir/" ${MAKE} $$targ; \
- ;; \
- *) \
- ${VERBOSE_ECHO} "$$targ ===> ${_THISDIR_}$$dir" 1>&2; \
- cd "${.CURDIR}/$$dir"; \
- env "_THISDIR_=${_THISDIR_}$$dir/" ${MAKE} $$targ; \
- ;; \
- esac
-
-###########
-
-.endif # __initialized__
diff --git a/mkc_imp.links.mk b/mkc_imp.links.mk
deleted file mode 100644
index 450d23f..0000000
--- a/mkc_imp.links.mk
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright (c) 2009-2010 by Aleksey Cheusov
-# Copyright (c) 1994-2009 The NetBSD Foundation, Inc.
-# Copyright (c) 1988, 1989, 1993 The Regents of the University of California
-# Copyright (c) 1988, 1989 by Adam de Boor
-# Copyright (c) 1989 by Berkeley Softworks
-#
-# See COPYRIGHT file in the distribution.
-############################################################
-
-.PHONY: linksinstall
-realinstall: linksinstall
-
-.if defined(SYMLINKS) && !empty(SYMLINKS) && ${MKINSTALL:tl} == "yes"
-linksinstall::
- @(set ${SYMLINKS}; \
- while test $$# -ge 2; do \
- l=$$1; \
- shift; \
- t=${DESTDIR}$$1; \
- shift; \
- if [ -h $$t ]; then \
- cur=`ls -ld $$t | awk '{print $$NF}'` ; \
- if [ "$$cur" = "$$l" ]; then \
- continue ; \
- fi; \
- fi; \
- echo "$$t -> $$l"; \
- rm -rf $$t; ln -s $$l $$t; \
- done; )
-.for l r in ${SYMLINKS}
-UNINSTALLFILES += ${DESTDIR}${r}
-INSTALLDIRS += ${DESTDIR}${r:H}
-.endfor
-.endif
-
-.if defined(LINKS) && !empty(LINKS) && ${MKINSTALL:tl} == "yes"
-linksinstall::
- @(set ${LINKS}; \
- echo ".include <mkc.own.mk>"; \
- while test $$# -ge 2; do \
- l=${DESTDIR}$$1; \
- shift; \
- t=${DESTDIR}$$1; \
- shift; \
- echo "realall: $$t"; \
- echo ".PHONY: $$t"; \
- echo "$$t:"; \
- echo " @echo \"$$t -> $$l\""; \
- echo " @rm -f $$t; ln $$l $$t"; \
- done; \
- ) | ${MAKE} -f- all
-.for l r in ${LINKS}
-UNINSTALLFILES += ${DESTDIR}${r}
-INSTALLDIRS += ${DESTDIR}${r:H}
-.endfor
-.endif
-
-.if !target(linksinstall)
-linksinstall:
-.endif
diff --git a/mkc_imp.own.mk b/mkc_imp.own.mk
deleted file mode 100644
index 5892226..0000000
--- a/mkc_imp.own.mk
+++ /dev/null
@@ -1,189 +0,0 @@
-# Copyright (c) 2009-2010 by Aleksey Cheusov
-# Copyright (c) 1994-2009 The NetBSD Foundation, Inc.
-# Copyright (c) 1988, 1989, 1993 The Regents of the University of California
-# Copyright (c) 1988, 1989 by Adam de Boor
-# Copyright (c) 1989 by Berkeley Softworks
-#
-# See COPYRIGHT file in the distribution.
-############################################################
-
-.if !defined(_BSD_OWN_MK_)
-_BSD_OWN_MK_ := 1
-
-PROJECTNAME ?= ${!empty(PROG):?${PROG}:${!empty(LIB):?${LIB}:${.CURDIR:T}}}
-
-.if defined(MAKECONF) && exists(${MAKECONF})
-.include "${MAKECONF}"
-.elif defined(MKC_SYSCONFDIR) && exists(${MKC_SYSCONFDIR}/mk.conf)
-.include "${MKC_SYSCONFDIR}/mk.conf"
-.elif exists(/etc/mk.conf)
-.include "/etc/mk.conf"
-.endif
-
-.if ${OPSYS:Ux} == "SunOS"
-_MKC_USER != /usr/xpg4/bin/id -un
-_MKC_GROUP != /usr/xpg4/bin/id -gn
-.else
-_MKC_USER != id -un
-_MKC_GROUP != id -gn
-.endif
-
-.if ${_MKC_USER} != root && ${OPSYS}${_MKC_USER} != "InterixAdministrator"
-ROOT_USER ?= ${_MKC_USER}
-ROOT_GROUP ?= ${_MKC_GROUP}
-.endif
-
-# Define MANZ to have the man pages compressed (gzip)
-#MANZ= 1
-
-PREFIX ?= /usr/local
-
-BINDIR ?= ${PREFIX}/bin
-SBINDIR ?= ${PREFIX}/sbin
-FILESDIR ?= ${PREFIX}/bin
-LIBEXECDIR ?= ${PREFIX}/libexec
-INCSDIR ?= ${PREFIX}/include
-DATADIR ?= ${PREFIX}/share
-SYSCONFDIR ?= ${PREFIX}/etc
-INFODIR ?= ${PREFIX}/info
-MANDIR ?= ${PREFIX}/man
-LIBDIR ?= ${PREFIX}/lib
-SCRIPTSDIR ?= ${BINDIR}
-
-DOCDIR? = ${DATADIR}/doc
-HTMLDOCDIR ?= ${DOCDIR}/html
-HTMLDIR ?= ${MANDIR}
-
-BINGRP ?= ${ROOT_GROUP}
-BINOWN ?= ${ROOT_USER}
-
-SHLIBMODE.HP-UX = ${BINMODE}
-SHLIBMODE.OSF1 = ${BINMODE}
-SHLIBMODE.Interix = ${BINMODE}
-SHLIBMODE ?= ${SHLIBMODE.${TARGET_OPSYS}:U${NONBINMODE}}
-
-ROOT_GROUP.NetBSD = wheel
-ROOT_GROUP.OpenBSD = wheel
-ROOT_GROUP.FreeBSD = wheel
-ROOT_GROUP.Darwin = wheel
-ROOT_GROUP.DragonFly = wheel
-ROOT_GROUP.MirBSD = wheel
-ROOT_GROUP.HP-UX = bin
-ROOT_GROUP.OSF1 = bin
-ROOT_GROUP.Interix = +Administrators
-ROOR_GROUP.Haiku = root
-
-ROOT_USER.HP-UX = bin
-ROOT_USER.OSF1 = bin
-ROOT_USER.Interix = Administrator
-ROOT_USER.Haiku = user
-
-ROOT_USER ?= ${ROOT_USER.${OPSYS}:Uroot}
-ROOT_GROUP ?= ${ROOT_GROUP.${OPSYS}:Uroot}
-
-BINMODE.Interix.Administrator = 775
-NONBINMODE.Interix.Administrator = 664
-
-BINMODE ?= ${BINMODE.${TARGET_OPSYS}.${ROOT_USER}:U755}
-NONBINMODE ?= ${BINMODE.${TARGET_OPSYS}.${ROOT_USER}:U644}
-DIRMODE ?= ${BINMODE}
-
-MANGRP ?= ${ROOT_GROUP}
-MANOWN ?= ${ROOT_USER}
-MANMODE ?= ${NONBINMODE}
-MANINSTALL ?= maninstall catinstall
-
-INFOGRP ?= ${ROOT_GROUP}
-INFOOWN ?= ${ROOT_USER}
-INFOMODE ?= ${NONBINMODE}
-
-LIBGRP ?= ${BINGRP}
-LIBOWN ?= ${BINOWN}
-LIBMODE ?= ${NONBINMODE}
-
-DOCGRP ?= ${ROOT_GROUP}
-DOCOWN ?= ${ROOT_USER}
-DOCMODE ?= ${NONBINMODE}
-
-FILESOWN ?= ${BINOWN}
-FILESGRP ?= ${BINGRP}
-FILESMODE ?= ${NONBINMODE}
-
-SCRIPTSOWN ?= ${BINOWN}
-SCRIPTSGRP ?= ${BINGRP}
-SCRIPTSMODE ?= ${BINMODE}
-
-COPY ?= -c
-PRESERVE ?=
-STRIPFLAG ?= -s
-
-.PHONY: ${TARGETS}
-
-install: realinstall
-subdir-install:
-realinstall:
-
-all: realall
-subdir-all:
-realall:
-
-distclean: cleandir
-
-PRINTOBJDIR = printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}\n" | ${MAKE} -B -s -f-
-
-MKINSTALL ?= yes
-
-MKCATPAGES ?= no
-MKHTML ?= no
-MKDOC ?= yes
-MKINFO ?= yes
-MKMAN ?= yes
-
-#
-# MKOBJDIRS controls whether object dirs are created during "make build".
-# MKOBJ controls whether the "make obj" rule does anything.
-#
-MKOBJ ?= yes
-MKOBJDIRS ?= no
-
-MKSHARE ?= yes
-
-MKPIE ?= no
-USE_SSP ?= no
-USE_RELRO ?= no
-USE_FORT ?= no
-
-MKDLL ?= no
-.if ${MKDLL:tl} == "only"
-MKDLL = yes
-MKSTATICLIB ?= no
-.else
-MKSTATICLIB ?= yes
-.endif # MKDLL
-
-SHLIB_MINOR ?= 0
-.if ${MKDLL:tl} != "no"
-SHLIB_MAJOR ?= 1
-.endif # MKDLL
-
-.if defined(SHLIB_MAJOR)
-MKSHLIB ?= yes
-.else
-MKSHLIB ?= no
-.endif # SHLIB_MAJOR
-
-MKPICLIB ?= no
-MKPROFILELIB ?= no
-
-MKINSTALLDIRS ?= yes
-
-EXPORT_VARNAMES += MKC_CACHEDIR REC_MAKEFILES
-
-EXPORT_DYNAMIC ?= no
-
-MKC_CACHEDIR ?= ${.OBJDIR} # directory for cache and intermediate files
-DISTCLEANFILES += ${MKC_CACHEDIR}/_mkc_*
-
-.include <mkc_imp.sys.mk>
-
-.endif # _BSD_OWN_MK_
diff --git a/mkc_imp.preinit.mk b/mkc_imp.preinit.mk
deleted file mode 100644
index fdeab6a..0000000
--- a/mkc_imp.preinit.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright (c) 2010 by Aleksey Cheusov
-#
-# See COPYRIGHT file in the distribution.
-############################################################
-
-.if !make(clean) && !make(cleandir) && !make(distclean)
-MKCHECKS ?= yes
-.else
-MKCHECKS ?= no
-.endif # clean/cleandir/distclean
diff --git a/mkc_imp.subdir.mk b/mkc_imp.subdir.mk
deleted file mode 100644
index c2faaec..0000000
--- a/mkc_imp.subdir.mk
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright (c) 2009-2012 by Aleksey Cheusov
-# Copyright (c) 1994-2009 The NetBSD Foundation, Inc.
-# Copyright (c) 1988, 1989, 1993 The Regents of the University of California
-# Copyright (c) 1988, 1989 by Adam de Boor
-# Copyright (c) 1989 by Berkeley Softworks
-#
-# See COPYRIGHT file in the distribution.
-############################################################
-
-.if !defined(_MKC_IMP_SUBDIR_MK)
-_MKC_IMP_SUBDIR_MK := 1
-
-.for dir in ${SUBDIR}
-.if empty(NOSUBDIR:U:M${dir})
-__REALSUBPRJ += ${dir}
-.endif
-.endfor
-
-# for obscure reasons, we can't do a simple .if ${dir} == ".WAIT"
-# but have to assign to __TARGDIR first.
-.for targ in ${TARGETS}
-.for dir in ${__REALSUBPRJ}
-__TARGDIR := ${dir}
-.if ${__TARGDIR} == ".WAIT"
-SUBDIR_${targ} += .WAIT
-.else
-.PHONY: ${targ}-${dir}
-${targ}-${dir}: .MAKE __recurse
-SUBDIR_${targ} += ${targ}-${dir}
-.endif # .WAIT
-.endfor # dir
-
-.if !commands(${targ})
-${targ}: ${SUBDIR_${targ}:U}
-.endif
-
-.endfor # targ
-
-.for dir in ${__REALSUBPRJ}
-.PHONY: ${dir}
-${dir}: all-${dir}
-.endfor # dir
-
-# Make sure all of the standard targets are defined, even if they do nothing.
-${TARGETS}:
-
-.include <mkc_imp.objdir.mk>
-
-.endif # _MKC_IMP_SUBDIR_MK
diff --git a/mkc_imp.subprj.mk b/mkc_imp.subprj.mk
deleted file mode 100644
index 69dc369..0000000
--- a/mkc_imp.subprj.mk
+++ /dev/null
@@ -1,54 +0,0 @@
-# Copyright (c) 2010 by Aleksey Cheusov
-# Copyright (c) 1994-2009 The NetBSD Foundation, Inc.
-# Copyright (c) 1988, 1989, 1993 The Regents of the University of California
-# Copyright (c) 1988, 1989 by Adam de Boor
-# Copyright (c) 1989 by Berkeley Softworks
-#
-# See COPYRIGHT file in the distribution.
-############################################################
-
-.if !defined(_MKC_IMP_SUBPRJ_MK)
-_MKC_IMP_SUBPRJ_MK := 1
-
-.for dir in ${SUBPRJ:S/:/ /g}
-.if empty(NOSUBDIR:U:M${dir})
-__REALSUBPRJ += ${dir}
-.endif
-.endfor
-
-__REALSUBPRJ := ${__REALSUBPRJ:O:u}
-
-SUBPRJ_DFLT ?= ${__REALSUBPRJ}
-
-.for targ in ${TARGETS}
-.for dir in ${__REALSUBPRJ}
-.PHONY: nodeps-${targ}-${dir} subdir-${targ}-${dir} ${targ}-${dir}
-nodeps-${targ}-${dir}: .MAKE __recurse
- ${targ}-${dir}: .MAKE __recurse # nodeps-${targ}-${dir}
-subdir-${targ}-${dir}: .MAKE __recurse # nodeps-${targ}-${dir}
-.endfor # dir
-
-.for dir in ${SUBPRJ_DFLT}
-.if !commands(${targ})
-${targ}: ${targ}-${dir}
-.endif
-.endfor
-
-.for dep prj in ${SUBPRJ:M*\:*:S/:/ /}
-.PHONY: ${targ}-${prj} ${targ}-${dep}
-${targ}-${prj}: ${targ}-${dep}
-.endfor
-
-.endfor # targ
-
-.for dir in ${__REALSUBPRJ}
-.PHONY: ${dir}
-${dir}: all-${dir}
-.endfor # dir
-
-# Make sure all of the standard targets are defined, even if they do nothing.
-${TARGETS}:
-
-.include <mkc_imp.objdir.mk>
-
-.endif # _MKC_IMP_SUBPRJ_MK
diff --git a/mkc_imp.sys.mk b/mkc_imp.sys.mk
deleted file mode 100644
index ab91a58..0000000
--- a/mkc_imp.sys.mk
+++ /dev/null
@@ -1,246 +0,0 @@
-# Copyright (c) 2009-2010 by Aleksey Cheusov
-# Copyright (c) 1994-2009 The NetBSD Foundation, Inc.
-# Copyright (c) 1988, 1989, 1993 The Regents of the University of California
-# Copyright (c) 1988, 1989 by Adam de Boor
-# Copyright (c) 1989 by Berkeley Softworks
-#
-# See COPYRIGHT file in the distribution.
-############################################################
-
-.ifndef _MKC_IMP_SYS_MK
-_MKC_IMP_SYS_MK := 1
-
-.include <mkc_imp.platform.sys.mk>
-
-.SUFFIXES: .a .o .op .os .s .S .c .cc .cpp .cxx .C .F .f .r .m .y .l .cl .p .h
-
-.LIBS: .a
-
-.if ${MKPIE:U:tl} == "yes"
-LDFLAGS.prog += ${LDFLAGS.pie}
-CFLAGS += ${CFLAGS.pie}
-CXXFLAGS += ${CXXFLAGS.pie}
-.endif
-
-.if ${USE_SSP:U:tl} == "yes"
-CFLAGS += ${CFLAGS.ssp}
-CXXFLAGS += ${CXXFLAGS.ssp}
-.endif
-
-.if ${USE_RELRO:U:tl} == "yes"
-LDFLAGS.prog += ${LDFLAGS.relro}
-.endif
-
-.if ${USE_FORT:U:tl} == "yes"
-CPPFLAGS += -D_FORTIFY_SOURCE=2
-.endif
-
-SHRTOUT ?= no
-
-.if ${SHRTOUT:tl} != "no"
-_MESSAGE ?= echo
-_MESSAGE_V ?= :
-_V ?= @
-.else
-_MESSAGE ?= :
-_MESSAGE_V ?= echo
-_V ?=
-.endif
-
-AR ?= ar
-ARFLAGS ?= rl
-RANLIB ?= ranlib
-MESSAGE.ar ?= @${_MESSAGE} "AR: ${.TARGET}"
-
-AS ?= as
-AFLAGS ?=
-COMPILE.s ?= ${_V} ${CC} ${AFLAGS} -c
-LINK.s ?= ${_V} ${CC} ${AFLAGS} ${LDFLAGS}
-MESSAGE.s ?= @${_MESSAGE} "AS: ${.IMPSRC}"
-
-CC ?= cc
-CFLAGS ?=
-COMPILE.c ?= ${_V} ${CC} ${CFLAGS} ${CPPFLAGS} ${CFLAGS.warnerr} -c
-LINK.c ?= ${_V} ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} ${LDFLAGS.prog}
-MESSAGE.c ?= @${_MESSAGE} "CC: ${.IMPSRC}"
-
-CXX ?= c++
-CXXFLAGS += ${CFLAGS}
-COMPILE.cc ?= ${_V} ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${CFLAGS.warnerr} -c
-LINK.cc ?= ${_V} ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} ${LDFLAGS.prog}
-MESSAGE.cc ?= @${_MESSAGE} "CXX: ${.IMPSRC}"
-
-OBJC ?= ${CC}
-OBJCFLAGS ?= ${CFLAGS}
-COMPILE.m ?= ${_V} ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
-LINK.m ?= ${_V} ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
-MESSAGE.m ?= @${_MESSAGE} "OBJC: ${.IMPSRC}"
-
-CPP ?= cpp
-CPPFLAGS ?=
-
-FC ?= f77
-FFLAGS ?= -O
-RFLAGS ?=
-COMPILE.f ?= ${_V} ${FC} ${FFLAGS} -c
-LINK.f ?= ${_V} ${FC} ${FFLAGS} ${LDFLAGS}
-MESSAGE.f ?= @${_MESSAGE} "FC: ${.IMPSRC}"
-COMPILE.F ?= ${_V} ${FC} ${FFLAGS} ${CPPFLAGS} -c
-LINK.F ?= ${_V} ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
-MESSAGE.F ?= ${MESSAGE.f}
-COMPILE.r ?= ${_V} ${FC} ${FFLAGS} ${RFLAGS} -c
-LINK.r ?= ${_V} ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
-MESSAGE.r ?= ${MESSAGE.f}
-
-MESSAGE.ld ?= @${_MESSAGE} "LD: ${.TARGET}"
-
-INSTALL ?= install
-
-LEX ?= lex
-LFLAGS ?=
-LEX.l ?= ${_V} ${LEX} ${LFLAGS}
-MESSAGE.l ?= @${_MESSAGE} "LEX: ${.IMPSRC}"
-
-LD.SunOS ?= /usr/ccs/bin/ld
-LD.OSF1 ?= /usr/bin/ld
-LD ?= ${LD.${TARGET_OPSYS}:Uld}
-LDFLAGS ?=
-
-LORDER ?= lorder
-
-NM ?= nm
-
-PC ?= pc
-PFLAGS ?=
-COMPILE.p ?= ${_V} ${PC} ${PFLAGS} ${CPPFLAGS} -c
-LINK.p ?= ${_V} ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
-MESSAGE.p ?= @${_MESSAGE} "PC: ${.IMPSRC}"
-
-SHELL ?= sh
-
-SIZE ?= size
-
-TSORT ?= tsort -q
-
-YACC ?= yacc
-YFLAGS ?=
-YACC.y ?= ${_V} ${YACC} ${YFLAGS}
-MESSAGE.y ?= @${_MESSAGE} "YACC: ${.IMPSRC}"
-
-TAR ?= tar
-GZIP ?= gzip
-BZIP2 ?= bzip2
-ZIP ?= zip
-
-OBJCOPY ?= objcopy
-
-OBJDUMP ?= objdump
-
-STRIP ?= strip
-
-#ADDR2LINE ?= addr2line
-#READELF ?= readelf
-#STRINGS ?= strings
-
-# C
-_PN=${PROJECTNAME} # short synonym
-
-.c.o:
- ${MESSAGE.c}
- ${COMPILE.c} ${CPPFLAGS_${_PN}} ${CFLAGS_${_PN}} \
- ${COPTS_${_PN}} -o ${.TARGET} ${.IMPSRC}
-.c.op:
- ${MESSAGE.c}
- ${COMPILE.c} -pg ${CPPFLAGS_${_PN}} ${CFLAGS_${_PN}} \
- ${COPTS_${_PN}} -o ${.TARGET} ${.IMPSRC}
-.c.os:
- ${MESSAGE.c}
- ${COMPILE.c} ${CFLAGS.pic} ${CPPFLAGS_${_PN}} \
- ${CFLAGS_${_PN}} ${COPTS_${_PN}} -o ${.TARGET} ${.IMPSRC}
-
-# C++
-.cc.o .cpp.o .cxx.o .C.o:
- ${MESSAGE.cc}
- ${COMPILE.cc} ${CPPFLAGS_${_PN}} ${CXXFLAGS_${_PN}} \
- ${COPTS_${_PN}} -o ${.TARGET} ${.IMPSRC}
-.cc.op .C.op .cpp.op:
- ${MESSAGE.cc}
- ${COMPILE.cc} -pg ${CPPFLAGS_${_PN}} ${CXXFLAGS_${_PN}} \
- ${COPTS_${_PN}} -o ${.TARGET} ${.IMPSRC}
-.cc.os .C.os .cpp.os:
- ${MESSAGE.cc}
- ${COMPILE.cc} ${CXXFLAGS.pic} ${CPPFLAGS_${_PN}} \
- ${CXXFLAGS_${_PN}} ${COPTS_${_PN}} -o ${.TARGET} ${.IMPSRC}
-
-# Fortran/Ratfor
-.f.o:
- ${MESSAGE.f}
- ${COMPILE.f} ${FFLAGS_${_PN}} -o ${.TARGET} ${.IMPSRC}
-.f.op:
- ${MESSAGE.f}
- ${COMPILE.f} -pg ${FFLAGS_${_PN}} -o ${.TARGET} ${.IMPSRC}
-.f.os:
- ${MESSAGE.f}
- ${COMPILE.f} ${FFLAGS.pic} ${FFLAGS_${_PN}} -o ${.TARGET} ${.IMPSRC}
-
-#.F:
-.F.o:
- ${MESSAGE.F}
- ${COMPILE.F} -o ${.TARGET} ${.IMPSRC}
-
-#.r:
-.r.o:
- ${MESSAGE.r}
- ${COMPILE.r} -o ${.TARGET} ${.IMPSRC}
-
-# Pascal
-.p.o:
- ${MESSAGE.p}
- ${COMPILE.p} -o ${.TARGET} ${.IMPSRC}
-
-# Assembly
-.S.o .s.o:
- ${MESSAGE.s}
- ${COMPILE.s} -o ${.TARGET} ${.IMPSRC}
-.S.op .s.op:
- ${MESSAGE.s}
- ${COMPILE.s} -o ${.TARGET} -pg ${.IMPSRC}
-.S.os .s.os:
- ${MESSAGE.s}
- ${COMPILE.s} ${CAFLAGS.pic} -o ${.TARGET} ${.IMPSRC}
-
-# Objective-C
-.m.o:
- ${MESSAGE.m}
- ${COMPILE.m} ${.IMPSRC}
-.m.op:
- ${MESSAGE.m}
- ${COMPILE.m} -pg -o ${.TARGET} ${.IMPSRC}
-.m.os:
- ${MESSAGE.m}
- ${COMPILE.m} ${CMFLAGS.pic} -o ${.TARGET} ${.IMPSRC}
-
-# Lex
-LPREFIX ?= yy
-.if ${LPREFIX} != "yy"
-LFLAGS += -P${LPREFIX}
-.endif
-LEXLIB ?= -ll
-
-.l.c:
- ${MESSAGE.l}
- ${LEX.l} -t ${.IMPSRC} > ${.TARGET}
-
-# Yacc
-YFLAGS += ${YPREFIX:D-p${YPREFIX}} ${YHEADER:D-d}
-
-.y.h: ${.TARGET:R}.c
-.y.c:
- ${MESSAGE.y}
- ${YACC.y} ${.IMPSRC}
- ${_V}mv y.tab.c ${.TARGET}
-.ifdef YHEADER
- ${_V}mv y.tab.h ${.TARGET:R}.h
-.endif
-
-.endif
diff --git a/presentation/Makefile b/presentation/Makefile
new file mode 100644
index 0000000..cdafd80
--- /dev/null
+++ b/presentation/Makefile
@@ -0,0 +1,49 @@
+############################################################
+
+MKC_REQUIRE_PROGS = ${PS2PDF} ${DOT} ${DVIPS} ${LATEX}
+
+############################################################
+
+all : presentation.pdf myprojects.pdf
+
+.PHONY : pdf dvi rtf
+pdf : presentation.pdf
+ps : presentation.ps
+dvi : presentation.dvi
+
+.SUFFIXES: .ps .eps .pdf .dvi .tex .dot
+
+presentation.ps presentation.pdf presentation.dvi: my_prjs.eps dep_graph.eps
+
+.ps.pdf:
+ ${PROG.${PS2PDF}} "$<" "$@"
+
+#.tex.pdf:
+# pdflatex "$<" && pdflatex "$<"
+
+.dot.eps:
+ ${PROG.${DOT}} -Tps ${.IMPSRC} > ${.TARGET}
+
+.dvi.ps:
+ ${PROG.${DVIPS}} $<
+
+.tex.dvi:
+ ${PROG.${LATEX}} "${.IMPSRC}" && ${PROG.${LATEX}} "${.IMPSRC}"
+
+.gz:
+ gzip ${.IMPSRC}
+
+GARBAGE= *.dvi *.aux *.vrb *.toc *.snm *.log *.nav *.out *.eps *.ps
+CLEANFILES+= ${GARBAGE} *.pdf *.ps myprojects.tex
+
+.PHONY: clean-garbage
+clean-garbage:
+ rm -f ${GARBAGE}
+
+##################################################
+myprojects.tex : presentation.tex
+ awk '/^%%%begin-myprojects/, /^%%%end-myprojects/' \
+ ${.ALLSRC} > ${.TARGET}
+myprojects.ps myprojects.pdf myprojects.dvi: my_prjs.eps
+
+.include <mkc.mk>
diff --git a/doc/dep_graph.dot b/presentation/dep_graph.dot
index 73ad03f..73ad03f 100644
--- a/doc/dep_graph.dot
+++ b/presentation/dep_graph.dot
diff --git a/doc/my_prjs.dot b/presentation/my_prjs.dot
index 863e2ee..e2bcfe0 100644
--- a/doc/my_prjs.dot
+++ b/presentation/my_prjs.dot
@@ -11,6 +11,7 @@ digraph FSA {
"runawk";
"pkg_summary-utils";
"nih";
+ "pipestatus";
node [ shape = oval style=solid ];
diff --git a/doc/presentation.tex b/presentation/presentation.tex
index f28356b..f28356b 100644
--- a/doc/presentation.tex
+++ b/presentation/presentation.tex
diff --git a/scripts/Makefile b/scripts/Makefile
new file mode 100644
index 0000000..c651993
--- /dev/null
+++ b/scripts/Makefile
@@ -0,0 +1,21 @@
+FILES = mkc_check_common.sh
+INFILES = mk-configure.7
+FILESDIR = ${BINDIR}
+
+SCRIPTS = mkc_check_funclib mkc_check_header \
+ mkc_check_sizeof mkc_check_decl \
+ mkc_check_prog mkc_check_custom \
+ mkc_which mkc_check_compiler \
+ mkc_install ${INSCRIPTS}
+INSCRIPTS += mkc_check_version mkcmake
+
+MAN = mkc_check_funclib.1 mkc_check_header.1 \
+ mkc_check_sizeof.1 mkc_check_decl.1 \
+ mkc_check_prog.1 mkc_check_custom.1 \
+ mk-configure.7 mkcmake.1
+
+SYMLINKS = mkc.subprj.mk ${MKFILESDIR}/mkc.subprjs.mk
+SYMLINKS += mkc_imp.pkg-config.mk ${MKFILESDIR}/mkc.pkg-config.mk
+SYMLINKS += mkc_imp.intexts.mk ${MKFILESDIR}/mkc.intexts.mk
+
+.include <mkc.mk>
diff --git a/mk-configure.7.in b/scripts/mk-configure.7.in
index f172304..7b0e4bc 100644
--- a/mk-configure.7.in
+++ b/scripts/mk-configure.7.in
@@ -18,7 +18,7 @@
.sp
..
.\" ------------------------------------------------------------------
-.TH MK-CONFIGURE 7 "Sep 2, 2009" "" ""
+.TH MK-CONFIGURE 7 "Dec 1, 2013" "" ""
.SH NAME
mk-configure \- lightweight replacement for GNU autotools
.SH DESCRIPTION
@@ -28,10 +28,12 @@ NetBSD make) and a number of executables. It is intended to simplify
crossplatform development and software building.
.P
To get system-specific configuration parameters, mkc.*.mk include
-files will try to include the file specified by the "MAKECONF"
+files try to include the file specified by the "MAKECONF"
variable. If MAKECONF is not set, or no such file exists, the system
make configuration file, @sysconfdir@/mk.conf or /etc/mk.conf, is
-included. These files may define any of the variables described
+included. Unless SRCTOP variable is set, "../Makefile.inc"
+is also included if exists.
+These files may define any of the variables described
below. Below in square brackets the default value for variables are specified.
In triangle brackets -- typical way of use, where
.I I
@@ -50,33 +52,38 @@ means "May be set in project's Makefile but may be initialized or overriden by u
.BR mkc.prog.mk ", " mkc.lib.mk ", " mkc.files.mk ", " mkc.subdir.mk ", and " mkc.subprj.mk
include files provide the following targets:
.IP all
-build everything
+build everything.
.IP clean
-clean temporary files created while building.
+clean temporary files and directories created while building with a help of
+${CLEANFILES_CMD} and ${CLEANDIRS_CMD} commands.
.IP cleandir
remove all of the files removed by the target clean, as
well as cache files created by
.BR mkc.configure.mk .
.IP distclean
-synonym for target "cleandir"
+synonym for target "cleandir".
.IP installdirs
-create target directories
+create target directories.
.IP install
install programs, libraries, files, include files, manual pages etc.
-to the target directories
+to the target directories with a help of ${INSTALL} program.
.IP uninstall
-remove installed files
+remove installed files with a help of ${UNINSTALL} command.
.IP errorcheck
check for MKC_ERR_MSG variable and fails if it set printing
an error message
.IP depend
-create .depend file containing list of dependencies (see mkdep(1))
+create .depend file containing list of dependencies (see mkdep(1)).
.IP filelist
output a list of destination files of the project, one per line, e.g.
.VS
/usr/local/bin/hello
/usr/local/man/man1/hello.1
.VE
+.IP "obj"
+if MKOBJDIR is "yes", creates object directories (${.OBJDIR}) according
+to MAKEOBJDIR and MAKEOBJPREFIX variables. Current umask is used for
+this.
.IP "bin_tar, bin_targz, bin_tarbz2, bin_zip, bin_deb"
build software, install it to a temporary directory (using DESTDIR)
and create .tar/.tar.gz/.tar.bz2/.zip/.deb archive
@@ -85,20 +92,22 @@ The target
.I bin_deb
expects debian control files in DEBIAN subdirectory, see examples/hello_files
for the sample.
-.IP <subdir>
+.IP "<subdir> and <subdir:T>"
<subdir> is a subdirectory listed in SUBDIR or SUBPRJ.
This target is equivalent to all-<subdir> and is provided by
.BR mkc.subdir.mk " and " mkc.subprj.mk
only. For details see
.BR mkc.subdir.mk " or " mkc.subprj.mk
-sections below.
+sections below. <subdir:T> means the last component of the directory.
+This target is created if ${SHORTPRJNAME} is "yes".
.IP <target>-<subdir>
runs the specified <target> for the specified <subdir>.
This target is provided by
.BR mkc.subdir.mk " and " mkc.subprj.mk
only. For details see
.BR mkc.subdir.mk " or " mkc.subprj.mk
-sections below.
+sections below. The target <target>-<subdir:T> is also provided
+if ${SHORTPRJNAME} is "yes".
.IP "subdir-<target>-<subdir> and nodeps-<target>-<subdir>"
runs the specified <target> for the specified <subdir> without dependencies.
These targets are provided by
@@ -106,6 +115,9 @@ These targets are provided by
only. For details see
.BR mkc.subprj.mk
section below.
+Targets subdir-<target>-<subdir:T>
+and nodeps-<target>-<subdir:T> are also provided
+if ${SHORTPRJNAME} is "yes".
.P
.B NOTE:
Commands associated with targets
@@ -134,12 +146,24 @@ assembly source files. []
C compiler.
.RI < Iu >
.RI [ cc ]
+.IP CC_PREFIX
+Prefix command for ${CC}, for example, distcc or ccache.
+.RI < Iu >
+.RI [ "" ]
.IP CFLAGS
Additional flags to the compiler when creating C objects.
.RI < "IM" >
.IP CFLAGS_<project>
Similar to CFLAGS but for project ${PROJECTNAME}.
.RI < "U" >
+.IP CLEANFILES_CMD
+Command for removing files used by targets "clean" and "cleandir".
+.RI < Iu >
+.RI [ "${RM} -f" ]
+.IP CLEANDIRS_CMD
+Command for removing directories used by targets "clean" and "cleandir".
+.RI < Iu >
+.RI [ "${RM} -rf" ]
.IP COPTS
Additional flags to the compiler when creating C objects.
.RI < "U" >
@@ -150,6 +174,10 @@ Similar to COPTS but for project ${PROJECTNAME}.
C++ compiler.
.RI < Iu >
.RI [ c++ ]
+.IP CXX_PREFIX
+Prefix command for ${CXX}, for example, distcc or ccache.
+.RI < Iu >
+.RI [ "" ]
.IP CXXFLAGS
Additional flags to the compiler when creating C++ objects.
.RI < "Iu" >
@@ -191,6 +219,14 @@ Lexical analyzer.
Options to ${LEX}.
.RI < Iu >
.RI [ "" ]
+.IP LN
+ln(1) tool.
+.RI < Iu >
+.RI [ ln ]
+.IP LN_S
+Tool equivalent to ln -s.
+.RI < Iu >
+.RI [ "${LN} -s" ]
.IP LPREFIX
Symbol prefix for ${LEX} (see -P option in lex(1)).
.RI < Iu >
@@ -212,6 +248,16 @@ List dependencies for object files.
.IP MAKE
bmake(1).
.RI [ bmake " or " make " on NetBSD]"
+.IP MAKEDEPEND
+makedepend(1) tool.
+.RI < Iu >
+.IP MKDIR
+mkdir(1) tool.
+.RI < Iu >
+.RI [ mkdir ]
+.IP MKDEP
+mkdep(1) tool.
+.RI < Iu >
.IP NM
List symbols from object files.
.RI < Iu >
@@ -240,6 +286,10 @@ Display information from object files.
Generate index to archive.
.RI < Iu >
.RI [ ranlib ]
+.IP RM
+rm(1) tool.
+.RI < Iu >
+.RI [ rm ]
.IP SIZE
List section sizes and total size.
.RI < Iu >
@@ -256,6 +306,10 @@ to be stripped.
Topological sort of a directed graph.
.RI < Iu >
.RI [ "tsort -q" ]
+.IP UNINSTALL
+Command for removing files used by target "uninstall".
+.RI < Iu >
+.RI [ "${RM} -f" ]
.IP YACC
LALR(1) parser generator.
.RI < Iu >
@@ -358,6 +412,19 @@ before installing files (target
.IR install ).
.RI < "Iu" >
.RI [ yes ]
+.IP MKOBJDIR
+If "yes", the target "obj" creates object directories, if "auto",
+object directories are created automatically. Otherwise object
+directories are not created.
+.RI < "Iu" >
+.RI [ auto ]
+.IP BMAKE_REQD
+Minimal required version of
+.BR bmake .
+If it is older,
+.B mkcmake
+exits with error.
+.RI < "Im" >
.IP MKC_REQD
Minimal required version of
.BR mk-configure .
@@ -454,6 +521,10 @@ These variables are set by mk-configure and enable warning messages
for C or C++ compilers according to their types (CC_TYPE and CXX_TYPE)
and warning level (WARNS).
.RI < "Iu" >
+.IP "CFLAGS.dflt.<cctype>, CXXFLAGS.dflt.<cxxtype>"
+Additional flags passed to
+C or C++ compilers according to their types (CC_TYPE and CXX_TYPE).
+.RI < "Iu" >
.IP "CFLAGS.pic, CXXFLAGS.pic"
Options for C and C++ compilers for generating position independent
code. On some platforms it makes sense to override these variables
@@ -476,6 +547,28 @@ See USE_SSP variable for more information.
If "yes", enables stack protection code, which detects stack overflows
and aborts the program. This enhances security but imposes some
performance penalty.
+.RI < "U" >
+.RI [ no ]
+.IP SRCTOP
+Top-level project's directory which
+defaults to ${.CURDIR} if ${.MAKE.LEVEL} is 0.
+If set, "../Makefile.inc"
+is not included. Also, the following command
+.br
+ mkcmake -C subproject target
+.br
+will be translated to
+.br
+ cd ${SRCTOP}; mkcmake target-subproject
+.RI < Iu >
+.IP OBJTOP
+Top-level object directory which
+defaults to ${.OBJDIR} if ${.MAKE.LEVEL} is 0.
+.RI < I >
+.SS "mkc.init.mk"
+This file sets most important mk-configure variables, for example,
+OPSYS, PREFIX, CC_TYPE etc. and is included automatically by
+.BR mkc.files.mk ", " mkc.lib.mk ", " mkc.prog.mk ", " mkc.subdir.mk " and " mkc.subprj.mk
.SS "mkc.files.mk"
The include file
.B mkc.files.mk
@@ -580,10 +673,6 @@ The include file
handles building program from one or
more source files, along with their manual pages. It has a limited
number of suffixes.
-The include file
-.B mkc.prog.mk
-includes the file named "../Makefile.inc"
-if it exists.
List of supported variables:
.IP PROG
The name of the program to build.
@@ -661,18 +750,12 @@ be exported.
.B mkc.prog.mk
includes
.B mkc.files.mk
-.\" and
-.\" .B mkc.own.mk
and therefore supports all variables supported by it.
.SS "mkc.lib.mk"
The include file
.B mkc.lib.mk
has support for building a static or dynanic library. It has a
limited number of suffixes.
-The include file
-.B mkc.lib.mk
-includes the file named "../Makefile.inc"
-if it exists.
.B mkc.lib.mk
uses the following variables:
.IP LIB
@@ -751,7 +834,7 @@ List of source files to build the library. Suffix types
If "yes", ${CC} is used for linking instead of ${LD}.
For C++ sources ${CXX} is used for linking.
.RI < "Iu" >
-.RI [ no ]
+.RI [ yes ]
.IP MKSHLIB
If not "no", build and install shared library provided that SHLIB_MAJOR is defined.
.RI < "IMu" >
@@ -798,9 +881,7 @@ The include file
.B mkc.subprj.mk
handles subprojects (subdirectories)
organized as a dependency graph.
-It includes the file named "../Makefile.inc"
-if it exists,
-and provides all targets provided by
+It provides all targets provided by
.BR mkc.prog.mk .
Variable SUBPRJ contains a list of pairs
.I depdir:dir
@@ -861,6 +942,15 @@ for subprojects are created in a top-level directory.
List of variables excluded from EXPORT_VARNAMES.
.RI < "Mu" >
.RI [ "" ]
+.IP NODEPS
+This variable specifies a list of patterns that describes edges from dependency
+graph in
+.IR targdep-prjdep : targ-prj
+or
+.IR targ-prj : targ
+formats to be excluded from dependency graph.
+.RI < "M" >
+.RI []
.IP NOSUBDIR
If for some reason you want to exclude some subdirectories from build,
list them in this variable.
@@ -870,16 +960,32 @@ list them in this variable.
Value of ${.OBJDIR} inside
.I dir
subdirectory. Slash symbols inside <dir> are replaced with underlines.
-In addition, OBJDIR_<dir:T> variable is set to ${OBJDIR_<dir>} if <dir>
-contains slashes.
+In addition, OBJDIR_<dir:T> variable is set to ${OBJDIR_<dir>}
+if ${SHORTPRJNAME} is "yes".
+.IP TARGETS
+List of recursive targets supported by the project and all its subprojects.
+.RI < "Im" >
+.RI [ all ", " install ", " installdirs ", " uninstall ", " clean ", "
+.IR cleandir ", " depends ", " test ", " errorcheck ", " filelist ]
+By setting this variable in the Makefile one can add new targets for special
+purposes, for example, static code analysis, partial builds etc.
+.IP SHORTPRJNAME
+If "yes", special targets with last component of the subprojects are provided.
+.RI < "Im" >
+.RI [ yes ]
+.IP MKRELOBJDIR
+If "yes", object directories
+.RI ${TOPOBJ}/ dir
+are used. Unlike MAKEOBJDIRPREFIX object directories do not contain
+top-level ${.CURDIR} in paths.
+.RI < "Iu" >
+.RI [ no ]
.SS "mkc.subdir.mk"
The include file
.B mkc.subdir.mk
contains the default targets for building
subdirectories.
-It includes the file named "../Makefile.inc"
-if it exists,
-and provides the same targets as
+It provides the same targets as
.BR mkc.prog.mk .
For all of
the directories listed in the variable SUBDIR, the specified directory
@@ -898,18 +1004,11 @@ must complete before any subdirs after .WAIT are
started. See
.B bmake(1)
for some caveats on use of .WAIT and other
-special sources.
+special sources. SUBDIR variable is provided as well as all variables provided
+by mkc.subprj.mk except SUBPRJ.
.IP SUBDIR
List of subdirectories
.RI < "M" >
-.IP "EXPORT_VARNAMES and NOEXPORT_VARNAMES"
-The same as in
-.B mkc.subprj.mk
-.IP NOSUBDIR
-The same as in
-.B mkc.subdir.mk
-.IP OBJDIR_<dir>
-The same as in
.B mkc.subprj.mk
.SS "mkc.configure.mk"
.B mkc.configure.mk
@@ -1204,6 +1303,9 @@ and
as
.IR lex .
.TP
+.BR prog_mkdep ", " prog_nbmkdep
+Find traditional BSD mkdep(1) or recent NetBSD version of it respectively.
+.TP
.B endianess
BUILTIN.endianess variable is set to either
.IR little ", " big " or " unknown
@@ -1576,7 +1678,10 @@ is an auxiliary include file that implement simple framework for unit
tests. Idea: application provides the target test_output and
expect.out file that contains ideal output. "bmake test" runs "bmake
test_output" and compare generated output with expect.out.
-Look at the sources.
+.IP TEST_PREREQS
+Prerequisites for target "test".
+.RI < "Iu" >
+.RI [ all ]
.SS "mkc_imp.pkg-config.mk"
.B mkc_imp.pkg-config.mk
is internal include file which is included from
@@ -1635,6 +1740,24 @@ Path to POD to HTML conversion utility
Flags passed to ${POD2HTML}
.RI < "Iu" >
.RI [ "" ].
+.SS "mkc_imp.dep.mk"
+.B mkc_imp.dep.mk
+is internal include file which is included from
+.BR mkc.prog.mk " and " mkc.lib.mk .
+Do not use it directly! This include file contains the default
+targets for building .depend files. It creates .d files from entries
+in SRCS and DPSRCS that are C, C++, or Objective C source files, and
+builds .depend from the .d files. All other files in SRCS and all of
+DPSRCS will be used as dependencies for the .d files.
+The following variables are provided:
+.IP SRCS
+The same as in
+.B mkc.prog.mk
+and
+.BR mkc.lib.mk .
+.IP DPSRCS
+List of source files which are needed for generating
+dependencies, but are not needed in ${SRCS}.
.SH "CROSS COMPILATION"
The following variables are used for compiling software using cross-rools.
.IP SYSROOT
diff --git a/mkc_check_common.sh b/scripts/mkc_check_common.sh
index 0f653d8..8daff04 100644
--- a/mkc_check_common.sh
+++ b/scripts/mkc_check_common.sh
@@ -1,6 +1,6 @@
# Copyright (c) 2009-2010 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
# include file, not executable
@@ -14,11 +14,11 @@ fi
MKC_CACHEDIR=${MKC_CACHEDIR:-.}
CC=${CC:-cc}
-tmpc=$MKC_CACHEDIR/_mkc_${pathpart}.c
-tmpo=$MKC_CACHEDIR/_mkc_${pathpart}.o
-tmperr=$MKC_CACHEDIR/_mkc_${pathpart}.err
-tmpexe=$MKC_CACHEDIR/_mkc_${pathpart}.exe
-cache=$MKC_CACHEDIR/_mkc_${pathpart}.res
+tmpc=$MKC_CACHEDIR/_mkc_${pathpart}${MKC_NOCACHE}.c
+tmpo=$MKC_CACHEDIR/_mkc_${pathpart}${MKC_NOCACHE}.o
+tmperr=$MKC_CACHEDIR/_mkc_${pathpart}${MKC_NOCACHE}.err
+tmpexe=$MKC_CACHEDIR/_mkc_${pathpart}${MKC_NOCACHE}.exe
+cache=$MKC_CACHEDIR/_mkc_${pathpart}${MKC_NOCACHE}.res
printme (){
if test "$MKC_VERBOSE" != 1; then
@@ -41,6 +41,13 @@ cleanup (){
fi
}
+cleanup_all (){
+ MKC_DELETE_TMPFILES=1
+ KEEP_SOURCE=0
+ rm -f "$cache"
+ cleanup
+}
+
check_and_cache (){
# $1 - message
# $2 - cache file name
@@ -81,3 +88,8 @@ find_n_match (){
exit 0
fi
}
+
+if test -n "$delcache"; then
+ cleanup_all
+ exit 0
+fi
diff --git a/mkc_check_compiler b/scripts/mkc_check_compiler
index 293d059..2945f24 100755
--- a/mkc_check_compiler
+++ b/scripts/mkc_check_compiler
@@ -3,7 +3,7 @@
############################################################
# Copyright (c) 2009-2010 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
set -e
@@ -11,6 +11,11 @@ set -e
LC_ALL=C
export LC_ALL
+: ${TMPDIR:=/tmp}
+
+tmpfile="$TMPDIR/mk-c.$$.c"
+trap 'rm -f "$tmpfile"' 0
+
##################################################
pathpart=compiler_type
@@ -50,7 +55,9 @@ BEGIN {
printf "if defined(%s)\ncompiler %s\n#el", ARGV [i], ARGV [i+1]
}
printf "se\ncompiler unknown\n#endif\n"
-}' $checks | $CC -E - | awk '$1 == "compiler" {print $2}'
+}' $checks >"$tmpfile"
+ $CC -E "$tmpfile" |
+ awk 'BEGIN { ret="unknown"} $1 == "compiler" {ret=$2; exit} END {print ret}'
}
. mkc_check_common.sh
diff --git a/mkc_check_custom b/scripts/mkc_check_custom
index e615761..5213d29 100755
--- a/mkc_check_custom
+++ b/scripts/mkc_check_custom
@@ -3,7 +3,7 @@
############################################################
# Copyright (c) 2009-2010 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
set -e
@@ -25,13 +25,14 @@ Usage:
mkc_check_custom [OPTIONS] cmd [args...]
OPTIONS:
- -h|--help display this help
+ -h display this help
-r build application and run it
-p a part of cache filename, defaults to "custom"
-n a part of cache filename, defaults to
`basename <source_file>` without extension
-m A part of verbose message, defaults to -n args
-s exit status of executable will be check
+ -d delete cache files
Examples:
mkc_check_custom my_custom_test.c
mkc_check_custom -r mmap_works_perfectly.c
@@ -42,7 +43,7 @@ if test $# -eq 0; then
usage
exit 1
fi
-if test "_$1" = '_-h' -o "_$1" = '_--help'; then
+if test "_$1" = '_-h'; then
usage
exit 0
fi
@@ -62,6 +63,8 @@ while test $# -ne 0; do
shift;;
-s)
check_status=1;;
+ -d)
+ delcache=1;;
-*)
echo "Bad option $1" 1>&2
exit 1;;
diff --git a/mkc_check_custom.1 b/scripts/mkc_check_custom.1
index d2f51f7..6ea2845 100644
--- a/mkc_check_custom.1
+++ b/scripts/mkc_check_custom.1
@@ -20,7 +20,7 @@ mkc_check_custom \- run user's custom checks.
.SH SYNOPSIS
.BI mkc_check_custom " [-r] <file>"
.br
-.BI mkc_check_custom " -h|--help"
+.BI mkc_check_custom " -h"
.SH DESCRIPTION
.B mkc_check_custom
takes a
@@ -48,7 +48,7 @@ extension. '.c' corresponds to
(Fortran).
.SH OPTIONS
.TP
-.B "-h|--help"
+.B "-h"
display help message
.SH ENVIRONMENT
.TP
diff --git a/mkc_check_decl b/scripts/mkc_check_decl
index f160d4f..e0cb8ea 100755
--- a/mkc_check_decl
+++ b/scripts/mkc_check_decl
@@ -3,7 +3,7 @@
############################################################
# Copyright (c) 2009-2010 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
set -e
@@ -25,7 +25,13 @@ mkc_check_decl detects presense of define, variable, function or type
in system header files by compiling a test program.
Usage:
- mkc_check_decl <define|variable|func[0-9]|type|member> <what> [includes...]
+ mkc_check_decl [OPTIONS] <CHECKTYPE> <what> [includes...]
+where CHECKTYPE is either of the following: "define", "variable",
+"func[0-9]", "type" or "member"
+
+OPTIONS:
+ -h display this help
+ -d delete cache files
Examples:
mkc_check_decl define __GNUC__
@@ -45,10 +51,14 @@ if test $# -eq 0; then
usage
exit 1
fi
-if test "_$1" = '_-h' -o "_$1" = '_--help'; then
+if test "_$1" = '_-h'; then
usage
exit 0
fi
+if test "_$1" = '_-d'; then
+ delcache=1
+ shift
+fi
##################################################
# initializing
diff --git a/mkc_check_decl.1 b/scripts/mkc_check_decl.1
index 6c87e3f..bc1866e 100644
--- a/mkc_check_decl.1
+++ b/scripts/mkc_check_decl.1
@@ -20,7 +20,7 @@ mkc_check_decl \- checks for define, function, variable or type.
.SH SYNOPSIS
.BI mkc_check_decl " <check_type> <what> [includes...]"
.br
-.BI mkc_check_decl " -h|--help"
+.BI mkc_check_decl " -h"
.SH DESCRIPTION
.I check_type
is either
@@ -35,7 +35,7 @@ by compiling a test program.
As a result it prints either 1 (success) or 0 (failure) to stdout.
.SH OPTIONS
.TP
-.B "-h|--help"
+.B "-h"
display help message
.SH ENVIRONMENT
.TP
diff --git a/mkc_check_funclib b/scripts/mkc_check_funclib
index 7e4b810..6b3ba4b 100755
--- a/mkc_check_funclib
+++ b/scripts/mkc_check_funclib
@@ -3,7 +3,7 @@
############################################################
# Copyright (c) 2009-2010 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
set -e
@@ -18,7 +18,11 @@ usage (){
mkc_check_funclib detects presense of function in a library
by compiling and linking a test program.
-Usage: mkc_check_funclib function [librarries...]
+Usage: mkc_check_funclib [OPTIONS] function [libraries...]
+
+OPTIONS:
+ -h display this help
+ -d delete cache files
Examples:
mkc_check_funclib dlopen dl
@@ -32,10 +36,14 @@ if test $# -eq 0; then
usage
exit 1
fi
-if test "_$1" = '_-h' -o "_$1" = '_--help'; then
+if test "_$1" = '_-h'; then
usage
exit 0
fi
+if test "_$1" = '_-d'; then
+ delcache=1
+ shift
+fi
##################################################
# initializing
diff --git a/mkc_check_funclib.1 b/scripts/mkc_check_funclib.1
index 415041d..edf4f1a 100644
--- a/mkc_check_funclib.1
+++ b/scripts/mkc_check_funclib.1
@@ -20,7 +20,7 @@ mkc_check_funclib \- detects presense of function in a library.
.SH SYNOPSIS
.BI mkc_check_funclib " <functionname>" " [libraries...]"
.br
-.BI mkc_check_funclib " -h|--help"
+.BI mkc_check_funclib " -h"
.SH DESCRIPTION
.B mkc_check_funclib
detects presense of function in a library
@@ -28,7 +28,7 @@ by compiling and linking a test program.
As a result it prints either 1 (true) or 0 (false) to stdout.
.SH OPTIONS
.TP
-.B "-h|--help"
+.B "-h"
display help message
.SH ENVIRONMENT
.TP
diff --git a/mkc_check_header b/scripts/mkc_check_header
index cf3dd9b..9398c3a 100755
--- a/mkc_check_header
+++ b/scripts/mkc_check_header
@@ -3,7 +3,7 @@
############################################################
# Copyright (c) 2009-2010 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
set -e
@@ -18,7 +18,7 @@ usage (){
mkc_check_header detects presense of header file
by compiling a test program.
-Usage: mkc_check_header header.h
+Usage: mkc_check_header [OPTIONS] header.h
Examples:
mkc_check_header stdint.h
@@ -30,10 +30,14 @@ if test $# -eq 0; then
usage
exit 1
fi
-if test "_$1" = '_-h' -o "_$1" = '_--help'; then
+if test "_$1" = '_-h'; then
usage
exit 0
fi
+if test "_$1" = '_-d'; then
+ delcache=1
+ shift
+fi
##################################################
# initializing
diff --git a/mkc_check_header.1 b/scripts/mkc_check_header.1
index f78b639..bd8bab7 100644
--- a/mkc_check_header.1
+++ b/scripts/mkc_check_header.1
@@ -20,14 +20,14 @@ mkc_check_header \- detects presense of header file.
.SH SYNOPSIS
.BI mkc_check_header " <header>"
.br
-.BI mkc_check_header " -h|--help"
+.BI mkc_check_header " -h"
.SH DESCRIPTION
.B mkc_check_header
detects presense of header file by compiling a test program.
As a result it prints either 1 (true) or 0 (false) to stdout.
.SH OPTIONS
.TP
-.B "-h|--help"
+.B "-h"
display help message
.SH ENVIRONMENT
.TP
diff --git a/mkc_check_prog b/scripts/mkc_check_prog
index db049b6..bf4a58e 100755
--- a/mkc_check_prog
+++ b/scripts/mkc_check_prog
@@ -3,7 +3,7 @@
############################################################
# Copyright (c) 2009-2010 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
set -e
@@ -20,8 +20,9 @@ mkc_check_prog detects presense of program file.
Usage: mkc_check_prog [OPTION] progname
OPTIONS:
- -h|--help display this screen
- -i program id, a part of _mkc_* cache file
+ -h display this screen
+ -i <progid> program id, a part of _mkc_* cache file
+ -d delete cache files
Examples:
mkc_check_prog -h
mkc_check_prog lua
@@ -32,12 +33,14 @@ EOF
while test $# -ne 0; do
case "$1" in
- -h|--help)
+ -h)
usage
exit 0;;
-i)
pathpart=prog_$2
shift;;
+ -d)
+ delcache=1;;
--)
shift
break;;
diff --git a/mkc_check_prog.1 b/scripts/mkc_check_prog.1
index 949ce3a..979897a 100644
--- a/mkc_check_prog.1
+++ b/scripts/mkc_check_prog.1
@@ -20,7 +20,7 @@ mkc_check_prog \- detects presense of header file.
.SH SYNOPSIS
.BI mkc_check_prog " <progname>"
.br
-.BI mkc_check_prog " -h|--help"
+.BI mkc_check_prog " -h"
.SH DESCRIPTION
.B mkc_check_prog
takes a name and looks for the file with that name which would be
@@ -31,8 +31,12 @@ Otherwise, an error message is printed and
exits with error.
.SH OPTIONS
.TP
-.B "-h|--help"
-display help message
+.B "-h"
+Display help message.
+.TP
+.BI -i " progid"
+.I progid
+will be used as a part of _mkc_* cache file name.
.SH ENVIRONMENT
.TP
.B PATH
diff --git a/mkc_check_sizeof b/scripts/mkc_check_sizeof
index 3980b23..5b35387 100755
--- a/mkc_check_sizeof
+++ b/scripts/mkc_check_sizeof
@@ -3,7 +3,7 @@
############################################################
# Copyright (c) 2009-2010 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
set -e
@@ -33,7 +33,7 @@ if test $# -eq 0; then
usage
exit 1
fi
-if test "_$1" = '_-h' -o "_$1" = '_--help'; then
+if test "_$1" = '_-h'; then
usage
exit 0
fi
diff --git a/mkc_check_sizeof.1 b/scripts/mkc_check_sizeof.1
index 385c94e..81b6136 100644
--- a/mkc_check_sizeof.1
+++ b/scripts/mkc_check_sizeof.1
@@ -20,7 +20,7 @@ mkc_check_sizeof \- detects a sizeof(type).
.SH SYNOPSIS
.BI mkc_check_sizeof " type [headers...]"
.br
-.BI mkc_check_sizeof " -h|--help"
+.BI mkc_check_sizeof " -h"
.SH DESCRIPTION
.B mkc_check_sizeof
detects sizeof(
@@ -32,7 +32,7 @@ and therefore is ready for using a cross-compiler.
are #include-d.
.SH OPTIONS
.TP
-.B "-h|--help"
+.B "-h"
display help message
.SH ENVIRONMENT
.TP
diff --git a/mkc_check_version.in b/scripts/mkc_check_version.in
index d4ed400..79ca154 100755
--- a/mkc_check_version.in
+++ b/scripts/mkc_check_version.in
@@ -3,7 +3,7 @@
############################################################
# Copyright (c) 2009-2010 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
#
diff --git a/mkc_install b/scripts/mkc_install
index e9de238..913753b 100755
--- a/mkc_install
+++ b/scripts/mkc_install
@@ -4,6 +4,7 @@
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
+# Copyright 2013 by Aleksey Cheusov <vle@gmx.net>
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
@@ -41,8 +42,6 @@ stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
-transformbasename=""
-transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
@@ -83,20 +82,9 @@ while [ x"$1" != x ]; do
shift
continue;;
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
+ *) if [ x"$src" = x ]; then
src=$1
else
- # this colon is to work around a 386BSD /bin/sh bug
- :
dst=$1
fi
shift
@@ -104,8 +92,7 @@ while [ x"$1" != x ]; do
esac
done
-if [ x"$src" = x ]
-then
+if [ x"$src" = x ]; then
echo "install: no input file specified"
exit 1
else
@@ -114,13 +101,12 @@ fi
if [ x"$dir_arg" != x ]; then
dst=$src
- src=""
-
+
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
- instcmd=mkdir
+ instcmd="$mkdirprog -p"
fi
else
@@ -128,16 +114,14 @@ else
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
- if [ -f $src -o -d $src ]
- then
+ if [ -f $src -o -d $src ]; then
true
else
echo "install: $src does not exist"
exit 1
fi
- if [ x"$dst" = x ]
- then
+ if [ x"$dst" = x ]; then
echo "install: no destination specified"
exit 1
else
@@ -147,51 +131,17 @@ else
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
- if [ -d $dst ]
- then
+ if [ -d $dst ]; then
dst="$dst"/`basename $src`
else
true
fi
fi
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
+##
+dstdir=`dirname $dst`
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
+if [ x"$dir_arg" != x ]; then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
@@ -199,25 +149,13 @@ then
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
+# Make sure that the destination directory exists.
+ if [ ! -d "$dstdir" ]; then
+ $mkdirprog -p "$dstdir" 2>/dev/null
fi
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
+# No renaming of the final executable
+ dstfile=`basename $dst`
# Make a temp file name in the proper directory.
diff --git a/mkc_which b/scripts/mkc_which
index 3d5c60e..9b764a4 100755
--- a/mkc_which
+++ b/scripts/mkc_which
@@ -3,7 +3,7 @@
############################################################
# Copyright (c) 2009-2012 by Aleksey Cheusov
#
-# See COPYRIGHT file in the distribution.
+# See LICENSE file in the distribution.
############################################################
# Portable replacement for which(1)
@@ -24,15 +24,18 @@ EOF
fi
if echo "$1" | grep '^/' > /dev/null; then
- echo $1
- exit 0
-fi
-for i in `echo $PATH|tr : ' '`; do
- if test -x "$i/$1" -a -f "$i/$1"; then
- echo $i/$1
+ if test -x "$1"; then
+ echo $1
exit 0
fi
-done
+else
+ for i in `echo $PATH|tr : ' '`; do
+ if test -x "$i/$1" -a -f "$i/$1"; then
+ echo $i/$1
+ exit 0
+ fi
+ done
+fi
echo "Cannot find $1" >&2
exit $failure
diff --git a/mkcmake.1 b/scripts/mkcmake.1
index 5757e77..5757e77 100644
--- a/mkcmake.1
+++ b/scripts/mkcmake.1
diff --git a/mkcmake.in b/scripts/mkcmake.in
index b2d3fe7..b2d3fe7 100644
--- a/mkcmake.in
+++ b/scripts/mkcmake.in
diff --git a/tests/Makefile b/tests/Makefile
index b3621eb..3445bd2 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,6 +1,12 @@
-NOEXPORT_VARNAMES= MKC_CACHEDIR
+SHRTOUT = no
+NOEXPORT_VARNAMES = MKC_CACHEDIR
+EXPORT_VARNAMES = SHRTOUT
-SUBDIR += configure_test
+BUILTINSDIR = ${OBJDIR_custom}
+.export BUILTINSDIR
+
+SUBDIR += configure_test
+SUBDIR += mkinstall
SUBDIR += ../examples
SUBDIR += mkshlib
SUBDIR += mkstaticlib
@@ -15,5 +21,13 @@ SUBDIR += rec_makefiles
SUBDIR += reqd
SUBDIR += reqd2
SUBDIR += reqd3
+SUBDIR += reqd4
+SUBDIR += reqd_clean_cache
+SUBDIR += intexts_cleantrg
+SUBDIR += test_subprj_dash
+SUBDIR += test_mkc_vs_PROG
+SUBDIR += test_mkc_vs_LIB
+SUBDIR += test_mkc_vs_SUBDIR
+SUBDIR += test_mkc_vs_SUBPRJ
.include <mkc.mk>
diff --git a/tests/configure_test/expect.out b/tests/configure_test/expect.out
index 585ca10..f7e8ddf 100644
--- a/tests/configure_test/expect.out
+++ b/tests/configure_test/expect.out
@@ -85,7 +85,7 @@ HAVE_PROG.sh=1
PROG.sh=/somewhere/bin/sh
HAVE_PROG.awk=0
PROG.awk=
-HAVE_PROG.megaprog-x34=1
+HAVE_PROG.megaprog-x34=0
PROG.megaprog-x34=/bad/path
MKC_AUTO_CFLAGS=-DHAVE_HEADER_SYS_TIME_H=2 -DHAVE_HEADER_STRING_H=2 -DHAVE_HEADER_INCLUDE_MKC_TEST_H=1 -DSIZEOF_INT=n -DSIZEOF_LONG_LONG=n -DSIZEOF_VOIDP=n -DSIZEOF_SIZE_T_STRING_H=n -DHAVE_DEFINE___BAD_DEFINE__=1 -DHAVE_DEFINE_MKC_TEST_DEFINE_INCLUDE_MKC_TEST_H=1 -DHAVE_TYPE_SIZE_T_STRING_H=1 -DHAVE_TYPE_BAD_TYPE=1 -DHAVE_VAR_ERRNO_ERRNO_H=1 -DHAVE_VAR_MKC_TEST_VAR_INCLUDE_MKC_TEST_H=1 -DHAVE_MEMBER_STRUCT_TM_TM_ISDST_TIME_H=1 -DHAVE_MEMBER_STRUCT_SOCKADDR_IN_SIN_ADDR_S_ADDR_ARPA_INET_H_NETINET_IN_H=1 -DHAVE_MEMBER_BAD_MEMBER=1 -DHAVE_MEMBER_BAD_MEMBER_STRING_H=1 -DHAVE_MEMBER_STRUCT_MKC_TEST_T_A_INCLUDE_MKC_TEST_H=1 -DHAVE_MEMBER_STRUCT_MKC_TEST_T_B_C_INCLUDE_MKC_TEST_H=1 -DHAVE_FUNC2_STRCMP_STRING_H=1 -DHAVE_FUNC3_STRCPY=1 -DHAVE_FUNC5_MKC_TEST_FUNC_INCLUDE_MKC_TEST_H=1 -DCUSTOM_CUSTOM_CHECK2=1
MKC_AUTO_SRCS=superfunc1.c superfunc2.c
diff --git a/tests/intexts_cleantrg/Makefile b/tests/intexts_cleantrg/Makefile
new file mode 100644
index 0000000..6ed3399
--- /dev/null
+++ b/tests/intexts_cleantrg/Makefile
@@ -0,0 +1,6 @@
+INFILES = foo
+INTEXTS_REPLS = AWK ${PROG.awk}
+MKC_CHECK_PROGS = awk
+
+.include "test.mk"
+.include <mkc.mk>
diff --git a/tests/intexts_cleantrg/expect.out b/tests/intexts_cleantrg/expect.out
new file mode 100644
index 0000000..b0d1d21
--- /dev/null
+++ b/tests/intexts_cleantrg/expect.out
@@ -0,0 +1,29 @@
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_prog_awk.err
+/objdir/_mkc_prog_awk.res
+/objdir/expect.out
+/objdir/foo
+/objdir/foo.in
+/objdir/intexts_cleantrg.test.out.tmp
+/objdir/test.mk
+========== clean ===========
+/objdir/Makefile
+/objdir/_mkc_prog_awk.err
+/objdir/_mkc_prog_awk.res
+/objdir/expect.out
+/objdir/foo.in
+/objdir/intexts_cleantrg.test.out.tmp
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/foo.in
+/objdir/intexts_cleantrg.test.out.tmp
+/objdir/test.mk
+======= cleandir ==========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/foo.in
+/objdir/intexts_cleantrg.test.out.tmp
+/objdir/test.mk
diff --git a/tests/intexts_cleantrg/foo.in b/tests/intexts_cleantrg/foo.in
new file mode 100644
index 0000000..9e1d5a8
--- /dev/null
+++ b/tests/intexts_cleantrg/foo.in
@@ -0,0 +1,6 @@
+#!@AWK@
+
+BEGIN {
+ print "Hello World!"
+}
+
diff --git a/tests/intexts_cleantrg/test.mk b/tests/intexts_cleantrg/test.mk
new file mode 100644
index 0000000..c1964a5
--- /dev/null
+++ b/tests/intexts_cleantrg/test.mk
@@ -0,0 +1,26 @@
+.PHONY : test_output
+test_output :
+ @set -e; \
+ \
+ echo =========== all ============; \
+ 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 ======= cleandir ==========; \
+ ${MAKE} ${MAKEFLAGS} distclean > /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/tests/lua_dirs/Makefile b/tests/lua_dirs/Makefile
index e1d7e48..80603d8 100644
--- a/tests/lua_dirs/Makefile
+++ b/tests/lua_dirs/Makefile
@@ -5,7 +5,8 @@ LUA_LMODULES= ../../examples/hello_lua/foo.lua
LUA_LMODULES+= ../../examples/hello_lua/bar.lua
LUA_CMODULE= baz
-SCRIPTS= ../../examples/hello_lua/foobar
+SCRIPTS = ${INSCRIPTS:T}
+INSCRIPTS= ../../examples/hello_lua/foobar
.include <mkc.lib.mk>
.include "test.mk"
diff --git a/tests/lua_dirs/expect.out b/tests/lua_dirs/expect.out
index 9846e1d..ef92d27 100644
--- a/tests/lua_dirs/expect.out
+++ b/tests/lua_dirs/expect.out
@@ -19,6 +19,7 @@
/objdir/baz.os
/objdir/baz.so
/objdir/expect.out
+/objdir/foobar
/objdir/lua_dirs.test.out.tmp
/objdir/test.mk
========= install ==========
diff --git a/tests/lua_dirs/test.mk b/tests/lua_dirs/test.mk
index 7ccc23b..824da7e 100644
--- a/tests/lua_dirs/test.mk
+++ b/tests/lua_dirs/test.mk
@@ -12,12 +12,12 @@ test_output:
echo ========= install ==========; \
${MAKE} ${MAKEFLAGS} installdirs install DESTDIR=${.OBJDIR} \
> /dev/null; \
- find ${.OBJDIR}/usr -type f -o -type d | \
+ find ${.OBJDIR}${PREFIX} -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 | \
+ find ${.OBJDIR}${PREFIX} -type f | \
mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
\
echo ========== clean ===========; \
diff --git a/tests/mkinstall/Makefile b/tests/mkinstall/Makefile
new file mode 100644
index 0000000..8a4cc6a
--- /dev/null
+++ b/tests/mkinstall/Makefile
@@ -0,0 +1,12 @@
+PROG = qux
+MAN = qux.1
+FILES = foo
+SCRIPTS = bar
+INCS = baz.h
+LINKS = ${BINDIR}/qux ${BINDIR}/qux2
+SYMLINKS = ${BINDIR}/foo ${BINDIR}/foo2
+MLINKS = qux.1 qux2.1
+TEXINFO = qux.info
+
+.include "test.mk"
+.include <mkc.mk>
diff --git a/tests/mkinstall/bar b/tests/mkinstall/bar
new file mode 100755
index 0000000..97cca98
--- /dev/null
+++ b/tests/mkinstall/bar
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo 'Hello World!'
diff --git a/tests/mkinstall/baz.h b/tests/mkinstall/baz.h
new file mode 100644
index 0000000..de42f2d
--- /dev/null
+++ b/tests/mkinstall/baz.h
@@ -0,0 +1 @@
+extern int baz;
diff --git a/tests/mkinstall/expect.out b/tests/mkinstall/expect.out
new file mode 100644
index 0000000..4e40bcf
--- /dev/null
+++ b/tests/mkinstall/expect.out
@@ -0,0 +1,55 @@
+=========== all ============
+/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
+/objdir/bar
+/objdir/baz.h
+/objdir/expect.out
+/objdir/foo
+/objdir/foo.in
+/objdir/mkinstall.test.out.tmp
+/objdir/qux
+/objdir/qux.1
+/objdir/qux.c
+/objdir/qux.cat1
+/objdir/qux.info
+/objdir/qux.o
+/objdir/qux.texinfo
+/objdir/test.mk
+===== all SHRTOUT=yes ======
+CC: qux.c
+LD: qux
+NROFF: qux.cat1
+TEXINFO: qux.info
+========= installdirs MKINSTALL=no ==========
+========= install MKINSTALL=no ==========
+========= installdirs ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/include
+/objdir/prefix/info
+/objdir/prefix/man
+/objdir/prefix/man/cat1
+/objdir/prefix/man/man1
+========= install ==========
+/objdir/prefix
+/objdir/prefix/bin
+/objdir/prefix/bin/bar
+/objdir/prefix/bin/foo
+/objdir/prefix/bin/foo2
+/objdir/prefix/bin/qux
+/objdir/prefix/bin/qux2
+/objdir/prefix/include
+/objdir/prefix/include/baz.h
+/objdir/prefix/info
+/objdir/prefix/info/dir
+/objdir/prefix/info/qux.info
+/objdir/prefix/man
+/objdir/prefix/man/cat1
+/objdir/prefix/man/cat1/qux.0
+/objdir/prefix/man/cat1/qux2.0
+/objdir/prefix/man/man1
+/objdir/prefix/man/man1/qux.1
+/objdir/prefix/man/man1/qux2.1
diff --git a/tests/mkinstall/foo b/tests/mkinstall/foo
new file mode 100644
index 0000000..a371886
--- /dev/null
+++ b/tests/mkinstall/foo
@@ -0,0 +1 @@
+# lalala
diff --git a/tests/mkinstall/foo.in b/tests/mkinstall/foo.in
new file mode 100644
index 0000000..9e1d5a8
--- /dev/null
+++ b/tests/mkinstall/foo.in
@@ -0,0 +1,6 @@
+#!@AWK@
+
+BEGIN {
+ print "Hello World!"
+}
+
diff --git a/tests/mkinstall/qux.1 b/tests/mkinstall/qux.1
new file mode 100644
index 0000000..7c0573a
--- /dev/null
+++ b/tests/mkinstall/qux.1
@@ -0,0 +1,15 @@
+.\" $NetBSD$
+.\"
+.\" Copyright (c) 2013 by Aleksey Cheusov (vle@gmx.net)
+.\" Absolutely no warranty.
+.\"
+.TH SHELL_FUNCS 7 "Oct 29, 2013"
+.SH NAME
+qux - test
+.SH DESCRIPTION
+.B qux
+is a test...
+.SH SEE ALSO
+.BR sh(1) ,
+.SH AUTHOR
+Aleksey Cheusov <vle@gmx.net>
diff --git a/tests/mkinstall/qux.c b/tests/mkinstall/qux.c
new file mode 100644
index 0000000..bab33e9
--- /dev/null
+++ b/tests/mkinstall/qux.c
@@ -0,0 +1,4 @@
+int main (int argc, char **argv)
+{
+ return 0;
+}
diff --git a/tests/mkinstall/qux.texinfo b/tests/mkinstall/qux.texinfo
new file mode 100644
index 0000000..13e7efb
--- /dev/null
+++ b/tests/mkinstall/qux.texinfo
@@ -0,0 +1,38 @@
+\input texinfo @c -*-texinfo-*-
+@setfilename qux.info
+@settitle qux shell functions
+@setchapternewpage odd
+
+@ifinfo
+@dircategory Libraries
+@direntry
+* qux: (qux). Info page for qux.
+@end direntry
+
+This is fake!
+
+@end ifinfo
+
+@titlepage
+@title qux info page
+@subtitle Edition 11, Version 22.
+@subtitle 5
+@author Aleksey Cheusov
+
+@page
+foobar
+
+@vskip 0pt plus 1filll
+Copyright @copyright{} 2009 Aleksey Cheusov
+@end titlepage
+
+@ifinfo
+@node Top
+@top qux fake!
+
+This is fake too!
+
+@end ifinfo
+
+@contents
+@bye
diff --git a/tests/mkinstall/test.mk b/tests/mkinstall/test.mk
new file mode 100644
index 0000000..4f86b05
--- /dev/null
+++ b/tests/mkinstall/test.mk
@@ -0,0 +1,47 @@
+.PHONY : test_output
+test_output :
+ @set -e; \
+ MKCATPAGES=yes; export MKCATPAGES; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo =========== all ============; \
+ ${MAKE} ${MAKEFLAGS} all > /dev/null; \
+ 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 MKINSTALL=no ==========; \
+ env MKINSTALL=no ${MAKE} ${MAKEFLAGS} installdirs \
+ DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l -o -type d | grep '${PREFIX}' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ echo ========= install MKINSTALL=no ==========; \
+ env MKINSTALL=no ${MAKE} ${MAKEFLAGS} install \
+ DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l -o -type d | grep '${PREFIX}' | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ 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}"; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ \
+ 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}"; \
+ \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null
+
+.include <mkc.minitest.mk>
diff --git a/tests/pkg_config_1/Makefile b/tests/pkg_config_1/Makefile
index d2dcc08..533a5a6 100644
--- a/tests/pkg_config_1/Makefile
+++ b/tests/pkg_config_1/Makefile
@@ -3,4 +3,4 @@ LIB= mkc_fake
PKG_CONFIG_DEPS= mkc_fake-2.0>=2.10
.include "test.mk"
-.include <mkc.prog.mk>
+.include <mkc.lib.mk>
diff --git a/tests/reqd/expect.out b/tests/reqd/expect.out
index f613042..4c34049 100644
--- a/tests/reqd/expect.out
+++ b/tests/reqd/expect.out
@@ -1 +1 @@
-ERROR: We need mk-configure v.999.0.0 while 0.24.0 is detected
+ERROR: We need mk-configure v.999.0.0 while 0.25.0 is detected
diff --git a/tests/reqd2/expect.out b/tests/reqd2/expect.out
index f613042..4c34049 100644
--- a/tests/reqd2/expect.out
+++ b/tests/reqd2/expect.out
@@ -1 +1 @@
-ERROR: We need mk-configure v.999.0.0 while 0.24.0 is detected
+ERROR: We need mk-configure v.999.0.0 while 0.25.0 is detected
diff --git a/tests/reqd3/expect.out b/tests/reqd3/expect.out
index f613042..4c34049 100644
--- a/tests/reqd3/expect.out
+++ b/tests/reqd3/expect.out
@@ -1 +1 @@
-ERROR: We need mk-configure v.999.0.0 while 0.24.0 is detected
+ERROR: We need mk-configure v.999.0.0 while 0.25.0 is detected
diff --git a/tests/reqd4/Makefile b/tests/reqd4/Makefile
new file mode 100644
index 0000000..fc3d62b
--- /dev/null
+++ b/tests/reqd4/Makefile
@@ -0,0 +1,9 @@
+MKC_REQD = 999.0.0
+
+MKC_CHECK_HEADERS = stdio.h
+
+INSCRIPTS = hello
+SCRIPTS = ${INSCRIPTS}
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/tests/reqd4/expect.out b/tests/reqd4/expect.out
new file mode 100644
index 0000000..8df812e
--- /dev/null
+++ b/tests/reqd4/expect.out
@@ -0,0 +1,8 @@
+ERROR: We need mk-configure v.999.0.0 while 0.25.0 is detected
+"bmake-20110606 or newer is required"
+=========== all ============
+/objdir/Makefile
+/objdir/expect.out
+/objdir/hello.in
+/objdir/reqd4.test.out
+/objdir/test.mk
diff --git a/tests/reqd4/hello.in b/tests/reqd4/hello.in
new file mode 100755
index 0000000..97cca98
--- /dev/null
+++ b/tests/reqd4/hello.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo 'Hello World!'
diff --git a/tests/reqd4/test.mk b/tests/reqd4/test.mk
new file mode 100644
index 0000000..bfcfb07
--- /dev/null
+++ b/tests/reqd4/test.mk
@@ -0,0 +1,18 @@
+CLEANFILES += ${.OBJDIR}/${.CURDIR:T}.test.out
+
+test:
+ @echo 'Testing ${.CURDIR}... ' 1>&2; \
+ set -e; cd ${.CURDIR}; \
+ tmp_out=${.OBJDIR}/${.CURDIR:T}.test.out; \
+ { \
+ ${MAKE} ${MAKEFLAGS} -j3 all 2>&1 | sed -n 2p; \
+ ${MAKE} ${MAKEFLAGS} -j3 all MAKE_VERSION=00000000 2>&1 | sed 's/^.*"bmake/"bmake/'; \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ } > $$tmp_out; \
+ diff ${.CURDIR}/expect.out $$tmp_out && \
+ echo ' succeeded' 1>&2 || \
+ { echo ' FAILED' 1>&2; ex=1; }; \
+ ${MAKE} ${MAKEFLAGS} cleandir; \
+ exit $$ex
diff --git a/tests/reqd_clean_cache/Makefile b/tests/reqd_clean_cache/Makefile
new file mode 100644
index 0000000..04ea2e9
--- /dev/null
+++ b/tests/reqd_clean_cache/Makefile
@@ -0,0 +1,14 @@
+MKC_REQUIRE_HEADERS = trtrtr.h sys/brbrbr.h
+MKC_REQUIRE_PROGS = trtrtr brbrbr
+MKC_REQUIRE_FUNCLIBS = trtrtr brbrbr:dl
+MKC_REQUIRE_DEFINES = TRTRTR BRBRBR:sys/time.h
+MKC_REQUIRE_TYPES = trtrtr_t brbrbr_t:sys/time.h
+MKC_REQUIRE_VARS = v_trtrtr v_brbrbr:sys/time.h
+MKC_REQUIRE_MEMBERS = trtr.trtr_t:string.h brbr.brbr_t:sys/time.h
+MKC_REQUIRE_FUNCS2 = trtrtr:sys/time.h
+MKC_REQUIRE_FUNCS3 = brbrbr
+MKC_REQUIRE_CUSTOM = test1
+MKC_CUSTOM_FN.test1 = test1.c
+
+.include "test.mk"
+.include <mkc.mk>
diff --git a/tests/reqd_clean_cache/expect.out b/tests/reqd_clean_cache/expect.out
new file mode 100644
index 0000000..877cecc
--- /dev/null
+++ b/tests/reqd_clean_cache/expect.out
@@ -0,0 +1,27 @@
+=========== all ============
+ERROR: cannot find header trtrtr.h
+ERROR: cannot find header sys/brbrbr.h
+ERROR: cannot find function trtrtr
+ERROR: cannot find function brbrbr:dl
+ERROR: cannot find declaration of define TRTRTR
+ERROR: cannot find declaration of define BRBRBR:sys/time.h
+ERROR: cannot find declaration of type trtrtr_t
+ERROR: cannot find declaration of type brbrbr_t:sys/time.h
+ERROR: cannot find declaration of variable v_trtrtr
+ERROR: cannot find declaration of variable v_brbrbr:sys/time.h
+ERROR: cannot find member trtr.trtr_t:string.h
+ERROR: cannot find member brbr.brbr_t:sys/time.h
+ERROR: cannot find declaration of function trtrtr:sys/time.h
+ERROR: cannot find declaration of function brbrbr
+ERROR: custom test test1 failed
+ERROR: cannot find program trtrtr
+ERROR: cannot find program brbrbr
+*** Error code 1
+
+Stop.
+bmake: stopped in /objdir
+/objdir/Makefile
+/objdir/expect.out
+/objdir/reqd_clean_cache.test.out.tmp
+/objdir/test.mk
+/objdir/test1.c
diff --git a/tests/reqd_clean_cache/test.mk b/tests/reqd_clean_cache/test.mk
new file mode 100644
index 0000000..e5cea19
--- /dev/null
+++ b/tests/reqd_clean_cache/test.mk
@@ -0,0 +1,14 @@
+TEST_PREREQS = # empty
+
+.PHONY : test_output
+test_output :
+ @set -e; LC_ALL=C; export LC_ALL; \
+ \
+ echo =========== all ============; \
+ { ${MAKE} ${MAKEFLAGS} all 2>/dev/null || true; \
+ find ${.OBJDIR} -type f -o -type l | sort; } | \
+ env NOSORT=1 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ ${MAKE} ${MAKEFLAGS} cleandir > /dev/null
+
+.include <mkc.minitest.mk>
diff --git a/tests/reqd_clean_cache/test1.c b/tests/reqd_clean_cache/test1.c
new file mode 100644
index 0000000..cdbfe11
--- /dev/null
+++ b/tests/reqd_clean_cache/test1.c
@@ -0,0 +1 @@
+badtype_t var = 0;
diff --git a/tests/test_mkc_vs_LIB/Makefile b/tests/test_mkc_vs_LIB/Makefile
new file mode 100644
index 0000000..764c949
--- /dev/null
+++ b/tests/test_mkc_vs_LIB/Makefile
@@ -0,0 +1 @@
+.include "../test_mkc_vs_PROG/Makefile"
diff --git a/tests/test_mkc_vs_LIB/expect.out b/tests/test_mkc_vs_LIB/expect.out
new file mode 100644
index 0000000..5d75455
--- /dev/null
+++ b/tests/test_mkc_vs_LIB/expect.out
@@ -0,0 +1 @@
+LIB is not allowed for mkc.files.mk
diff --git a/tests/test_mkc_vs_LIB/test.mk b/tests/test_mkc_vs_LIB/test.mk
new file mode 100644
index 0000000..23930e1
--- /dev/null
+++ b/tests/test_mkc_vs_LIB/test.mk
@@ -0,0 +1,3 @@
+LIB = my
+
+.include <mkc.files.mk>
diff --git a/tests/test_mkc_vs_PROG/Makefile b/tests/test_mkc_vs_PROG/Makefile
new file mode 100644
index 0000000..706f1d2
--- /dev/null
+++ b/tests/test_mkc_vs_PROG/Makefile
@@ -0,0 +1 @@
+.include "../test_subprj_dash/Makefile"
diff --git a/tests/test_mkc_vs_PROG/expect.out b/tests/test_mkc_vs_PROG/expect.out
new file mode 100644
index 0000000..fe8b169
--- /dev/null
+++ b/tests/test_mkc_vs_PROG/expect.out
@@ -0,0 +1 @@
+PROG is not allowed for mkc.lib.mk
diff --git a/tests/test_mkc_vs_PROG/test.mk b/tests/test_mkc_vs_PROG/test.mk
new file mode 100644
index 0000000..c46502f
--- /dev/null
+++ b/tests/test_mkc_vs_PROG/test.mk
@@ -0,0 +1,3 @@
+PROG = prog
+
+.include <mkc.lib.mk>
diff --git a/tests/test_mkc_vs_SUBDIR/Makefile b/tests/test_mkc_vs_SUBDIR/Makefile
new file mode 100644
index 0000000..764c949
--- /dev/null
+++ b/tests/test_mkc_vs_SUBDIR/Makefile
@@ -0,0 +1 @@
+.include "../test_mkc_vs_PROG/Makefile"
diff --git a/tests/test_mkc_vs_SUBDIR/expect.out b/tests/test_mkc_vs_SUBDIR/expect.out
new file mode 100644
index 0000000..c62036f
--- /dev/null
+++ b/tests/test_mkc_vs_SUBDIR/expect.out
@@ -0,0 +1 @@
+SUBDIR is not allowed for mkc.subprj.mk
diff --git a/tests/test_mkc_vs_SUBDIR/test.mk b/tests/test_mkc_vs_SUBDIR/test.mk
new file mode 100644
index 0000000..518407c
--- /dev/null
+++ b/tests/test_mkc_vs_SUBDIR/test.mk
@@ -0,0 +1,3 @@
+SUBDIR = dir1 dir2
+
+.include <mkc.subprj.mk>
diff --git a/tests/test_mkc_vs_SUBPRJ/Makefile b/tests/test_mkc_vs_SUBPRJ/Makefile
new file mode 100644
index 0000000..764c949
--- /dev/null
+++ b/tests/test_mkc_vs_SUBPRJ/Makefile
@@ -0,0 +1 @@
+.include "../test_mkc_vs_PROG/Makefile"
diff --git a/tests/test_mkc_vs_SUBPRJ/expect.out b/tests/test_mkc_vs_SUBPRJ/expect.out
new file mode 100644
index 0000000..0b488de
--- /dev/null
+++ b/tests/test_mkc_vs_SUBPRJ/expect.out
@@ -0,0 +1 @@
+SUBPRJ is not allowed for mkc.prog.mk
diff --git a/tests/test_mkc_vs_SUBPRJ/test.mk b/tests/test_mkc_vs_SUBPRJ/test.mk
new file mode 100644
index 0000000..227e635
--- /dev/null
+++ b/tests/test_mkc_vs_SUBPRJ/test.mk
@@ -0,0 +1,3 @@
+SUBPRJ = dir1 dir2
+
+.include <mkc.prog.mk>
diff --git a/tests/test_subprj_dash/Makefile b/tests/test_subprj_dash/Makefile
new file mode 100644
index 0000000..532832d
--- /dev/null
+++ b/tests/test_subprj_dash/Makefile
@@ -0,0 +1,14 @@
+CLEANFILES += ${.OBJDIR}/${.CURDIR:T}.test.out
+
+test:
+ @echo 'Testing ${.CURDIR}... ' 1>&2; \
+ set -e; \
+ tmp_out=${.OBJDIR}/${.CURDIR:T}.test.out; \
+ rm -f $$tmp_out; \
+ ${MAKE} ${MAKEFLAGS} -f ${.CURDIR}/test.mk all 2>&1 | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}" > $$tmp_out; \
+ diff ${.CURDIR}/expect.out $$tmp_out && \
+ echo ' succeeded' 1>&2 || \
+ { echo ' FAILED' 1>&2; false; }
+
+.include <mkc.subprj.mk>
diff --git a/tests/test_subprj_dash/expect.out b/tests/test_subprj_dash/expect.out
new file mode 100644
index 0000000..e23e0e3
--- /dev/null
+++ b/tests/test_subprj_dash/expect.out
@@ -0,0 +1 @@
+Dash symbol is not allowed inside subdir (another-one prog100-500)
diff --git a/tests/test_subprj_dash/test.mk b/tests/test_subprj_dash/test.mk
new file mode 100644
index 0000000..7ba6a8f
--- /dev/null
+++ b/tests/test_subprj_dash/test.mk
@@ -0,0 +1,3 @@
+SUBPRJ = prog prog100-500 liba another-one
+
+.include <mkc.subprj.mk>