From 8d15cbf39b8aa01eaabfa3167e6ce3dc9f9e0af8 Mon Sep 17 00:00:00 2001 From: Andrew Shadura Date: Sat, 25 Jul 2015 14:44:48 +0200 Subject: Imported Upstream version 0.27.0 --- Makefile.inc | 2 +- custom/prog_mkdep | 6 +- doc/NEWS | 30 +++++++ doc/TODO | 18 ++-- examples/hello_RBTREE/hello_RBTREE.c | 5 +- examples/hello_cxx/Makefile | 2 +- examples/hello_cxx/expect.out | 24 ++++++ examples/hello_cxx/five.c | 6 ++ examples/hello_cxx/five.h | 14 +++ examples/hello_cxx/main.cc | 6 ++ examples/hello_cxx/seven.c | 6 ++ examples/hello_cxx/seven.h | 14 +++ examples/hello_dictd/test.mk | 2 +- examples/hello_lex/expect.out | 2 +- examples/hello_superfs/Makefile | 3 + examples/hello_superfs/Makefile.inc | 15 +++- examples/hello_superfs/expect.out | 12 +++ examples/hello_superfs/test.mk | 21 +++++ features/mkc_imp.f_SLIST.mk | 13 ++- main.mk | 2 +- mk/Makefile | 10 +-- mk/mkc.init.mk | 15 ++-- mk/mkc_imp.arch.mk | 16 ++-- mk/mkc_imp.dep.mk | 33 ++++--- mk/mkc_imp.files.mk | 17 ++-- mk/mkc_imp.final.mk | 23 +++-- mk/mkc_imp.inc.mk | 9 +- mk/mkc_imp.info.mk | 17 ++-- mk/mkc_imp.intexts.mk | 3 +- mk/mkc_imp.lib.mk | 12 +-- mk/mkc_imp.links.mk | 5 +- mk/mkc_imp.man.mk | 16 ++-- mk/mkc_imp.mk | 38 +++----- mk/mkc_imp.pkg-config.mk | 6 +- mk/mkc_imp.platform.sys.mk | 13 +-- mk/mkc_imp.prog.mk | 9 +- mk/mkc_imp.scripts.mk | 16 ++-- mk/mkc_imp.subprj.mk | 3 - presentation/presentation.pdf | Bin 160669 -> 160669 bytes scripts/mk-configure.7.in | 27 +++++- scripts/mkc_check_compiler | 5 +- scripts/mkc_install | 147 ++++++++++++++++--------------- tests/predopost_targets/Makefile | 9 ++ tests/predopost_targets/Makefile.inc | 7 ++ tests/predopost_targets/expect.out | 148 ++++++++++++++++++++++++++++++++ tests/predopost_targets/lib/Makefile | 3 + tests/predopost_targets/lua/Makefile | 4 + tests/predopost_targets/others/Makefile | 15 ++++ tests/predopost_targets/test.mk | 23 +++++ tests/reqd/expect.out | 2 +- tests/reqd2/expect.out | 2 +- tests/reqd3/expect.out | 2 +- tests/reqd4/expect.out | 2 +- tests/reqd_clean_cache/test.mk | 2 +- tests/test_subprj_dash/Makefile | 2 +- 55 files changed, 623 insertions(+), 241 deletions(-) create mode 100644 examples/hello_cxx/five.c create mode 100644 examples/hello_cxx/five.h create mode 100644 examples/hello_cxx/seven.c create mode 100644 examples/hello_cxx/seven.h create mode 100644 tests/predopost_targets/Makefile create mode 100644 tests/predopost_targets/Makefile.inc create mode 100644 tests/predopost_targets/expect.out create mode 100644 tests/predopost_targets/lib/Makefile create mode 100644 tests/predopost_targets/lua/Makefile create mode 100644 tests/predopost_targets/others/Makefile create mode 100644 tests/predopost_targets/test.mk diff --git a/Makefile.inc b/Makefile.inc index ae58017..84c7c52 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -1,4 +1,4 @@ -VERSION = 0.26.0 +VERSION = 0.27.0 BIRTHDATE = 2009-02-21 diff --git a/custom/prog_mkdep b/custom/prog_mkdep index cdbea04..c2e1b94 100755 --- a/custom/prog_mkdep +++ b/custom/prog_mkdep @@ -14,13 +14,17 @@ extra_args="$*" pathpart='custom_nbmkdep' . mkc_check_common.sh -#trap "echo $tmpc; rm $tmpc" 0 trap "rm -f $tmpc $tmpo" 0 cat > "$tmpc" <<'EOF' #include EOF +if test -n "$MKDEP_CC"; then + CC="$MKDEP_CC" + export CC +fi + check_mkdep (){ "$1" -f "$tmpo" $extra_args -I . -I `pwd` "$tmpc" } diff --git a/doc/NEWS b/doc/NEWS index 323adaf..c665192 100644 --- a/doc/NEWS +++ b/doc/NEWS @@ -1,3 +1,33 @@ +====================================================================== +Version 0.27.0, by Aleksey Cheusov, Sun, 13 Jul 2014 17:03:12 +0300 + + Fix pkg-config support (github issue #8). + Thanks to Andrew Shadura for the report. + + Fix support for mixed C/C++ projects. + + Fixes for Interix and Cygwin where users and groups may have spaces. + Thanks to Michael Crogan for the report. + + Fix in mkc_imp.f_SLIST.mk (we have to restore original MKC_NOAUTO) + + mkc.lib.mk: + - MKPIE=yes also turns on PIC + + pre_*, do_* and post_* targets were introduced. ALLTARGETS was + introduced which lists all targets with pre_/do_/post_ + counterparts. + + examples/hello_superfs: + - new interesting feature proposed by Michael Crogan + + As makedepend(1) is broken on Linux, {b}mkdep(1) is used for + generating .depend by default. + + mkc_install: + - new option -l for symlinking + - fixes for files and directories with spaces + ====================================================================== Version 0.26.0, by Aleksey Cheusov, Mon, 3 Feb 2014 00:32:51 +0300 diff --git a/doc/TODO b/doc/TODO index 5bc9e8b..00d77ad 100644 --- a/doc/TODO +++ b/doc/TODO @@ -1,23 +1,17 @@ ============================================================ Plan 0.26.0 +- CLEANFILES: pod2htmd.tmp pod2htmi.tmp only if POD is built + +- DISTCLEANFILES: .depend for C/C++ projects + +- MKC_FEATURES: err(err,warn etc.), fgetln(via getline(3)) - Special marker for checks that cannot be possible in cross-compiling Some thoughts inspired by talks with Michael Crogan - MKASNEEDED=yes => ld --as-needed -- During development of huge projects it may make sense to always keep - "installed" version of the software somewhere (FAKEPREFIX?) - and always keep it synced. - mk-configure needs a mechanism to always "install" - after "all" and "uninstall" before "clean". Options: develop this in - mk-c and make it optional feature; provide a mechanism for - auto-depend one target from TARGETS from another one. In the latter - case users will be able to implement this kind of things themself. - (myall -> "myall-* : all-* .WAIT install-*) - (myclean -> "myclean-* : uninstall-* .WAIT clean-*) - - VARIANTS for libraries. - _mkc_done__ @@ -47,8 +41,6 @@ Some thoughts inspired by talks with Michael Crogan libraries and programs. In addition examples/ is needed for triggering rebuild of subproject if "something" was rebuild in another subproject (build script for example). -- For better extensibility it makes sense to implement user-implementable - pre_all, post_all, pre_install, post_install etc. targets. - Interdependencies between targetX-subprjA and targetY-subprjB (for example all-prject1 and install-prject2). Maybe this is cool idea for examples/ and slides. I need some good example for this. 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 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 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 diff --git a/features/mkc_imp.f_SLIST.mk b/features/mkc_imp.f_SLIST.mk index de7d2af..c00abc6 100644 --- a/features/mkc_imp.f_SLIST.mk +++ b/features/mkc_imp.f_SLIST.mk @@ -2,6 +2,8 @@ # # See LICENSE file in the distribution. ############################################################ +.include + _macro = SLIST SIMPLEQ STAILQ LIST TAILQ TAILQ .for m in ${_macro} @@ -9,7 +11,8 @@ MKC_CHECK_DEFINES += ${m}_ENTRY:sys/queue.h _macro.${m} = 1 .endfor -MKC_NOAUTO=1 +MKC_NOAUTO.orig := ${MKC_NOAUTO} +MKC_NOAUTO = 1 .include @@ -23,8 +26,12 @@ bad=1 CFLAGS+= -DMKC_SYS_QUEUE_IS_FINE=1 .endif -.undef bad - .for m in ${_macro} .undef _macro.${m} .endfor + +MKC_NOAUTO := ${MKC_NOAUTO.orig} + +.undef bad +.undef _macro +.undef MKC_NOAUTO.orig diff --git a/main.mk b/main.mk index d2bafee..b7eff3e 100644 --- a/main.mk +++ b/main.mk @@ -9,7 +9,7 @@ tests = configure_test mkinstall mkshlib mkstaticlib mkpiclib \ lua_dirs rec_makefiles reqd reqd2 reqd3 reqd4 reqd_clean_cache \ intexts_cleantrg require_prototype test_subprj_dash test_mkc_vs_PROG \ test_mkc_vs_LIB test_mkc_vs_SUBDIR test_mkc_vs_SUBPRJ endianess \ - create_cachedir sys_queue + create_cachedir sys_queue predopost_targets .for t in ${tests} SUBPRJ += tests/${t}:tests .endfor diff --git a/mk/Makefile b/mk/Makefile index e3ba4e2..90d43e2 100644 --- a/mk/Makefile +++ b/mk/Makefile @@ -24,16 +24,16 @@ MKC_CHECK_PROGS += makedepend .include -.if ${HAVE_PROG.makedepend:U0} -makedepend_cmd = ${PROG.makedepend} -mkdep_cmd = mkdep -mkdep_type = makedepend -.elif !empty(CUSTOM.prog_nbmkdep) +.if !empty(CUSTOM.prog_nbmkdep) mkdep_cmd = ${CUSTOM.prog_nbmkdep} mkdep_type = nbmkdep .elif !empty(CUSTOM.prog_mkdep) mkdep_cmd = ${CUSTOM.prog_mkdep} mkdep_type = mkdep +.elif ${HAVE_PROG.makedepend:U0} +makedepend_cmd = ${PROG.makedepend} +mkdep_cmd = mkdep +mkdep_type = makedepend .else MKC_ERR_MSG += "mkdep(1) cannot be found" .endif diff --git a/mk/mkc.init.mk b/mk/mkc.init.mk index 3196242..7d7339f 100644 --- a/mk/mkc.init.mk +++ b/mk/mkc.init.mk @@ -283,13 +283,13 @@ DISTCLEANFILES += ${MKC_CACHEDIR}/_mkc_* ###### .if ${MKPIE:U:tl} == "yes" LDFLAGS.prog += ${LDFLAGS.pie} -CFLAGS += ${CFLAGS.pie} -CXXFLAGS += ${CXXFLAGS.pie} +_CFLAGS.pie += ${CFLAGS.pie} +_CXXFLAGS.pie += ${CXXFLAGS.pie} .endif .if ${USE_SSP:U:tl} == "yes" -CFLAGS += ${CFLAGS.ssp} -CXXFLAGS += ${CXXFLAGS.ssp} +_CFLAGS.ssp = ${CFLAGS.ssp} +_CXXFLAGS.ssp = ${CXXFLAGS.ssp} .endif .if ${USE_RELRO:U:tl} == "yes" @@ -325,12 +325,12 @@ MESSAGE.s ?= @${_MESSAGE} "AS: ${.IMPSRC}" CC ?= cc CFLAGS ?= -COMPILE.c ?= ${_V} ${CC_PREFIX} ${CC} ${CFLAGS} ${CPPFLAGS} ${CFLAGS.warnerr} -c +COMPILE.c ?= ${_V} ${CC_PREFIX} ${CC} ${CFLAGS} ${CPPFLAGS} ${_CFLAGS.ssp} ${_CFLAGS.pie} ${CFLAGS.warns} -c MESSAGE.c ?= @${_MESSAGE} "CC: ${.IMPSRC}" CXX ?= c++ CXXFLAGS += ${CFLAGS} -COMPILE.cc ?= ${_V} ${CXX_PREFIX} ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${CFLAGS.warnerr} -c +COMPILE.cc ?= ${_V} ${CXX_PREFIX} ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${_CXXFLAGS.ssp} ${_CXXFLAGS.pie} ${CXXFLAGS.warns} -c MESSAGE.cc ?= @${_MESSAGE} "CXX: ${.IMPSRC}" OBJC ?= ${CC} @@ -438,6 +438,9 @@ TARGETS += all install clean cleandir depend test \ installdirs uninstall errorcheck filelist obj TARGETS := ${TARGETS:O:u} +ALLTARGETS += all install clean cleandir depend uninstall installdirs \ + bin_tar bin_targz bin_tarbz2 bin_zip bin_deb + VERBOSE_ECHO ?= echo .endif # __initialized__ diff --git a/mk/mkc_imp.arch.mk b/mk/mkc_imp.arch.mk index fda3999..30554ad 100644 --- a/mk/mkc_imp.arch.mk +++ b/mk/mkc_imp.arch.mk @@ -1,4 +1,4 @@ -# Copyright (c) 2010 by Aleksey Cheusov +# Copyright (c) 2010-2014 by Aleksey Cheusov # # See LICENSE file in the distribution. ############################################################ @@ -10,27 +10,25 @@ rnd != echo $$$$ destdir = ${TMPDIR:U/tmp}/mkc.${rnd} basefile = ${.CURDIR}/${PROJECTNAME} -.PHONY: bin_cleanup bin_tar bin_targz bin_tarbz2 - -bin_cleanup: +bin_cleanup: .PHONY set -e; ${RM} -rf ${destdir}; ${MKDIR} -m 0700 ${destdir}; \ ${MAKE} ${MAKEFLAGS} all install DESTDIR=${destdir} -bin_tar: bin_cleanup +realdo_bin_tar: bin_cleanup set -e; ${RM} -f ${basefile}.tar; cd ${destdir}; \ ${TAR} -cf ${basefile}.tar .; cd /; ${RM} -rf ${destdir} -bin_targz: bin_tar +realdo_bin_targz: bin_tar ${GZIP} ${basefile}.tar -bin_tarbz2: bin_tar +realdo_bin_tarbz2: bin_tar ${BZIP2} ${basefile}.tar -bin_zip: bin_cleanup +realdo_bin_zip: bin_cleanup set -e; ${RM} -f ${basefile}.zip; cd ${destdir}; \ ${ZIP} -r ${basefile}.zip .; ${RM} -rf ${destdir} -bin_deb: DEBIAN/control bin_cleanup +realdo_bin_deb: DEBIAN/control bin_cleanup set -e; cp -rp DEBIAN ${destdir}; ${RM} -rf ${destdir}/DEBIAN/CVS; \ dpkg-deb -b ${destdir} ${.CURDIR:T:S/_/-/g}.deb; \ ${RM} -rf ${destdir} diff --git a/mk/mkc_imp.dep.mk b/mk/mkc_imp.dep.mk index bf5c512..85ee413 100644 --- a/mk/mkc_imp.dep.mk +++ b/mk/mkc_imp.dep.mk @@ -8,15 +8,13 @@ _MKC_IMP_DEP_MK := 1 DISTCLEANFILES += .depend ${__DPSRCS.d} ${CLEANDEPEND} ##### Basic targets -.PHONY: _beforedepend depend -_beforedepend .depend: # ensure existence - -.ORDER: _beforedepend .depend -depend: _beforedepend .depend +do_depend1 do_depend2: .PHONY # ensure existence +realdo_depend: do_depend1 .WAIT do_depend2 ##### Default values MKDEP ?= mkdep MKDEP_SUFFIXES ?= .o .os .op +MKDEP_CC ?= ${CC} ##### Build rules # some of the rules involve .h sources, so remove them from mkdep line @@ -27,7 +25,8 @@ __DPSRCS.all = ${_SRCS_ALL:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \ __DPSRCS.d = ${__DPSRCS.all:O:u:M*.d} __DPSRCS.notd = ${__DPSRCS.all:O:u:N*.d} -_beforedepend: ${DPSRCS} +do_depend1: ${DPSRCS} +do_depend2: .depend MESSAGE.dep ?= @${_MESSAGE} "DEP: ${.TARGET}" @@ -44,22 +43,22 @@ ddash= .endif .if ${MKDEP_TYPE:U} == "makedepend" -MKDEP.c = @${MAKEDEPEND} -f- ${ddash} ${MKDEPFLAGS} \ +MKDEP.c = ${MAKEDEPEND} -f- ${ddash} ${MKDEPFLAGS} \ ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET} -MKDEP.m = @${MKDEP} -f- ${ddash} ${MKDEPFLAGS} \ +MKDEP.m = ${MKDEP} -f- ${ddash} ${MKDEPFLAGS} \ ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET} -MKDEP.cc = @${MKDEP} -f- ${ddash} ${MKDEPFLAGS} \ +MKDEP.cc = ${MKDEP} -f- ${ddash} ${MKDEPFLAGS} \ ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET} -MKDEP.s = @${MKDEP} -f- ${ddash} ${MKDEPFLAGS} \ +MKDEP.s = ${MKDEP} -f- ${ddash} ${MKDEPFLAGS} \ ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET} .else -MKDEP.c = @${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \ +MKDEP.c = ${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \ ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} -MKDEP.m = @${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \ +MKDEP.m = ${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \ ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} -MKDEP.cc = @${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \ +MKDEP.cc = ${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \ ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} -MKDEP.s = @${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \ +MKDEP.s = ${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \ ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} .endif @@ -76,7 +75,7 @@ MKDEP.s = @${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \ .c.d: ${MESSAGE.dep} - @${MKDEP.c} ${.IMPSRC} + @env CC=${MKDEP_CC} ${MKDEP.c} ${.IMPSRC} .m.d: ${MESSAGE.dep} @@ -84,11 +83,11 @@ MKDEP.s = @${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \ .s.d .S.d: ${MESSAGE.dep} - @${MKDEP.s} ${.IMPSRC} + @env CC=${MKDEP_CC} ${MKDEP.s} ${.IMPSRC} .C.d .cc.d .cpp.d .cxx.d: ${MESSAGE.dep} - @${MKDEP.cc} ${.IMPSRC} + @env CC=${MKDEP_CC} ${MKDEP.cc} ${.IMPSRC} .endif # defined(SRCS) diff --git a/mk/mkc_imp.files.mk b/mk/mkc_imp.files.mk index e1cb16f..40c9f53 100644 --- a/mk/mkc_imp.files.mk +++ b/mk/mkc_imp.files.mk @@ -1,4 +1,4 @@ -# Copyright (c) 2009-2010 by Aleksey Cheusov +# Copyright (c) 2009-2014 by Aleksey Cheusov # Copyright (c) 1994-2009 The NetBSD Foundation, Inc. # Copyright (c) 1988, 1989, 1993 The Regents of the University of California # Copyright (c) 1988, 1989 by Adam de Boor @@ -10,14 +10,15 @@ .if !defined(_BSD_FILES_MK) _BSD_FILES_MK := 1 +filesinstall: .PHONY # ensure existence + .include -.PHONY: filesinstall -realinstall: filesinstall +do_install1: .PHONY filesinstall .if defined(FILES) && !empty(FILES) -realall: ${FILES} +realdo_all: ${FILES} .if ${MKINSTALL:tl} == "yes" destination_files = ${FILES:@F@${DESTDIR}${FILESDIR_${F}:U${FILESDIR}}/${FILESNAME_${F}:U${FILESNAME:U${F:T}}}@} @@ -28,8 +29,8 @@ filesinstall: ${destination_files} __fileinstall: .USE ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} \ - -o ${FILESOWN_${.ALLSRC:T}:U${FILESOWN}} \ - -g ${FILESGRP_${.ALLSRC:T}:U${FILESGRP}} \ + -o ${FILESOWN_${.ALLSRC:T}:U${FILESOWN}:Q} \ + -g ${FILESGRP_${.ALLSRC:T}:U${FILESGRP}:Q} \ -m ${FILESMODE_${.ALLSRC:T}:U${FILESMODE}} \ ${.ALLSRC} ${.TARGET} @@ -42,8 +43,4 @@ INSTALLDIRS += ${destination_files:H} .endif # MKINSTALL .endif # FILES -.if !target(filesinstall) -filesinstall: -.endif - .endif # _BSD_FILES_MK diff --git a/mk/mkc_imp.final.mk b/mk/mkc_imp.final.mk index 1b96da3..02fb20d 100644 --- a/mk/mkc_imp.final.mk +++ b/mk/mkc_imp.final.mk @@ -29,11 +29,9 @@ export_cmd += MAKEOBJDIR=${.OBJDIR}/${.TARGET:C/^.*-//}; \ .endif ########## -.if !commands(clean) -clean: mkc_clean -.endif +realdo_clean: mkc_clean -mkc_clean: +mkc_clean: .PHONY .if ${CLEANFILES:U} != "" -${CLEANFILES_CMD} ${CLEANFILES} .endif @@ -43,9 +41,8 @@ mkc_clean: ##### distclean: cleandir -.if !commands(cleandir) -cleandir: mkc_cleandir -.endif + +realdo_cleandir: mkc_cleandir mkc_cleandir: .if ${CLEANFILES:U} != "" || ${DISTCLEANFILES:U} != "" @@ -55,6 +52,18 @@ mkc_cleandir: -${CLEANDIRS_CMD} ${DISTCLEANDIRS} ${CLEANDIRS} .endif +########## +# pre_, do_, post_ targets +.for t in ${ALLTARGETS} +${t}: pre_${t} .WAIT do_${t} .WAIT post_${t} +pre_${t} do_${t} realdo_${t} post_${t}: .PHONY # ensure existence +.if !commands(do_${t}) +do_${t}: realdo_${t} +.endif +.endfor + +${TARGETS}: .PHONY + ########## .endif # MKC_IMP.FINAL.MK diff --git a/mk/mkc_imp.inc.mk b/mk/mkc_imp.inc.mk index 0f0a8ba..49e0f6a 100644 --- a/mk/mkc_imp.inc.mk +++ b/mk/mkc_imp.inc.mk @@ -7,9 +7,8 @@ # See LICENSE file in the distribution. ############################################################ -.PHONY: incinstall -realinstall: incinstall -incinstall: # ensure existence +do_install1: incinstall +incinstall: .PHONY # ensure existence .if defined(INCS) INCSSRCDIR ?= . @@ -24,8 +23,8 @@ incinstall: ${destination_incs} __incinstall: .USE ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} \ - -o ${BINOWN} \ - -g ${BINGRP} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET} + -o ${BINOWN:Q} \ + -g ${BINGRP:Q} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET} .for I in ${INCS:O:u} ${DESTDIR}${INCSDIR}/$I: ${"${INCSSRCDIR}" != ".":?${INCSSRCDIR}/$I:$I} __incinstall diff --git a/mk/mkc_imp.info.mk b/mk/mkc_imp.info.mk index 3a97ca5..7d3976d 100644 --- a/mk/mkc_imp.info.mk +++ b/mk/mkc_imp.info.mk @@ -10,14 +10,14 @@ .if !defined(_MKC_IMP_INFO_MK) && defined(TEXINFO) _MKC_IMP_INFO_MK := 1 +infoinstall: .PHONY + .include MAKEINFO ?= makeinfo INFOFLAGS ?= INSTALL_INFO ?= install-info -.PHONY: infoinstall - .SUFFIXES: .txi .texi .texinfo .info MESSAGE.texinfo ?= @${_MESSAGE} "TEXINFO: ${.TARGET}" @@ -27,32 +27,33 @@ MESSAGE.texinfo ?= @${_MESSAGE} "TEXINFO: ${.TARGET}" ${_V}${MAKEINFO} ${INFOFLAGS} --no-split -o $@ $< .if defined(TEXINFO) && !empty(TEXINFO) -realall: ${TEXINFO} +realdo_all: ${TEXINFO} + INFOFILES = ${TEXINFO:S/.texinfo/.info/g:S/.texi/.info/g:S/.txi/.info/g} .NOPATH: ${INFOFILES} .if ${MKINFO:tl} != "no" -realall: ${INFOFILES} +realdo_all: ${INFOFILES} CLEANFILES += ${INFOFILES} destination_infos = ${INFOFILES:@F@${DESTDIR}${INFODIR_${F}:U${INFODIR}}/${INFONAME_${F}:U${INFONAME:U${F:T}}}@} -infoinstall:: ${destination_infos} +infoinstall: ${destination_infos} .PRECIOUS: ${destination_infos} .PHONY: ${destination_infos} __infoinstall: .USE ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} \ - -o ${INFOOWN_${.ALLSRC:T}:U${INFOOWN}} \ - -g ${INFOGRP_${.ALLSRC:T}:U${INFOGRP}} \ + -o ${INFOOWN_${.ALLSRC:T}:U${INFOOWN}:Q} \ + -g ${INFOGRP_${.ALLSRC:T}:U${INFOGRP}:Q} \ -m ${INFOMODE_${.ALLSRC:T}:U${INFOMODE}} \ ${.ALLSRC} ${.TARGET} @${INSTALL_INFO} --remove --info-dir=${DESTDIR}${INFODIR} ${.TARGET} ${INSTALL_INFO} --info-dir=${DESTDIR}${INFODIR} ${.TARGET} .if ${MKINSTALL:tl} == "yes" -realinstall: infoinstall +do_install1: infoinstall .for F in ${INFOFILES:O:u} ${DESTDIR}${INFODIR_${F}:U${INFODIR}}/${INFONAME_${F}:U${INFONAME:U${F:T}}}: ${F} __infoinstall .endfor # F diff --git a/mk/mkc_imp.intexts.mk b/mk/mkc_imp.intexts.mk index cdfb2a4..225b17d 100644 --- a/mk/mkc_imp.intexts.mk +++ b/mk/mkc_imp.intexts.mk @@ -46,7 +46,8 @@ ${i:T} : ${i}.in .endfor CLEANFILES += ${INSCRIPTS:T} ${INFILES:T} -realall: ${INSCRIPTS:T} ${INFILES:T} + +realdo_all: ${INSCRIPTS:T} ${INFILES:T} ###################################################################### .endif # _MKC_IMP_INTEXTS_MK diff --git a/mk/mkc_imp.lib.mk b/mk/mkc_imp.lib.mk index 2ff6ab4..c5ea8d4 100644 --- a/mk/mkc_imp.lib.mk +++ b/mk/mkc_imp.lib.mk @@ -12,7 +12,7 @@ _MKC_IMP_LIB_MK := 1 .PHONY: libinstall .if ${MKINSTALL:tl} == "yes" -realinstall: libinstall +do_install1: libinstall INSTALLDIRS += ${DESTDIR}${LIBDIR} UNINSTALLFILES += ${UNINSTALLFILES.lib} .endif # MKINSTALL @@ -67,7 +67,7 @@ _LIBS += ${SHLIBFN} .NOPATH: ${_LIBS} -realall: ${SRCS} ${_LIBS} +realdo_all: ${SRCS} ${_LIBS} _SRCS_ALL = ${SRCS} @@ -78,8 +78,8 @@ __archivebuild: .USE ${RANLIB} ${.TARGET} __archiveinstall: .USE - ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o ${LIBOWN} \ - -g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${.TARGET} + ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o ${LIBOWN:Q} \ + -g ${LIBGRP:Q} -m ${LIBMODE} ${.ALLSRC} ${.TARGET} DPSRCS += ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c} CLEANFILES += ${DPSRCS} @@ -166,8 +166,8 @@ UNINSTALLFILES.lib += ${DESTDIR}${LIBDIR}/lib${LIB}${SHLIB_EXT} \ .endif ${DESTDIR}${LIBDIR}/${SHLIBFN}: ${SHLIBFN} - ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o ${LIBOWN} \ - -g ${LIBGRP} -m ${SHLIBMODE} ${.ALLSRC} ${.TARGET} + ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o ${LIBOWN:Q} \ + -g ${LIBGRP:Q} -m ${SHLIBMODE} ${.ALLSRC} ${.TARGET} .if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR) && ${MKDLL:tl} == "no" /sbin/ldconfig -m ${LIBDIR} .endif diff --git a/mk/mkc_imp.links.mk b/mk/mkc_imp.links.mk index c9f6eb3..00cbec1 100644 --- a/mk/mkc_imp.links.mk +++ b/mk/mkc_imp.links.mk @@ -6,10 +6,9 @@ .if !defined(_MKC_IMP_LINKS_MK) _MKC_IMP_LINKS_MK := 1 -.PHONY: linksinstall -linksinstall: +linksinstall: .PHONY # ensure existence -realinstall2: linksinstall +do_install2: linksinstall .if ${MKINSTALL:tl} == "yes" diff --git a/mk/mkc_imp.man.mk b/mk/mkc_imp.man.mk index 15203d4..c66f056 100644 --- a/mk/mkc_imp.man.mk +++ b/mk/mkc_imp.man.mk @@ -34,7 +34,7 @@ MKCATPAGES = no .PHONY: catinstall maninstall catpages manpages catlinks \ manlinks html installhtml .if ${MKMAN:tl} != "no" -realinstall: ${MANINSTALL} +do_install1: ${MANINSTALL} .endif MANTARGET ?= cat @@ -68,7 +68,7 @@ TBL ?= tbl .endif .if defined(MAN) && !empty(MAN) -realall: ${MAN} +realdo_all: ${MAN} MANPAGES = ${MAN} CATPAGES = ${MANPAGES:C/(.*).([1-9])/\1.cat\2/} CLEANFILES += ${CATPAGES} @@ -77,7 +77,7 @@ HTMLPAGES = ${MANPAGES:C/(.*).([1-9])/\1.html\2/} .endif MINSTALL = ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} \ - -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} + -o ${MANOWN:Q} -g ${MANGRP:Q} -m ${MANMODE} .if defined(MANZ) # chown and chmod are done afterward automatically @@ -92,7 +92,7 @@ __installpage: .USE .if defined(MCOMPRESS) && !empty(MCOMPRESS) @${RM} -f ${.TARGET} ${MCOMPRESS} ${.ALLSRC} > ${.TARGET} - @chown ${MANOWN}:${MANGRP} ${.TARGET} + @chown ${MANOWN:Q}:${MANGRP:Q} ${.TARGET} @chmod ${MANMODE} ${.TARGET} .else ${MINSTALL} ${.ALLSRC} ${.TARGET} @@ -101,7 +101,7 @@ __installpage: .USE # Rules for cat'ed man page installation .if defined(CATPAGES) && !empty(CATPAGES) && ${MKCATPAGES:tl} != "no" -realall: ${CATPAGES} +realdo_all: ${CATPAGES} .if ${MKINSTALL:tl} == "yes" destination_capages = ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@} @@ -177,13 +177,11 @@ installhtml: ${destination_htmls} CLEANFILES += ${HTMLPAGES} .if ${MKHTML:tl} == "yes" -realinstall: installhtml -realall: ${HTMLPAGES} +do_install1: installhtml +realdo_all: ${HTMLPAGES} UNINSTALLFILES += ${destination_htmls} INSTALLDIRS += ${destination_htmls:H} .endif # MKHTML .endif # HTMLPAGES -realall: - .endif # _MKC_IMP_MAN_MK diff --git a/mk/mkc_imp.mk b/mk/mkc_imp.mk index 1979748..def92ea 100644 --- a/mk/mkc_imp.mk +++ b/mk/mkc_imp.mk @@ -16,36 +16,32 @@ SUBPRJ += ${SUBPRJS} # for backward compatility only, use SUBPRJ! _use_prog := 1 .endif -.if defined(_use_prog) || defined(LIB) .include .include -.endif # _use_prog || LIB .include .include .include # Make sure all of the standard targets are defined, even if they do nothing. -.PHONY: ${TARGETS} realinstall realinstall2 realall -${TARGETS} realinstall realinstall2 realall: - -distclean: cleandir +do_install1 do_install2: .PHONY -all: realall +distclean: .PHONY cleandir .if ${MKINSTALLDIRS:tl} == "yes" -install: installdirs .WAIT realinstall .WAIT realinstall2 -.else -install: realinstall .WAIT realinstall2 +install: pre_installdirs .WAIT do_installdirs .WAIT post_installdirs .WAIT \ + pre_install .WAIT do_install .WAIT post_install .endif +realdo_install: do_install1 .WAIT do_install2 + # skip uninstalling files and creating destination dirs for mkc.subprj.mk .if !defined(SUBPRJ) -uninstall: +realdo_uninstall: -${UNINSTALL} ${UNINSTALLFILES} -installdirs: +realdo_installdirs: for d in _ ${INSTALLDIRS:O:u:S|/.$||}; do \ test "$$d" = _ || ${INSTALL} -d -m ${DIRMODE} "$$d"; \ done @@ -73,7 +69,7 @@ print-values2 : .endfor ########### -.PHONY: realall realerrorcheck +.PHONY: realerrorcheck __errorcheck: .USE @if test -n '${MKC_ERR_MSG}'; then \ @@ -87,7 +83,7 @@ __errorcheck: .USE exit $$ex; \ fi -realall : realerrorcheck +do_all : realerrorcheck realerrorcheck: __errorcheck .include @@ -123,21 +119,11 @@ CFLAGS += ${MKC_FEATURES:D-I${FEATURESDIR}} ######################################## .if defined(SUBPRJ) .include - -# -.PHONY: subprj-clean subprj-distclean -clean: subprj-clean -subprj-clean: - -${CLEANFILES_CMD} -f ${CLEANFILES} -cleandir: subprj-distclean -subprj-distclean: - -${CLEANFILES_CMD} ${DISTCLEANFILES} - .endif # SUBPRJ ######################################## .include -.include -# .endif # MKC_ERR_MSG + +.include diff --git a/mk/mkc_imp.pkg-config.mk b/mk/mkc_imp.pkg-config.mk index a77073a..85d5417 100644 --- a/mk/mkc_imp.pkg-config.mk +++ b/mk/mkc_imp.pkg-config.mk @@ -42,8 +42,8 @@ LDADD.pkg-config.${_ln} != env ${mkc.environ} mkc_check_custom \ ${PROG.pkg-config} --libs "${_lp}" .endif # LDADD.pkg-config.${l} -MKC_CPPFLAGS += ${CPPFLAGS.pkg-config.${_ln}} -MKC_LDADD += ${LDADD.pkg-config.${_ln}} +MKC_CPPFLAGS := ${MKC_CPPFLAGS} ${CPPFLAGS.pkg-config.${_ln}} +MKC_LDADD := ${MKC_LDADD} ${LDADD.pkg-config.${_ln}} .endif # PROGS || LIB .for i in ${PKG_CONFIG_VARS.${_ln}} @@ -54,7 +54,7 @@ PKG_CONFIG.var.${_ln}.${i} != env ${mkc.environ} mkc_check_custom \ .endif # PKG_CONFIG.var.${_ln}.${i} .endfor # i -MKC_CFLAGS += -DHAVE_PKCONFIG_${_id:S/-/_/g:S/+/P/g:S/./_/g}=1 +MKC_CFLAGS := ${MKC_CFLAGS} -DHAVE_PKGCONFIG_${_id:S/-/_/g:S/+/P/g:S/./_/g}=1 .elif !empty(MKC_REQUIRE_PKGCONFIG:M${l}) MKC_ERR_MSG := ${MKC_ERR_MSG} "%%%: ${MKC_CACHEDIR}/_mkc_pkgconfig_${_ln}.err" diff --git a/mk/mkc_imp.platform.sys.mk b/mk/mkc_imp.platform.sys.mk index bbf5aac..90fee7f 100644 --- a/mk/mkc_imp.platform.sys.mk +++ b/mk/mkc_imp.platform.sys.mk @@ -103,11 +103,12 @@ CPPFLAGS += ${CPPFLAGS.${TARGET_OPSYS}:U} ############################################################ # CC compiler type .if make(cleandir) || make(distclean) || make(clean) -.elif ${MKCHECKS:Uno:tl} == "yes" && !defined(CC_TYPE) && (defined(PROGS) || defined(LIB)) +.elif ${MKCHECKS:Uno:tl} == "yes" && !defined(CC_TYPE) && (defined(PROGS) || defined(LIB) || defined(MKC_CHECK_PROTOTYPES)) mkc.cc_type.environ = CC='${CC}' CXX='${CXX}' CPPFLAGS='${CPPFLAGS}' CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}' LDADD='${LDADD}' MKC_CACHEDIR='${MKC_CACHEDIR}' MKC_DELETE_TMPFILES='${MKC_DELETE_TMPFILES}' MKC_SHOW_CACHED='${MKC_SHOW_CACHED}' MKC_NOCACHE='${MKC_NOCACHE}' MKC_VERBOSE=1 .if !empty(src_type:Mc) CC_TYPE != env ${mkc.cc_type.environ} mkc_check_compiler -.elif !empty(src_type:Mcxx) +.endif +.if !empty(src_type:Mcxx) CXX_TYPE != env ${mkc.cc_type.environ} mkc_check_compiler -x .endif # src_type .endif # cleandir|distclean|... @@ -120,11 +121,13 @@ CXX_TYPE ?= unknown # C CFLAGS.dflt.clang = -Qunused-arguments +CFLAGS.dflt.icc = -we147 # 147 is required for MKC_CHECK_PROTOTYPES CFLAGS += ${CFLAGS.dflt.${CC_TYPE}} # C++ CXXFLAGS.dflt.clang = ${CFLAGS.dflt.clang} +CXXFLAGS.dflt.icc = -we147 CXXFLAGS += ${CXXFLAGS.dflt.${CXX_TYPE}} @@ -208,8 +211,8 @@ CXXFLAGS.warns.hpc.4 = ${CFLAGS.warns.hpc.4} #################### -CFLAGS += ${CFLAGS.warns.${CC_TYPE}.${WARNS}} -CXXFLAGS += ${CXXFLAGS.warns.${CXX_TYPE}.${WARNS}} +CFLAGS.warns = ${CFLAGS.warns.${CC_TYPE}.${WARNS}} ${CFLAGS.warnerr} +CXXFLAGS.warns = ${CXXFLAGS.warns.${CXX_TYPE}.${WARNS}} ${CXXFLAGS.warnerr} #################### CFLAGS.pic.gcc.Interix = @@ -233,7 +236,7 @@ CFLAGS.pie.icc = -fPIE -DPIC CFLAGS.pie.clang = -fPIE -DPIC CFLAGS.pie ?= ${CFLAGS.pie.${CC_TYPE}.${TARGET_OPSYS}:U${CFLAGS.pie.${CC_TYPE}}:U${CFLAGS.pic}} -CXXFLAGS.pie ?= ${CFLAGS.pie.${CC_TYPE}.${TARGET_OPSYS}:U${CFLAGS.pie.${CC_TYPE}}:U${CXXFLAGS.pic}} +CXXFLAGS.pie ?= ${CFLAGS.pie.${CC_TYPE}.${TARGET_OPSYS}:U${CFLAGS.pie.${CXX_TYPE}}:U${CXXFLAGS.pic}} #################### CFLAGS.ssp.gcc = -fstack-protector -Wstack-protector --param ssp-buffer-size=1 diff --git a/mk/mkc_imp.prog.mk b/mk/mkc_imp.prog.mk index fc4f952..b634564 100644 --- a/mk/mkc_imp.prog.mk +++ b/mk/mkc_imp.prog.mk @@ -10,17 +10,16 @@ .if !defined(_MKC_IMP_PROG_MK) _MKC_IMP_PROG_MK := 1 -.PHONY: proginstall -proginstall: +proginstall: .PHONY # ensure existence CFLAGS += ${COPTS} __proginstall: .USE ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${STRIPFLAG} \ - -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} ${.ALLSRC} ${.TARGET} + -o ${BINOWN:Q} -g ${BINGRP:Q} -m ${BINMODE} ${.ALLSRC} ${.TARGET} .for p in ${PROGS} -realinstall: proginstall +do_install1: proginstall _SRCS_ALL += ${SRCS.${p}} @@ -71,7 +70,7 @@ CLEANFILES += ${OBJS.${p}} .endfor # ${PROGS} -realall: ${PROGS} +realdo_all: ${PROGS} CLEANFILES += ${PROGS} diff --git a/mk/mkc_imp.scripts.mk b/mk/mkc_imp.scripts.mk index f066275..1d53b48 100644 --- a/mk/mkc_imp.scripts.mk +++ b/mk/mkc_imp.scripts.mk @@ -1,4 +1,4 @@ -# Copyright (c) 2009-2010 by Aleksey Cheusov +# Copyright (c) 2009-2014 by Aleksey Cheusov # Copyright (c) 1994-2009 The NetBSD Foundation, Inc. # Copyright (c) 1988, 1989, 1993 The Regents of the University of California # Copyright (c) 1988, 1989 by Adam de Boor @@ -10,10 +10,10 @@ .if !defined(_MKC_IMP_SCRIPTS_MK) _MKC_IMP_SCRIPTS_MK := 1 -.PHONY: scriptsinstall -realinstall: scriptsinstall +scriptsinstall: .PHONY # ensure existence +do_install1: scriptsinstall -realall: ${SCRIPTS} +realdo_all: ${SCRIPTS} .if defined(SCRIPTS) .if ${MKINSTALL:tl} == "yes" @@ -22,14 +22,14 @@ UNINSTALLFILES += ${destination_scripts} INSTALLDIRS += ${destination_scripts:H} .endif # MKINSTALL -scriptsinstall:: ${destination_scripts} +scriptsinstall: ${destination_scripts} .PRECIOUS: ${destination_scripts} .PHONY: ${destination_scripts} __scriptinstall: .USE ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} \ - -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \ - -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \ + -o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}:Q} \ + -g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}:Q} \ -m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \ ${.ALLSRC} ${.TARGET} @@ -37,8 +37,6 @@ __scriptinstall: .USE ${DESTDIR}${SCRIPTSDIR_${S:S|/|_|g}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S:S|/|_|g}:U${SCRIPTSNAME:U${S:T}}}: ${S} __scriptinstall .endfor -.else # defined(SCRIPTS) -scriptsinstall: .endif # defined(SCRIPTS) .endif # _MKC_IMP_SCRIPTS_MK diff --git a/mk/mkc_imp.subprj.mk b/mk/mkc_imp.subprj.mk index d4beee3..4eb491e 100644 --- a/mk/mkc_imp.subprj.mk +++ b/mk/mkc_imp.subprj.mk @@ -93,9 +93,6 @@ _ALLTARGDEPS := ${_ALLTARGDEPS:N${excl}} ${prjtarg}: ${deptarg} .endfor -# Make sure all of the standard targets are defined, even if they do nothing. -${TARGETS}: - .PHONY: print_deps print_deps: .for i in ${_ALLTARGDEPS} ${_ALLTARGDEPS2} ${_ALLTARGDEPS3} ${TARGETS} diff --git a/presentation/presentation.pdf b/presentation/presentation.pdf index 194fe85..31e6676 100644 Binary files a/presentation/presentation.pdf and b/presentation/presentation.pdf differ diff --git a/scripts/mk-configure.7.in b/scripts/mk-configure.7.in index 316d6ae..e9579a5 100644 --- a/scripts/mk-configure.7.in +++ b/scripts/mk-configure.7.in @@ -99,6 +99,11 @@ for the sample. Commands associated with targets .IR all ", " install ", " clean ", " cleandir ", " depend ", " test ", " installdirs ", " uninstall ", " errorcheck " and " filelist in Makefile override the standard behaviour. +.P +.B NOTE: +All targets in this list have +.IR pre\_* ", " do\_* " and " post\_* +counterparts. See ALLTARGETS for details. .SS "Common variables" The following variables control how various files are compiled/built. .IP AR @@ -959,19 +964,31 @@ subdirectory. Slash symbols inside are replaced with underlines. In addition, SRCDIR_ variable is set to ${SRCDIR_} if ${SHORTPRJNAME} is "yes". .IP TARGETS -List of recursive targets supported by the project and all its subprojects. +A list of recursive targets. "Recursive" means that the target will be called +for all subproject recursively (See +.BR mkc.subprj.mk " and " mkc.subdir.mk ). .RI < "Im" > .RI [ all ", " install ", " installdirs ", " uninstall ", " clean ", " -.IR cleandir ", " depends ", " test ", " errorcheck ", " filelist ] +.IR cleandir ", " depends ", " test ", " errorcheck ", " filelist ", " obj ] By setting this variable in the Makefile one can add new targets for special purposes, for example, static code analysis, partial builds etc. +.IP ALLTARGETS +A list of targets for which pre\_*, do_* and post\_* counterparts exist, for example, +pre\_all, do\_all and post\_all. pre\_* target runs before do\_* target which in turn +runs before post\_*. Unless action is provided for do\_* targets +they implement the standard behaviour of +.BR mk-configure . +No action is provided for targets pre\_* and post\_*, so they are +for user's extensions. The standard behaviour for ${ALLTARGETS} +may also be extended by adding new prerequisites +to targets do\_*. .IP SHORTPRJNAME If "yes", special targets with last component of the subprojects are provided. .RI < "Im" > .RI [ yes ] .IP MKRELOBJDIR If "yes", object directories -.RI ${TOPOBJ}/ dir +.RI ${OBJTOP}/ dir are used. Unlike MAKEOBJDIRPREFIX object directories do not contain top-level ${.CURDIR} in paths. .RI < "Iu" > @@ -1879,6 +1896,10 @@ and .IP DPSRCS List of source files which are needed for generating dependencies, but are not needed in ${SRCS}. +.IP MKDEP_CC +Compiler passed to mkdep(1). +.RI < "Iu" > +.RI [ "${CC}" ]. .SH "CROSS COMPILATION" The following variables are used for compiling software using cross-tools. .IP MACHINE_GNU_PLATFORM diff --git a/scripts/mkc_check_compiler b/scripts/mkc_check_compiler index 2945f24..6930a2f 100755 --- a/scripts/mkc_check_compiler +++ b/scripts/mkc_check_compiler @@ -21,8 +21,11 @@ trap 'rm -f "$tmpfile"' 0 pathpart=compiler_type if test "$1" = -x; then pathpart=cxx_type + langname='C++' CC="$CXX" export CC +else + langname='C' fi ################################################## @@ -62,7 +65,7 @@ BEGIN { . mkc_check_common.sh -check_and_cache "checking for compiler type" "$cache" +check_and_cache "checking for $langname compiler type" "$cache" printme '%s\n' "$ret" 1>&2 diff --git a/scripts/mkc_install b/scripts/mkc_install index 913753b..a17d086 100755 --- a/scripts/mkc_install +++ b/scripts/mkc_install @@ -1,10 +1,11 @@ #!/bin/sh # # install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). +# This comes from X11R5 (mit/util/scripts/install.sh) +# and was modified by Aleksey Cheusov . # # Copyright 1991 by the Massachusetts Institute of Technology -# Copyright 2013 by Aleksey Cheusov +# Copyright 2013-2014 by Aleksey Cheusov # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that @@ -26,15 +27,13 @@ # set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" - # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" +lnsprog="${LNSPROG-ln -f -s}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" @@ -43,37 +42,50 @@ rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" +chmodcmd=mkcchmod; mod=0755; +chowncmd=":" +chgrpcmd=":" +stripcmd=":" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" +set -e + +mkcchgrp () { $chgrpprog "$grp" "$@"; } +mkcchown () { $chownprog "$own" "$@"; } +mkcchmod () { $chmodprog "$mod" "$@"; } + while [ x"$1" != x ]; do - case $1 in + case "$1" in -c) instcmd="$cpprog" shift continue;; + -l) instcmd="$lnsprog" + shift + continue;; + -d) dir_arg=true shift continue;; - -m) chmodcmd="$chmodprog $2" + -m) mod="$2" + chmodcmd=mkcchmod shift shift continue;; - -o) chowncmd="$chownprog $2" + -o) own="$2" + chowncmd=mkcchown shift shift continue;; - -g) chgrpcmd="$chgrpprog $2" + -g) grp="$2" + chgrpcmd=mkcchgrp shift shift continue;; @@ -83,89 +95,90 @@ while [ x"$1" != x ]; do continue;; *) if [ x"$src" = x ]; then - src=$1 + src="$1" else - dst=$1 + dst="$1" fi shift continue;; esac done +if test "_$instcmd" = "_$lnsprog"; then + chowncmd=: + chgrpcmd=: + chmodcmd=: + stripcmd=: +fi + if [ x"$src" = x ]; then - echo "install: no input file specified" - exit 1 -else - true + echo "install: no input file specified" + exit 1 fi if [ x"$dir_arg" != x ]; then - dst=$src - - if [ -d $dst ]; then - instcmd=: - chmodcmd="" - else - instcmd="$mkdirprog -p" - fi + dst="$src" + + if [ -d "$dst" ]; then + instcmd=: + chmodcmd=: + else + instcmd="$mkdirprog -p" + fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. - if [ -f $src -o -d $src ]; then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ]; then - echo "install: no destination specified" - exit 1 - else - true - fi + if [ -f "$src" -o -d "$src" ]; then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ]; then + echo "install: no destination specified" + exit 1 + fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic - if [ -d $dst ]; then - dst="$dst"/`basename $src` - else - true - fi + if [ -d "$dst" ]; then + dst="$dst"/`basename "$src"` + fi fi ## -dstdir=`dirname $dst` +dstdir=`dirname "$dst"` if [ x"$dir_arg" != x ]; then - $doit $instcmd $dst && + $doit $instcmd "$dst" - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi + $doit $chowncmd "$dst" + $doit $chgrpcmd "$dst" + $doit $stripcmd "$dst" + $doit $chmodcmd "$dst" else # Make sure that the destination directory exists. - if [ ! -d "$dstdir" ]; then - $mkdirprog -p "$dstdir" 2>/dev/null - fi + if [ ! -d "$dstdir" ]; then + $mkdirprog -p "$dstdir" + fi # No renaming of the final executable - dstfile=`basename $dst` + dstfile=`basename "$dst"` # Make a temp file name in the proper directory. - dsttmp=$dstdir/#inst.$$# + dsttmp="$dstdir/#inst.$$#" # Move or copy the file name to the temp name - $doit $instcmd $src $dsttmp && + $doit $instcmd "$src" "$dsttmp" - trap "rm -f ${dsttmp}" 0 && + trap "rm -f '${dsttmp}'" 0 # and set any options; do chmod last to preserve setuid bits @@ -173,17 +186,13 @@ else # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + $doit $chowncmd "$dsttmp" + $doit $chgrpcmd "$dsttmp" + $doit $stripcmd "$dsttmp" + $doit $chmodcmd "$dsttmp" # Now rename the file to the real destination. - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 + $doit $rmcmd -f "$dstdir/$dstfile" + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" +fi diff --git a/tests/predopost_targets/Makefile b/tests/predopost_targets/Makefile new file mode 100644 index 0000000..01e4388 --- /dev/null +++ b/tests/predopost_targets/Makefile @@ -0,0 +1,9 @@ +SUBDIR = lib others lua +TEST_PREREQS = + +.ifdef INCFILE +.include "${INCFILE}" +.endif + +.include "test.mk" +.include diff --git a/tests/predopost_targets/Makefile.inc b/tests/predopost_targets/Makefile.inc new file mode 100644 index 0000000..02da702 --- /dev/null +++ b/tests/predopost_targets/Makefile.inc @@ -0,0 +1,7 @@ +.ifndef REAL_TARGETS +.for i in clean cleandir install all uninstall installdirs depend \ + bin_tar bin_targz bin_tarbz2 bin_zip bin_deb +pre_${i} do_${i} post_${i}: + @echo "fake target ${.TARGET}" +.endfor +.endif diff --git a/tests/predopost_targets/expect.out b/tests/predopost_targets/expect.out new file mode 100644 index 0000000..e5bbcaf --- /dev/null +++ b/tests/predopost_targets/expect.out @@ -0,0 +1,148 @@ +=========== {pre,do,post}_recursive ============ +================================================== +clean ===> tests/predopost_targets/lib +fake target pre_clean +fake target do_clean +fake target post_clean +================================================== +clean ===> tests/predopost_targets/others +fake target pre_clean +fake target do_clean +fake target post_clean +================================================== +clean ===> tests/predopost_targets/lua +fake target pre_clean +fake target do_clean +fake target post_clean +rm -rf /objdir/prefix /objdir/prefix +================================================== +cleandir ===> tests/predopost_targets/lib +fake target pre_cleandir +fake target do_cleandir +fake target post_cleandir +================================================== +cleandir ===> tests/predopost_targets/others +fake target pre_cleandir +fake target do_cleandir +fake target post_cleandir +================================================== +cleandir ===> tests/predopost_targets/lua +fake target pre_cleandir +fake target do_cleandir +fake target post_cleandir +rm -rf /objdir/prefix /objdir/prefix +================================================== +install ===> tests/predopost_targets/lib +fake target pre_installdirs +fake target do_installdirs +fake target post_installdirs +fake target pre_install +fake target do_install +fake target post_install +================================================== +install ===> tests/predopost_targets/others +fake target pre_installdirs +fake target do_installdirs +fake target post_installdirs +fake target pre_install +fake target do_install +fake target post_install +================================================== +install ===> tests/predopost_targets/lua +fake target pre_installdirs +fake target do_installdirs +fake target post_installdirs +fake target pre_install +fake target do_install +fake target post_install +================================================== +all ===> tests/predopost_targets/lib +fake target pre_all +fake target do_all +fake target post_all +================================================== +all ===> tests/predopost_targets/others +fake target pre_all +fake target do_all +fake target post_all +================================================== +all ===> tests/predopost_targets/lua +fake target pre_all +fake target do_all +fake target post_all +================================================== +uninstall ===> tests/predopost_targets/lib +fake target pre_uninstall +fake target do_uninstall +fake target post_uninstall +================================================== +uninstall ===> tests/predopost_targets/others +fake target pre_uninstall +fake target do_uninstall +fake target post_uninstall +================================================== +uninstall ===> tests/predopost_targets/lua +fake target pre_uninstall +fake target do_uninstall +fake target post_uninstall +================================================== +installdirs ===> tests/predopost_targets/lib +fake target pre_installdirs +fake target do_installdirs +fake target post_installdirs +================================================== +installdirs ===> tests/predopost_targets/others +fake target pre_installdirs +fake target do_installdirs +fake target post_installdirs +================================================== +installdirs ===> tests/predopost_targets/lua +fake target pre_installdirs +fake target do_installdirs +fake target post_installdirs +================================================== +depend ===> tests/predopost_targets/lib +fake target pre_depend +fake target do_depend +fake target post_depend +================================================== +depend ===> tests/predopost_targets/others +fake target pre_depend +fake target do_depend +fake target post_depend +================================================== +depend ===> tests/predopost_targets/lua +fake target pre_depend +fake target do_depend +fake target post_depend +================================================== +install ===> tests/predopost_targets/lib +fake target pre_install +fake target do_install +fake target post_install +================================================== +install ===> tests/predopost_targets/others +fake target pre_install +fake target do_install +fake target post_install +================================================== +install ===> tests/predopost_targets/lua +fake target pre_install +fake target do_install +fake target post_install +=========== {pre,do,post}_nonrec ============ +fake target pre_bin_tar +fake target do_bin_tar +fake target post_bin_tar +fake target pre_bin_targz +fake target do_bin_targz +fake target post_bin_targz +fake target pre_bin_tarbz2 +fake target do_bin_tarbz2 +fake target post_bin_tarbz2 +fake target pre_bin_zip +fake target do_bin_zip +fake target post_bin_zip +fake target pre_bin_deb +fake target do_bin_deb +fake target post_bin_deb diff --git a/tests/predopost_targets/lib/Makefile b/tests/predopost_targets/lib/Makefile new file mode 100644 index 0000000..6793f09 --- /dev/null +++ b/tests/predopost_targets/lib/Makefile @@ -0,0 +1,3 @@ +LIB = foo + +.include diff --git a/tests/predopost_targets/lua/Makefile b/tests/predopost_targets/lua/Makefile new file mode 100644 index 0000000..4b52cb7 --- /dev/null +++ b/tests/predopost_targets/lua/Makefile @@ -0,0 +1,4 @@ +LUA_LMODULES = cat.module1 +LUA_CMODULES = cat.module2 + +.include diff --git a/tests/predopost_targets/others/Makefile b/tests/predopost_targets/others/Makefile new file mode 100644 index 0000000..d0812e1 --- /dev/null +++ b/tests/predopost_targets/others/Makefile @@ -0,0 +1,15 @@ +PROG = program +INSCRIPTS = lalala foo +INFILES = bar +TEXINFO = program.texinfo +SCRIPTS = baz shell_script +FILES = file1 file2 +MAN = program.1 +MKCATPAGES= yes +MLINKS = bar1 bar2 +SYMLINKS = foo1 foo2 +LINKS = baz1 baz2 +INCS = qqq.h +DPSRCS = zzz.c + +.include diff --git a/tests/predopost_targets/test.mk b/tests/predopost_targets/test.mk new file mode 100644 index 0000000..5db4de1 --- /dev/null +++ b/tests/predopost_targets/test.mk @@ -0,0 +1,23 @@ +.PHONY : test_output +test_output : + @set -e; \ + \ + { \ + echo '=========== {pre,do,post}_recursive ============'; \ + for t in clean cleandir install all uninstall installdirs depend; do \ + ${MAKE} ${MAKEFLAGS} -j1 $$t | \ + grep -v checking; \ + done ; \ + env MKINSTALLDIRS=no ${MAKE} ${MAKEFLAGS} -j1 install; \ + } | env NOSORT=1 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ + \ + echo '=========== {pre,do,post}_nonrec ============'; \ + for t in bin_tar bin_targz bin_tarbz2 bin_zip bin_deb; do \ + env INCFILE=Makefile.inc ${MAKE} ${MAKEFLAGS} -j1 $$t | \ + grep -v checking; \ + done ; \ + \ + true =========== cleandir ============; \ + env REAL_TARGETS=1 ${MAKE} ${MAKEFLAGS} distclean > /dev/null + +.include diff --git a/tests/reqd/expect.out b/tests/reqd/expect.out index c5cf415..9e1a280 100644 --- a/tests/reqd/expect.out +++ b/tests/reqd/expect.out @@ -1 +1 @@ -ERROR: We need mk-configure v.999.0.0 while 0.26.0 is detected +ERROR: We need mk-configure v.999.0.0 while 0.27.0 is detected diff --git a/tests/reqd2/expect.out b/tests/reqd2/expect.out index c5cf415..9e1a280 100644 --- a/tests/reqd2/expect.out +++ b/tests/reqd2/expect.out @@ -1 +1 @@ -ERROR: We need mk-configure v.999.0.0 while 0.26.0 is detected +ERROR: We need mk-configure v.999.0.0 while 0.27.0 is detected diff --git a/tests/reqd3/expect.out b/tests/reqd3/expect.out index c5cf415..9e1a280 100644 --- a/tests/reqd3/expect.out +++ b/tests/reqd3/expect.out @@ -1 +1 @@ -ERROR: We need mk-configure v.999.0.0 while 0.26.0 is detected +ERROR: We need mk-configure v.999.0.0 while 0.27.0 is detected diff --git a/tests/reqd4/expect.out b/tests/reqd4/expect.out index 29fe3b6..5e1cb98 100644 --- a/tests/reqd4/expect.out +++ b/tests/reqd4/expect.out @@ -1,4 +1,4 @@ -ERROR: We need mk-configure v.999.0.0 while 0.26.0 is detected +ERROR: We need mk-configure v.999.0.0 while 0.27.0 is detected "bmake-20110606 or newer is required" =========== all ============ /objdir/Makefile diff --git a/tests/reqd_clean_cache/test.mk b/tests/reqd_clean_cache/test.mk index 92c35c3..55e71b8 100644 --- a/tests/reqd_clean_cache/test.mk +++ b/tests/reqd_clean_cache/test.mk @@ -7,7 +7,7 @@ test_output : echo =========== all ============; \ { ${MAKE} ${MAKEFLAGS} all 2>/dev/null || true; \ find ${.OBJDIR} -type f -o -type l | sort; } | \ - sed 's,bmake\[[0-9]*\],bmake,' | \ + sed 's,n*bmake\[[0-9]*\],bmake,' | \ env NOSORT=1 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ \ ${MAKE} ${MAKEFLAGS} cleandir > /dev/null diff --git a/tests/test_subprj_dash/Makefile b/tests/test_subprj_dash/Makefile index f518e28..a0f8d9b 100644 --- a/tests/test_subprj_dash/Makefile +++ b/tests/test_subprj_dash/Makefile @@ -6,7 +6,7 @@ test: tmp_out=${.OBJDIR}/${.CURDIR:T}.test.out; \ rm -f $$tmp_out; \ ${MAKE} ${MAKEFLAGS} -f ${.CURDIR}/test.mk all 2>&1 | \ - sed 's,bmake\[[0-9]*\],bmake,' | \ + sed 's,n*bmake\[[0-9]*\],bmake,' | \ mkc_test_helper "${PREFIX}" "${.OBJDIR}" > $$tmp_out; \ diff ${.CURDIR}/expect.out $$tmp_out && \ echo ' succeeded' 1>&2 || \ -- cgit v1.2.3