diff options
author | Andrew Shadura <andrew@shadura.me> | 2015-07-25 14:44:48 +0200 |
---|---|---|
committer | Andrew Shadura <andrew@shadura.me> | 2015-07-25 14:44:48 +0200 |
commit | 8d15cbf39b8aa01eaabfa3167e6ce3dc9f9e0af8 (patch) | |
tree | 285bc54cde407bc53e4134c649569b92758ed33a /examples | |
parent | 6ec061aabc159e3f37591e92fa1df407cdca6246 (diff) |
Imported Upstream version 0.27.0
Diffstat (limited to 'examples')
-rw-r--r-- | examples/hello_RBTREE/hello_RBTREE.c | 5 | ||||
-rw-r--r-- | examples/hello_cxx/Makefile | 2 | ||||
-rw-r--r-- | examples/hello_cxx/expect.out | 24 | ||||
-rw-r--r-- | examples/hello_cxx/five.c | 6 | ||||
-rw-r--r-- | examples/hello_cxx/five.h | 14 | ||||
-rw-r--r-- | examples/hello_cxx/main.cc | 6 | ||||
-rw-r--r-- | examples/hello_cxx/seven.c | 6 | ||||
-rw-r--r-- | examples/hello_cxx/seven.h | 14 | ||||
-rw-r--r-- | examples/hello_dictd/test.mk | 2 | ||||
-rw-r--r-- | examples/hello_lex/expect.out | 2 | ||||
-rw-r--r-- | examples/hello_superfs/Makefile | 3 | ||||
-rw-r--r-- | examples/hello_superfs/Makefile.inc | 15 | ||||
-rw-r--r-- | examples/hello_superfs/expect.out | 12 | ||||
-rw-r--r-- | examples/hello_superfs/test.mk | 21 |
14 files changed, 126 insertions, 6 deletions
diff --git a/examples/hello_RBTREE/hello_RBTREE.c b/examples/hello_RBTREE/hello_RBTREE.c index bfcf96b..4ee1314 100644 --- a/examples/hello_RBTREE/hello_RBTREE.c +++ b/examples/hello_RBTREE/hello_RBTREE.c @@ -21,8 +21,9 @@ static int berrys_cmp (struct berry *a, struct berry *b) } static RB_HEAD (berrys_entries, berry) berrys = RB_INITIALIZER(&berrys); -RB_PROTOTYPE (berrys_entries, berry, link, berrys_cmp); -RB_GENERATE (berrys_entries, berry, link, berrys_cmp); + +RB_PROTOTYPE (berrys_entries, berry, link, berrys_cmp) +RB_GENERATE (berrys_entries, berry, link, berrys_cmp) static void output_berries (void) { diff --git a/examples/hello_cxx/Makefile b/examples/hello_cxx/Makefile index f9a1a11..be0460d 100644 --- a/examples/hello_cxx/Makefile +++ b/examples/hello_cxx/Makefile @@ -4,7 +4,7 @@ WARNS = 4 CPPFLAGS += -I. -SRCS = hello_msg.cc main.cc +SRCS = main.cc hello_msg.cc five.c seven.c MKC_REQD = 0.12.9 diff --git a/examples/hello_cxx/expect.out b/examples/hello_cxx/expect.out index 626ff9f..2d97290 100644 --- a/examples/hello_cxx/expect.out +++ b/examples/hello_cxx/expect.out @@ -1,11 +1,20 @@ Hello world! +Five: 5 +Seven: 7 =========== 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_prog_cc.err +/objdir/_mkc_prog_cc.res /objdir/_mkc_prog_cxx.err /objdir/_mkc_prog_cxx.res /objdir/expect.out +/objdir/five.c +/objdir/five.h +/objdir/five.o /objdir/hello_cxx /objdir/hello_cxx.test.out.tmp /objdir/hello_msg.cc @@ -13,6 +22,9 @@ Hello world! /objdir/hello_msg.o /objdir/main.cc /objdir/main.o +/objdir/seven.c +/objdir/seven.h +/objdir/seven.o /objdir/test.mk ========= install ========== /objdir/prefix @@ -21,21 +33,33 @@ Hello world! ======== 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_prog_cc.err +/objdir/_mkc_prog_cc.res /objdir/_mkc_prog_cxx.err /objdir/_mkc_prog_cxx.res /objdir/expect.out +/objdir/five.c +/objdir/five.h /objdir/hello_cxx.test.out.tmp /objdir/hello_msg.cc /objdir/hello_msg.h /objdir/main.cc +/objdir/seven.c +/objdir/seven.h /objdir/test.mk ======= distclean ========== /objdir/Makefile /objdir/expect.out +/objdir/five.c +/objdir/five.h /objdir/hello_cxx.test.out.tmp /objdir/hello_msg.cc /objdir/hello_msg.h /objdir/main.cc +/objdir/seven.c +/objdir/seven.h /objdir/test.mk diff --git a/examples/hello_cxx/five.c b/examples/hello_cxx/five.c new file mode 100644 index 0000000..1b2f63f --- /dev/null +++ b/examples/hello_cxx/five.c @@ -0,0 +1,6 @@ +#include "five.h" + +int five (void) +{ + return 5; +} diff --git a/examples/hello_cxx/five.h b/examples/hello_cxx/five.h new file mode 100644 index 0000000..51f786b --- /dev/null +++ b/examples/hello_cxx/five.h @@ -0,0 +1,14 @@ +#ifndef _FIVE_H_ +#define _FIVE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +int five (void); + +#ifdef __cplusplus +}; +#endif + +#endif // _FIVE_H_ diff --git a/examples/hello_cxx/main.cc b/examples/hello_cxx/main.cc index 4b93a98..1d99736 100644 --- a/examples/hello_cxx/main.cc +++ b/examples/hello_cxx/main.cc @@ -1,7 +1,13 @@ #include "hello_msg.h" +#include "five.h" +#include "seven.h" + +#include <iostream> int main (int argc, char **argv) { hello_msg (); + std::cout << "Five: " << five () << '\n'; + std::cout << "Seven: " << seven () << '\n'; return 0; } diff --git a/examples/hello_cxx/seven.c b/examples/hello_cxx/seven.c new file mode 100644 index 0000000..1e4316a --- /dev/null +++ b/examples/hello_cxx/seven.c @@ -0,0 +1,6 @@ +#include "seven.h" + +int seven (void) +{ + return 7; +} diff --git a/examples/hello_cxx/seven.h b/examples/hello_cxx/seven.h new file mode 100644 index 0000000..34c3642 --- /dev/null +++ b/examples/hello_cxx/seven.h @@ -0,0 +1,14 @@ +#ifndef _SEVEN_H_ +#define _SEVEN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +int seven (void); + +#ifdef __cplusplus +}; +#endif + +#endif // _SEVEN_H_ diff --git a/examples/hello_dictd/test.mk b/examples/hello_dictd/test.mk index 0ccfb4e..2ec6e83 100644 --- a/examples/hello_dictd/test.mk +++ b/examples/hello_dictd/test.mk @@ -64,7 +64,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; \ + rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/home; \ echo =========== MKOBJDIRS=auto ============; \ env TARGETS=fake ${MAKE} ${MAKEFLAGS} fake \ MKCHECKS=no MAKEOBJDIRPREFIX=${.OBJDIR}/obj1 > /dev/null; \ diff --git a/examples/hello_lex/expect.out b/examples/hello_lex/expect.out index 7e6f996..1f96feb 100644 --- a/examples/hello_lex/expect.out +++ b/examples/hello_lex/expect.out @@ -50,7 +50,7 @@ /objdir/input.txt /objdir/test.mk ==== SHRTOUT=yes depend ==== -checking for compiler mmm... nnn +checking for C compiler mmm... nnn checking for program mmm... nnn checking for program mmm... nnn LEX: hello_lex.l diff --git a/examples/hello_superfs/Makefile b/examples/hello_superfs/Makefile index 81442e4..57a1655 100644 --- a/examples/hello_superfs/Makefile +++ b/examples/hello_superfs/Makefile @@ -4,5 +4,8 @@ SUBPRJ_DFLT = mkfs_superfs fsck_superfs docs # "tools" is a virtual subproject, there is no subdirectory for it +TMPPREFIX = ${.OBJDIR}/tmp +.export TMPPREFIX + .include "test.mk" .include <mkc.subprj.mk> diff --git a/examples/hello_superfs/Makefile.inc b/examples/hello_superfs/Makefile.inc index d29359b..57c8208 100644 --- a/examples/hello_superfs/Makefile.inc +++ b/examples/hello_superfs/Makefile.inc @@ -1 +1,14 @@ -BINDIR?= ${SBINDIR} +BINDIR ?= ${SBINDIR} + +.ifdef MICHAEL_MODE +# If MICHAEL_MODE environment variabe is set, everything +# is installed to temporary directory after build and +# uninstalled before cleaning. +# This feature may be useful for development +# and was proposed by Michael Crogan. +PREFIX = ${TMPPREFIX} +INSTALL = mkc_install +COPY = -l # symlinks instead of copying/moving +post_all: install +pre_clean: uninstall +.endif diff --git a/examples/hello_superfs/expect.out b/examples/hello_superfs/expect.out index 45af717..3e0ab3e 100644 --- a/examples/hello_superfs/expect.out +++ b/examples/hello_superfs/expect.out @@ -147,3 +147,15 @@ /objdir/mkfs_superfs/mkfs_superfs.cat8 /objdir/mkfs_superfs/mkfs_superfs.o /objdir/test.mk +=========== Michael mode: all ============ +/objdir/tmp/man/cat8/fsck_superfs.0 +/objdir/tmp/man/cat8/mkfs_superfs.0 +/objdir/tmp/man/man8/fsck_superfs.8 +/objdir/tmp/man/man8/mkfs_superfs.8 +/objdir/tmp/sbin/fsck_superfs +/objdir/tmp/sbin/mkfs_superfs +/objdir/tmp/share/doc/dict/LICENSE +/objdir/tmp/share/doc/dict/NEWS +/objdir/tmp/share/doc/dict/README +=========== Michael mode: clean ============ +=========== Michael mode: cleandir ============ diff --git a/examples/hello_superfs/test.mk b/examples/hello_superfs/test.mk index 90f220d..d7b0b98 100644 --- a/examples/hello_superfs/test.mk +++ b/examples/hello_superfs/test.mk @@ -1,3 +1,5 @@ +next_level != expr ${.MAKE.LEVEL} + 1 + .PHONY : test_output test_output: @set -e; \ @@ -45,9 +47,28 @@ test_output: ${MAKE} ${MAKEFLAGS} all installdirs install -j3 DESTDIR=${.OBJDIR} \ > /dev/null; \ find ${.OBJDIR} -type f -o -type l | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}"; unset MKINSTALL; \ + \ + echo =========== Michael mode: all ============; \ + MICHAEL_MODE=1; export MICHAEL_MODE; \ + env init_make_level=${next_level} ${MAKE} ${MAKEFLAGS} all > /dev/null 2>&1; \ + find ${TMPPREFIX} -type l | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ + \ + echo =========== Michael mode: clean ============; \ + env init_make_level=${next_level} ${MAKE} ${MAKEFLAGS} clean > /dev/null 2>&1; \ + find ${TMPPREFIX} -type f -o -type l | \ + mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ + \ + echo =========== Michael mode: cleandir ============; \ + env init_make_level=${next_level} ${MAKE} ${MAKEFLAGS} all > /dev/null 2>&1; \ + env init_make_level=${next_level} ${MAKE} ${MAKEFLAGS} cleandir > /dev/null 2>&1; \ + find ${TMPPREFIX} -type f -o -type l | \ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ \ true ======= distclean ==========; \ ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null +CLEANDIRS += ${TMPPREFIX} + .include <mkc.minitest.mk> |