From 7bea690e43ee009efc9e8f6a45504496348cd3ee Mon Sep 17 00:00:00 2001 From: Andrew Shadura Date: Sat, 25 Jul 2015 14:44:54 +0200 Subject: Imported Upstream version 0.28.0 --- examples/Makefile.inc | 4 +- examples/hello_autoconf/Makefile | 15 ++ examples/hello_autoconf/expect.out | 46 ++++ examples/hello_autoconf/proj/AUTHORS | 1 + examples/hello_autoconf/proj/COPYING | 26 +++ examples/hello_autoconf/proj/ChangeLog | 1 + examples/hello_autoconf/proj/Makefile.in | 26 +++ examples/hello_autoconf/proj/NEWS | 1 + examples/hello_autoconf/proj/README | 1 + examples/hello_autoconf/proj/configure.ac | 14 ++ examples/hello_autoconf/proj/hello_autoconf.c | 11 + examples/hello_autoconf/test.mk | 27 +++ examples/hello_autotools/Makefile | 11 + examples/hello_autotools/expect.out | 62 ++++++ examples/hello_autotools/proj/AUTHORS | 1 + examples/hello_autotools/proj/COPYING | 26 +++ examples/hello_autotools/proj/ChangeLog | 1 + examples/hello_autotools/proj/Makefile.am | 3 + examples/hello_autotools/proj/NEWS | 1 + examples/hello_autotools/proj/README | 1 + examples/hello_autotools/proj/configure.ac | 17 ++ examples/hello_autotools/proj/main.c | 11 + examples/hello_autotools/test.mk | 39 ++++ examples/hello_calc2/Makefile | 2 +- examples/hello_compatlib/Makefile | 5 + examples/hello_compatlib/Makefile.inc | 1 + examples/hello_compatlib/expect.out | 90 ++++++++ examples/hello_compatlib/libcmpt/Makefile | 3 + examples/hello_compatlib/prog1/Makefile | 7 + examples/hello_compatlib/prog1/prog1.c | 38 ++++ examples/hello_compatlib/prog2/Makefile | 7 + examples/hello_compatlib/prog2/prog2.c | 24 +++ examples/hello_compatlib/test.mk | 14 ++ examples/hello_cxxlib/cxxlib/Makefile | 3 + examples/hello_cxxlib/cxxlib/dummy.c | 6 + examples/hello_cxxlib/cxxlib/linkme.mk | 6 +- examples/hello_cxxlib/expect.out | 15 ++ examples/hello_cxxlib/test.mk | 3 +- examples/hello_dictd/Makefile | 20 +- examples/hello_dictd/dict/Makefile | 3 - examples/hello_dictd/dictd/Makefile | 3 - examples/hello_dictd/dictfmt/Makefile | 3 - examples/hello_dictd/dictzip/Makefile | 4 - examples/hello_dictd/expect.out | 231 +++++++++++++++++---- examples/hello_dictd/libcommon/Makefile | 2 - examples/hello_dictd/libcommon/linkme.mk | 5 - examples/hello_dictd/libdz/dz.c | 8 +- examples/hello_dictd/libdz/linkme.mk | 5 - examples/hello_dictd/libmaa/linkme.mk | 5 - examples/hello_dictd/test.mk | 39 ++-- examples/hello_errwarn/Makefile | 10 + examples/hello_errwarn/expect.out | 23 ++ examples/hello_errwarn/hello.c | 54 +++++ examples/hello_errwarn/test.mk | 19 ++ examples/hello_fgetln/Makefile | 10 + examples/hello_fgetln/expect.out | 99 +++++++++ examples/hello_fgetln/hello.c | 24 +++ examples/hello_fgetln/test.mk | 19 ++ examples/hello_files/expect.NetBSD.out | 3 + examples/hello_files/expect.out | 3 + examples/hello_files/test.mk | 5 + examples/hello_libdeps/Makefile | 7 + examples/hello_libdeps/expect.out | 127 +++++++++++ examples/hello_libdeps/libs/libbar/Makefile | 9 + examples/hello_libdeps/libs/libbar/bar.c | 8 + examples/hello_libdeps/libs/libbar/bar.h | 6 + examples/hello_libdeps/libs/libbaz/Makefile | 10 + examples/hello_libdeps/libs/libbaz/baz.c | 8 + examples/hello_libdeps/libs/libbaz/include/baz.h | 6 + examples/hello_libdeps/libs/libbaz/linkme.mk | 5 + examples/hello_libdeps/libs/libfoo/Makefile | 9 + examples/hello_libdeps/libs/libfoo/foo.c | 8 + examples/hello_libdeps/libs/libfoo/foo.h | 6 + examples/hello_libdeps/libs/libfoo/linkme.mk | 1 + examples/hello_libdeps/libs/libfooqux/Makefile | 9 + examples/hello_libdeps/libs/libfooqux/fooqux.c | 9 + examples/hello_libdeps/libs/libfooqux/fooqux.h | 8 + examples/hello_libdeps/progs/foobaz/Makefile | 5 + examples/hello_libdeps/progs/foobaz/foobaz.c | 11 + examples/hello_libdeps/progs/fooquxfoobar/Makefile | 5 + .../progs/fooquxfoobar/fooquxfoobar.c | 12 ++ examples/hello_libdeps/test.mk | 52 +++++ examples/hello_lua/Makefile | 2 +- examples/hello_require_tools/Makefile | 13 +- examples/hello_scripts/Makefile | 6 +- examples/hello_scripts/expect.out | 12 +- examples/hello_scripts/hello_world3 | 6 - examples/hello_scripts/hello_world3.in | 6 + examples/hello_strlcpy/expect.out | 2 +- examples/hello_strlcpy/test.mk | 4 +- examples/hello_strlcpy2/expect.out | 2 +- examples/hello_strlcpy2/test.mk | 4 +- examples/hello_strlcpy3/Makefile | 2 +- examples/hello_strlcpy3/expect.out | 41 +++- examples/hello_strlcpy3/hello.c | 6 + examples/hello_strlcpy3/test.mk | 9 +- examples/hello_subdirs/prog1/Makefile | 6 +- examples/hello_subdirs/prog1/expect.out | 5 +- examples/hello_subdirs/prog1/prog1.awk | 6 - examples/hello_subdirs/prog1/prog1.awk.in | 6 + examples/subprojects/libhello1/linkme.mk | 6 +- examples/subprojects/libhello2/linkme.mk | 6 +- examples/subprojects/test.mk | 4 +- examples/tools/Makefile | 8 +- examples/tools/expect.out | 31 +-- examples/tools/libs/bar/linkme.mk | 5 - examples/tools/libs/foo/linkme.mk | 5 - examples/tools/libs/qux/linkme.mk | 5 - examples/tools/tools/prog1/Makefile | 1 - examples/tools/tools/prog2/Makefile | 1 - examples/tools/tools/prog3/Makefile | 3 - examples/tools/tools/prog4/Makefile | 1 - examples/tools2/Makefile | 8 +- examples/tools2/expect.out | 35 +--- examples/tools2/libs/bar/linkme.mk | 5 - examples/tools2/libs/foo/linkme.mk | 5 - examples/tools2/libs/qux/linkme.mk | 5 - examples/tools2/tools/prog1/Makefile | 1 - examples/tools2/tools/prog2/Makefile | 1 - examples/tools2/tools/prog3/Makefile | 3 - examples/tools2/tools/prog4/Makefile | 1 - 121 files changed, 1509 insertions(+), 257 deletions(-) create mode 100644 examples/hello_autoconf/Makefile create mode 100644 examples/hello_autoconf/expect.out create mode 100644 examples/hello_autoconf/proj/AUTHORS create mode 100644 examples/hello_autoconf/proj/COPYING create mode 100644 examples/hello_autoconf/proj/ChangeLog create mode 100644 examples/hello_autoconf/proj/Makefile.in create mode 100644 examples/hello_autoconf/proj/NEWS create mode 100644 examples/hello_autoconf/proj/README create mode 100644 examples/hello_autoconf/proj/configure.ac create mode 100644 examples/hello_autoconf/proj/hello_autoconf.c create mode 100644 examples/hello_autoconf/test.mk create mode 100644 examples/hello_autotools/Makefile create mode 100644 examples/hello_autotools/expect.out create mode 100644 examples/hello_autotools/proj/AUTHORS create mode 100644 examples/hello_autotools/proj/COPYING create mode 100644 examples/hello_autotools/proj/ChangeLog create mode 100644 examples/hello_autotools/proj/Makefile.am create mode 100644 examples/hello_autotools/proj/NEWS create mode 100644 examples/hello_autotools/proj/README create mode 100644 examples/hello_autotools/proj/configure.ac create mode 100644 examples/hello_autotools/proj/main.c create mode 100644 examples/hello_autotools/test.mk create mode 100644 examples/hello_compatlib/Makefile create mode 100644 examples/hello_compatlib/Makefile.inc create mode 100644 examples/hello_compatlib/expect.out create mode 100644 examples/hello_compatlib/libcmpt/Makefile create mode 100644 examples/hello_compatlib/prog1/Makefile create mode 100644 examples/hello_compatlib/prog1/prog1.c create mode 100644 examples/hello_compatlib/prog2/Makefile create mode 100644 examples/hello_compatlib/prog2/prog2.c create mode 100644 examples/hello_compatlib/test.mk create mode 100644 examples/hello_cxxlib/cxxlib/dummy.c delete mode 100644 examples/hello_dictd/libcommon/linkme.mk delete mode 100644 examples/hello_dictd/libdz/linkme.mk delete mode 100644 examples/hello_dictd/libmaa/linkme.mk create mode 100644 examples/hello_errwarn/Makefile create mode 100644 examples/hello_errwarn/expect.out create mode 100644 examples/hello_errwarn/hello.c create mode 100644 examples/hello_errwarn/test.mk create mode 100644 examples/hello_fgetln/Makefile create mode 100644 examples/hello_fgetln/expect.out create mode 100644 examples/hello_fgetln/hello.c create mode 100644 examples/hello_fgetln/test.mk create mode 100644 examples/hello_libdeps/Makefile create mode 100644 examples/hello_libdeps/expect.out create mode 100644 examples/hello_libdeps/libs/libbar/Makefile create mode 100644 examples/hello_libdeps/libs/libbar/bar.c create mode 100644 examples/hello_libdeps/libs/libbar/bar.h create mode 100644 examples/hello_libdeps/libs/libbaz/Makefile create mode 100644 examples/hello_libdeps/libs/libbaz/baz.c create mode 100644 examples/hello_libdeps/libs/libbaz/include/baz.h create mode 100644 examples/hello_libdeps/libs/libbaz/linkme.mk create mode 100644 examples/hello_libdeps/libs/libfoo/Makefile create mode 100644 examples/hello_libdeps/libs/libfoo/foo.c create mode 100644 examples/hello_libdeps/libs/libfoo/foo.h create mode 100644 examples/hello_libdeps/libs/libfoo/linkme.mk create mode 100644 examples/hello_libdeps/libs/libfooqux/Makefile create mode 100644 examples/hello_libdeps/libs/libfooqux/fooqux.c create mode 100644 examples/hello_libdeps/libs/libfooqux/fooqux.h create mode 100644 examples/hello_libdeps/progs/foobaz/Makefile create mode 100644 examples/hello_libdeps/progs/foobaz/foobaz.c create mode 100644 examples/hello_libdeps/progs/fooquxfoobar/Makefile create mode 100644 examples/hello_libdeps/progs/fooquxfoobar/fooquxfoobar.c create mode 100644 examples/hello_libdeps/test.mk delete mode 100755 examples/hello_scripts/hello_world3 create mode 100755 examples/hello_scripts/hello_world3.in delete mode 100755 examples/hello_subdirs/prog1/prog1.awk create mode 100755 examples/hello_subdirs/prog1/prog1.awk.in delete mode 100644 examples/tools/libs/bar/linkme.mk delete mode 100644 examples/tools/libs/foo/linkme.mk delete mode 100644 examples/tools/libs/qux/linkme.mk delete mode 100644 examples/tools2/libs/bar/linkme.mk delete mode 100644 examples/tools2/libs/foo/linkme.mk delete mode 100644 examples/tools2/libs/qux/linkme.mk (limited to 'examples') diff --git a/examples/Makefile.inc b/examples/Makefile.inc index eadc408..1c1912d 100644 --- a/examples/Makefile.inc +++ b/examples/Makefile.inc @@ -1,9 +1,9 @@ CLEANDIRS += ${.CURDIR}/usr ${.CURDIR}/opt -.ifdef SRCDIR_custom +.ifdef SRCDIR_builtins # regression test for mk-configure MKC_CACHEDIR = ${.CURDIR} -BUILTINSDIR = ${SRCDIR_custom} +BUILTINSDIR = ${SRCDIR_builtins} FEATURESDIR = ${SRCDIR_features} SHRTOUT = no .export MKC_CACHEDIR BUILTINSDIR FEATURESDIR SHRTOUT diff --git a/examples/hello_autoconf/Makefile b/examples/hello_autoconf/Makefile new file mode 100644 index 0000000..3f6e87b --- /dev/null +++ b/examples/hello_autoconf/Makefile @@ -0,0 +1,15 @@ +FOREIGN = autotools +FSRCDIR = proj + +AT_USE_AUTOMAKE = no +AT_MAKE = ${BUILTIN.prog_gmake} + +MKC_CHECK_BUILTINS = prog_gmake +MKCHECKS = yes # we need path to gmake for target "clean" + +# The following line is for regression tests. +# In real life we don't need this. +all: mkgen + +.include "test.mk" +.include diff --git a/examples/hello_autoconf/expect.out b/examples/hello_autoconf/expect.out new file mode 100644 index 0000000..86d30a6 --- /dev/null +++ b/examples/hello_autoconf/expect.out @@ -0,0 +1,46 @@ +Hello autoconf +=========== all ============ +/objdir/AUTHORS +/objdir/COPYING +/objdir/ChangeLog +/objdir/Makefile +/objdir/Makefile.in +/objdir/NEWS +/objdir/README +/objdir/config.h +/objdir/config.h.in +/objdir/config.log +/objdir/config.status +/objdir/configure +/objdir/configure.ac +/objdir/hello_autoconf +/objdir/hello_autoconf.c +========== clean =========== +/objdir/AUTHORS +/objdir/COPYING +/objdir/ChangeLog +/objdir/Makefile +/objdir/Makefile.in +/objdir/NEWS +/objdir/README +/objdir/config.h +/objdir/config.h.in +/objdir/config.log +/objdir/config.status +/objdir/configure +/objdir/configure.ac +/objdir/hello_autoconf.c +========== all SHRTOUT=yes =========== +MKGEN: +CONFIGURE: +configure: creating ./config.status +AUTOTOOLS: +======= cleandir ========== +/objdir/AUTHORS +/objdir/COPYING +/objdir/ChangeLog +/objdir/Makefile.in +/objdir/NEWS +/objdir/README +/objdir/configure.ac +/objdir/hello_autoconf.c diff --git a/examples/hello_autoconf/proj/AUTHORS b/examples/hello_autoconf/proj/AUTHORS new file mode 100644 index 0000000..28b4a17 --- /dev/null +++ b/examples/hello_autoconf/proj/AUTHORS @@ -0,0 +1 @@ +Aleksey Cheusov diff --git a/examples/hello_autoconf/proj/COPYING b/examples/hello_autoconf/proj/COPYING new file mode 100644 index 0000000..332900b --- /dev/null +++ b/examples/hello_autoconf/proj/COPYING @@ -0,0 +1,26 @@ +Copyright (c) 2014 by Aleksey Cheusov + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the + distribution. + +THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND +CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/examples/hello_autoconf/proj/ChangeLog b/examples/hello_autoconf/proj/ChangeLog new file mode 100644 index 0000000..82573db --- /dev/null +++ b/examples/hello_autoconf/proj/ChangeLog @@ -0,0 +1 @@ +Useless ChangeLog diff --git a/examples/hello_autoconf/proj/Makefile.in b/examples/hello_autoconf/proj/Makefile.in new file mode 100644 index 0000000..0ea68cc --- /dev/null +++ b/examples/hello_autoconf/proj/Makefile.in @@ -0,0 +1,26 @@ +# GNU Make is required + +srcdir = @srcdir@ + +CC ?= @CC@ + +CFLAGS ?= @CFLAGS@ +CPPFLAGS ?= @CPPFLAGS@ +LDFLAGS ?= @LDFLAGS@ +LIBS ?= @LIBS@ + +CPPFLAGS += -I. -I${srcdir} +CFLAGS += -DMSG='"$(shell echo Hello autoconf)"' + +.PHONY: all clean distclean + +all: hello_autoconf + +%: %.c + ${CC} -o $@ ${CPPFLAGS} ${CFLAGS} $< ${LDFLAGS} ${LIBS} + +clean: + -rm -f hello_autoconf + +distclean: clean # mk-configure removes almost everything + -rm -f ${srcdir}/config.h.in config.h diff --git a/examples/hello_autoconf/proj/NEWS b/examples/hello_autoconf/proj/NEWS new file mode 100644 index 0000000..5d9ab38 --- /dev/null +++ b/examples/hello_autoconf/proj/NEWS @@ -0,0 +1 @@ +No news is good news diff --git a/examples/hello_autoconf/proj/README b/examples/hello_autoconf/proj/README new file mode 100644 index 0000000..3d1830e --- /dev/null +++ b/examples/hello_autoconf/proj/README @@ -0,0 +1 @@ +This is a trivial autoconf-based project. diff --git a/examples/hello_autoconf/proj/configure.ac b/examples/hello_autoconf/proj/configure.ac new file mode 100644 index 0000000..bc5c142 --- /dev/null +++ b/examples/hello_autoconf/proj/configure.ac @@ -0,0 +1,14 @@ +dnl +dnl Process this file with autoconf to create configure. + +# Initialize Autoconf +AC_PREREQ([2.60]) +AC_INIT([hello_autotools], [0.28.0], + [https://github.com/cheusov/mk-configure]) +AC_CONFIG_SRCDIR([Makefile.in]) +AC_CONFIG_HEADERS([config.h]) + +dnl Checks for functions +AC_CHECK_HEADERS([stdio.h]) + +AC_OUTPUT([Makefile]) diff --git a/examples/hello_autoconf/proj/hello_autoconf.c b/examples/hello_autoconf/proj/hello_autoconf.c new file mode 100644 index 0000000..111fc7e --- /dev/null +++ b/examples/hello_autoconf/proj/hello_autoconf.c @@ -0,0 +1,11 @@ +#include + +#ifdef HAVE_STDIO_H +#include +#endif + +int main (int argc, char **argv) +{ + puts (MSG); + return 0; +} diff --git a/examples/hello_autoconf/test.mk b/examples/hello_autoconf/test.mk new file mode 100644 index 0000000..8e6586e --- /dev/null +++ b/examples/hello_autoconf/test.mk @@ -0,0 +1,27 @@ +EXCL_RE='autom4te[.]cache' + +.PHONY : test_output +test_output: + @ \ + ${.OBJDIR}/hello_autoconf; \ + rm -rf ${.OBJDIR}${PREFIX}; \ + \ + echo =========== all ============; \ + find ${.OBJDIR} -type f | grep -Ev '${EXCL_RE}' | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ + \ + echo ========== clean ===========; \ + ${MAKE} ${MAKEFLAGS} clean > /dev/null; \ + find ${.OBJDIR} -type f | grep -vE '${EXCL_RE}' | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ + \ + echo ========== all SHRTOUT=yes ===========; \ + ${MAKE} ${MAKEFLAGS} all SHRTOUT=yes | \ + grep -E '^[[:alpha:]]+:'; \ + \ + echo ======= cleandir ==========; \ + ${MAKE} ${MAKEFLAGS} cleandir > /dev/null; \ + find ${.OBJDIR} -type f | grep -vE '${EXCL_RE}' | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}" + +.include diff --git a/examples/hello_autotools/Makefile b/examples/hello_autotools/Makefile new file mode 100644 index 0000000..fa4c406 --- /dev/null +++ b/examples/hello_autotools/Makefile @@ -0,0 +1,11 @@ +FOREIGN = autotools +FSRCDIR = proj + +DISTCLEANFILES += ${.CURDIR}/${FSRCDIR}/hello_autotools-config.h.in + + +# the following is for regression tests. In real life we don't need this. +all: mkgen + +.include "test.mk" +.include diff --git a/examples/hello_autotools/expect.out b/examples/hello_autotools/expect.out new file mode 100644 index 0000000..0900108 --- /dev/null +++ b/examples/hello_autotools/expect.out @@ -0,0 +1,62 @@ +Hello AutoShi^H^H^HTools! +=========== all ============ +/objdir/.deps/main.Po +/objdir/AUTHORS +/objdir/COPYING +/objdir/ChangeLog +/objdir/Makefile +/objdir/Makefile.am +/objdir/Makefile.in +/objdir/NEWS +/objdir/README +/objdir/aclocal.m4 +/objdir/config.log +/objdir/config.status +/objdir/configure +/objdir/configure.ac +/objdir/hello_autotools +/objdir/hello_autotools-config.h +/objdir/hello_autotools-config.h.in +/objdir/main.c +/objdir/main.o +/objdir/stamp-h1 +========= install ========== +/objdir/prefix +/objdir/prefix/bin +/objdir/prefix/bin/hello_autotools +======== uninstall ========= +/objdir/prefix +/objdir/prefix/bin +========== clean =========== +/objdir/.deps/main.Po +/objdir/AUTHORS +/objdir/COPYING +/objdir/ChangeLog +/objdir/Makefile +/objdir/Makefile.am +/objdir/Makefile.in +/objdir/NEWS +/objdir/README +/objdir/aclocal.m4 +/objdir/config.log +/objdir/config.status +/objdir/configure +/objdir/configure.ac +/objdir/hello_autotools-config.h +/objdir/hello_autotools-config.h.in +/objdir/main.c +/objdir/stamp-h1 +========== all SHRTOUT=yes =========== +MKGEN: +CONFIGURE: +configure: creating ./config.status +AUTOTOOLS: +======= cleandir ========== +/objdir/AUTHORS +/objdir/COPYING +/objdir/ChangeLog +/objdir/Makefile.am +/objdir/NEWS +/objdir/README +/objdir/configure.ac +/objdir/main.c diff --git a/examples/hello_autotools/proj/AUTHORS b/examples/hello_autotools/proj/AUTHORS new file mode 100644 index 0000000..28b4a17 --- /dev/null +++ b/examples/hello_autotools/proj/AUTHORS @@ -0,0 +1 @@ +Aleksey Cheusov diff --git a/examples/hello_autotools/proj/COPYING b/examples/hello_autotools/proj/COPYING new file mode 100644 index 0000000..332900b --- /dev/null +++ b/examples/hello_autotools/proj/COPYING @@ -0,0 +1,26 @@ +Copyright (c) 2014 by Aleksey Cheusov + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the + distribution. + +THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND +CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/examples/hello_autotools/proj/ChangeLog b/examples/hello_autotools/proj/ChangeLog new file mode 100644 index 0000000..82573db --- /dev/null +++ b/examples/hello_autotools/proj/ChangeLog @@ -0,0 +1 @@ +Useless ChangeLog diff --git a/examples/hello_autotools/proj/Makefile.am b/examples/hello_autotools/proj/Makefile.am new file mode 100644 index 0000000..5316cb9 --- /dev/null +++ b/examples/hello_autotools/proj/Makefile.am @@ -0,0 +1,3 @@ +bin_PROGRAMS = hello_autotools + +hello_autotools_SOURCES = main.c diff --git a/examples/hello_autotools/proj/NEWS b/examples/hello_autotools/proj/NEWS new file mode 100644 index 0000000..5d9ab38 --- /dev/null +++ b/examples/hello_autotools/proj/NEWS @@ -0,0 +1 @@ +No news is good news diff --git a/examples/hello_autotools/proj/README b/examples/hello_autotools/proj/README new file mode 100644 index 0000000..8b75e2d --- /dev/null +++ b/examples/hello_autotools/proj/README @@ -0,0 +1 @@ +This is a trivial autotools-based project. diff --git a/examples/hello_autotools/proj/configure.ac b/examples/hello_autotools/proj/configure.ac new file mode 100644 index 0000000..9122a3f --- /dev/null +++ b/examples/hello_autotools/proj/configure.ac @@ -0,0 +1,17 @@ +dnl +dnl Process this file with autoconf to create configure. + +# Initialize Autoconf +AC_PREREQ([2.60]) +AC_INIT([hello_autotools], [0.28.0], + [https://github.com/cheusov/mk-configure]) +AC_CONFIG_SRCDIR([Makefile.am]) +AC_CONFIG_HEADERS([hello_autotools-config.h]) + +# Initialize Automake +AM_INIT_AUTOMAKE + +dnl Checks for functions +AC_CHECK_HEADERS([stdio.h]) + +AC_OUTPUT([Makefile]) diff --git a/examples/hello_autotools/proj/main.c b/examples/hello_autotools/proj/main.c new file mode 100644 index 0000000..05a6dd3 --- /dev/null +++ b/examples/hello_autotools/proj/main.c @@ -0,0 +1,11 @@ +#include + +#ifdef HAVE_STDIO_H +#include +#endif + +int main (int argc, char **argv) +{ + puts ("Hello AutoShi^H^H^HTools!"); + return 0; +} diff --git a/examples/hello_autotools/test.mk b/examples/hello_autotools/test.mk new file mode 100644 index 0000000..b8f96f3 --- /dev/null +++ b/examples/hello_autotools/test.mk @@ -0,0 +1,39 @@ +EXCL_RE='autom4te[.]cache' + +.PHONY : test_output +test_output: + @ \ + ${.OBJDIR}/hello_autotools; \ + rm -rf ${.OBJDIR}${PREFIX}; \ + \ + echo =========== all ============; \ + find ${.OBJDIR} -type f | grep -Ev '${EXCL_RE}' | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ + \ + echo ========= install ==========; \ + ${MAKE} ${MAKEFLAGS} install -j3 \ + DESTDIR=${.OBJDIR} > /dev/null; \ + find ${.OBJDIR}${PREFIX} -type f -o -type d | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ + \ + echo ======== uninstall =========; \ + ${MAKE} ${MAKEFLAGS} -j4 uninstall \ + DESTDIR=${.OBJDIR} > /dev/null; \ + find ${.OBJDIR}${PREFIX} -type f -o -type d | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ + \ + echo ========== clean ===========; \ + ${MAKE} ${MAKEFLAGS} clean > /dev/null; \ + find ${.OBJDIR} -type f | grep -vE '${EXCL_RE}' | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ + \ + echo ========== all SHRTOUT=yes ===========; \ + ${MAKE} ${MAKEFLAGS} all SHRTOUT=yes | \ + grep -E '^[[:alpha:]]+:'; \ + \ + echo ======= cleandir ==========; \ + ${MAKE} ${MAKEFLAGS} cleandir > /dev/null; \ + find ${.OBJDIR} -type f | grep -vE '${EXCL_RE}' | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}" + +.include diff --git a/examples/hello_calc2/Makefile b/examples/hello_calc2/Makefile index 8005614..dbb0682 100644 --- a/examples/hello_calc2/Makefile +++ b/examples/hello_calc2/Makefile @@ -17,7 +17,7 @@ lex.o: parser.h YACC = ${"${BUILTIN.prog_bison}" != "":?${BUILTIN.prog_bison} -y:} LEX = ${BUILTIN.prog_flex} -LEXLIB = -lfl +LEXLIB = #-lfl .if empty(BUILTIN.prog_flex) MKC_ERR_MSG += "Cannot find flex, good bye!" diff --git a/examples/hello_compatlib/Makefile b/examples/hello_compatlib/Makefile new file mode 100644 index 0000000..82ec6b0 --- /dev/null +++ b/examples/hello_compatlib/Makefile @@ -0,0 +1,5 @@ +LIBDEPS = libcmpt:prog1 libcmpt:prog2 +COMPATLIB = libcmpt + +.include "test.mk" +.include diff --git a/examples/hello_compatlib/Makefile.inc b/examples/hello_compatlib/Makefile.inc new file mode 100644 index 0000000..de1cf0d --- /dev/null +++ b/examples/hello_compatlib/Makefile.inc @@ -0,0 +1 @@ +MKC_FEATURES = strlcpy strlcat getline progname fgetln err diff --git a/examples/hello_compatlib/expect.out b/examples/hello_compatlib/expect.out new file mode 100644 index 0000000..de509d4 --- /dev/null +++ b/examples/hello_compatlib/expect.out @@ -0,0 +1,90 @@ +=========== all ============ +/objdir/Makefile +/objdir/Makefile.inc +/objdir/_mkc_compiler_type.err +/objdir/_mkc_compiler_type.res +/objdir/_mkc_func0_getexecname_stdlib_h.c +/objdir/_mkc_func0_getexecname_stdlib_h.err +/objdir/_mkc_func0_getexecname_stdlib_h.res +/objdir/_mkc_func0_getprogname_stdlib_h.c +/objdir/_mkc_func0_getprogname_stdlib_h.err +/objdir/_mkc_func0_getprogname_stdlib_h.res +/objdir/_mkc_func1_setprogname_stdlib_h.c +/objdir/_mkc_func1_setprogname_stdlib_h.err +/objdir/_mkc_func1_setprogname_stdlib_h.res +/objdir/_mkc_func3_err_err_h.c +/objdir/_mkc_func3_err_err_h.err +/objdir/_mkc_func3_err_err_h.res +/objdir/_mkc_func3_errx_err_h.c +/objdir/_mkc_func3_errx_err_h.err +/objdir/_mkc_func3_errx_err_h.res +/objdir/_mkc_func3_fgetln_stdio_h.c +/objdir/_mkc_func3_fgetln_stdio_h.err +/objdir/_mkc_func3_fgetln_stdio_h.res +/objdir/_mkc_func3_getline_stdio_h.c +/objdir/_mkc_func3_getline_stdio_h.err +/objdir/_mkc_func3_getline_stdio_h.res +/objdir/_mkc_func3_strlcat_string_h.c +/objdir/_mkc_func3_strlcat_string_h.err +/objdir/_mkc_func3_strlcat_string_h.res +/objdir/_mkc_func3_strlcpy_string_h.c +/objdir/_mkc_func3_strlcpy_string_h.err +/objdir/_mkc_func3_strlcpy_string_h.res +/objdir/_mkc_func3_verr_err_h.c +/objdir/_mkc_func3_verr_err_h.err +/objdir/_mkc_func3_verr_err_h.res +/objdir/_mkc_func3_verrx_err_h.c +/objdir/_mkc_func3_verrx_err_h.err +/objdir/_mkc_func3_verrx_err_h.res +/objdir/_mkc_funclib_err.c +/objdir/_mkc_funclib_err.err +/objdir/_mkc_funclib_err.res +/objdir/_mkc_funclib_errx.c +/objdir/_mkc_funclib_errx.err +/objdir/_mkc_funclib_errx.res +/objdir/_mkc_funclib_fgetln.c +/objdir/_mkc_funclib_fgetln.err +/objdir/_mkc_funclib_fgetln.res +/objdir/_mkc_funclib_getline.c +/objdir/_mkc_funclib_getline.err +/objdir/_mkc_funclib_getline.res +/objdir/_mkc_funclib_getprogname.c +/objdir/_mkc_funclib_getprogname.err +/objdir/_mkc_funclib_getprogname.res +/objdir/_mkc_funclib_setprogname.c +/objdir/_mkc_funclib_setprogname.err +/objdir/_mkc_funclib_setprogname.res +/objdir/_mkc_funclib_strlcat.c +/objdir/_mkc_funclib_strlcat.err +/objdir/_mkc_funclib_strlcat.res +/objdir/_mkc_funclib_strlcpy.c +/objdir/_mkc_funclib_strlcpy.err +/objdir/_mkc_funclib_strlcpy.res +/objdir/_mkc_funclib_verr.c +/objdir/_mkc_funclib_verr.err +/objdir/_mkc_funclib_verr.res +/objdir/_mkc_funclib_verrx.c +/objdir/_mkc_funclib_verrx.err +/objdir/_mkc_funclib_verrx.res +/objdir/_mkc_header_err_h.c +/objdir/_mkc_header_err_h.err +/objdir/_mkc_header_err_h.res +/objdir/_mkc_prog_cc.err +/objdir/_mkc_prog_cc.res +/objdir/_mkc_variable_program_invocation_short_name_errno_h.c +/objdir/_mkc_variable_program_invocation_short_name_errno_h.err +/objdir/_mkc_variable_program_invocation_short_name_errno_h.res +/objdir/expect.out +/objdir/hello_compatlib.test.out.tmp +/objdir/libcmpt/Makefile +/objdir/libcmpt/libcmpt.a +/objdir/libcmpt/libcmpt_pic.a +/objdir/prog1/Makefile +/objdir/prog1/prog1 +/objdir/prog1/prog1.c +/objdir/prog1/prog1.o +/objdir/prog2/Makefile +/objdir/prog2/prog2 +/objdir/prog2/prog2.c +/objdir/prog2/prog2.o +/objdir/test.mk diff --git a/examples/hello_compatlib/libcmpt/Makefile b/examples/hello_compatlib/libcmpt/Makefile new file mode 100644 index 0000000..a0d0bda --- /dev/null +++ b/examples/hello_compatlib/libcmpt/Makefile @@ -0,0 +1,3 @@ +LIB = cmpt + +.include diff --git a/examples/hello_compatlib/prog1/Makefile b/examples/hello_compatlib/prog1/Makefile new file mode 100644 index 0000000..4a343d0 --- /dev/null +++ b/examples/hello_compatlib/prog1/Makefile @@ -0,0 +1,7 @@ +PROG = prog1 + +WARNS = 4 + +MKC_REQD = 0.27.0 + +.include diff --git a/examples/hello_compatlib/prog1/prog1.c b/examples/hello_compatlib/prog1/prog1.c new file mode 100644 index 0000000..b662024 --- /dev/null +++ b/examples/hello_compatlib/prog1/prog1.c @@ -0,0 +1,38 @@ +#include +#include + +#include +#include +#include +#include + +static const char message [] = "Theo de Raadt said: \"The strlcpy() and strlcat() functions provide a consistent, unambiguous API to help the programmer write more bullet-proof code.\""; + +int main (int argc, char ** argv) +{ + char *buf = NULL; + size_t size = 0; + ssize_t len = 0; + char small_buf [15]; + char said [19]; + + setprogname (argv [0]); + + while (len = getline (&buf, &size, stdin), len != -1){ + len = strlen (buf); + if (len > 0 && buf [len-1] == '\n') + buf [len-1] = 0; + + strlcpy (small_buf, "foo17", sizeof (small_buf)); + strlcat (small_buf, buf, sizeof (small_buf)); + puts (small_buf); + } + + strlcpy (said, message, sizeof (said)); + puts (said); + + printf ("short progname=%s\n", getprogname ()); + printf ("full progname=%s\n", argv [0]); + + return 0; +} diff --git a/examples/hello_compatlib/prog2/Makefile b/examples/hello_compatlib/prog2/Makefile new file mode 100644 index 0000000..6cde3eb --- /dev/null +++ b/examples/hello_compatlib/prog2/Makefile @@ -0,0 +1,7 @@ +PROG = prog2 + +WARNS = 4 + +MKC_REQD = 0.27.0 + +.include diff --git a/examples/hello_compatlib/prog2/prog2.c b/examples/hello_compatlib/prog2/prog2.c new file mode 100644 index 0000000..8a4f0fb --- /dev/null +++ b/examples/hello_compatlib/prog2/prog2.c @@ -0,0 +1,24 @@ +#include +#include +#include + +#include +#include + +int main (int argc, char ** argv) +{ + char *buf, *lbuf; + size_t len; + + while ((lbuf = buf = fgetln (stdin, &len)) != NULL) { + if (len > 0 && buf [len - 1] == '\n') + buf[len - 1] = '\0'; + else if ((lbuf = strndup (buf, len + 1)) == NULL) + err (1, NULL); + printf ("%s\n", lbuf); + + if (lbuf != buf) + free (lbuf); + } + return 0; +} diff --git a/examples/hello_compatlib/test.mk b/examples/hello_compatlib/test.mk new file mode 100644 index 0000000..425ad83 --- /dev/null +++ b/examples/hello_compatlib/test.mk @@ -0,0 +1,14 @@ +FUNCS_RE=(fgetln|progname|strlcat|strlcpy|getline)[.]o + +.PHONY : test_output +test_output : + @set -e; \ + echo =========== all ============; \ + find ${.OBJDIR} -type f | grep -Ev '${FUNCS_RE}' | \ + grep -vE 'libcmpt/.*[.]os?$$' | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ + \ + true =========== cleandir ============; \ + ${MAKE} ${MAKEFLAGS} distclean > /dev/null + +.include diff --git a/examples/hello_cxxlib/cxxlib/Makefile b/examples/hello_cxxlib/cxxlib/Makefile index a9f974a..540eb02 100644 --- a/examples/hello_cxxlib/cxxlib/Makefile +++ b/examples/hello_cxxlib/cxxlib/Makefile @@ -12,4 +12,7 @@ INCSSRCDIR = include SRCS = hello_msg1.cpp hello_msg2.cpp +MKC_SOURCE_FUNCLIBS = dummy # a part of regression test +MKC_SOURCE_DIR.dummy.c := ${.PARSEDIR} + .include diff --git a/examples/hello_cxxlib/cxxlib/dummy.c b/examples/hello_cxxlib/cxxlib/dummy.c new file mode 100644 index 0000000..a30fafb --- /dev/null +++ b/examples/hello_cxxlib/cxxlib/dummy.c @@ -0,0 +1,6 @@ +/* we do use this function, this is just a part of regression test */ +void dummy_func (void); +void dummy_func (void) +{ + /* we do nothing here */ +} diff --git a/examples/hello_cxxlib/cxxlib/linkme.mk b/examples/hello_cxxlib/cxxlib/linkme.mk index 85b9277..20864c9 100644 --- a/examples/hello_cxxlib/cxxlib/linkme.mk +++ b/examples/hello_cxxlib/cxxlib/linkme.mk @@ -1,5 +1,5 @@ -PATH.cxxlib := ${.PARSEDIR} +PATH.cxxlib := ${.PARSEDIR:tA} -CPPFLAGS += -I${PATH.cxxlib}/include +DPINCDIRS += ${PATH.cxxlib}/include DPLIBDIRS += ${PATH.cxxlib} -LDADD0 += -lcxxlib +DPLDADD += cxxlib diff --git a/examples/hello_cxxlib/expect.out b/examples/hello_cxxlib/expect.out index e961c75..09dc8a7 100644 --- a/examples/hello_cxxlib/expect.out +++ b/examples/hello_cxxlib/expect.out @@ -2,8 +2,13 @@ Hello world 1! hello world 2! =========== all ============ /objdir/Makefile +/objdir/_mkc_compiler_type.err +/objdir/_mkc_compiler_type.res /objdir/_mkc_cxx_type.err /objdir/_mkc_cxx_type.res +/objdir/_mkc_funclib_dummy.c +/objdir/_mkc_funclib_dummy.err +/objdir/_mkc_funclib_dummy.res /objdir/_mkc_prog_cxx.err /objdir/_mkc_prog_cxx.res /objdir/cxxapp/Makefile @@ -11,6 +16,9 @@ hello world 2! /objdir/cxxapp/cxxapp.cc /objdir/cxxapp/cxxapp.o /objdir/cxxlib/Makefile +/objdir/cxxlib/dummy.c +/objdir/cxxlib/dummy.o +/objdir/cxxlib/dummy.os /objdir/cxxlib/hello_msg1.cpp /objdir/cxxlib/hello_msg1.o /objdir/cxxlib/hello_msg1.os @@ -43,13 +51,19 @@ hello world 2! ======== uninstall ========= ========== clean =========== /objdir/Makefile +/objdir/_mkc_compiler_type.err +/objdir/_mkc_compiler_type.res /objdir/_mkc_cxx_type.err /objdir/_mkc_cxx_type.res +/objdir/_mkc_funclib_dummy.c +/objdir/_mkc_funclib_dummy.err +/objdir/_mkc_funclib_dummy.res /objdir/_mkc_prog_cxx.err /objdir/_mkc_prog_cxx.res /objdir/cxxapp/Makefile /objdir/cxxapp/cxxapp.cc /objdir/cxxlib/Makefile +/objdir/cxxlib/dummy.c /objdir/cxxlib/hello_msg1.cpp /objdir/cxxlib/hello_msg2.cpp /objdir/cxxlib/include/hello_msg.h @@ -64,6 +78,7 @@ hello world 2! /objdir/cxxapp/Makefile /objdir/cxxapp/cxxapp.cc /objdir/cxxlib/Makefile +/objdir/cxxlib/dummy.c /objdir/cxxlib/hello_msg1.cpp /objdir/cxxlib/hello_msg2.cpp /objdir/cxxlib/include/hello_msg.h diff --git a/examples/hello_cxxlib/test.mk b/examples/hello_cxxlib/test.mk index ce5dd80..96b2a2b 100644 --- a/examples/hello_cxxlib/test.mk +++ b/examples/hello_cxxlib/test.mk @@ -5,7 +5,8 @@ test_output: rm -rf ${.OBJDIR}${PREFIX}; \ LD_LIBRARY_PATH=${.CURDIR}/cxxlib:$$LD_LIBRARY_PATH; \ DYLD_LIBRARY_PATH=${.CURDIR}/cxxlib:$$LD_LIBRARY_PATH; \ - export LD_LIBRARY_PATH DYLD_LIBRARY_PATH; \ + LIBRARY_PATH=$$LIBRARY_PATH:$$LD_LIBRARY_PATH; \ + export LD_LIBRARY_PATH DYLD_LIBRARY_PATH LIBRARY_PATH; \ ${.CURDIR}/cxxapp/cxxapp; \ \ echo =========== all ============; \ diff --git a/examples/hello_dictd/Makefile b/examples/hello_dictd/Makefile index fe7e319..5c4c567 100644 --- a/examples/hello_dictd/Makefile +++ b/examples/hello_dictd/Makefile @@ -1,12 +1,14 @@ -SUBPRJ = libcommon:dict -SUBPRJ += libcommon:dictd -SUBPRJ += libcommon:dictzip -SUBPRJ += libcommon:dictfmt -SUBPRJ += libmaa:dict -SUBPRJ += libmaa:dictd -SUBPRJ += libmaa:dictzip -SUBPRJ += libmaa:dictfmt -SUBPRJ += libdz:dictzip +LIBDEPS = libcommon:dict +LIBDEPS += libcommon:dictd +LIBDEPS += libcommon:dictzip +LIBDEPS += libcommon:dictfmt +LIBDEPS += libmaa:dict +LIBDEPS += libmaa:dictd +LIBDEPS += libmaa:dictzip +LIBDEPS += libmaa:dictfmt +LIBDEPS += libdz:dictzip + +INTERNALLIBS += libcommon # Subproject "doc" has no dependencies SUBPRJ += doc diff --git a/examples/hello_dictd/dict/Makefile b/examples/hello_dictd/dict/Makefile index b7e3e1c..17f232f 100644 --- a/examples/hello_dictd/dict/Makefile +++ b/examples/hello_dictd/dict/Makefile @@ -3,7 +3,4 @@ MAN = dict.1 WARNS = 4 -.include "../libcommon/linkme.mk" -.include "../libmaa/linkme.mk" - .include diff --git a/examples/hello_dictd/dictd/Makefile b/examples/hello_dictd/dictd/Makefile index 1f3d8ca..325df68 100644 --- a/examples/hello_dictd/dictd/Makefile +++ b/examples/hello_dictd/dictd/Makefile @@ -3,7 +3,4 @@ MAN = dictd.8 WARNS = 4 -.include "../libcommon/linkme.mk" -.include "../libmaa/linkme.mk" - .include diff --git a/examples/hello_dictd/dictfmt/Makefile b/examples/hello_dictd/dictfmt/Makefile index a34d541..c30ed3e 100644 --- a/examples/hello_dictd/dictfmt/Makefile +++ b/examples/hello_dictd/dictfmt/Makefile @@ -3,7 +3,4 @@ MAN = dictfmt.1 WARNS = 4 -.include "../libcommon/linkme.mk" -.include "../libmaa/linkme.mk" - .include diff --git a/examples/hello_dictd/dictzip/Makefile b/examples/hello_dictd/dictzip/Makefile index db50d14..456bb00 100644 --- a/examples/hello_dictd/dictzip/Makefile +++ b/examples/hello_dictd/dictzip/Makefile @@ -3,8 +3,4 @@ MAN = dictzip.1 WARNS = 4 -.include "../libcommon/linkme.mk" -.include "../libdz/linkme.mk" -.include "../libmaa/linkme.mk" - .include diff --git a/examples/hello_dictd/expect.out b/examples/hello_dictd/expect.out index 462d425..9c3f7f1 100644 --- a/examples/hello_dictd/expect.out +++ b/examples/hello_dictd/expect.out @@ -20,10 +20,11 @@ dictzip: fake4=4 dictzip: fake5=5 dictzip: fake6=6 =========== nm ============ -libmaa fake4 -libmaa fake5 -libmaa fake6 -libdz fake3 +symbol fake4 +symbol fake5 +symbol fake6 += +symbol fake3 =========== all ============ /objdir/Makefile /objdir/Makefile.inc @@ -71,10 +72,12 @@ libdz fake3 /objdir/libcommon/Makefile /objdir/libcommon/iswalnum.c /objdir/libcommon/iswalnum.o +/objdir/libcommon/iswalnum.os /objdir/libcommon/libcommon.a -/objdir/libcommon/linkme.mk +/objdir/libcommon/libcommon_pic.a /objdir/libcommon/str.c /objdir/libcommon/str.o +/objdir/libcommon/str.os /objdir/libdz/Makefile /objdir/libdz/dz.c /objdir/libdz/dz.o @@ -84,14 +87,12 @@ libdz fake3 /objdir/libdz/libdz.so /objdir/libdz/libdz.so.1 /objdir/libdz/libdz.so.1.0 -/objdir/libdz/linkme.mk /objdir/libmaa/Makefile /objdir/libmaa/export.sym /objdir/libmaa/libmaa.a /objdir/libmaa/libmaa.so /objdir/libmaa/libmaa.so.1 /objdir/libmaa/libmaa.so.1.2.0 -/objdir/libmaa/linkme.mk /objdir/libmaa/log.c /objdir/libmaa/log.o /objdir/libmaa/log.os @@ -102,6 +103,25 @@ libdz fake3 /objdir/libmaa/set.o /objdir/libmaa/set.os /objdir/test.mk +========= INTERNALLIBS ========== +installdirs ===> examples/hello_dictd/libmaa +installdirs ===> examples/hello_dictd/dict +installdirs ===> examples/hello_dictd/dictd +installdirs ===> examples/hello_dictd/libdz +installdirs ===> examples/hello_dictd/dictzip +installdirs ===> examples/hello_dictd/dictfmt +install ===> examples/hello_dictd/libmaa +install ===> examples/hello_dictd/dict +install ===> examples/hello_dictd/dictd +install ===> examples/hello_dictd/libdz +install ===> examples/hello_dictd/dictzip +install ===> examples/hello_dictd/dictfmt +uninstall ===> examples/hello_dictd/libmaa +uninstall ===> examples/hello_dictd/dict +uninstall ===> examples/hello_dictd/dictd +uninstall ===> examples/hello_dictd/libdz +uninstall ===> examples/hello_dictd/dictzip +uninstall ===> examples/hello_dictd/dictfmt ========= installdirs ========== /objdir/prefix /objdir/prefix/bin @@ -169,10 +189,12 @@ libdz fake3 /objdir/libcommon/Makefile /objdir/libcommon/iswalnum.c /objdir/libcommon/iswalnum.o +/objdir/libcommon/iswalnum.os /objdir/libcommon/libcommon.a -/objdir/libcommon/linkme.mk +/objdir/libcommon/libcommon_pic.a /objdir/libcommon/str.c /objdir/libcommon/str.o +/objdir/libcommon/str.os /objdir/libdz/Makefile /objdir/libdz/dz.c /objdir/libdz/dz.o @@ -182,14 +204,12 @@ libdz fake3 /objdir/libdz/libdz.so /objdir/libdz/libdz.so.1 /objdir/libdz/libdz.so.1.0 -/objdir/libdz/linkme.mk /objdir/libmaa/Makefile /objdir/libmaa/export.sym /objdir/libmaa/libmaa.a /objdir/libmaa/libmaa.so /objdir/libmaa/libmaa.so.1 /objdir/libmaa/libmaa.so.1.2.0 -/objdir/libmaa/linkme.mk /objdir/libmaa/log.c /objdir/libmaa/log.o /objdir/libmaa/log.os @@ -221,15 +241,12 @@ libdz fake3 /objdir/hello_dictd.test.out.tmp /objdir/libcommon/Makefile /objdir/libcommon/iswalnum.c -/objdir/libcommon/linkme.mk /objdir/libcommon/str.c /objdir/libdz/Makefile /objdir/libdz/dz.c /objdir/libdz/export.sym -/objdir/libdz/linkme.mk /objdir/libmaa/Makefile /objdir/libmaa/export.sym -/objdir/libmaa/linkme.mk /objdir/libmaa/log.c /objdir/libmaa/prime.c /objdir/libmaa/set.c @@ -255,15 +272,12 @@ libdz fake3 /objdir/hello_dictd.test.out.tmp /objdir/libcommon/Makefile /objdir/libcommon/iswalnum.c -/objdir/libcommon/linkme.mk /objdir/libcommon/str.c /objdir/libdz/Makefile /objdir/libdz/dz.c /objdir/libdz/export.sym -/objdir/libdz/linkme.mk /objdir/libmaa/Makefile /objdir/libmaa/export.sym -/objdir/libmaa/linkme.mk /objdir/libmaa/log.c /objdir/libmaa/prime.c /objdir/libmaa/set.c @@ -296,17 +310,14 @@ libdz fake3 /objdir/libcommon /objdir/libcommon/Makefile /objdir/libcommon/iswalnum.c -/objdir/libcommon/linkme.mk /objdir/libcommon/str.c /objdir/libdz /objdir/libdz/Makefile /objdir/libdz/dz.c /objdir/libdz/export.sym -/objdir/libdz/linkme.mk /objdir/libmaa /objdir/libmaa/Makefile /objdir/libmaa/export.sym -/objdir/libmaa/linkme.mk /objdir/libmaa/log.c /objdir/libmaa/prime.c /objdir/libmaa/set.c @@ -350,17 +361,14 @@ obj1 does not exist /objdir/libcommon /objdir/libcommon/Makefile /objdir/libcommon/iswalnum.c -/objdir/libcommon/linkme.mk /objdir/libcommon/str.c /objdir/libdz /objdir/libdz/Makefile /objdir/libdz/dz.c /objdir/libdz/export.sym -/objdir/libdz/linkme.mk /objdir/libmaa /objdir/libmaa/Makefile /objdir/libmaa/export.sym -/objdir/libmaa/linkme.mk /objdir/libmaa/log.c /objdir/libmaa/prime.c /objdir/libmaa/set.c @@ -410,15 +418,12 @@ obj1 does not exist /objdir/hello_dictd.test.out.tmp /objdir/libcommon/Makefile /objdir/libcommon/iswalnum.c -/objdir/libcommon/linkme.mk /objdir/libcommon/str.c /objdir/libdz/Makefile /objdir/libdz/dz.c /objdir/libdz/export.sym -/objdir/libdz/linkme.mk /objdir/libmaa/Makefile /objdir/libmaa/export.sym -/objdir/libmaa/linkme.mk /objdir/libmaa/log.c /objdir/libmaa/prime.c /objdir/libmaa/set.c @@ -452,21 +457,21 @@ obj1 does not exist /objdir/libcommon/Makefile /objdir/libcommon/iswalnum.c /objdir/libcommon/iswalnum.o +/objdir/libcommon/iswalnum.os /objdir/libcommon/libcommon.a -/objdir/libcommon/linkme.mk +/objdir/libcommon/libcommon_pic.a /objdir/libcommon/str.c /objdir/libcommon/str.o +/objdir/libcommon/str.os /objdir/libdz/Makefile /objdir/libdz/dz.c /objdir/libdz/export.sym -/objdir/libdz/linkme.mk /objdir/libmaa/Makefile /objdir/libmaa/export.sym /objdir/libmaa/libmaa.a /objdir/libmaa/libmaa.so /objdir/libmaa/libmaa.so.1 /objdir/libmaa/libmaa.so.1.2.0 -/objdir/libmaa/linkme.mk /objdir/libmaa/log.c /objdir/libmaa/log.o /objdir/libmaa/log.os @@ -506,21 +511,21 @@ obj1 does not exist /objdir/libcommon/Makefile /objdir/libcommon/iswalnum.c /objdir/libcommon/iswalnum.o +/objdir/libcommon/iswalnum.os /objdir/libcommon/libcommon.a -/objdir/libcommon/linkme.mk +/objdir/libcommon/libcommon_pic.a /objdir/libcommon/str.c /objdir/libcommon/str.o +/objdir/libcommon/str.os /objdir/libdz/Makefile /objdir/libdz/dz.c /objdir/libdz/export.sym -/objdir/libdz/linkme.mk /objdir/libmaa/Makefile /objdir/libmaa/export.sym /objdir/libmaa/libmaa.a /objdir/libmaa/libmaa.so /objdir/libmaa/libmaa.so.1 /objdir/libmaa/libmaa.so.1.2.0 -/objdir/libmaa/linkme.mk /objdir/libmaa/log.c /objdir/libmaa/log.o /objdir/libmaa/log.os @@ -592,15 +597,12 @@ obj1 does not exist /objdir/hello_dictd.test.out.tmp /objdir/libcommon/Makefile /objdir/libcommon/iswalnum.c -/objdir/libcommon/linkme.mk /objdir/libcommon/str.c /objdir/libdz/Makefile /objdir/libdz/dz.c /objdir/libdz/export.sym -/objdir/libdz/linkme.mk /objdir/libmaa/Makefile /objdir/libmaa/export.sym -/objdir/libmaa/linkme.mk /objdir/libmaa/log.c /objdir/libmaa/prime.c /objdir/libmaa/set.c @@ -626,15 +628,12 @@ obj1 does not exist /objdir/hello_dictd.test.out.tmp /objdir/libcommon/Makefile /objdir/libcommon/iswalnum.c -/objdir/libcommon/linkme.mk /objdir/libcommon/str.c /objdir/libdz/Makefile /objdir/libdz/dz.c /objdir/libdz/export.sym -/objdir/libdz/linkme.mk /objdir/libmaa/Makefile /objdir/libmaa/export.sym -/objdir/libmaa/linkme.mk /objdir/libmaa/log.c /objdir/libmaa/prime.c /objdir/libmaa/set.c @@ -683,21 +682,173 @@ obj1 does not exist /objdir/libcommon/Makefile /objdir/libcommon/iswalnum.c /objdir/libcommon/iswalnum.o +/objdir/libcommon/iswalnum.os /objdir/libcommon/libcommon.a -/objdir/libcommon/linkme.mk +/objdir/libcommon/libcommon_pic.a /objdir/libcommon/str.c /objdir/libcommon/str.o +/objdir/libcommon/str.os /objdir/libdz/Makefile /objdir/libdz/dz.c /objdir/libdz/export.sym -/objdir/libdz/linkme.mk /objdir/libmaa/Makefile /objdir/libmaa/export.sym /objdir/libmaa/libmaa.a /objdir/libmaa/libmaa.so /objdir/libmaa/libmaa.so.1 /objdir/libmaa/libmaa.so.1.2.0 -/objdir/libmaa/linkme.mk +/objdir/libmaa/log.c +/objdir/libmaa/log.o +/objdir/libmaa/log.os +/objdir/libmaa/prime.c +/objdir/libmaa/prime.o +/objdir/libmaa/prime.os +/objdir/libmaa/set.c +/objdir/libmaa/set.o +/objdir/libmaa/set.os +/objdir/test.mk +=========== all with MKPIE=yes ============ +/objdir/Makefile +/objdir/Makefile.inc +/objdir/_mkc_compiler_type.err +/objdir/_mkc_compiler_type.res +/objdir/_mkc_funclib_deflate.c +/objdir/_mkc_funclib_deflate.err +/objdir/_mkc_funclib_deflate.res +/objdir/_mkc_funclib_deflate_z.c +/objdir/_mkc_funclib_deflate_z.err +/objdir/_mkc_funclib_deflate_z.res +/objdir/_mkc_header_zlib_h.c +/objdir/_mkc_header_zlib_h.err +/objdir/_mkc_header_zlib_h.res +/objdir/_mkc_prog_cc.err +/objdir/_mkc_prog_cc.res +/objdir/dict/Makefile +/objdir/dict/dict +/objdir/dict/dict.1 +/objdir/dict/dict.c +/objdir/dict/dict.cat1 +/objdir/dict/dict.o +/objdir/dictd/Makefile +/objdir/dictd/dictd +/objdir/dictd/dictd.8 +/objdir/dictd/dictd.c +/objdir/dictd/dictd.cat8 +/objdir/dictd/dictd.o +/objdir/dictfmt/Makefile +/objdir/dictfmt/dictfmt +/objdir/dictfmt/dictfmt.1 +/objdir/dictfmt/dictfmt.c +/objdir/dictfmt/dictfmt.cat1 +/objdir/dictfmt/dictfmt.o +/objdir/dictzip/Makefile +/objdir/dictzip/dictzip +/objdir/dictzip/dictzip.1 +/objdir/dictzip/dictzip.c +/objdir/dictzip/dictzip.cat1 +/objdir/dictzip/dictzip.o +/objdir/doc/Makefile +/objdir/doc/doc.txt +/objdir/expect.out +/objdir/hello_dictd.test.out.tmp +/objdir/libcommon/Makefile +/objdir/libcommon/iswalnum.c +/objdir/libcommon/iswalnum.o +/objdir/libcommon/iswalnum.os +/objdir/libcommon/libcommon.a +/objdir/libcommon/libcommon_pic.a +/objdir/libcommon/str.c +/objdir/libcommon/str.o +/objdir/libcommon/str.os +/objdir/libdz/Makefile +/objdir/libdz/dz.c +/objdir/libdz/dz.o +/objdir/libdz/dz.os +/objdir/libdz/export.sym +/objdir/libdz/libdz.a +/objdir/libdz/libdz.so +/objdir/libdz/libdz.so.1 +/objdir/libdz/libdz.so.1.0 +/objdir/libmaa/Makefile +/objdir/libmaa/export.sym +/objdir/libmaa/libmaa.a +/objdir/libmaa/libmaa.so +/objdir/libmaa/libmaa.so.1 +/objdir/libmaa/libmaa.so.1.2.0 +/objdir/libmaa/log.c +/objdir/libmaa/log.o +/objdir/libmaa/log.os +/objdir/libmaa/prime.c +/objdir/libmaa/prime.o +/objdir/libmaa/prime.os +/objdir/libmaa/set.c +/objdir/libmaa/set.o +/objdir/libmaa/set.os +/objdir/test.mk +=========== all with STATICLIBS=everything... ============ +/objdir/Makefile +/objdir/Makefile.inc +/objdir/_mkc_compiler_type.err +/objdir/_mkc_compiler_type.res +/objdir/_mkc_funclib_deflate.c +/objdir/_mkc_funclib_deflate.err +/objdir/_mkc_funclib_deflate.res +/objdir/_mkc_funclib_deflate_z.c +/objdir/_mkc_funclib_deflate_z.err +/objdir/_mkc_funclib_deflate_z.res +/objdir/_mkc_header_zlib_h.c +/objdir/_mkc_header_zlib_h.err +/objdir/_mkc_header_zlib_h.res +/objdir/_mkc_prog_cc.err +/objdir/_mkc_prog_cc.res +/objdir/dict/Makefile +/objdir/dict/dict +/objdir/dict/dict.1 +/objdir/dict/dict.c +/objdir/dict/dict.cat1 +/objdir/dict/dict.o +/objdir/dictd/Makefile +/objdir/dictd/dictd +/objdir/dictd/dictd.8 +/objdir/dictd/dictd.c +/objdir/dictd/dictd.cat8 +/objdir/dictd/dictd.o +/objdir/dictfmt/Makefile +/objdir/dictfmt/dictfmt +/objdir/dictfmt/dictfmt.1 +/objdir/dictfmt/dictfmt.c +/objdir/dictfmt/dictfmt.cat1 +/objdir/dictfmt/dictfmt.o +/objdir/dictzip/Makefile +/objdir/dictzip/dictzip +/objdir/dictzip/dictzip.1 +/objdir/dictzip/dictzip.c +/objdir/dictzip/dictzip.cat1 +/objdir/dictzip/dictzip.o +/objdir/doc/Makefile +/objdir/doc/doc.txt +/objdir/expect.out +/objdir/hello_dictd.test.out.tmp +/objdir/libcommon/Makefile +/objdir/libcommon/iswalnum.c +/objdir/libcommon/iswalnum.o +/objdir/libcommon/iswalnum.os +/objdir/libcommon/libcommon.a +/objdir/libcommon/libcommon_pic.a +/objdir/libcommon/str.c +/objdir/libcommon/str.o +/objdir/libcommon/str.os +/objdir/libdz/Makefile +/objdir/libdz/dz.c +/objdir/libdz/dz.o +/objdir/libdz/dz.os +/objdir/libdz/export.sym +/objdir/libdz/libdz.a +/objdir/libdz/libdz_pic.a +/objdir/libmaa/Makefile +/objdir/libmaa/export.sym +/objdir/libmaa/libmaa.a +/objdir/libmaa/libmaa_pic.a /objdir/libmaa/log.c /objdir/libmaa/log.o /objdir/libmaa/log.os diff --git a/examples/hello_dictd/libcommon/Makefile b/examples/hello_dictd/libcommon/Makefile index 33e4167..c3c5253 100644 --- a/examples/hello_dictd/libcommon/Makefile +++ b/examples/hello_dictd/libcommon/Makefile @@ -5,6 +5,4 @@ SRCS = str.c iswalnum.c # and others WARNS = 4 -MKINSTALL = no - .include diff --git a/examples/hello_dictd/libcommon/linkme.mk b/examples/hello_dictd/libcommon/linkme.mk deleted file mode 100644 index 84c543c..0000000 --- a/examples/hello_dictd/libcommon/linkme.mk +++ /dev/null @@ -1,5 +0,0 @@ -PATH.common := ${.PARSEDIR} - -CPPFLAGS += -I${PATH.common} -DPLIBDIRS += ${PATH.common} -LDADD0 += -lcommon diff --git a/examples/hello_dictd/libdz/dz.c b/examples/hello_dictd/libdz/dz.c index 1fbe98e..81442b5 100644 --- a/examples/hello_dictd/libdz/dz.c +++ b/examples/hello_dictd/libdz/dz.c @@ -5,10 +5,10 @@ int fake3 (void) return 3; } -/* fake must not be exported */ -int fake2 (void); +/* fake22 must not be exported */ +int fake22 (void); -int fake2 (void) +int fake22 (void) { - return 2; + return 22; } diff --git a/examples/hello_dictd/libdz/linkme.mk b/examples/hello_dictd/libdz/linkme.mk deleted file mode 100644 index 5904614..0000000 --- a/examples/hello_dictd/libdz/linkme.mk +++ /dev/null @@ -1,5 +0,0 @@ -PATH.dz := ${.PARSEDIR} - -CPPFLAGS += -I${PATH.dz} -DPLIBDIRS += ${PATH.dz} -LDADD0 += -ldz diff --git a/examples/hello_dictd/libmaa/linkme.mk b/examples/hello_dictd/libmaa/linkme.mk deleted file mode 100644 index 9d1456e..0000000 --- a/examples/hello_dictd/libmaa/linkme.mk +++ /dev/null @@ -1,5 +0,0 @@ -PATH.maa := ${.PARSEDIR} - -CPPFLAGS += -I${PATH.maa} -DPLIBDIRS += ${PATH.maa} -LDADD0 += -lmaa diff --git a/examples/hello_dictd/test.mk b/examples/hello_dictd/test.mk index 2ec6e83..7081e20 100644 --- a/examples/hello_dictd/test.mk +++ b/examples/hello_dictd/test.mk @@ -1,5 +1,7 @@ next_level != expr ${.MAKE.LEVEL} + 1 +run_nm := env NM=${NM:Q} OPSYS=${OPSTS:Q} mkc_test_nm + .PHONY : test_output test_output : @set -e; \ @@ -9,7 +11,8 @@ test_output : rm -rf ${.OBJDIR}${PREFIX}; \ LD_LIBRARY_PATH=${.CURDIR}/libdz:${.CURDIR}/libmaa:$$LD_LIBRARY_PATH; \ DYLD_LIBRARY_PATH=${.CURDIR}/libdz:${.CURDIR}/libmaa:$$LD_LIBRARY_PATH; \ - export LD_LIBRARY_PATH DYLD_LIBRARY_PATH; \ + LIBRARY_PATH=$$LIBRARY_PATH:$$LD_LIBRARY_PATH; \ + export LD_LIBRARY_PATH DYLD_LIBRARY_PATH LIBRARY_PATH; \ ${.CURDIR}/dict/dict; \ ${.CURDIR}/dictd/dictd; \ ${.CURDIR}/dictfmt/dictfmt; \ @@ -17,17 +20,12 @@ test_output : \ echo =========== nm ============; \ case ${OPSYS} in \ - OpenBSD) \ - ${NM} ${.CURDIR}/libmaa/libmaa*.so | awk '$$2=="T" {print "libmaa " $$3}'; \ - ${NM} ${.CURDIR}/libdz/libdz*.so | awk '$$2=="T" {print "libdz " $$3}';; \ - *BSD|SunOS|DragonFly) \ - ${NM} -P ${.CURDIR}/libmaa/libmaa*.so | awk 'NF==4 && $$2=="T" {print "libmaa " $$1}'; \ - ${NM} -P ${.CURDIR}/libdz/libdz*.so | awk 'NF==4 && $$2=="T" {print "libdz " $$1}';; \ - Linux) \ - ${NM} -P ${.CURDIR}/libmaa/libmaa*.so | awk 'NF==4 && $$2 ~ /^[DT]$$/ {print "libmaa " $$1}'; \ - ${NM} -P ${.CURDIR}/libdz/libdz*.so | awk 'NF==4 && $$2 ~ /^[DT]$$/ {print "libdz " $$1}';; \ + *BSD|DragonFly|SunOS|Linux) \ + ${run_nm} ${OBJDIR_libmaa}/libmaa*.so; \ + echo =; \ + ${run_nm} ${OBJDIR_libdz}/libdz*.so;; \ *) \ - printf 'libmaa fake4\nlibmaa fake5\nlibmaa fake6\nlibdz fake3\n';; \ + printf 'symbol fake4\nsymbol fake5\nsymbol fake6\n=\nsymbol fake3\n';; \ esac; \ \ echo =========== all ============; \ @@ -35,6 +33,11 @@ test_output : find ${.OBJDIR} -type f -o -type l | \ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ \ + echo ========= INTERNALLIBS ==========; \ + { ${MAKE} ${MAKEFLAGS} installdirs DESTDIR=${.OBJDIR}; \ + ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR}; \ + ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR}; } 2>&1 | awk '/^(un)?install/'; \ + rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/home ${.OBJDIR}/Users; \ echo ========= installdirs ==========; \ ${MAKE} ${MAKEFLAGS} installdirs DESTDIR=${.OBJDIR} > /dev/null; \ find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \ @@ -64,7 +67,7 @@ test_output : ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \ find ${.OBJDIR} -type f -o -type l | \ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ - rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/home; \ + rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/home ${.OBJDIR}/Users; \ echo =========== MKOBJDIRS=auto ============; \ env TARGETS=fake ${MAKE} ${MAKEFLAGS} fake \ MKCHECKS=no MAKEOBJDIRPREFIX=${.OBJDIR}/obj1 > /dev/null; \ @@ -168,6 +171,18 @@ test_output : mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ unset NOSUBDIR; \ \ + echo =========== all with MKPIE=yes ============; \ + ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \ + ${MAKE} ${MAKEFLAGS} -j4 all MKPIE=yes > /dev/null; \ + find ${.OBJDIR} -type f -o -type l | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ + \ + echo =========== all with STATICLIBS=everything... ============; \ + ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \ + env STATICLIBS='libmaa libdz' ${MAKE} ${MAKEFLAGS} -j4 all > /dev/null; \ + find ${.OBJDIR} -type f -o -type l | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ + \ echo =========== print_deps ============; \ ${MAKE} ${MAKEFLAGS} print_deps | grep -E '^(all|test)'; \ echo =====; \ diff --git a/examples/hello_errwarn/Makefile b/examples/hello_errwarn/Makefile new file mode 100644 index 0000000..6b8c160 --- /dev/null +++ b/examples/hello_errwarn/Makefile @@ -0,0 +1,10 @@ +PROG = hello + +WARNS = 4 + +MKC_FEATURES = err warn + +MKC_REQD = 0.26.0 + +.include "test.mk" +.include diff --git a/examples/hello_errwarn/expect.out b/examples/hello_errwarn/expect.out new file mode 100644 index 0000000..8587981 --- /dev/null +++ b/examples/hello_errwarn/expect.out @@ -0,0 +1,23 @@ +======= ex ========== +hello: warnx test1: Cannot allocate memory +hello: errx test1: Cannot allocate memory +$?=21 +hello: warnx test2, six=6: Cannot allocate memory +hello: errx test2, six=6: Cannot allocate memory +$?=22 +errx(3): invalid argv +$?=94 +hello: warn test1 +hello: err test1 +$?=11 +hello: warn test2, five=5 +hello: err test2, five=5 +$?=12 +err(3): invalid argv +$?=93 +======= CLEANFILES ========== +hello.o +progname.o +err.o +warn.o +======= cleandir ========== diff --git a/examples/hello_errwarn/hello.c b/examples/hello_errwarn/hello.c new file mode 100644 index 0000000..a648890 --- /dev/null +++ b/examples/hello_errwarn/hello.c @@ -0,0 +1,54 @@ +#include +#include +#include + +#include +#include + +int main (int argc, char ** argv) +{ + --argc; + ++argv; + + if (argc != 2) + return (90); + + if (!strcmp (argv [0], "errx")){ + switch (argv [1][0]){ + case '1': + warnx ("warn test1"); + errx (11, "err test1"); + break; + case '2': + warnx ("warn test2, five=%d", 5); + errx (12, "err test2, five=%d", 5); + break; + default: + fprintf (stderr, "err(3): invalid argv\n"); + return 93; + } + }else if (!strcmp (argv [0], "err")){ + switch (argv [1][0]){ + case '1': + errno = ENOMEM; + warn ("warnx test1"); + errno = ENOMEM; + err (21, "errx test1"); + break; + case '2': + errno = ENOMEM; + warn ("warnx test2, six=%d", 6); + errno = ENOMEM; + err (22, "errx test2, six=%d", 6); + break; + default: + fprintf (stderr, "errx(3): invalid argv\n"); + return 94; + } + }else{ + fprintf (stderr, "bad err id '%s'\n", argv [0]); + return (91); + } + + return 0; +} diff --git a/examples/hello_errwarn/test.mk b/examples/hello_errwarn/test.mk new file mode 100644 index 0000000..94f48a2 --- /dev/null +++ b/examples/hello_errwarn/test.mk @@ -0,0 +1,19 @@ +SUBST_CMD=sed -e 's,Not enough space,Cannot allocate memory,' + +.PHONY : test_output +test_output: + @\ + echo ======= ex ==========; \ + { ${.OBJDIR}/hello err 1 2>&1 >/dev/null; echo '$$?='$$?; } | ${SUBST_CMD}; \ + { ${.OBJDIR}/hello err 2 2>&1 >/dev/null; echo '$$?='$$?; } | ${SUBST_CMD}; \ + { ${.OBJDIR}/hello err 3 2>&1 >/dev/null; echo '$$?='$$?; } | ${SUBST_CMD}; \ + ${.OBJDIR}/hello errx 1 2>&1 >/dev/null; echo '$$?='$$?; \ + ${.OBJDIR}/hello errx 2 2>&1 >/dev/null; echo '$$?='$$?; \ + ${.OBJDIR}/hello errx 3 2>&1 >/dev/null; echo '$$?='$$?; \ + echo ======= CLEANFILES ==========; \ + ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \ + awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}'; \ + echo ======= cleandir ==========; \ + ${MAKE} ${MAKEFLAGS} cleandir > /dev/null + +.include diff --git a/examples/hello_fgetln/Makefile b/examples/hello_fgetln/Makefile new file mode 100644 index 0000000..d77b37e --- /dev/null +++ b/examples/hello_fgetln/Makefile @@ -0,0 +1,10 @@ +MKC_FEATURES = fgetln err + +PROG = hello + +WARNS = 4 + +MKC_REQD = 0.26.0 + +.include "test.mk" +.include diff --git a/examples/hello_fgetln/expect.out b/examples/hello_fgetln/expect.out new file mode 100644 index 0000000..cd19953 --- /dev/null +++ b/examples/hello_fgetln/expect.out @@ -0,0 +1,99 @@ +# Copyright (c) 2009, Aleksey Cheusov +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +=========== all ============ +/objdir/Makefile +/objdir/_mkc_compiler_type.err +/objdir/_mkc_compiler_type.res +/objdir/_mkc_func0_getexecname_stdlib_h.c +/objdir/_mkc_func0_getexecname_stdlib_h.err +/objdir/_mkc_func0_getexecname_stdlib_h.res +/objdir/_mkc_func0_getprogname_stdlib_h.c +/objdir/_mkc_func0_getprogname_stdlib_h.err +/objdir/_mkc_func0_getprogname_stdlib_h.res +/objdir/_mkc_func1_setprogname_stdlib_h.c +/objdir/_mkc_func1_setprogname_stdlib_h.err +/objdir/_mkc_func1_setprogname_stdlib_h.res +/objdir/_mkc_func3_err_err_h.c +/objdir/_mkc_func3_err_err_h.err +/objdir/_mkc_func3_err_err_h.res +/objdir/_mkc_func3_errx_err_h.c +/objdir/_mkc_func3_errx_err_h.err +/objdir/_mkc_func3_errx_err_h.res +/objdir/_mkc_func3_fgetln_stdio_h.c +/objdir/_mkc_func3_fgetln_stdio_h.err +/objdir/_mkc_func3_fgetln_stdio_h.res +/objdir/_mkc_func3_getline_stdio_h.c +/objdir/_mkc_func3_getline_stdio_h.err +/objdir/_mkc_func3_getline_stdio_h.res +/objdir/_mkc_func3_verr_err_h.c +/objdir/_mkc_func3_verr_err_h.err +/objdir/_mkc_func3_verr_err_h.res +/objdir/_mkc_func3_verrx_err_h.c +/objdir/_mkc_func3_verrx_err_h.err +/objdir/_mkc_func3_verrx_err_h.res +/objdir/_mkc_funclib_err.c +/objdir/_mkc_funclib_err.err +/objdir/_mkc_funclib_err.res +/objdir/_mkc_funclib_errx.c +/objdir/_mkc_funclib_errx.err +/objdir/_mkc_funclib_errx.res +/objdir/_mkc_funclib_fgetln.c +/objdir/_mkc_funclib_fgetln.err +/objdir/_mkc_funclib_fgetln.res +/objdir/_mkc_funclib_getline.c +/objdir/_mkc_funclib_getline.err +/objdir/_mkc_funclib_getline.res +/objdir/_mkc_funclib_getprogname.c +/objdir/_mkc_funclib_getprogname.err +/objdir/_mkc_funclib_getprogname.res +/objdir/_mkc_funclib_setprogname.c +/objdir/_mkc_funclib_setprogname.err +/objdir/_mkc_funclib_setprogname.res +/objdir/_mkc_funclib_verr.c +/objdir/_mkc_funclib_verr.err +/objdir/_mkc_funclib_verr.res +/objdir/_mkc_funclib_verrx.c +/objdir/_mkc_funclib_verrx.err +/objdir/_mkc_funclib_verrx.res +/objdir/_mkc_header_err_h.c +/objdir/_mkc_header_err_h.err +/objdir/_mkc_header_err_h.res +/objdir/_mkc_prog_cc.err +/objdir/_mkc_prog_cc.res +/objdir/_mkc_variable_program_invocation_short_name_errno_h.c +/objdir/_mkc_variable_program_invocation_short_name_errno_h.err +/objdir/_mkc_variable_program_invocation_short_name_errno_h.res +/objdir/expect.out +/objdir/hello +/objdir/hello.c +/objdir/hello.o +/objdir/hello_fgetln.test.out.tmp +/objdir/test.mk +======= CLEANFILES ========== +hello.o +getline.o +fgetln.o +progname.o +err.o +======= cleandir ========== diff --git a/examples/hello_fgetln/hello.c b/examples/hello_fgetln/hello.c new file mode 100644 index 0000000..8a4f0fb --- /dev/null +++ b/examples/hello_fgetln/hello.c @@ -0,0 +1,24 @@ +#include +#include +#include + +#include +#include + +int main (int argc, char ** argv) +{ + char *buf, *lbuf; + size_t len; + + while ((lbuf = buf = fgetln (stdin, &len)) != NULL) { + if (len > 0 && buf [len - 1] == '\n') + buf[len - 1] = '\0'; + else if ((lbuf = strndup (buf, len + 1)) == NULL) + err (1, NULL); + printf ("%s\n", lbuf); + + if (lbuf != buf) + free (lbuf); + } + return 0; +} diff --git a/examples/hello_fgetln/test.mk b/examples/hello_fgetln/test.mk new file mode 100644 index 0000000..58c7925 --- /dev/null +++ b/examples/hello_fgetln/test.mk @@ -0,0 +1,19 @@ +FUNCS_RE=(fgetln|getline|err|progname)[.]o + +.PHONY : test_output +test_output: + @set -e; \ + ${.OBJDIR}/hello < ${.CURDIR}/../hello_strlcpy2/input.in; \ + rm -rf ${.OBJDIR}${PREFIX}; \ + \ + echo =========== all ============; \ + find ${.OBJDIR} -type f | grep -Ev '${FUNCS_RE}' | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ + \ + echo ======= CLEANFILES ==========; \ + ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \ + awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}'; \ + echo ======= cleandir ==========; \ + ${MAKE} ${MAKEFLAGS} cleandir > /dev/null + +.include diff --git a/examples/hello_files/expect.NetBSD.out b/examples/hello_files/expect.NetBSD.out index ca8f78e..0b28371 100644 --- a/examples/hello_files/expect.NetBSD.out +++ b/examples/hello_files/expect.NetBSD.out @@ -1,3 +1,6 @@ +=========== vars ============ +CLEANFILES=/path/to/hello_files.test.out pod2htmd.tmp pod2htmi.tmp shell_func.cat7 shell_func.html7 shell_func.info +DISTCLEANFILES=/path/to/_mkc_* =========== all ============ /objdir/DEBIAN/control /objdir/Makefile diff --git a/examples/hello_files/expect.out b/examples/hello_files/expect.out index 932f5b8..5eebc44 100644 --- a/examples/hello_files/expect.out +++ b/examples/hello_files/expect.out @@ -1,3 +1,6 @@ +=========== vars ============ +CLEANFILES=/path/to/hello_files.test.out pod2htmd.tmp pod2htmi.tmp shell_func.cat7 shell_func.html7 shell_func.info +DISTCLEANFILES=/path/to/_mkc_* =========== all ============ /objdir/DEBIAN/control /objdir/Makefile diff --git a/examples/hello_files/test.mk b/examples/hello_files/test.mk index 8764c4b..e7dbfec 100644 --- a/examples/hello_files/test.mk +++ b/examples/hello_files/test.mk @@ -4,6 +4,11 @@ test_output: MKCATPAGES=yes; export MKCATPAGES; \ rm -rf ${.OBJDIR}${PREFIX}; \ \ + echo =========== vars ============; \ + echo CLEANFILES=${CLEANFILES:Q} | \ + mkc_test_helper_paths; \ + echo DISTCLEANFILES=${DISTCLEANFILES:Q} | \ + mkc_test_helper_paths; \ echo =========== all ============; \ ${MAKE} ${MAKEFLAGS} -j4 all > /dev/null; \ find ${.OBJDIR} -type f -o -type l | \ diff --git a/examples/hello_libdeps/Makefile b/examples/hello_libdeps/Makefile new file mode 100644 index 0000000..40ea9d6 --- /dev/null +++ b/examples/hello_libdeps/Makefile @@ -0,0 +1,7 @@ +LIBDEPS += libs/libfoo:libs/libfooqux +LIBDEPS += libs/libbar:progs/fooquxfoobar +LIBDEPS += libs/libfooqux:progs/fooquxfoobar +LIBDEPS += libs/libfoo:progs/foobaz libs/libbaz:progs/foobaz + +.include "test.mk" +.include diff --git a/examples/hello_libdeps/expect.out b/examples/hello_libdeps/expect.out new file mode 100644 index 0000000..a80481d --- /dev/null +++ b/examples/hello_libdeps/expect.out @@ -0,0 +1,127 @@ +=========== fooquxfoobar ============ +I am foo + and qux +I am foo +I am bar +=========== foobaz ============ +I am foo +I am baz +=========== depends ============ +bar.o bar.o bar.o: bar.c bar.h +baz.o baz.o baz.o: baz.c include/baz.h +foo.o foo.o foo.o: foo.c foo.h +foobaz.o foobaz.o foobaz.o: foobaz.c /objdir/libs/libfoo/foo.h /objdir/libs/libbaz/include/baz.h +fooqux.o fooqux.o fooqux.o: fooqux.c fooqux.h /objdir/libs/libfoo/foo.h +fooquxfoobar.o fooquxfoobar.o fooquxfoobar.o: fooquxfoobar.c /objdir/libs/libfooqux/fooqux.h /objdir/libs/libfoo/foo.h /objdir/libs/libbar/bar.h +======= install ========== +/objdir/prefix/bin/foobaz +/objdir/prefix/bin/fooquxfoobar +/objdir/prefix/include/bar.h +/objdir/prefix/include/baz.h +/objdir/prefix/include/foo.h +/objdir/prefix/include/fooqux.h +/objdir/prefix/lib/libbar.a +/objdir/prefix/lib/libbar.so +/objdir/prefix/lib/libbar.so.0 +/objdir/prefix/lib/libbar.so.0.0 +/objdir/prefix/lib/libbazbaz.a +/objdir/prefix/lib/libfoo.a +/objdir/prefix/lib/libfoo.so +/objdir/prefix/lib/libfoo.so.0 +/objdir/prefix/lib/libfoo.so.0.0 +/objdir/prefix/lib/libfooqux.a +/objdir/prefix/lib/libfooqux.so +/objdir/prefix/lib/libfooqux.so.0 +/objdir/prefix/lib/libfooqux.so.0.0 +=========== all with STATICLIBS=... ============ +/objdir/Makefile +/objdir/_mkc_compiler_type.err +/objdir/_mkc_compiler_type.res +/objdir/_mkc_prog_cc.err +/objdir/_mkc_prog_cc.res +/objdir/expect.out +/objdir/hello_libdeps.test.out.tmp +/objdir/libs/libbar/Makefile +/objdir/libs/libbar/bar.c +/objdir/libs/libbar/bar.h +/objdir/libs/libbar/bar.o +/objdir/libs/libbar/bar.os +/objdir/libs/libbar/libbar.a +/objdir/libs/libbar/libbar_pic.a +/objdir/libs/libbaz/Makefile +/objdir/libs/libbaz/baz.c +/objdir/libs/libbaz/baz.o +/objdir/libs/libbaz/include/baz.h +/objdir/libs/libbaz/libbazbaz.a +/objdir/libs/libbaz/linkme.mk +/objdir/libs/libfoo/Makefile +/objdir/libs/libfoo/foo.c +/objdir/libs/libfoo/foo.h +/objdir/libs/libfoo/foo.o +/objdir/libs/libfoo/foo.os +/objdir/libs/libfoo/libfoo.a +/objdir/libs/libfoo/libfoo_pic.a +/objdir/libs/libfoo/linkme.mk +/objdir/libs/libfooqux/Makefile +/objdir/libs/libfooqux/fooqux.c +/objdir/libs/libfooqux/fooqux.h +/objdir/libs/libfooqux/fooqux.o +/objdir/libs/libfooqux/fooqux.os +/objdir/libs/libfooqux/libfooqux.a +/objdir/libs/libfooqux/libfooqux.so +/objdir/libs/libfooqux/libfooqux.so.0 +/objdir/libs/libfooqux/libfooqux.so.0.0 +/objdir/progs/foobaz/Makefile +/objdir/progs/foobaz/foobaz +/objdir/progs/foobaz/foobaz.c +/objdir/progs/foobaz/foobaz.o +/objdir/progs/fooquxfoobar/Makefile +/objdir/progs/fooquxfoobar/fooquxfoobar +/objdir/progs/fooquxfoobar/fooquxfoobar.c +/objdir/progs/fooquxfoobar/fooquxfoobar.o +/objdir/test.mk +========= install with STATICLIBS=... ========== +/objdir/prefix +/objdir/prefix/bin +/objdir/prefix/bin/foobaz +/objdir/prefix/bin/fooquxfoobar +/objdir/prefix/include +/objdir/prefix/include/bar.h +/objdir/prefix/include/baz.h +/objdir/prefix/include/foo.h +/objdir/prefix/include/fooqux.h +/objdir/prefix/lib +/objdir/prefix/lib/libbar.a +/objdir/prefix/lib/libbar_pic.a +/objdir/prefix/lib/libbazbaz.a +/objdir/prefix/lib/libfoo.a +/objdir/prefix/lib/libfoo_pic.a +/objdir/prefix/lib/libfooqux.a +/objdir/prefix/lib/libfooqux.so +/objdir/prefix/lib/libfooqux.so.0 +/objdir/prefix/lib/libfooqux.so.0.0 +symbol foo +symbol fooqux +======= distclean ========== +/objdir/Makefile +/objdir/expect.out +/objdir/hello_libdeps.test.out.tmp +/objdir/libs/libbar/Makefile +/objdir/libs/libbar/bar.c +/objdir/libs/libbar/bar.h +/objdir/libs/libbaz/Makefile +/objdir/libs/libbaz/baz.c +/objdir/libs/libbaz/include/baz.h +/objdir/libs/libbaz/linkme.mk +/objdir/libs/libfoo/Makefile +/objdir/libs/libfoo/foo.c +/objdir/libs/libfoo/foo.h +/objdir/libs/libfoo/linkme.mk +/objdir/libs/libfooqux/Makefile +/objdir/libs/libfooqux/fooqux.c +/objdir/libs/libfooqux/fooqux.h +/objdir/progs/foobaz/Makefile +/objdir/progs/foobaz/foobaz.c +/objdir/progs/fooquxfoobar/Makefile +/objdir/progs/fooquxfoobar/fooquxfoobar.c +/objdir/test.mk diff --git a/examples/hello_libdeps/libs/libbar/Makefile b/examples/hello_libdeps/libs/libbar/Makefile new file mode 100644 index 0000000..6514a70 --- /dev/null +++ b/examples/hello_libdeps/libs/libbar/Makefile @@ -0,0 +1,9 @@ +LIB = bar +INCS = bar.h + +SHLIB_MAJOR = 0 +SHLIB_MINOR = 0 + +WARNS = 4 + +.include diff --git a/examples/hello_libdeps/libs/libbar/bar.c b/examples/hello_libdeps/libs/libbar/bar.c new file mode 100644 index 0000000..b8015fc --- /dev/null +++ b/examples/hello_libdeps/libs/libbar/bar.c @@ -0,0 +1,8 @@ +#include "bar.h" + +#include + +void bar (void) +{ + puts ("I am bar"); +} diff --git a/examples/hello_libdeps/libs/libbar/bar.h b/examples/hello_libdeps/libs/libbar/bar.h new file mode 100644 index 0000000..e1d9f28 --- /dev/null +++ b/examples/hello_libdeps/libs/libbar/bar.h @@ -0,0 +1,6 @@ +#ifndef _BAR_H_ +#define _BAR_H_ + +void bar (void); + +#endif // _BAR_H_ diff --git a/examples/hello_libdeps/libs/libbaz/Makefile b/examples/hello_libdeps/libs/libbaz/Makefile new file mode 100644 index 0000000..fb96ef1 --- /dev/null +++ b/examples/hello_libdeps/libs/libbaz/Makefile @@ -0,0 +1,10 @@ +LIB = bazbaz # LIB name is not equal to ${.CURDIR:T}! +SRCS = baz.c +INCS = baz.h +INCSSRCDIR = include + +CPPFLAGS += ${INCSSRCDIR} + +WARNS = 4 + +.include diff --git a/examples/hello_libdeps/libs/libbaz/baz.c b/examples/hello_libdeps/libs/libbaz/baz.c new file mode 100644 index 0000000..e9000dc --- /dev/null +++ b/examples/hello_libdeps/libs/libbaz/baz.c @@ -0,0 +1,8 @@ +#include "baz.h" + +#include + +void baz (void) +{ + puts ("I am baz"); +} diff --git a/examples/hello_libdeps/libs/libbaz/include/baz.h b/examples/hello_libdeps/libs/libbaz/include/baz.h new file mode 100644 index 0000000..3a8879c --- /dev/null +++ b/examples/hello_libdeps/libs/libbaz/include/baz.h @@ -0,0 +1,6 @@ +#ifndef _BAZ_H_ +#define _BAZ_H_ + +void baz (void); + +#endif // _BAZ_H_ diff --git a/examples/hello_libdeps/libs/libbaz/linkme.mk b/examples/hello_libdeps/libs/libbaz/linkme.mk new file mode 100644 index 0000000..8127ebd --- /dev/null +++ b/examples/hello_libdeps/libs/libbaz/linkme.mk @@ -0,0 +1,5 @@ +PATH.baz := ${.PARSEDIR:tA} + +DPINCDIRS += ${PATH.baz}/include # non-default dir for headers +DPLIBDIRS += ${OBJDIR_libs_libbaz} +DPLDADD += bazbaz # non-default library name diff --git a/examples/hello_libdeps/libs/libfoo/Makefile b/examples/hello_libdeps/libs/libfoo/Makefile new file mode 100644 index 0000000..747a9e6 --- /dev/null +++ b/examples/hello_libdeps/libs/libfoo/Makefile @@ -0,0 +1,9 @@ +LIB = foo +INCS = foo.h + +SHLIB_MAJOR = 0 +SHLIB_MINOR = 0 + +WARNS = 4 + +.include diff --git a/examples/hello_libdeps/libs/libfoo/foo.c b/examples/hello_libdeps/libs/libfoo/foo.c new file mode 100644 index 0000000..fa86b30 --- /dev/null +++ b/examples/hello_libdeps/libs/libfoo/foo.c @@ -0,0 +1,8 @@ +#include "foo.h" + +#include + +void foo (void) +{ + puts ("I am foo"); +} diff --git a/examples/hello_libdeps/libs/libfoo/foo.h b/examples/hello_libdeps/libs/libfoo/foo.h new file mode 100644 index 0000000..a5bf6dd --- /dev/null +++ b/examples/hello_libdeps/libs/libfoo/foo.h @@ -0,0 +1,6 @@ +#ifndef _FOO_H_ +#define _FOO_H_ + +void foo (void); + +#endif // _FOO_H_ diff --git a/examples/hello_libdeps/libs/libfoo/linkme.mk b/examples/hello_libdeps/libs/libfoo/linkme.mk new file mode 100644 index 0000000..25e2e05 --- /dev/null +++ b/examples/hello_libdeps/libs/libfoo/linkme.mk @@ -0,0 +1 @@ +# empty linkme.mk is useless, this is a part of regression tests diff --git a/examples/hello_libdeps/libs/libfooqux/Makefile b/examples/hello_libdeps/libs/libfooqux/Makefile new file mode 100644 index 0000000..9157963 --- /dev/null +++ b/examples/hello_libdeps/libs/libfooqux/Makefile @@ -0,0 +1,9 @@ +LIB = fooqux +INCS = fooqux.h + +SHLIB_MAJOR = 0 +SHLIB_MINOR = 0 + +WARNS = 4 + +.include diff --git a/examples/hello_libdeps/libs/libfooqux/fooqux.c b/examples/hello_libdeps/libs/libfooqux/fooqux.c new file mode 100644 index 0000000..27d5225 --- /dev/null +++ b/examples/hello_libdeps/libs/libfooqux/fooqux.c @@ -0,0 +1,9 @@ +#include "fooqux.h" + +#include + +void fooqux (void) +{ + foo (); + puts (" and qux"); +} diff --git a/examples/hello_libdeps/libs/libfooqux/fooqux.h b/examples/hello_libdeps/libs/libfooqux/fooqux.h new file mode 100644 index 0000000..0c4f973 --- /dev/null +++ b/examples/hello_libdeps/libs/libfooqux/fooqux.h @@ -0,0 +1,8 @@ +#ifndef _FOOQUX_H_ +#define _FOOQUX_H_ + +#include "foo.h" + +void fooqux (void); + +#endif // _FOOQUX_H_ diff --git a/examples/hello_libdeps/progs/foobaz/Makefile b/examples/hello_libdeps/progs/foobaz/Makefile new file mode 100644 index 0000000..e24d1cf --- /dev/null +++ b/examples/hello_libdeps/progs/foobaz/Makefile @@ -0,0 +1,5 @@ +PROG = foobaz + +WARNS = 4 + +.include diff --git a/examples/hello_libdeps/progs/foobaz/foobaz.c b/examples/hello_libdeps/progs/foobaz/foobaz.c new file mode 100644 index 0000000..e2cf60b --- /dev/null +++ b/examples/hello_libdeps/progs/foobaz/foobaz.c @@ -0,0 +1,11 @@ +#include "foo.h" +#include "baz.h" + +#include + +int main (int argc, char **argv) +{ + foo (); + baz (); + return 0; +} diff --git a/examples/hello_libdeps/progs/fooquxfoobar/Makefile b/examples/hello_libdeps/progs/fooquxfoobar/Makefile new file mode 100644 index 0000000..5017e96 --- /dev/null +++ b/examples/hello_libdeps/progs/fooquxfoobar/Makefile @@ -0,0 +1,5 @@ +PROG = fooquxfoobar + +WARNS = 4 + +.include diff --git a/examples/hello_libdeps/progs/fooquxfoobar/fooquxfoobar.c b/examples/hello_libdeps/progs/fooquxfoobar/fooquxfoobar.c new file mode 100644 index 0000000..3d154b6 --- /dev/null +++ b/examples/hello_libdeps/progs/fooquxfoobar/fooquxfoobar.c @@ -0,0 +1,12 @@ +#include "fooqux.h" +#include "bar.h" + +#include + +int main (int argc, char **argv) +{ + fooqux (); + foo (); + bar (); + return 0; +} diff --git a/examples/hello_libdeps/test.mk b/examples/hello_libdeps/test.mk new file mode 100644 index 0000000..0c9daf4 --- /dev/null +++ b/examples/hello_libdeps/test.mk @@ -0,0 +1,52 @@ +run_nm := env NM=${NM:Q} OPSYS=${OPSTS:Q} mkc_test_nm + +.PHONY : test_output +test_output: + @set -e; LC_ALL=C; export LC_ALL; \ + LD_LIBRARY_PATH=${OBJDIR_libs_libfoo}:${OBJDIR_libs_libfooqux}:${OBJDIR_libs_libbar}:${OBJDIR_libs_libbaz}; \ + DYLD_LIBRARY_PATH=$$LD_LIBRARY_PATH; \ + LIBRARY_PATH=$$LIBRARY_PATH:$$LD_LIBRARY_PATH; \ + export LD_LIBRARY_PATH DYLD_LIBRARY_PATH LIBRARY_PATH; \ + echo =========== fooquxfoobar ============; \ + ${OBJDIR_progs_fooquxfoobar}/fooquxfoobar; \ + echo =========== foobaz ============; \ + ${OBJDIR_progs_foobaz}/foobaz; \ + rm -rf ${.OBJDIR}${PREFIX}; \ + \ + echo =========== depends ============; \ + ${MAKE} ${MAKEFLAGS} -j4 depend > /dev/null; \ + mkc_long_lines `find ${.CURDIR} -type f -name .depend` | \ + awk '!/^#/ {for (i=1; i <= NF; ++i) if ($$i ~ /^\// && $$i !~ /mk-configure/) $$i = ""; print $$0; }' | \ + awk '{$$1 = $$1; gsub(/[.]o[ps]/, ".o"); print $$0}' | sort | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ + \ + echo ======= install ==========; \ + ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} > /dev/null; \ + find ${.OBJDIR}${PREFIX} -type f -o -type l | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ + rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/Users ${.OBJDIR}/home; \ + \ + echo =========== all with STATICLIBS=... ============; \ + ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \ + env STATICLIBS='libfoo libbar' ${MAKE} ${MAKEFLAGS} -j4 all > /dev/null; \ + find ${.OBJDIR} -type f -o -type l | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ + \ + echo ========= install with STATICLIBS=... ==========; \ + env STATICLIBS='libfoo libbar' ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} > /dev/null; \ + find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ + case ${OPSYS} in \ + *BSD|DragonFly|SunOS|Linux) \ + ${run_nm} ${OBJDIR_libfooqux}/libfooqux.so;; \ + *) \ + printf 'symbol foo\nsymbol fooqux\n';; \ + esac; \ + rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/home ${.OBJDIR}/Users; \ + \ + echo ======= distclean ==========; \ + ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \ + find ${.OBJDIR} -type f | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}" + +.include diff --git a/examples/hello_lua/Makefile b/examples/hello_lua/Makefile index 3e40bfb..6bd702a 100644 --- a/examples/hello_lua/Makefile +++ b/examples/hello_lua/Makefile @@ -7,7 +7,7 @@ INSCRIPTS = foobar SCRIPTS = ${INSCRIPTS} INTEXTS_REPLS = LUA ${PROG.lua} -MKC_CHECK_PROGS = lua +MKC_REQUIRE_PROGS = lua .include "test.mk" .include diff --git a/examples/hello_require_tools/Makefile b/examples/hello_require_tools/Makefile index ad4f88d..ee953c5 100644 --- a/examples/hello_require_tools/Makefile +++ b/examples/hello_require_tools/Makefile @@ -1,11 +1,12 @@ -MKC_REQUIRE_BUILTINS += prog_gawk prog_flex prog_gm4 prog_bison +MKC_REQUIRE_BUILTINS += prog_gawk prog_flex prog_gm4 prog_bison prog_gmake SCRIPTS = fake -test: error-check - @echo ${CUSTOM.prog_gawk} - @echo ${CUSTOM.prog_gm4} - @echo ${CUSTOM.prog_flex} - @echo ${CUSTOM.prog_bison} +test: errorcheck + @echo GNU awk: ${CUSTOM.prog_gawk} + @echo GNU m4: ${CUSTOM.prog_gm4} + @echo GNU make: ${CUSTOM.prog_gmake} + @echo flex: ${CUSTOM.prog_flex} + @echo bison: ${CUSTOM.prog_bison} .include diff --git a/examples/hello_scripts/Makefile b/examples/hello_scripts/Makefile index 9325a85..005f212 100644 --- a/examples/hello_scripts/Makefile +++ b/examples/hello_scripts/Makefile @@ -3,7 +3,8 @@ SRCS = main.c msg.c WARNS = 4 -SCRIPTS = hello_world2 hello_world3 +INSCRIPTS = hello_world3 +SCRIPTS = hello_world2 ${INSCRIPTS} SCRIPTS += ${:!echo more_scripts/*!:N*/CVS} SCRIPTSDIR_more_scripts_script1 = ${BINDIR}/subdir1 @@ -13,6 +14,9 @@ SCRIPTSNAME_more_scripts_script2 = myscript2 SCRIPTSDIR_more_scripts_script3 = ${BINDIR}/subdir3 SCRIPTSNAME_more_scripts_script3 = myscript3 +MKC_REQUIRE_PROGS = awk +INTEXTS_REPLS = AWK ${PROG.awk} + MAN = hello_world.1 MKC_REQD = 0.10.0 diff --git a/examples/hello_scripts/expect.out b/examples/hello_scripts/expect.out index 72b1abb..fedcafd 100644 --- a/examples/hello_scripts/expect.out +++ b/examples/hello_scripts/expect.out @@ -5,6 +5,8 @@ Hello World 3! /objdir/Makefile /objdir/_mkc_compiler_type.err /objdir/_mkc_compiler_type.res +/objdir/_mkc_prog_awk.err +/objdir/_mkc_prog_awk.res /objdir/_mkc_prog_cc.err /objdir/_mkc_prog_cc.res /objdir/expect.out @@ -13,6 +15,7 @@ Hello World 3! /objdir/hello_world1 /objdir/hello_world2 /objdir/hello_world3 +/objdir/hello_world3.in /objdir/main.c /objdir/main.o /objdir/more_scripts/script1 @@ -42,13 +45,15 @@ Hello World 3! /objdir/Makefile /objdir/_mkc_compiler_type.err /objdir/_mkc_compiler_type.res +/objdir/_mkc_prog_awk.err +/objdir/_mkc_prog_awk.res /objdir/_mkc_prog_cc.err /objdir/_mkc_prog_cc.res /objdir/expect.out /objdir/hello_scripts.test.out.tmp /objdir/hello_world.1 /objdir/hello_world2 -/objdir/hello_world3 +/objdir/hello_world3.in /objdir/main.c /objdir/more_scripts/script1 /objdir/more_scripts/script2 @@ -61,7 +66,7 @@ Hello World 3! /objdir/hello_scripts.test.out.tmp /objdir/hello_world.1 /objdir/hello_world2 -/objdir/hello_world3 +/objdir/hello_world3.in /objdir/main.c /objdir/more_scripts/script1 /objdir/more_scripts/script2 @@ -72,6 +77,8 @@ Hello World 3! /objdir/Makefile /objdir/_mkc_compiler_type.err /objdir/_mkc_compiler_type.res +/objdir/_mkc_prog_awk.err +/objdir/_mkc_prog_awk.res /objdir/_mkc_prog_cc.err /objdir/_mkc_prog_cc.res /objdir/expect.out @@ -81,6 +88,7 @@ Hello World 3! /objdir/hello_world1 /objdir/hello_world2 /objdir/hello_world3 +/objdir/hello_world3.in /objdir/main.c /objdir/main.o /objdir/more_scripts/script1 diff --git a/examples/hello_scripts/hello_world3 b/examples/hello_scripts/hello_world3 deleted file mode 100755 index 53bdd92..0000000 --- a/examples/hello_scripts/hello_world3 +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/awk -f - -BEGIN { - print "Hello World 3!" - exit 0 -} diff --git a/examples/hello_scripts/hello_world3.in b/examples/hello_scripts/hello_world3.in new file mode 100755 index 0000000..86dcd79 --- /dev/null +++ b/examples/hello_scripts/hello_world3.in @@ -0,0 +1,6 @@ +#!@AWK@ -f + +BEGIN { + print "Hello World 3!" + exit 0 +} diff --git a/examples/hello_strlcpy/expect.out b/examples/hello_strlcpy/expect.out index d64ce75..8acecb6 100644 --- a/examples/hello_strlcpy/expect.out +++ b/examples/hello_strlcpy/expect.out @@ -88,6 +88,6 @@ /objdir/strlcpy.c /objdir/test.mk ======= CLEANFILES ========== +hello.o strlcpy.o getline.o -hello.o diff --git a/examples/hello_strlcpy/test.mk b/examples/hello_strlcpy/test.mk index e0155bb..29a6e51 100644 --- a/examples/hello_strlcpy/test.mk +++ b/examples/hello_strlcpy/test.mk @@ -32,7 +32,7 @@ test_output: mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ \ echo ======= CLEANFILES ==========; \ - ${MAKE} ${MAKEFLAGS} print-values VARS='CLEANFILES' MKCHECKS=no | \ - awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o$$/) print $$i}' + ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \ + awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}' .include diff --git a/examples/hello_strlcpy2/expect.out b/examples/hello_strlcpy2/expect.out index 8ca6686..6f351e2 100644 --- a/examples/hello_strlcpy2/expect.out +++ b/examples/hello_strlcpy2/expect.out @@ -88,6 +88,6 @@ /objdir/missing/strlcpy.c /objdir/test.mk ======= CLEANFILES ========== +hello.o strlcpy.o getline.o -hello.o diff --git a/examples/hello_strlcpy2/test.mk b/examples/hello_strlcpy2/test.mk index e0155bb..29a6e51 100644 --- a/examples/hello_strlcpy2/test.mk +++ b/examples/hello_strlcpy2/test.mk @@ -32,7 +32,7 @@ test_output: mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ \ echo ======= CLEANFILES ==========; \ - ${MAKE} ${MAKEFLAGS} print-values VARS='CLEANFILES' MKCHECKS=no | \ - awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o$$/) print $$i}' + ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \ + awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}' .include diff --git a/examples/hello_strlcpy3/Makefile b/examples/hello_strlcpy3/Makefile index 33e80b1..7257050 100644 --- a/examples/hello_strlcpy3/Makefile +++ b/examples/hello_strlcpy3/Makefile @@ -3,7 +3,7 @@ SRCS = hello.c WARNS = 4 -MKC_FEATURES = strlcpy strlcat getline +MKC_FEATURES = strlcpy strlcat getline progname MKC_REQD = 0.26.0 diff --git a/examples/hello_strlcpy3/expect.out b/examples/hello_strlcpy3/expect.out index 3cd8ac5..ce90dc7 100644 --- a/examples/hello_strlcpy3/expect.out +++ b/examples/hello_strlcpy3/expect.out @@ -22,10 +22,21 @@ foo17# CONTRAC foo17# ARISING foo17# POSSIBI Theo de Raadt said +short progname=hello +full progname=/path/to/hello =========== all ============ /objdir/Makefile /objdir/_mkc_compiler_type.err /objdir/_mkc_compiler_type.res +/objdir/_mkc_func0_getexecname_stdlib_h.c +/objdir/_mkc_func0_getexecname_stdlib_h.err +/objdir/_mkc_func0_getexecname_stdlib_h.res +/objdir/_mkc_func0_getprogname_stdlib_h.c +/objdir/_mkc_func0_getprogname_stdlib_h.err +/objdir/_mkc_func0_getprogname_stdlib_h.res +/objdir/_mkc_func1_setprogname_stdlib_h.c +/objdir/_mkc_func1_setprogname_stdlib_h.err +/objdir/_mkc_func1_setprogname_stdlib_h.res /objdir/_mkc_func3_getline_stdio_h.c /objdir/_mkc_func3_getline_stdio_h.err /objdir/_mkc_func3_getline_stdio_h.res @@ -38,6 +49,12 @@ Theo de Raadt said /objdir/_mkc_funclib_getline.c /objdir/_mkc_funclib_getline.err /objdir/_mkc_funclib_getline.res +/objdir/_mkc_funclib_getprogname.c +/objdir/_mkc_funclib_getprogname.err +/objdir/_mkc_funclib_getprogname.res +/objdir/_mkc_funclib_setprogname.c +/objdir/_mkc_funclib_setprogname.err +/objdir/_mkc_funclib_setprogname.res /objdir/_mkc_funclib_strlcat.c /objdir/_mkc_funclib_strlcat.err /objdir/_mkc_funclib_strlcat.res @@ -46,6 +63,9 @@ Theo de Raadt said /objdir/_mkc_funclib_strlcpy.res /objdir/_mkc_prog_cc.err /objdir/_mkc_prog_cc.res +/objdir/_mkc_variable_program_invocation_short_name_errno_h.c +/objdir/_mkc_variable_program_invocation_short_name_errno_h.err +/objdir/_mkc_variable_program_invocation_short_name_errno_h.res /objdir/expect.out /objdir/hello /objdir/hello.c @@ -62,6 +82,15 @@ Theo de Raadt said /objdir/Makefile /objdir/_mkc_compiler_type.err /objdir/_mkc_compiler_type.res +/objdir/_mkc_func0_getexecname_stdlib_h.c +/objdir/_mkc_func0_getexecname_stdlib_h.err +/objdir/_mkc_func0_getexecname_stdlib_h.res +/objdir/_mkc_func0_getprogname_stdlib_h.c +/objdir/_mkc_func0_getprogname_stdlib_h.err +/objdir/_mkc_func0_getprogname_stdlib_h.res +/objdir/_mkc_func1_setprogname_stdlib_h.c +/objdir/_mkc_func1_setprogname_stdlib_h.err +/objdir/_mkc_func1_setprogname_stdlib_h.res /objdir/_mkc_func3_getline_stdio_h.c /objdir/_mkc_func3_getline_stdio_h.err /objdir/_mkc_func3_getline_stdio_h.res @@ -74,6 +103,12 @@ Theo de Raadt said /objdir/_mkc_funclib_getline.c /objdir/_mkc_funclib_getline.err /objdir/_mkc_funclib_getline.res +/objdir/_mkc_funclib_getprogname.c +/objdir/_mkc_funclib_getprogname.err +/objdir/_mkc_funclib_getprogname.res +/objdir/_mkc_funclib_setprogname.c +/objdir/_mkc_funclib_setprogname.err +/objdir/_mkc_funclib_setprogname.res /objdir/_mkc_funclib_strlcat.c /objdir/_mkc_funclib_strlcat.err /objdir/_mkc_funclib_strlcat.res @@ -82,6 +117,9 @@ Theo de Raadt said /objdir/_mkc_funclib_strlcpy.res /objdir/_mkc_prog_cc.err /objdir/_mkc_prog_cc.res +/objdir/_mkc_variable_program_invocation_short_name_errno_h.c +/objdir/_mkc_variable_program_invocation_short_name_errno_h.err +/objdir/_mkc_variable_program_invocation_short_name_errno_h.res /objdir/expect.out /objdir/hello.c /objdir/hello_strlcpy3.test.out.tmp @@ -95,7 +133,8 @@ Theo de Raadt said /objdir/input.in /objdir/test.mk ======= CLEANFILES ========== +hello.o strlcpy.o strlcat.o getline.o -hello.o +progname.o diff --git a/examples/hello_strlcpy3/hello.c b/examples/hello_strlcpy3/hello.c index 2993cc5..b662024 100644 --- a/examples/hello_strlcpy3/hello.c +++ b/examples/hello_strlcpy3/hello.c @@ -4,6 +4,7 @@ #include #include #include +#include static const char message [] = "Theo de Raadt said: \"The strlcpy() and strlcat() functions provide a consistent, unambiguous API to help the programmer write more bullet-proof code.\""; @@ -15,6 +16,8 @@ int main (int argc, char ** argv) char small_buf [15]; char said [19]; + setprogname (argv [0]); + while (len = getline (&buf, &size, stdin), len != -1){ len = strlen (buf); if (len > 0 && buf [len-1] == '\n') @@ -28,5 +31,8 @@ int main (int argc, char ** argv) strlcpy (said, message, sizeof (said)); puts (said); + printf ("short progname=%s\n", getprogname ()); + printf ("full progname=%s\n", argv [0]); + return 0; } diff --git a/examples/hello_strlcpy3/test.mk b/examples/hello_strlcpy3/test.mk index a123816..065088a 100644 --- a/examples/hello_strlcpy3/test.mk +++ b/examples/hello_strlcpy3/test.mk @@ -1,9 +1,10 @@ -FUNCS_RE=(strlcat|strlcpy|getline)[.]o +FUNCS_RE=(strlcat|strlcpy|getline|progname)[.]o .PHONY : test_output test_output: @set -e; \ - ${.OBJDIR}/hello < ${.CURDIR}/input.in; \ + ${.OBJDIR}/hello < ${.CURDIR}/input.in | \ + mkc_test_helper_paths; \ rm -rf ${.OBJDIR}${PREFIX}; \ MKCATPAGES=yes; export MKCATPAGES; \ \ @@ -34,7 +35,7 @@ test_output: mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ \ echo ======= CLEANFILES ==========; \ - ${MAKE} ${MAKEFLAGS} print-values VARS='CLEANFILES' MKCHECKS=no | \ - awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o$$/) print $$i}' + ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \ + awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}' .include diff --git a/examples/hello_subdirs/prog1/Makefile b/examples/hello_subdirs/prog1/Makefile index d103cbe..0a4c0ad 100644 --- a/examples/hello_subdirs/prog1/Makefile +++ b/examples/hello_subdirs/prog1/Makefile @@ -1,8 +1,12 @@ PROG = prog1 -SCRIPTS = prog1.sh prog1.awk +SCRIPTS = prog1.sh ${INSCRIPTS} +INSCRIPTS = prog1.awk WARNS = 4 +MKC_REQUIRE_PROGS = awk +INTEXTS_REPLS = AWK ${PROG.awk} + # Do not set SCRIPTSNAME in project's Makefile! # This is just a regression test. SCRIPTSNAME_prog1.awk = program1.awk diff --git a/examples/hello_subdirs/prog1/expect.out b/examples/hello_subdirs/prog1/expect.out index 4930183..d3284bf 100644 --- a/examples/hello_subdirs/prog1/expect.out +++ b/examples/hello_subdirs/prog1/expect.out @@ -10,6 +10,7 @@ SRCDIR_prog2=hello_subdirs/prog2 /objdir/expect.out /objdir/prog1 /objdir/prog1.awk +/objdir/prog1.awk.in /objdir/prog1.c /objdir/prog1.o /objdir/prog1.sh @@ -23,7 +24,7 @@ SRCDIR_prog2=hello_subdirs/prog2 ========== clean =========== /objdir/Makefile /objdir/expect.out -/objdir/prog1.awk +/objdir/prog1.awk.in /objdir/prog1.c /objdir/prog1.sh /objdir/prog1.test.out.tmp @@ -31,7 +32,7 @@ SRCDIR_prog2=hello_subdirs/prog2 ======= distclean ========== /objdir/Makefile /objdir/expect.out -/objdir/prog1.awk +/objdir/prog1.awk.in /objdir/prog1.c /objdir/prog1.sh /objdir/prog1.test.out.tmp diff --git a/examples/hello_subdirs/prog1/prog1.awk b/examples/hello_subdirs/prog1/prog1.awk deleted file mode 100755 index 5a03ed8..0000000 --- a/examples/hello_subdirs/prog1/prog1.awk +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/awk -f - -BEGIN { - print "Hello World1-3" - exit 0 -} diff --git a/examples/hello_subdirs/prog1/prog1.awk.in b/examples/hello_subdirs/prog1/prog1.awk.in new file mode 100755 index 0000000..65ab78a --- /dev/null +++ b/examples/hello_subdirs/prog1/prog1.awk.in @@ -0,0 +1,6 @@ +#!@AWK@ -f + +BEGIN { + print "Hello World1-3" + exit 0 +} diff --git a/examples/subprojects/libhello1/linkme.mk b/examples/subprojects/libhello1/linkme.mk index 731ac90..41a35b6 100644 --- a/examples/subprojects/libhello1/linkme.mk +++ b/examples/subprojects/libhello1/linkme.mk @@ -1,5 +1,5 @@ -PATH.hello1 := ${.PARSEDIR} +PATH.hello1 := ${.PARSEDIR:tA} -CPPFLAGS += -I${PATH.hello1} +DPINCDIRS += ${PATH.hello1} DPLIBDIRS += ${PATH.hello1} -LDADD0 += -lhello1 +DPLDADD += hello1 diff --git a/examples/subprojects/libhello2/linkme.mk b/examples/subprojects/libhello2/linkme.mk index 135ad9e..ca21bf6 100644 --- a/examples/subprojects/libhello2/linkme.mk +++ b/examples/subprojects/libhello2/linkme.mk @@ -1,5 +1,5 @@ -PATH.hello2 := ${.PARSEDIR} +PATH.hello2 := ${.PARSEDIR:tA} -CPPFLAGS += -I${PATH.hello2}/include +DPINCDIRS += ${PATH.hello2}/include DPLIBDIRS += ${PATH.hello2} -LDADD0 += -lhello2 +DPLDADD += hello2 diff --git a/examples/subprojects/test.mk b/examples/subprojects/test.mk index 46ac375..27b2071 100644 --- a/examples/subprojects/test.mk +++ b/examples/subprojects/test.mk @@ -9,8 +9,9 @@ test_output : rm -rf ${.OBJDIR}${PREFIX}; \ LD_LIBRARY_PATH=${.CURDIR}/libhello1:${.CURDIR}/libhello2:$$LD_LIBRARY_PATH; \ DYLD_LIBRARY_PATH=${.CURDIR}/libhello1:${.CURDIR}/libhello2:$$LD_LIBRARY_PATH; \ + LIBRARY_PATH=$$LIBRARY_PATH:$$LD_LIBRARY_PATH; \ MKINSTALLDIRS=no; \ - export LD_LIBRARY_PATH DYLD_LIBRARY_PATH; \ + export LD_LIBRARY_PATH DYLD_LIBRARY_PATH LIBRARY_PATH; \ ${.CURDIR}/hello/hello_subprojects; \ ${.CURDIR}/hello/hello_subprojects2; \ \ @@ -21,6 +22,7 @@ test_output : echo ===== all SHRTOUT=yes ======; \ ${MAKE} ${MAKEFLAGS} clean > /dev/null; \ ${MAKE} ${MAKEFLAGS} all SHRTOUT=YES 2>&1 | \ + grep -v warning: | \ mkc_test_helper_paths; \ \ echo ========= installdirs ==========; \ diff --git a/examples/tools/Makefile b/examples/tools/Makefile index 5077390..6d59113 100644 --- a/examples/tools/Makefile +++ b/examples/tools/Makefile @@ -1,7 +1,7 @@ -SUBPRJ = libs/foo:tools/prog1 -SUBPRJ += libs/bar:tools/prog2 -SUBPRJ += libs/foo:tools/prog3 libs/bar:tools/prog3 -SUBPRJ += libs/qux:tools/prog4 +LIBDEPS = libs/foo:tools/prog1 +LIBDEPS += libs/bar:tools/prog2 +LIBDEPS += libs/foo:tools/prog3 libs/bar:tools/prog3 +LIBDEPS += libs/qux:tools/prog4 # target "check" is used for testing because "test" is used by mk-configure TARGETS = check diff --git a/examples/tools/expect.out b/examples/tools/expect.out index df742fd..3ffe8cd 100644 --- a/examples/tools/expect.out +++ b/examples/tools/expect.out @@ -47,16 +47,13 @@ check ===> tools/prog1 /objdir/libs/bar/bar.h /objdir/libs/bar/bar.o /objdir/libs/bar/libbar.a -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h /objdir/libs/foo/foo.o /objdir/libs/foo/libfoo.a -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile /objdir/libs/qux/libqux.a -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h /objdir/libs/qux/qux.h.in @@ -143,13 +140,10 @@ LD: prog4 /objdir/libs/bar/Makefile /objdir/libs/bar/bar.c /objdir/libs/bar/bar.h -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h.in /objdir/test.mk @@ -168,13 +162,10 @@ LD: prog4 /objdir/libs/bar/Makefile /objdir/libs/bar/bar.c /objdir/libs/bar/bar.h -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h.in /objdir/test.mk @@ -197,15 +188,12 @@ LD: prog4 /objdir/libs/bar/Makefile /objdir/libs/bar/bar.c /objdir/libs/bar/bar.h -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h /objdir/libs/foo/foo.o /objdir/libs/foo/libfoo.a -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h.in /objdir/test.mk @@ -230,15 +218,12 @@ LD: prog4 /objdir/libs/bar/Makefile /objdir/libs/bar/bar.c /objdir/libs/bar/bar.h -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h /objdir/libs/foo/foo.o /objdir/libs/foo/libfoo.a -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h.in /objdir/test.mk @@ -263,15 +248,12 @@ LD: prog4 /objdir/libs/bar/Makefile /objdir/libs/bar/bar.c /objdir/libs/bar/bar.h -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h /objdir/libs/foo/foo.o /objdir/libs/foo/libfoo.a -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h.in /objdir/test.mk @@ -298,13 +280,10 @@ LD: prog4 /objdir/libs/bar/bar.h /objdir/libs/bar/bar.o /objdir/libs/bar/libbar.a -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h.in /objdir/test.mk @@ -331,13 +310,10 @@ LD: prog4 /objdir/libs/bar/bar.h /objdir/libs/bar/bar.o /objdir/libs/bar/libbar.a -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h.in /objdir/test.mk @@ -364,15 +340,12 @@ LD: prog4 /objdir/libs/bar/bar.h /objdir/libs/bar/bar.o /objdir/libs/bar/libbar.a -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h /objdir/libs/foo/foo.o /objdir/libs/foo/libfoo.a -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h.in /objdir/test.mk @@ -400,14 +373,11 @@ LD: prog4 /objdir/libs/bar/Makefile /objdir/libs/bar/bar.c /objdir/libs/bar/bar.h -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile /objdir/libs/qux/libqux.a -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h /objdir/libs/qux/qux.h.in @@ -488,6 +458,7 @@ errorcheck filelist install installdirs +mkgen obj test uninstall diff --git a/examples/tools/libs/bar/linkme.mk b/examples/tools/libs/bar/linkme.mk deleted file mode 100644 index 6d6ad74..0000000 --- a/examples/tools/libs/bar/linkme.mk +++ /dev/null @@ -1,5 +0,0 @@ -PATH.bar := ${.PARSEDIR} - -CPPFLAGS += -I${PATH.bar} -DPLIBDIRS += ${PATH.bar} -LDADD0 += -lbar diff --git a/examples/tools/libs/foo/linkme.mk b/examples/tools/libs/foo/linkme.mk deleted file mode 100644 index 841ff33..0000000 --- a/examples/tools/libs/foo/linkme.mk +++ /dev/null @@ -1,5 +0,0 @@ -PATH.foo := ${.PARSEDIR} - -CPPFLAGS += -I${PATH.foo} -DPLIBDIRS += ${PATH.foo} -LDADD0 += -lfoo diff --git a/examples/tools/libs/qux/linkme.mk b/examples/tools/libs/qux/linkme.mk deleted file mode 100644 index ebf405e..0000000 --- a/examples/tools/libs/qux/linkme.mk +++ /dev/null @@ -1,5 +0,0 @@ -PATH.qux := ${.PARSEDIR} - -CPPFLAGS += -I${PATH.qux} -DPLIBDIRS += ${PATH.qux} -LDADD0 += -lqux diff --git a/examples/tools/tools/prog1/Makefile b/examples/tools/tools/prog1/Makefile index bca4588..bf306a3 100644 --- a/examples/tools/tools/prog1/Makefile +++ b/examples/tools/tools/prog1/Makefile @@ -8,5 +8,4 @@ MKC_REQD = 0.10.0 check: @: do something useful -.include "../../libs/foo/linkme.mk" .include diff --git a/examples/tools/tools/prog2/Makefile b/examples/tools/tools/prog2/Makefile index 63ab936..e80873a 100644 --- a/examples/tools/tools/prog2/Makefile +++ b/examples/tools/tools/prog2/Makefile @@ -8,5 +8,4 @@ MKC_REQD = 0.10.0 check: @: do something useful -.include "../../libs/bar/linkme.mk" .include diff --git a/examples/tools/tools/prog3/Makefile b/examples/tools/tools/prog3/Makefile index b361032..093e2d2 100644 --- a/examples/tools/tools/prog3/Makefile +++ b/examples/tools/tools/prog3/Makefile @@ -8,7 +8,4 @@ MKC_REQD = 0.10.0 check: @: do something useful -.include "../../libs/foo/linkme.mk" -.include "../../libs/bar/linkme.mk" - .include diff --git a/examples/tools/tools/prog4/Makefile b/examples/tools/tools/prog4/Makefile index 307f490..1d3ebf0 100644 --- a/examples/tools/tools/prog4/Makefile +++ b/examples/tools/tools/prog4/Makefile @@ -7,5 +7,4 @@ MKC_REQD = 0.10.0 check: @: do something useful -.include "../../libs/qux/linkme.mk" .include diff --git a/examples/tools2/Makefile b/examples/tools2/Makefile index fd00e1a..4476c66 100644 --- a/examples/tools2/Makefile +++ b/examples/tools2/Makefile @@ -1,7 +1,7 @@ -SUBPRJ = libs/foo:tools/prog1 -SUBPRJ += libs/bar:tools/prog2 -SUBPRJ += libs/foo:tools/prog3 libs/bar:tools/prog3 -SUBPRJ += libs/qux:tools/prog4 +LIBDEPS = libs/foo:tools/prog1 +LIBDEPS += libs/bar:tools/prog2 +LIBDEPS += libs/foo:tools/prog3 libs/bar:tools/prog3 +LIBDEPS += libs/qux:tools/prog4 SUBPRJ += tools/prog1:tests/prog1 SUBPRJ += tools/prog2:tests/prog2 diff --git a/examples/tools2/expect.out b/examples/tools2/expect.out index 735c615..d86a609 100644 --- a/examples/tools2/expect.out +++ b/examples/tools2/expect.out @@ -51,16 +51,13 @@ check ===> tools/prog1 /objdir/libs/bar/bar.h /objdir/libs/bar/bar.o /objdir/libs/bar/libbar.a -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h /objdir/libs/foo/foo.o /objdir/libs/foo/libfoo.a -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile /objdir/libs/qux/libqux.a -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h /objdir/libs/qux/qux.h.in @@ -151,13 +148,10 @@ LD: prog4 /objdir/libs/bar/Makefile /objdir/libs/bar/bar.c /objdir/libs/bar/bar.h -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h.in /objdir/test.mk @@ -180,13 +174,10 @@ LD: prog4 /objdir/libs/bar/Makefile /objdir/libs/bar/bar.c /objdir/libs/bar/bar.h -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h.in /objdir/test.mk @@ -213,15 +204,12 @@ LD: prog4 /objdir/libs/bar/Makefile /objdir/libs/bar/bar.c /objdir/libs/bar/bar.h -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h /objdir/libs/foo/foo.o /objdir/libs/foo/libfoo.a -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h.in /objdir/test.mk @@ -250,15 +238,12 @@ LD: prog4 /objdir/libs/bar/Makefile /objdir/libs/bar/bar.c /objdir/libs/bar/bar.h -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h /objdir/libs/foo/foo.o /objdir/libs/foo/libfoo.a -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h.in /objdir/test.mk @@ -289,13 +274,10 @@ LD: prog4 /objdir/libs/bar/bar.h /objdir/libs/bar/bar.o /objdir/libs/bar/libbar.a -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h.in /objdir/test.mk @@ -326,13 +308,10 @@ LD: prog4 /objdir/libs/bar/bar.h /objdir/libs/bar/bar.o /objdir/libs/bar/libbar.a -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h.in /objdir/test.mk @@ -363,15 +342,12 @@ LD: prog4 /objdir/libs/bar/bar.h /objdir/libs/bar/bar.o /objdir/libs/bar/libbar.a -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h /objdir/libs/foo/foo.o /objdir/libs/foo/libfoo.a -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h.in /objdir/test.mk @@ -403,14 +379,11 @@ LD: prog4 /objdir/libs/bar/Makefile /objdir/libs/bar/bar.c /objdir/libs/bar/bar.h -/objdir/libs/bar/linkme.mk /objdir/libs/foo/Makefile /objdir/libs/foo/foo.c /objdir/libs/foo/foo.h -/objdir/libs/foo/linkme.mk /objdir/libs/qux/Makefile /objdir/libs/qux/libqux.a -/objdir/libs/qux/linkme.mk /objdir/libs/qux/qux.c /objdir/libs/qux/qux.h /objdir/libs/qux/qux.h.in @@ -455,15 +428,15 @@ obj/tools/prog3/prog3.o obj/tools/prog4/prog4 obj/tools/prog4/prog4.o =========== print_deps ============ +all-tools/prog1 all-tests/prog1 +all-tools/prog2 all-tests/prog2 +all-tools/prog3 all-tests/prog3 +all-tools/prog4 all-tests/prog4 all-libs/foo all-tools/prog1 all-libs/bar all-tools/prog2 all-libs/foo all-tools/prog3 all-libs/bar all-tools/prog3 all-libs/qux all-tools/prog4 -all-tools/prog1 all-tests/prog1 -all-tools/prog2 all-tests/prog2 -all-tools/prog3 all-tests/prog3 -all-tools/prog4 all-tests/prog4 all-libs/bar libs/bar all-libs/foo libs/foo all-libs/qux libs/qux diff --git a/examples/tools2/libs/bar/linkme.mk b/examples/tools2/libs/bar/linkme.mk deleted file mode 100644 index 10a6279..0000000 --- a/examples/tools2/libs/bar/linkme.mk +++ /dev/null @@ -1,5 +0,0 @@ -PATH.bar := ${.PARSEDIR} - -CPPFLAGS += -I${PATH.bar} -DPLIBDIRS += libs/${PATH.bar:T} -LDADD0 += -lbar diff --git a/examples/tools2/libs/foo/linkme.mk b/examples/tools2/libs/foo/linkme.mk deleted file mode 100644 index b1da09b..0000000 --- a/examples/tools2/libs/foo/linkme.mk +++ /dev/null @@ -1,5 +0,0 @@ -PATH.foo := ${.PARSEDIR} - -CPPFLAGS += -I${PATH.foo} -DPLIBDIRS += libs/${PATH.foo:T} -LDADD0 += -lfoo diff --git a/examples/tools2/libs/qux/linkme.mk b/examples/tools2/libs/qux/linkme.mk deleted file mode 100644 index ec0e23a..0000000 --- a/examples/tools2/libs/qux/linkme.mk +++ /dev/null @@ -1,5 +0,0 @@ -PATH.qux := ${.PARSEDIR} - -CPPFLAGS += -I${OBJDIR_libs_qux} -DPLIBDIRS += libs/${PATH.qux:T} -LDADD0 += -lqux diff --git a/examples/tools2/tools/prog1/Makefile b/examples/tools2/tools/prog1/Makefile index bca4588..bf306a3 100644 --- a/examples/tools2/tools/prog1/Makefile +++ b/examples/tools2/tools/prog1/Makefile @@ -8,5 +8,4 @@ MKC_REQD = 0.10.0 check: @: do something useful -.include "../../libs/foo/linkme.mk" .include diff --git a/examples/tools2/tools/prog2/Makefile b/examples/tools2/tools/prog2/Makefile index 63ab936..e80873a 100644 --- a/examples/tools2/tools/prog2/Makefile +++ b/examples/tools2/tools/prog2/Makefile @@ -8,5 +8,4 @@ MKC_REQD = 0.10.0 check: @: do something useful -.include "../../libs/bar/linkme.mk" .include diff --git a/examples/tools2/tools/prog3/Makefile b/examples/tools2/tools/prog3/Makefile index b361032..093e2d2 100644 --- a/examples/tools2/tools/prog3/Makefile +++ b/examples/tools2/tools/prog3/Makefile @@ -8,7 +8,4 @@ MKC_REQD = 0.10.0 check: @: do something useful -.include "../../libs/foo/linkme.mk" -.include "../../libs/bar/linkme.mk" - .include diff --git a/examples/tools2/tools/prog4/Makefile b/examples/tools2/tools/prog4/Makefile index 307f490..1d3ebf0 100644 --- a/examples/tools2/tools/prog4/Makefile +++ b/examples/tools2/tools/prog4/Makefile @@ -7,5 +7,4 @@ MKC_REQD = 0.10.0 check: @: do something useful -.include "../../libs/qux/linkme.mk" .include -- cgit v1.2.3