diff options
47 files changed, 349 insertions, 193 deletions
diff --git a/Makefile.inc b/Makefile.inc index 38d9be8..dc1e155 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -1,4 +1,4 @@ -VERSION = 0.28.0 +VERSION = 0.29.0 BIRTHDATE = 2009-02-21 diff --git a/builtins/Makefile b/builtins/Makefile index 0b350bc..a49a305 100644 --- a/builtins/Makefile +++ b/builtins/Makefile @@ -1,5 +1,7 @@ SCRIPTS = endianness prog_bison prog_flex prog_gawk prog_gm4 prog_gmake - SCRIPTSDIR = ${BUILTINSDIR} +FILES = easy.c +FILESDIR = ${SCRIPTSDIR} + .include <mkc.mk> diff --git a/builtins/easy.c b/builtins/easy.c new file mode 100644 index 0000000..83f2643 --- /dev/null +++ b/builtins/easy.c @@ -0,0 +1,6 @@ +int two (void); + +int two (void) +{ + return 2; +} diff --git a/builtins/easy.cc b/builtins/easy.cc new file mode 100644 index 0000000..83f2643 --- /dev/null +++ b/builtins/easy.cc @@ -0,0 +1,6 @@ +int two (void); + +int two (void) +{ + return 2; +} @@ -1,4 +1,31 @@ ====================================================================== +Version 0.29.0, by Aleksey Cheusov, Sun, 30 Nov 2014 15:35:42 +0300 + + mkc.configure.mk: + - New variables MKC_CHECK_CC_OPTS and MKC_CHECK_CXX_OPTS were + introduced for checking C/C++ compiler's options + + Makefile.inc and Makefile.common are included after system variables + are set, in particular CC and CXX. + + CC_TYPE is now set in mk.init.mk + + Fixes for "err" and "warn" features. Now verr(3), verrx(3), + vwarn(3) and vwarnx(3) functions are detected correctly (the problem + was seen on gcc-4.9/armv7). + + Fix support for COMPATLIB. Objects for "features" should not be + generated outside compatibility library. + + A number of fixes in regression tests: support for latest GCC, + lib64 and lib/tri-ple-ts Linuxes. + + mkc_check_custom: + - new option -e was introduced for checking stderr for emptyness + - new option -b was introduced for printing yes/no instead of 1/0 + - additional options to compiler are passed via CARGS env. variable. + +====================================================================== Version 0.28.0, by Aleksey Cheusov, Sun, 14 Sep 2014 14:52:34 +0300 LIBDEPS, STATICLIBS, DPLDADD, DPLIBDIRS and DPINCDIRS variables were @@ -1,6 +1,13 @@ +fix verr from err.h failure on bone-deb + ============================================================ Plan 0.28.0 +- test for "inline" keyword +- test for CCLD option +- bzero, bcopy +- NetBSD style macroses + - check awk capabilities at build time - Hide regression tests details - "bmake -k regrtest/check" (mkc.minitest.mk?) diff --git a/examples/check_compiler_opts/Makefile b/examples/check_compiler_opts/Makefile new file mode 100644 index 0000000..7e0e552 --- /dev/null +++ b/examples/check_compiler_opts/Makefile @@ -0,0 +1,10 @@ +PROG = hello_world + +WARNS = 4 + +MKC_CHECK_CC_OPTS= -Wall -Zhopa -errwarn=%all + +.include <mkc.configure.mk> + +.include "test.mk" +.include <mkc.prog.mk> diff --git a/examples/check_compiler_opts/expect.out b/examples/check_compiler_opts/expect.out new file mode 100644 index 0000000..38c1f34 --- /dev/null +++ b/examples/check_compiler_opts/expect.out @@ -0,0 +1,4 @@ +========== lalala ========== +Wall: 1 +Zhopa: 0 +errwarn=%all: 1 diff --git a/examples/check_compiler_opts/hello_world.c b/examples/check_compiler_opts/hello_world.c new file mode 100644 index 0000000..3d8f214 --- /dev/null +++ b/examples/check_compiler_opts/hello_world.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main (int argc, char** argv) +{ + puts ("Hello World!"); + return 0; +} diff --git a/examples/check_compiler_opts/test.mk b/examples/check_compiler_opts/test.mk new file mode 100644 index 0000000..e828152 --- /dev/null +++ b/examples/check_compiler_opts/test.mk @@ -0,0 +1,12 @@ +.if ${CC_TYPE:U} == gcc +cmd=echo Wall: ${HAVE_CC_OPT.-Wall}; echo Zhopa: ${HAVE_CC_OPT.-Zhopa}; echo errwarn=%all: ${HAVE_CC_OPT.-errwarn_%all} +.else +cmd=echo Wall: 1; echo Zhopa: 0; echo errwarn=%all: 1 +.endif + +.PHONY : test_output +test_output: + @echo ========== lalala ==========; \ + ${cmd} + +.include <mkc.minitest.mk> diff --git a/examples/hello_compatlib/expect.out b/examples/hello_compatlib/expect.out index de509d4..a45b5b4 100644 --- a/examples/hello_compatlib/expect.out +++ b/examples/hello_compatlib/expect.out @@ -30,12 +30,6 @@ /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 @@ -71,6 +65,12 @@ /objdir/_mkc_header_err_h.res /objdir/_mkc_prog_cc.err /objdir/_mkc_prog_cc.res +/objdir/_mkc_prototype_void~verr_int,~const~char~8,~va_list__stdarg_h~err_h.c +/objdir/_mkc_prototype_void~verr_int,~const~char~8,~va_list__stdarg_h~err_h.err +/objdir/_mkc_prototype_void~verr_int,~const~char~8,~va_list__stdarg_h~err_h.res +/objdir/_mkc_prototype_void~verrx_int,~const~char~8,~va_list__stdarg_h~err_h.c +/objdir/_mkc_prototype_void~verrx_int,~const~char~8,~va_list__stdarg_h~err_h.err +/objdir/_mkc_prototype_void~verrx_int,~const~char~8,~va_list__stdarg_h~err_h.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 @@ -79,6 +79,8 @@ /objdir/libcmpt/Makefile /objdir/libcmpt/libcmpt.a /objdir/libcmpt/libcmpt_pic.a +/objdir/test.mk +=== /objdir/prog1/Makefile /objdir/prog1/prog1 /objdir/prog1/prog1.c @@ -87,4 +89,3 @@ /objdir/prog2/prog2 /objdir/prog2/prog2.c /objdir/prog2/prog2.o -/objdir/test.mk diff --git a/examples/hello_compatlib/test.mk b/examples/hello_compatlib/test.mk index 425ad83..060fb52 100644 --- a/examples/hello_compatlib/test.mk +++ b/examples/hello_compatlib/test.mk @@ -1,12 +1,17 @@ -FUNCS_RE=(fgetln|progname|strlcat|strlcpy|getline)[.]o +FUNCS_RE=(fgetln|progname|strlcat|strlcpy|getline|err|_mkcfake)[.]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}"; \ + { find ${.OBJDIR} -type f | \ + LC_ALL=C sort | \ + grep -Ev '${FUNCS_RE}|prog1/|prog2/'; \ + echo ===; \ + find ${.OBJDIR}/prog1 ${.OBJDIR}/prog2 -type f | \ + LC_ALL=C sort; \ + } | \ + env NOSORT=1 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \ \ true =========== cleandir ============; \ ${MAKE} ${MAKEFLAGS} distclean > /dev/null diff --git a/examples/hello_cxxlib/Makefile.inc b/examples/hello_cxxlib/Makefile.inc new file mode 100644 index 0000000..8b76495 --- /dev/null +++ b/examples/hello_cxxlib/Makefile.inc @@ -0,0 +1,10 @@ +OPT_FLAG ?= -Os + +MKC_CHECK_CXX_OPTS = ${OPT_FLAG} +MKC_CHECK_CC_OPTS = ${OPT_FLAG} + +.include <mkc.configure.mk> + +.if ${HAVE_CXX_OPT.${OPT_FLAG}:U0} +CXXFLAGS += ${OPT_FLAG} +.endif diff --git a/examples/hello_cxxlib/expect.out b/examples/hello_cxxlib/expect.out index 09dc8a7..fe66d4d 100644 --- a/examples/hello_cxxlib/expect.out +++ b/examples/hello_cxxlib/expect.out @@ -2,13 +2,20 @@ Hello world 1! hello world 2! =========== all ============ /objdir/Makefile +/objdir/Makefile.inc +/objdir/_mkc_cc_option_-Os.err +/objdir/_mkc_cc_option_-Os.res /objdir/_mkc_compiler_type.err /objdir/_mkc_compiler_type.res +/objdir/_mkc_cxx_option_-Os.err +/objdir/_mkc_cxx_option_-Os.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_cc.err +/objdir/_mkc_prog_cc.res /objdir/_mkc_prog_cxx.err /objdir/_mkc_prog_cxx.res /objdir/cxxapp/Makefile @@ -51,13 +58,20 @@ hello world 2! ======== uninstall ========= ========== clean =========== /objdir/Makefile +/objdir/Makefile.inc +/objdir/_mkc_cc_option_-Os.err +/objdir/_mkc_cc_option_-Os.res /objdir/_mkc_compiler_type.err /objdir/_mkc_compiler_type.res +/objdir/_mkc_cxx_option_-Os.err +/objdir/_mkc_cxx_option_-Os.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_cc.err +/objdir/_mkc_prog_cc.res /objdir/_mkc_prog_cxx.err /objdir/_mkc_prog_cxx.res /objdir/cxxapp/Makefile @@ -75,6 +89,7 @@ hello world 2! /objdir/test.mk ======= distclean ========== /objdir/Makefile +/objdir/Makefile.inc /objdir/cxxapp/Makefile /objdir/cxxapp/cxxapp.cc /objdir/cxxlib/Makefile diff --git a/examples/hello_errwarn/Makefile b/examples/hello_errwarn/Makefile index 6b8c160..40c3c95 100644 --- a/examples/hello_errwarn/Makefile +++ b/examples/hello_errwarn/Makefile @@ -6,5 +6,6 @@ MKC_FEATURES = err warn MKC_REQD = 0.26.0 +.include "Makefile.inc" .include "test.mk" .include <mkc.mk> diff --git a/examples/hello_errwarn/Makefile.inc b/examples/hello_errwarn/Makefile.inc new file mode 100644 index 0000000..5de4413 --- /dev/null +++ b/examples/hello_errwarn/Makefile.inc @@ -0,0 +1,9 @@ +.include <mkc.init.mk> + +.if ${CC_TYPE:U} == "sunpro" +MKC_CHECK_CC_OPTS += -erroff=E_STATEMENT_NOT_REACHED +.include <mkc.configure.mk> +.if ${HAVE_CC_OPT.-erroff_E_STATEMENT_NOT_REACHED:U0} +CFLAGS += -erroff=E_STATEMENT_NOT_REACHED +.endif +.endif diff --git a/examples/hello_fgetln/expect.out b/examples/hello_fgetln/expect.out index cd19953..c60d03d 100644 --- a/examples/hello_fgetln/expect.out +++ b/examples/hello_fgetln/expect.out @@ -46,12 +46,6 @@ /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 @@ -81,6 +75,12 @@ /objdir/_mkc_header_err_h.res /objdir/_mkc_prog_cc.err /objdir/_mkc_prog_cc.res +/objdir/_mkc_prototype_void~verr_int,~const~char~8,~va_list__stdarg_h~err_h.c +/objdir/_mkc_prototype_void~verr_int,~const~char~8,~va_list__stdarg_h~err_h.err +/objdir/_mkc_prototype_void~verr_int,~const~char~8,~va_list__stdarg_h~err_h.res +/objdir/_mkc_prototype_void~verrx_int,~const~char~8,~va_list__stdarg_h~err_h.c +/objdir/_mkc_prototype_void~verrx_int,~const~char~8,~va_list__stdarg_h~err_h.err +/objdir/_mkc_prototype_void~verrx_int,~const~char~8,~va_list__stdarg_h~err_h.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 diff --git a/examples/hello_libdeps/libs/libbaz/Makefile b/examples/hello_libdeps/libs/libbaz/Makefile index fb96ef1..b73696a 100644 --- a/examples/hello_libdeps/libs/libbaz/Makefile +++ b/examples/hello_libdeps/libs/libbaz/Makefile @@ -3,8 +3,6 @@ SRCS = baz.c INCS = baz.h INCSSRCDIR = include -CPPFLAGS += ${INCSSRCDIR} - WARNS = 4 .include <mkc.mk> diff --git a/examples/hello_lua/expect.out b/examples/hello_lua/expect.out index 0e51847..eaff9be 100644 --- a/examples/hello_lua/expect.out +++ b/examples/hello_lua/expect.out @@ -34,16 +34,8 @@ foobarbaz /objdir/hello_lua.test.out.tmp /objdir/test.mk ========= install ========== -/objdir/prefix -/objdir/prefix/bin /objdir/prefix/bin/foobar -/objdir/prefix/lib -/objdir/prefix/lib/lua -/objdir/prefix/lib/lua/X.Y /objdir/prefix/lib/lua/X.Y/baz.so -/objdir/prefix/share -/objdir/prefix/share/lua -/objdir/prefix/share/lua/X.Y /objdir/prefix/share/lua/X.Y/bar.lua /objdir/prefix/share/lua/X.Y/foo.lua ======== uninstall ========= diff --git a/examples/hello_lua/test.mk b/examples/hello_lua/test.mk index 8b6fc91..f780608 100644 --- a/examples/hello_lua/test.mk +++ b/examples/hello_lua/test.mk @@ -18,7 +18,7 @@ test_output: echo ========= install ==========; \ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} PREFIX=/usr/local \ > /dev/null; \ - find ${.OBJDIR}/usr -type f -o -type d | \ + find ${.OBJDIR}/usr -type f | \ mkc_test_helper /usr/local "${.OBJDIR}" | uniq; \ \ echo ======== uninstall =========; \ diff --git a/examples/hello_lua2/expect.out b/examples/hello_lua2/expect.out index 3af692c..137103c 100644 --- a/examples/hello_lua2/expect.out +++ b/examples/hello_lua2/expect.out @@ -14,12 +14,7 @@ foobar /objdir/hello_lua2.test.out.tmp /objdir/test.mk ========= install ========== -/objdir/prefix -/objdir/prefix/bin /objdir/prefix/bin/foobar -/objdir/prefix/share -/objdir/prefix/share/lua -/objdir/prefix/share/lua/X.Y /objdir/prefix/share/lua/X.Y/bar.lua /objdir/prefix/share/lua/X.Y/foo.lua ======== uninstall ========= diff --git a/examples/hello_lua2/test.mk b/examples/hello_lua2/test.mk index 0cc6d20..4cb529e 100644 --- a/examples/hello_lua2/test.mk +++ b/examples/hello_lua2/test.mk @@ -17,7 +17,7 @@ test_output: echo ========= install ==========; \ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} PREFIX=/usr/local \ > /dev/null; \ - find ${.OBJDIR}/usr -type f -o -type d | \ + find ${.OBJDIR}/usr -type f | \ mkc_test_helper /usr/local "${.OBJDIR}" | uniq; \ \ echo ======== uninstall =========; \ diff --git a/examples/hello_lua3/expect.out b/examples/hello_lua3/expect.out index e30135a..000bd74 100644 --- a/examples/hello_lua3/expect.out +++ b/examples/hello_lua3/expect.out @@ -29,16 +29,7 @@ PROJECTNAME=hello_lua3 /objdir/socket_foo.lua /objdir/test.mk ========= install ========== -/objdir/prefix -/objdir/prefix/lib -/objdir/prefix/lib/lua -/objdir/prefix/lib/lua/X.Y -/objdir/prefix/lib/lua/X.Y/socket /objdir/prefix/lib/lua/X.Y/socket/baz.so -/objdir/prefix/share -/objdir/prefix/share/lua -/objdir/prefix/share/lua/X.Y -/objdir/prefix/share/lua/X.Y/socket /objdir/prefix/share/lua/X.Y/socket/bar.lua /objdir/prefix/share/lua/X.Y/socket/foo.lua ======== uninstall ========= diff --git a/examples/hello_lua3/test.mk b/examples/hello_lua3/test.mk index dfe9e9f..525af27 100644 --- a/examples/hello_lua3/test.mk +++ b/examples/hello_lua3/test.mk @@ -12,7 +12,7 @@ test_output: echo ========= install ==========; \ ${MAKE} ${MAKEFLAGS} install -j3 DESTDIR=${.OBJDIR} \ > /dev/null; \ - find ${.OBJDIR}/usr -type f -o -type d | \ + find ${.OBJDIR}/usr -type f | \ mkc_test_helper "${PREFIX}" "${.OBJDIR}" | uniq; \ \ echo ======== uninstall =========; \ diff --git a/examples/hello_strlcpy/getline.c b/examples/hello_strlcpy/getline.c index 8e42c75..669c1ab 100644 --- a/examples/hello_strlcpy/getline.c +++ b/examples/hello_strlcpy/getline.c @@ -37,7 +37,7 @@ getline(char** lineptr, size_t* n, FILE* stream) if (sz+1 >= *n){ /* +2 is for `c' and 0-terminator */ *n = *n * 3 / 2 + 2; - *lineptr = realloc (*lineptr, *n); + *lineptr = (char *) realloc (*lineptr, *n); if (!*lineptr) return -1; } @@ -54,7 +54,7 @@ getline(char** lineptr, size_t* n, FILE* stream) if (feof (stream)){ return (ssize_t) -1; }else if (!*n){ - *lineptr = malloc (1); + *lineptr = (char *) malloc (1); if (!*lineptr) return -1; diff --git a/examples/hello_strlcpy2/missing/getline.c b/examples/hello_strlcpy2/missing/getline.c index 8e42c75..669c1ab 100644 --- a/examples/hello_strlcpy2/missing/getline.c +++ b/examples/hello_strlcpy2/missing/getline.c @@ -37,7 +37,7 @@ getline(char** lineptr, size_t* n, FILE* stream) if (sz+1 >= *n){ /* +2 is for `c' and 0-terminator */ *n = *n * 3 / 2 + 2; - *lineptr = realloc (*lineptr, *n); + *lineptr = (char *) realloc (*lineptr, *n); if (!*lineptr) return -1; } @@ -54,7 +54,7 @@ getline(char** lineptr, size_t* n, FILE* stream) if (feof (stream)){ return (ssize_t) -1; }else if (!*n){ - *lineptr = malloc (1); + *lineptr = (char *) malloc (1); if (!*lineptr) return -1; diff --git a/examples/subprojects/test.mk b/examples/subprojects/test.mk index 27b2071..078e3ab 100644 --- a/examples/subprojects/test.mk +++ b/examples/subprojects/test.mk @@ -98,7 +98,8 @@ test_output : \ echo ======= library dependencies =======; \ PREFIX=${.CURDIR}/usr; export PREFIX; \ - ${MAKE} ${MAKEFLAGS} all installdirs install -j3 >&2; \ + ${MAKE} ${MAKEFLAGS} all -j3 >&2; \ + ${MAKE} ${MAKEFLAGS} install -j3 >&2; \ LD_LIBRARY_PATH=${.CURDIR}/usr/lib; \ DYLD_LIBRARY_PATH=${.CURDIR}/usr/lib; \ export LD_LIBRARY_PATH DYLD_LIBRARY_PATH; \ diff --git a/features/getline/getline.c b/features/getline/getline.c index 93836b0..3abe46f 100644 --- a/features/getline/getline.c +++ b/features/getline/getline.c @@ -19,7 +19,7 @@ getline(char** lineptr, size_t* n, FILE* stream) if (sz+1 >= *n){ /* +2 is for `c' and 0-terminator */ *n = *n * 3 / 2 + 2; - *lineptr = realloc (*lineptr, *n); + *lineptr = (char *) realloc (*lineptr, *n); if (!*lineptr) return -1; } @@ -36,7 +36,7 @@ getline(char** lineptr, size_t* n, FILE* stream) if (feof (stream)){ return (ssize_t) -1; }else if (!*n){ - *lineptr = malloc (1); + *lineptr = (char *) malloc (1); if (!*lineptr) return -1; diff --git a/features/mkc_imp.f_err.mk b/features/mkc_imp.f_err.mk index d3b50e1..91546f1 100644 --- a/features/mkc_imp.f_err.mk +++ b/features/mkc_imp.f_err.mk @@ -11,14 +11,22 @@ _MKC_IMP_F_ERR_MK := 1 MKC_CHECK_HEADERS += err.h MKC_CHECK_FUNCLIBS += err errx verr verrx -MKC_CHECK_FUNCS3 += err:err.h errx:err.h verr:err.h verrx:err.h +MKC_CHECK_FUNCS3 += err:err.h errx:err.h + +MKC_CHECK_PROTOTYPES += verr +MKC_PROTOTYPE_FUNC.verr = void verr(int, const char *, va_list) +MKC_PROTOTYPE_HEADERS.verr = stdarg.h err.h + +MKC_CHECK_PROTOTYPES += verrx +MKC_PROTOTYPE_FUNC.verrx = void verrx(int, const char *, va_list) +MKC_PROTOTYPE_HEADERS.verrx = ${MKC_PROTOTYPE_HEADERS.verr} .include <mkc_imp.conf-cleanup.mk> .if ${HAVE_FUNCLIB.err:U0} && ${HAVE_FUNCLIB.errx:U0} && \ ${HAVE_FUNCLIB.verr:U0} && ${HAVE_FUNCLIB.verrx:U0} && \ ${HAVE_FUNC3.err.err_h:U0} && ${HAVE_FUNC3.errx.err_h:U0} && \ - ${HAVE_FUNC3.verr.err_h:U0} && ${HAVE_FUNC3.verrx.err_h:U0} + ${HAVE_PROTOTYPE.verr:U0} && ${HAVE_PROTOTYPE.verrx:U0} CFLAGS += -DMKC_ERR_IS_FINE .else MKC_SRCS += ${FEATURESDIR}/err/err.c diff --git a/features/mkc_imp.f_warn.mk b/features/mkc_imp.f_warn.mk index c494d50..328c3dc 100644 --- a/features/mkc_imp.f_warn.mk +++ b/features/mkc_imp.f_warn.mk @@ -11,14 +11,22 @@ _MKC_IMP_F_WARN_MK := 1 MKC_CHECK_HEADERS += err.h MKC_CHECK_FUNCLIBS += warn warnx vwarn vwarnx -MKC_CHECK_FUNCS2 += warn:err.h warnx:err.h vwarn:err.h vwarnx:err.h +MKC_CHECK_FUNCS2 += warn:err.h warnx:err.h + +MKC_CHECK_PROTOTYPES += vwarn +MKC_PROTOTYPE_FUNC.vwarn = void vwarn(const char *, va_list) +MKC_PROTOTYPE_HEADERS.vwarn = stdarg.h err.h + +MKC_CHECK_PROTOTYPES += vwarnx +MKC_PROTOTYPE_FUNC.vwarnx = void vwarnx(const char *, va_list) +MKC_PROTOTYPE_HEADERS.vwarnx = ${MKC_PROTOTYPE_HEADERS.vwarn} .include <mkc_imp.conf-cleanup.mk> .if ${HAVE_FUNCLIB.warn:U0} && ${HAVE_FUNCLIB.warnx:U0} && \ ${HAVE_FUNCLIB.vwarn:U0} && ${HAVE_FUNCLIB.vwarnx:U0} && \ ${HAVE_FUNC2.warn.err_h:U0} && ${HAVE_FUNC2.warnx.err_h:U0} && \ - ${HAVE_FUNC2.vwarn.err_h:U0} && ${HAVE_FUNC2.vwarnx.err_h:U0} + ${HAVE_PROTOTYPE.vwarn:U0} && ${HAVE_PROTOTYPE.vwarnx:U0} CFLAGS += -DMKC_WARN_IS_FINE .else MKC_SRCS += ${FEATURESDIR}/warn/warn.c diff --git a/helpers/mkc_test_helper b/helpers/mkc_test_helper index 934fa72..63ef30a 100755 --- a/helpers/mkc_test_helper +++ b/helpers/mkc_test_helper @@ -36,6 +36,8 @@ sed -e "s,$objdir,/objdir,g" \ -e '/export[.]sym[.]tmp/ d' \ -e '/pod2htmd.tmp/ d' \ -e '/pod2htmi.tmp/ d' \ + -e 's,lib64,lib,' \ + -e 's,lib/[^/]*/lua,lib/lua,' \ -e 's,lua/[0-9]*[.][0-9]*,lua/X.Y,' \ -e 's,//,/,g' \ -e 's,^bmake:.*line [0-9][0-9]*: "\(.*\)".*$,\1,g' \ diff --git a/helpers/mkc_test_nm b/helpers/mkc_test_nm index 82be0b8..ef25d9a 100755 --- a/helpers/mkc_test_nm +++ b/helpers/mkc_test_nm @@ -17,6 +17,6 @@ case ${OPSYS} in Linux) ${NM} "$@" | grep -Ev 'fini|init' | - awk 'NF==3 && $2 ~ /^[DT]$/ {print "symbol " $3}' + awk 'NF==3 && $2 == "T" {print "symbol " $3}' ;; esac @@ -27,7 +27,7 @@ examples = hello_world hello_scripts hello_files hello_sizeof hello_lex \ hello_lua3 hello_superfs hello_xxzip hello_progs hello_progs2 tools \ tools2 pkgconfig3 hello_SLIST hello_RBTREE hello_errwarn hello_fgetln \ hello_autotools hello_autoconf hello_libdeps hello_compatlib \ - hello_require_tools + hello_require_tools check_compiler_opts .for t in ${examples} SUBPRJ += examples/${t}:tests .endfor diff --git a/mk/mkc.configure.mk b/mk/mkc.configure.mk index bf48c5f..5945298 100644 --- a/mk/mkc.configure.mk +++ b/mk/mkc.configure.mk @@ -3,9 +3,7 @@ # See LICENSE file in the distribution. ############################################################ -.include <mkc_imp.preinit.mk> .include <mkc.init.mk> - .include <mkc_imp.conf.mk> .PHONY: configure diff --git a/mk/mkc.init.mk b/mk/mkc.init.mk index 6f7e3cb..89dd76e 100644 --- a/mk/mkc.init.mk +++ b/mk/mkc.init.mk @@ -21,6 +21,8 @@ SHORTPRJNAME ?= yes .ifndef __initialized__ __initialized__ := 1 +.include <mkc_imp.preinit.mk> + .MAIN: all ########### @@ -86,15 +88,6 @@ OBJTOP ?= ${.OBJDIR} .endif ########### -.if exists(${SRCTOP}/Makefile.common) -.include "${SRCTOP}/Makefile.common" -.endif - -.if ${SRCTOP:U} != ${.CURDIR} && exists(${.CURDIR}/../Makefile.inc) -.include "${.CURDIR}/../Makefile.inc" -.endif - -########### PROJECTNAME ?= ${!empty(PROG):?${PROG}:${!empty(LIB):?${LIB}:${.CURDIR:T}}} @@ -119,29 +112,6 @@ ROOT_USER ?= ${_MKC_USER} ROOT_GROUP ?= ${_MKC_GROUP} .endif -# Define MANZ to have the man pages compressed (gzip) -#MANZ= 1 - -PREFIX ?= /usr/local - -BINDIR ?= ${PREFIX}/bin -SBINDIR ?= ${PREFIX}/sbin -FILESDIR ?= ${PREFIX}/bin -LIBEXECDIR ?= ${PREFIX}/libexec -INCSDIR ?= ${PREFIX}/include -DATADIR ?= ${PREFIX}/share -SHAREDSTATEDIR ?= ${PREFIX}/com -VARDIR ?= ${PREFIX}/var -SYSCONFDIR ?= ${PREFIX}/etc -INFODIR ?= ${PREFIX}/info -MANDIR ?= ${PREFIX}/man -LIBDIR ?= ${PREFIX}/lib -SCRIPTSDIR ?= ${BINDIR} - -DOCDIR? = ${DATADIR}/doc -HTMLDOCDIR ?= ${DOCDIR}/html -HTMLDIR ?= ${MANDIR} - BINGRP ?= ${ROOT_GROUP} BINOWN ?= ${ROOT_USER} @@ -217,13 +187,12 @@ MKSHARE ?= yes # # MKOBJDIRS controls whether object dirs are created during "make all" or "make obj". # -MKOBJDIRS ?= auto +MKOBJDIRS ?= auto MKRELOBJDIR ?= no -MKPIE ?= no -USE_SSP ?= no -USE_RELRO ?= no -USE_FORT ?= no +MKINSTALLDIRS ?= yes + +DISTCLEANFILES += ${MKC_CACHEDIR}/_mkc_* MKDLL ?= no .if ${MKDLL:tl} == "only" @@ -233,13 +202,18 @@ MKSTATICLIB ?= no MKSTATICLIB ?= yes .endif # MKDLL +.if !empty(STATICLIBS:M${.CURDIR:T}) +MKPICLIB ?= yes +.else +MKPICLIB ?= no +.endif + SHLIB_MINOR ?= 0 .if ${MKDLL:tl} != "no" SHLIB_MAJOR ?= 1 .endif # MKDLL -INTERNALLIBS += ${COMPATLIB} -STATICLIBS += ${INTERNALLIBS} +MKPROFILELIB ?= no .if defined(SHLIB_MAJOR) && empty(STATICLIBS:M${.CURDIR:T}) MKSHLIB ?= yes @@ -247,57 +221,8 @@ MKSHLIB ?= yes MKSHLIB ?= no .endif # SHLIB_MAJOR -.if !empty(STATICLIBS:M${.CURDIR:T}) -MKPICLIB ?= yes -.else -MKPICLIB ?= no -.endif - -MKPROFILELIB ?= no - -MKINSTALLDIRS ?= yes - -EXPORT_VARNAMES += MKC_CACHEDIR TARGETS SHORTPRJNAME - -EXPORT_DYNAMIC ?= no - -DISTCLEANFILES += ${MKC_CACHEDIR}/_mkc_* - .include <mkc_imp.platform.sys.mk> -###### -.if ${MKPIE:U:tl} == "yes" -LDFLAGS.prog += ${LDFLAGS.pie} -_CFLAGS.pie += ${CFLAGS.pie} -_CXXFLAGS.pie += ${CXXFLAGS.pie} -.endif - -.if ${USE_SSP:U:tl} == "yes" -_CFLAGS.ssp = ${CFLAGS.ssp} -_CXXFLAGS.ssp = ${CXXFLAGS.ssp} -.endif - -.if ${USE_RELRO:U:tl} == "yes" -LDFLAGS.prog += ${LDFLAGS.relro} -.endif - -.if ${USE_FORT:U:tl} == "yes" -CPPFLAGS += -D_FORTIFY_SOURCE=2 -CFLAGS += -O -.endif - -SHRTOUT ?= no - -.if ${SHRTOUT:tl} != "no" -_MESSAGE ?= echo -_MESSAGE_V ?= : -_V ?= @ -.else -_MESSAGE ?= : -_MESSAGE_V ?= echo -_V ?= -.endif - AR ?= ar ARFLAGS ?= rl RANLIB ?= ranlib @@ -401,9 +326,14 @@ STRIP ?= strip RM ?= rm -#ADDR2LINE ?= addr2line -#READELF ?= readelf -#STRINGS ?= strings +TARGETS += all install clean cleandir depend test \ + installdirs uninstall errorcheck filelist obj mkgen +TARGETS := ${TARGETS:O:u} + +ALLTARGETS += errorcheck all install clean cleandir depend uninstall installdirs \ + mkgen bin_tar bin_targz bin_tarbz2 bin_zip bin_deb + +VERBOSE_ECHO ?= echo _PN = ${PROJECTNAME} # short synonym # Lex @@ -416,6 +346,82 @@ LEXLIB ?= -ll # Yacc YFLAGS += ${YPREFIX:D-p${YPREFIX}} ${YHEADER:D-d} +EXPORT_VARNAMES += MKC_CACHEDIR TARGETS SHORTPRJNAME + +EXPORT_DYNAMIC ?= no + +INTERNALLIBS += ${COMPATLIB} +STATICLIBS += ${INTERNALLIBS} + +########### +.if exists(${SRCTOP}/Makefile.common) +.include "${SRCTOP}/Makefile.common" +.endif + +.if ${SRCTOP:U} != ${.CURDIR} && exists(${.CURDIR}/../Makefile.inc) +.include "${.CURDIR}/../Makefile.inc" +.endif + +########### + +PREFIX ?= /usr/local + +BINDIR ?= ${PREFIX}/bin +SBINDIR ?= ${PREFIX}/sbin +FILESDIR ?= ${PREFIX}/bin +LIBEXECDIR ?= ${PREFIX}/libexec +INCSDIR ?= ${PREFIX}/include +DATADIR ?= ${PREFIX}/share +SHAREDSTATEDIR ?= ${PREFIX}/com +VARDIR ?= ${PREFIX}/var +SYSCONFDIR ?= ${PREFIX}/etc +INFODIR ?= ${PREFIX}/info +MANDIR ?= ${PREFIX}/man +LIBDIR ?= ${PREFIX}/lib +SCRIPTSDIR ?= ${BINDIR} + +DOCDIR? = ${DATADIR}/doc +HTMLDOCDIR ?= ${DOCDIR}/html +HTMLDIR ?= ${MANDIR} + +MKPIE ?= no +USE_SSP ?= no +USE_RELRO ?= no +USE_FORT ?= no + +###### +.if ${MKPIE:U:tl} == "yes" +LDFLAGS.prog += ${LDFLAGS.pie} +_CFLAGS.pie += ${CFLAGS.pie} +_CXXFLAGS.pie += ${CXXFLAGS.pie} +.endif + +.if ${USE_SSP:U:tl} == "yes" +_CFLAGS.ssp = ${CFLAGS.ssp} +_CXXFLAGS.ssp = ${CXXFLAGS.ssp} +.endif + +.if ${USE_RELRO:U:tl} == "yes" +LDFLAGS.prog += ${LDFLAGS.relro} +.endif + +.if ${USE_FORT:U:tl} == "yes" +CPPFLAGS += -D_FORTIFY_SOURCE=2 +CFLAGS += -O +.endif + +SHRTOUT ?= no + +.if ${SHRTOUT:tl} != "no" +_MESSAGE ?= echo +_MESSAGE_V ?= : +_V ?= @ +.else +_MESSAGE ?= : +_MESSAGE_V ?= echo +_V ?= +.endif + ########### .if defined(MKC_REQD) && defined(MKC_VERSION) @@ -428,13 +434,4 @@ MKCHECKS = no ########### -TARGETS += all install clean cleandir depend test \ - installdirs uninstall errorcheck filelist obj mkgen -TARGETS := ${TARGETS:O:u} - -ALLTARGETS += errorcheck all install clean cleandir depend uninstall installdirs \ - mkgen bin_tar bin_targz bin_tarbz2 bin_zip bin_deb - -VERBOSE_ECHO ?= echo - .endif # __initialized__ diff --git a/mk/mkc_imp.conf-cleanup.mk b/mk/mkc_imp.conf-cleanup.mk index 0a341f1..90f16bb 100644 --- a/mk/mkc_imp.conf-cleanup.mk +++ b/mk/mkc_imp.conf-cleanup.mk @@ -6,4 +6,3 @@ .include <mkc_imp.conf.mk> .undef MKC_NOAUTO -.undef MKC_NOSRCSAUTO diff --git a/mk/mkc_imp.conf.mk b/mk/mkc_imp.conf.mk index b103834..be3cd02 100644 --- a/mk/mkc_imp.conf.mk +++ b/mk/mkc_imp.conf.mk @@ -34,7 +34,7 @@ MKC_COMMON_HEADERS ?= # list of headers always #included MKC_NOCACHE ?= # 1 or yes for disabling cache MKC_CUSTOM_DIR ?=${.CURDIR} # directory with custom tests.c MKC_SOURCE_DIR ?=${.CURDIR} # directory with missing strlcat.c etc. -.if ${COMPATLIB:U} == ${.CURDIR:T} +.if !empty(COMPATLIB) && ${COMPATLIB:U} != ${.CURDIR:T} MKC_NOSRCSAUTO ?= 1 .else MKC_NOSRCSAUTO ?= 0 @@ -323,6 +323,21 @@ MKC_ERR_MSG += "ERROR: cannot find program ${p}" .undef MKC_REQUIRE_CUSTOM ###################################################### +# checks whether $CC accepts some arguments +.for a in ${MKC_CHECK_CC_OPTS} +.if !defined(HAVE_CC_OPT.${a:S/=/_/g}) +HAVE_CC_OPT.${a:S/=/_/g} != env ${mkc.environ} CARGS=${a:Q} mkc_check_custom -b -e -p cc_option -n ${a:Q} -m 'whether ${CC} supports option '${a:Q} ${BUILTINSDIR}/easy.c +.endif # !defined(HAVE_CC_OPT.${a}) +.endfor # a + +# checks whether $CXX accepts some arguments +.for a in ${MKC_CHECK_CXX_OPTS} +.if !defined(HAVE_CXX_OPT.${a:S/=/_/g}) +HAVE_CXX_OPT.${a:S/=/_/g} != env ${mkc.environ} CARGS=${a:Q} mkc_check_custom -b -e -p cxx_option -n ${a:Q} -m 'whether ${CXX} supports option '${a:Q} ${BUILTINSDIR}/easy.cc +.endif # !defined(HAVE_CXX_OPT.${a}) +.endfor # a + +###################################################### # prototype checks .for p in ${MKC_CHECK_PROTOTYPES} ${MKC_REQUIRE_PROTOTYPES} .if !defined(HAVE_PROTOTYPE.${p}) @@ -341,6 +356,7 @@ MKC_ERR_MSG += "ERROR: prototype test ${p} failed" .undef MKC_CHECK_PROTOTYPES .undef MKC_REQUIRE_PROTOTYPES +###################################################### .else # MKCHECKS == yes .for i in ${_MKC_SOURCE_FUNCS} diff --git a/mk/mkc_imp.platform.sys.mk b/mk/mkc_imp.platform.sys.mk index 7fb81c4..84446fd 100644 --- a/mk/mkc_imp.platform.sys.mk +++ b/mk/mkc_imp.platform.sys.mk @@ -127,7 +127,7 @@ CFLAGS += ${CFLAGS.dflt.${CC_TYPE}} # C++ CXXFLAGS.dflt.clang = ${CFLAGS.dflt.clang} -CXXFLAGS.dflt.icc = -we147 +CXXFLAGS.dflt.icc = ${CFLAGS.dflt.icc} CXXFLAGS += ${CXXFLAGS.dflt.${CXX_TYPE}} diff --git a/mk/mkc_imp.preinit.mk b/mk/mkc_imp.preinit.mk index 81cdc1f..e967118 100644 --- a/mk/mkc_imp.preinit.mk +++ b/mk/mkc_imp.preinit.mk @@ -3,6 +3,9 @@ # See LICENSE file in the distribution. ############################################################ +.ifndef _MKC_IMP.PREINIT.MK + _MKC_IMP.PREINIT.MK:=1 + #################### BMAKE_REQD ?= 20110606 @@ -30,3 +33,5 @@ MKCHECKS ?= yes .else MKCHECKS ?= no .endif # clean/cleandir/distclean + +.endif # _MKC_IMP.PREINIT.MK diff --git a/presentation/presentation.pdf b/presentation/presentation.pdf Binary files differindex 8037e2d..7cf9c12 100644 --- a/presentation/presentation.pdf +++ b/presentation/presentation.pdf diff --git a/scripts/mk-configure.7.in b/scripts/mk-configure.7.in index ab6c9da..74d2518 100644 --- a/scripts/mk-configure.7.in +++ b/scripts/mk-configure.7.in @@ -18,7 +18,7 @@ .sp .. .\" ------------------------------------------------------------------ -.TH MK-CONFIGURE 7 "Aug 21, 2014" "" "" +.TH MK-CONFIGURE 7 "Nov 30, 2014" "" "" .SH NAME mk-configure \- lightweight replacement for GNU autotools .SH DESCRIPTION @@ -1547,6 +1547,19 @@ The same as MKC_CHECK_PROTOTYPES, but incorrect prototype is treated as a fatal error (See .B errorcheck target. +.IP MKC_CHECK_CC_OPTS +A list of C compiler options to check. +If ${CC} -c support the specified option, variable +HAVE_CC_OPT.<option:S/=/_/g> is set to 1 and 0 otherwise. +.VS +Ex. + MKC_CHECK_CC_OPTS = -Wall -errwarn=%all +Res. + HAVE_CC_OPT.-Wall=1 + HAVE_CC_OPT.-errwarn_%all=0 +.VE +.IP "MKC_CHECK_CXX_OPTS and HAVE_CXX_OPT.<option>" +The same as MKC_CHECK_CC_OPTS and HAVE_CC_OPT but for C++ compiler. .IP MKC_NOAUTO_FUNCLIBS See MKC_CHECK_FUNCLIBS .IP MKC_NOAUTO diff --git a/scripts/mkc_check_custom b/scripts/mkc_check_custom index e0d32d1..f3f587d 100755 --- a/scripts/mkc_check_custom +++ b/scripts/mkc_check_custom @@ -25,14 +25,16 @@ Usage: mkc_check_custom [OPTIONS] cmd [args...] OPTIONS: - -h display this help - -r build application and run it - -p text prefix for cache filename, defaults to "custom" - -n text a part of cache filename, defaults to - `basename <source_file>` without extension - -m text A part of verbose message, defaults to -n args - -s exit status of executable will be check - -d delete cache files + -h display this help + -r build application and run it + -p text prefix for cache filename, defaults to "custom" + -n text a part of cache filename, defaults to + `basename <source_file>` without extension + -m text A part of verbose message, defaults to -n args + -s exit status of executable will be check + -d delete cache files + -e print 0 if compiler/cmd print something to stderr + -b print yes/no instead of 1/0 Examples: mkc_check_custom my_custom_test.c mkc_check_custom -r mmap_works_perfectly.c @@ -65,6 +67,10 @@ while test $# -ne 0; do check_status=1;; -d) delcache=1;; + -e) + empty_stderr=1;; + -b) + boolean=1;; -*) echo "Bad option $1" 1>&2 exit 1;; @@ -102,9 +108,8 @@ done ################################################## # functions - compile (){ - if $CC -c -o "$tmpo" $CPPFLAGS $CFLAGS "$src_or_exe" 2>"$tmperr"; then + if $CC -c $CARGS -o "$tmpo" $CPPFLAGS $CFLAGS "$src_or_exe" 2>"$tmperr"; then echo 1 else echo 0 @@ -147,34 +152,31 @@ check_itself (){ return 1 fi - if $compiler $flags; then - echo 1 - else + if ! $compiler $CARGS $flags; then + echo 0 + elif test -n "$empty_stderr" -a -s "$tmperr"; then echo 0 + else + echo 1 fi } ################################################## # test msg=${msg-"custom test $basefn"} -check_and_cache "checking for ${msg}" "$cache" +check_and_cache "checking ${msg}" "$cache" ################################################## # clean-ups - KEEP_SOURCE=1 # do not delete user's source file! cleanup ################################################## # finishing - -case "$ret" in - 1) - printme '1 (yes)\n' 1>&2;; - 0) - printme '0 (no)\n' 1>&2;; - *) - printme '%s\n' "$ret" 1>&2;; +case "${boolean}_$ret" in + 1_0) printme 'no\n' 1>&2;; + 1_1) printme 'yes\n' 1>&2;; + *) printme '%s\n' "$ret" 1>&2;; esac echo $ret diff --git a/scripts/mkc_check_custom.1 b/scripts/mkc_check_custom.1 index 8655577..fbe6784 100644 --- a/scripts/mkc_check_custom.1 +++ b/scripts/mkc_check_custom.1 @@ -1,6 +1,6 @@ .\" $NetBSD$ .\" -.\" Copyright (c) 2009-2010 by Aleksey Cheusov (vle@gmx.net) +.\" Copyright (c) 2009-2014 by Aleksey Cheusov (vle@gmx.net) .\" Absolutely no warranty. .\" .\" ------------------------------------------------------------------ @@ -74,6 +74,12 @@ outputs an exit status of .TP .BI -d Delete cache files. +.TP +.BI -e +Print 0 if compiler/cmd print something to stderr. +.TP +.B -b +Print yes/no instead of 1/0. .SH ENVIRONMENT .TP .B CC @@ -82,6 +88,9 @@ C compiler .B CXX C++ compiler .TP +.B CARGS +Options passed to compiler (CC, CXX or FC) +.TP .B FC Fortran compiler .TP diff --git a/tests/reqd/expect.out b/tests/reqd/expect.out index 2cf1c41..5152a37 100644 --- a/tests/reqd/expect.out +++ b/tests/reqd/expect.out @@ -1 +1 @@ -ERROR: We need mk-configure v.999.0.0 while 0.28.0 is detected +ERROR: We need mk-configure v.999.0.0 while 0.29.0 is detected diff --git a/tests/reqd2/expect.out b/tests/reqd2/expect.out index 2cf1c41..5152a37 100644 --- a/tests/reqd2/expect.out +++ b/tests/reqd2/expect.out @@ -1 +1 @@ -ERROR: We need mk-configure v.999.0.0 while 0.28.0 is detected +ERROR: We need mk-configure v.999.0.0 while 0.29.0 is detected diff --git a/tests/reqd3/expect.out b/tests/reqd3/expect.out index 2cf1c41..5152a37 100644 --- a/tests/reqd3/expect.out +++ b/tests/reqd3/expect.out @@ -1 +1 @@ -ERROR: We need mk-configure v.999.0.0 while 0.28.0 is detected +ERROR: We need mk-configure v.999.0.0 while 0.29.0 is detected diff --git a/tests/reqd4/expect.out b/tests/reqd4/expect.out index 0cb180a..b1b8825 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.28.0 is detected +ERROR: We need mk-configure v.999.0.0 while 0.29.0 is detected "bmake-20110606 or newer is required" =========== all ============ /objdir/Makefile |