Codebase list mk-configure / 7bea690
Imported Upstream version 0.28.0 Andrew Shadura 8 years ago
218 changed file(s) with 3789 addition(s) and 1116 deletion(s). Raw diff Collapse all Expand all
0 # Copyright (c) 2014 by Aleksey Cheusov
1 #
2 # See LICENSE file in the distribution.
3 ############################################################
4
05 .MAIN: all
16 .DEFAULT:
27 @unset ROOT_GROUP; ${MAKE} ${MAKEFLAGS} -m ${.CURDIR}/mk -m ${.CURDIR}/features -f main.mk ${.TARGET}
0 VERSION = 0.27.0
0 VERSION = 0.28.0
11
22 BIRTHDATE = 2009-02-21
33
44 MKFILESDIR ?= ${PREFIX}/share/mkc-mk
55 DOCDIR ?= ${PREFIX}/share/doc/mk-configure
6 BUILTINSDIR ?= ${PREFIX}/share/mk-configure/custom
6 BUILTINSDIR ?= ${PREFIX}/share/mk-configure/builtins
77 FEATURESDIR ?= ${PREFIX}/share/mk-configure/features
88
99 INTEXTS_REPLS += version ${VERSION}
10 INTEXTS_REPLS += AWK ${AWK}
10 INTEXTS_REPLS += AWK ${PROG.awk}
1111 INTEXTS_REPLS += BMAKE ${BMAKE}
1212 INTEXTS_REPLS += mkfilesdir ${MKFILESDIR}
1313 INTEXTS_REPLS += syscustomdir ${BUILTINSDIR}
1616 .if exists(/usr/xpg4/bin/awk)
1717 # Solaris' /usr/bin/awk is completely broken,
1818 # /usr/xpg4/bin/awk sucks too but sucks less.
19 AWK ?= /usr/xpg4/bin/awk
20 .elif exists(/usr/bin/awk)
21 AWK ?= /usr/bin/awk
19 PROG.awk ?= /usr/xpg4/bin/awk
2220 .else
23 AWK ?= /bin/awk
21 MKC_REQUIRE_PROGS += awk
2422 .endif
2523
2624 BMAKE ?= bmake
257257 the samples.
258258
259259 - mkc.configure.mk is a replacement for GNU autoconf. Its
260 functionality is large enough to describe here. It short, it allows
260 functionality is large enough to describe here. In short, it allows
261261 to check for presence of header files, function or variable
262262 declarations, presence of function in a particular library, defines,
263263 sizeof of data types and other useful things. Read the documentation
279279 examples/ subdirectory.
280280
281281 - Documentation for mk include files is in mk-configure(7).
282
283 - doc/NOTES contains a number of useful recipes.
282284
283285 - Most programs (mkc_check_{decl,header,funclib,sizeof,prog,custom})
284286 have -h option and manual pages.
291293 - AWK interpreter from NetBSD cvs tree,
292294 ported to Darwin, Solaris, Linux and other BSD.
293295 http://mova.org/~cheusov/pub/mk-configure/nbawk/
294 - getopt_long(3) like module for Lua programming language (>=0.8.0)
295 http://sourceforge.net/projects/lua-alt-getopt/
296296
297297 -------------------------------------------------------------------------
298298 IS MK-CONFIGURE STABLE?
(New empty file)
0 /usr/bin/awk
0 SCRIPTS = endianness prog_bison prog_flex prog_gawk prog_gm4 prog_gmake
1
2 SCRIPTSDIR = ${BUILTINSDIR}
3
4 .include <mkc.mk>
0 #!/bin/sh
1
2 ############################################################
3 # Copyright (c) 2009 by Aleksey Cheusov
4 #
5 # See LICENSE file in the distribution.
6 ############################################################
7
8 set -e
9
10 LC_ALL=C
11 export LC_ALL
12
13 ##################################################
14
15 pathpart=endianness
16 . mkc_check_common.sh
17
18 trap "rm -f $tmpc $tmpo" 0
19
20 CFLAGS="$CFLAGS -D_GNU_SOURCE -D_ALL_SOURCE"
21
22 check_me (){
23 cat > "$tmpc" <<EOF
24 $3
25
26 int main (int argc, char **argv)
27 {
28 #if $1 == $2
29 return 0;
30 #else
31 error
32 #endif
33 }
34 EOF
35 if $CC -o "$tmpo" -c $CFLAGS $CPPFLAGS "$tmpc" 2>/dev/null; then
36 return 0
37 else
38 return 1
39 fi
40 }
41
42 if check_me BYTE_ORDER LITTLE_ENDIAN '
43 #include <sys/types.h>
44 #include <sys/param.h>
45 ';
46 then
47 echo little
48 exit 0
49 fi
50
51 if check_me BYTE_ORDER BIG_ENDIAN '
52 #include <sys/types.h>
53 #include <sys/param.h>
54 ';
55 then
56 echo big
57 exit 0
58 fi
59
60 echo unknown
61 exit 0
0 #!/bin/sh
1
2 ############################################################
3 # Copyright (c) 2009 by Aleksey Cheusov
4 #
5 # See LICENSE file in the distribution.
6 ############################################################
7
8 LC_ALL=C
9 export LC_ALL
10
11 pathpart=' ' # fake
12 . mkc_check_common.sh
13
14 find_n_match bison --version 'bison'
15
16 echo ''
0 #!/bin/sh
1
2 ############################################################
3 # Copyright (c) 2009 by Aleksey Cheusov
4 #
5 # See LICENSE file in the distribution.
6 ############################################################
7
8 LC_ALL=C
9 export LC_ALL
10
11 pathpart=' ' # fake
12 . mkc_check_common.sh
13
14 find_n_match flex --version 'flex'
15 find_n_match lex --version 'flex'
16
17 echo ''
0 #!/bin/sh
1
2 ############################################################
3 # Copyright (c) 2009 by Aleksey Cheusov
4 #
5 # See LICENSE file in the distribution.
6 ############################################################
7
8 LC_ALL=C
9 export LC_ALL
10
11 pathpart=' ' # fake
12 . mkc_check_common.sh
13
14 find_n_match gawk --version 'gnu awk'
15 find_n_match nawk --version 'gnu awk'
16 find_n_match awk --version 'gnu awk'
17
18 echo ''
0 #!/bin/sh
1
2 ############################################################
3 # Copyright (c) 2009 by Aleksey Cheusov
4 #
5 # See LICENSE file in the distribution.
6 ############################################################
7
8 LC_ALL=C
9 export LC_ALL
10
11 pathpart=' ' # fake
12 . mkc_check_common.sh
13
14 find_n_match gm4 --version 'gnu m4'
15 find_n_match m4 --version 'gnu m4'
16
17 echo ''
0 #!/bin/sh
1
2 ############################################################
3 # Copyright (c) 2014 by Aleksey Cheusov
4 #
5 # See LICENSE file in the distribution.
6 ############################################################
7
8 LC_ALL=C
9 export LC_ALL
10
11 pathpart=' ' # fake
12 . mkc_check_common.sh
13
14 find_n_match make --version 'gnu make'
15 find_n_match gmake --version 'gnu make'
16
17 echo ''
0 #!/bin/sh
1
2 ############################################################
3 # Copyright (c) 2013 by Aleksey Cheusov
4 #
5 # See LICENSE file in the distribution.
6 ############################################################
7
8 LC_ALL=C
9 export LC_ALL
10
11 extra_args="$*"
12
13 pathpart='custom_nbmkdep'
14 . mkc_check_common.sh
15
16 trap "rm -f $tmpc $tmpo" 0
17
18 cat > "$tmpc" <<'EOF'
19 #include <stdio.h>
20 EOF
21
22 if test -n "$MKDEP_CC"; then
23 CC="$MKDEP_CC"
24 export CC
25 fi
26
27 check_mkdep (){
28 "$1" -f "$tmpo" $extra_args -I . -I `pwd` "$tmpc"
29 }
30
31 for i in bmkdep nbmkdep mkdep; do
32 if test -z "`check_mkdep $i 2>&1 > /dev/null`"; then
33 mkc_which $i
34 exit 0
35 fi
36 done
37
38 echo ''
0 #!/bin/sh
1
2 ############################################################
3 # Copyright (c) 2013 by Aleksey Cheusov
4 #
5 # See LICENSE file in the distribution.
6 ############################################################
7
8 # workround for crappylaris
9 if test -z "$CRAPPYLIS" -a -x /usr/xpg4/bin/sh; then
10 CRAPPYLIS=1
11 export CRAPPYLIS
12 exec /usr/xpg4/bin/sh "$0" "$@"
13 fi
14
15 ${0%%/prog_nbmkdep}/prog_mkdep --
+0
-5
custom/Makefile less more
0 SCRIPTS = endianness prog_bison prog_flex prog_gawk prog_gm4
1
2 SCRIPTSDIR = ${BUILTINSDIR}
3
4 .include <mkc.mk>
+0
-62
custom/endianness less more
0 #!/bin/sh
1
2 ############################################################
3 # Copyright (c) 2009 by Aleksey Cheusov
4 #
5 # See LICENSE file in the distribution.
6 ############################################################
7
8 set -e
9
10 LC_ALL=C
11 export LC_ALL
12
13 ##################################################
14
15 pathpart=endianness
16 . mkc_check_common.sh
17
18 trap "rm -f $tmpc $tmpo" 0
19
20 CFLAGS="$CFLAGS -D_GNU_SOURCE -D_ALL_SOURCE"
21
22 check_me (){
23 cat > "$tmpc" <<EOF
24 $3
25
26 int main (int argc, char **argv)
27 {
28 #if $1 == $2
29 return 0;
30 #else
31 error
32 #endif
33 }
34 EOF
35 if $CC -o "$tmpo" -c $CFLAGS $CPPFLAGS "$tmpc" 2>/dev/null; then
36 return 0
37 else
38 return 1
39 fi
40 }
41
42 if check_me BYTE_ORDER LITTLE_ENDIAN '
43 #include <sys/types.h>
44 #include <sys/param.h>
45 ';
46 then
47 echo little
48 exit 0
49 fi
50
51 if check_me BYTE_ORDER BIG_ENDIAN '
52 #include <sys/types.h>
53 #include <sys/param.h>
54 ';
55 then
56 echo big
57 exit 0
58 fi
59
60 echo unknown
61 exit 0
+0
-17
custom/prog_bison less more
0 #!/bin/sh
1
2 ############################################################
3 # Copyright (c) 2009 by Aleksey Cheusov
4 #
5 # See LICENSE file in the distribution.
6 ############################################################
7
8 LC_ALL=C
9 export LC_ALL
10
11 pathpart=' ' # fake
12 . mkc_check_common.sh
13
14 find_n_match bison --version 'bison'
15
16 echo ''
+0
-18
custom/prog_flex less more
0 #!/bin/sh
1
2 ############################################################
3 # Copyright (c) 2009 by Aleksey Cheusov
4 #
5 # See LICENSE file in the distribution.
6 ############################################################
7
8 LC_ALL=C
9 export LC_ALL
10
11 pathpart=' ' # fake
12 . mkc_check_common.sh
13
14 find_n_match flex --version 'flex'
15 find_n_match lex --version 'flex'
16
17 echo ''
+0
-19
custom/prog_gawk less more
0 #!/bin/sh
1
2 ############################################################
3 # Copyright (c) 2009 by Aleksey Cheusov
4 #
5 # See LICENSE file in the distribution.
6 ############################################################
7
8 LC_ALL=C
9 export LC_ALL
10
11 pathpart=' ' # fake
12 . mkc_check_common.sh
13
14 find_n_match gawk --version 'gnu awk'
15 find_n_match nawk --version 'gnu awk'
16 find_n_match awk --version 'gnu awk'
17
18 echo ''
+0
-18
custom/prog_gm4 less more
0 #!/bin/sh
1
2 ############################################################
3 # Copyright (c) 2009 by Aleksey Cheusov
4 #
5 # See LICENSE file in the distribution.
6 ############################################################
7
8 LC_ALL=C
9 export LC_ALL
10
11 pathpart=' ' # fake
12 . mkc_check_common.sh
13
14 find_n_match gm4 --version 'gnu m4'
15 find_n_match m4 --version 'gnu m4'
16
17 echo ''
+0
-39
custom/prog_mkdep less more
0 #!/bin/sh
1
2 ############################################################
3 # Copyright (c) 2013 by Aleksey Cheusov
4 #
5 # See LICENSE file in the distribution.
6 ############################################################
7
8 LC_ALL=C
9 export LC_ALL
10
11 extra_args="$*"
12
13 pathpart='custom_nbmkdep'
14 . mkc_check_common.sh
15
16 trap "rm -f $tmpc $tmpo" 0
17
18 cat > "$tmpc" <<'EOF'
19 #include <stdio.h>
20 EOF
21
22 if test -n "$MKDEP_CC"; then
23 CC="$MKDEP_CC"
24 export CC
25 fi
26
27 check_mkdep (){
28 "$1" -f "$tmpo" $extra_args -I . -I `pwd` "$tmpc"
29 }
30
31 for i in bmkdep nbmkdep mkdep; do
32 if test -z "`check_mkdep $i 2>&1 > /dev/null`"; then
33 mkc_which $i
34 exit 0
35 fi
36 done
37
38 echo ''
+0
-16
custom/prog_nbmkdep less more
0 #!/bin/sh
1
2 ############################################################
3 # Copyright (c) 2013 by Aleksey Cheusov
4 #
5 # See LICENSE file in the distribution.
6 ############################################################
7
8 # workround for crappylaris
9 if test -z "$CRAPPYLIS" -a -x /usr/xpg4/bin/sh; then
10 CRAPPYLIS=1
11 export CRAPPYLIS
12 exec /usr/xpg4/bin/sh "$0" "$@"
13 fi
14
15 ${0%%/prog_nbmkdep}/prog_mkdep --
0 FILES = ../README NEWS TODO LICENSE FAQ
0 FILES = ../README NEWS TODO LICENSE FAQ NOTES
11 FILESDIR = ${DOCDIR}
22
33 .include <mkc.mk>
0 ======================================================================
1 Version 0.28.0, by Aleksey Cheusov, Sun, 14 Sep 2014 14:52:34 +0300
2
3 LIBDEPS, STATICLIBS, DPLDADD, DPLIBDIRS and DPINCDIRS variables were
4 introduced. With their help one can specify library dependencies in
5 the top-level Makefile. Users are also able to build some libraries
6 statically even if they were designed to be a dynamic libraries.
7
8 New variable FOREIGN was introduced. With its help one can embed
9 autotools-based projects (as a subproject) to mk-configure-based once.
10 See mkc_imp.foreign_autotools.mk section in man page for details.
11
12 Support for Darwin was fixed. Nowadays it uses clang.
13
14 New features were introduced:
15 - "progname" for setprogname(3) and getprogname(3) BSDisms;
16 - "err" for err(3), errx(3), verr(3) and verrx(3) BSDisms;
17 - "warn" for warn(3), warnx(3), vwarn(3) and vwarnx(3) BSD-isms;
18 - "fgetln" for fgetln(3) BSD-ism;
19
20 Support for Haiku was fixed. It does not support hard links
21 and uses LIBRARY_PATH.
22
23 LDCOMPILER variable was removed.
24 Compiler is always used for linking.
25
26 New builtin "prog_gmake" was introduced which search GNU make.
27
28 INTERNALLIBS variable was introduced. With its help one can
29 implement libraries common for several subprojects.
30
31 COMPATLIB variable was introduced. It is ideal solution for
32 portability code.
33
34 MKC_FEATURES: all objects are removed by target "clean"
35
36 Target "errorcheck" was added to ALLTARGETS. Therefore it also have
37 pre_, do_, post_ counterparts.
38
39 VARDIR, SHAREDSTATEDIR, SUBPRJSRCTOP, CPPFLAGS0 variables were introduced.
40
41 MKC_SOURCE_FUNCSLIBS: .o{s,p} objects are also removed by target "clean"
42
43 Hardcoded /etc/mk.conf is not included anymore. New mk-configure
44 specific configuration file @sysconfdir@/mk-c.conf was introduced.
45
46 Additions to doc/NOTES
47
48 .depends is added to DISTCLEANDIRS only for non-empty SRCS
49
50 mkc_imp.intexts.mk: new error type for odd tokens in INTEXTS_REPLS
51
52 MKDEP_CC is shquoted when passed to mkdep(1) as CC.
53
54 Code clean-ups, more regression tests.
55
56 This release was sucessfully tested on the following platforms.
57 NetBSD-6.1/x86_64/gcc-4.5, FreeBSD-9.0/i386/gcc-4.2,
58 OpenBSD-4.9/i386/gcc-4.2, DragonFlyBSD-3.4/x86_64/gcc-4.7,
59 Darwin-14.0/x86_64/clang-600.0.53, SunOS-5.11/i86pc/gcc-4.7,
60 SunOS-5.10/sparc/{gcc-4.8,SunStudio-12.3}, diverse
61 Linux-es/{gcc,icc-12.1,SunStudio-12.3}, Haiku/gcc-4.8.
62
063 ======================================================================
164 Version 0.27.0, by Aleksey Cheusov, Sun, 13 Jul 2014 17:03:12 +0300
265
0 BUILD SYSTEM IN GENERAL AND MK-CONFIGURE IN PARTICULAR IS A COMPLEX
1 SYSTEM. THIS FILE CONTAINS UNORDERED NOTES ABOUT HOW TO USE
2 MK-CONFIGURE EFFICIENTLY. I HOPE THESE NOTES WILL BE VALUABLE ADDON TO
3 MK-CONFIGURE(7) REFERENCE AND HELP USERS UNDERSTAND MK-CONFIGURE.
4 TAKE A NOTE THAT THESE NOTES ARE UNSORTED.
5
6 ***
7
8 For building projects with /usr prefix, run the following.
9
10 export PREFIX=/usr SYSCONFDIR=/etc VARDIR=/var
11 mkcmake all
12 mkcmake install
13
14 Packagers may use the following for creating a package using
15 unprivileged user.
16
17 mkdir /tmp/destdir
18 mkcmake install DESTDIR=/tmp/destdir
19
20 ***
21
22 mk-configure supports out-of-tree builds. Most of functionality is
23 supported by bmake. Examples are below.
24
25 1)
26 mkdir /tmp/xxxproj-obj
27 mkcmake MAKEOBJDIR=/tmp/xxxproj-obj
28
29 In this case all objects and temporary files are created in
30 /tmp/xxxproj-obj. Obviously, this may work if different subprojects
31 doesn't produce files with the same name. This features is supported
32 directly by bmake.
33
34 2)
35 mkdir /tmp/xxxproj-obj
36 mkcmake MAKEOBJDIRPREFIX=/tmp/xxxproj-obj
37
38 Here all objects and temporary files are saved to
39 ${MAKEOBJDIRPREFIX}${.CURDIR} directory. This features is also
40 supported by bmake.
41
42 3)
43 mkdir /tmp/xxxproj-obj
44 env MKRELOBJDIR=yes MAKEOBJDIR=/tmp/xxxproj-obj mkcmake
45
46 Unlike example 2) subdirectories under /tmp/xxxproj-obj for temporary
47 files won't contain ${SRCTOP}. The variable MKRELOBJDIR is provided by mk-c.
48
49 ***
50
51 Even if you project is trivial, that is consists of single executable
52 or library, I'd recommend to use mkc.subprj.mk in the top-level Makefile.
53 In provides better flexibility and easier work for packagers.
54
55 ***
56
57 It's very important to understand what is a recursive target.
58 See variable TARGETS.
59
60 ***
61
62 The variable TARGETS is a way to extend mk-c functionality.
63 See examples/hello_TARGETS.
64
65 ***
66
67 Look at examples/hello_superfs/Makefile.inc.
68 There you'll find a cool mk-configure's feature.
69
70 ***
71
72 If you want to override values for MKC_CHECK_* checks, run mkcmake
73 with additional parameters, like this
74
75 mkcmake all HAVE_HEADER.stdio_h=1 HAVE_HEADER.stdlib_h=1
76
77 See mkc.configure.mk section in mk-configure.7 for details.
78
79 ***
80
81 There are several ways of passing additional information from
82 top-level project to subprojects:
83 - environment variables via .export and .export-env bmake directives.
84 - EXPORT_VARNAMES and NOEXPORT_VARNAMES variables from mkc.subprj.mk.
85 - Makefile.common and Makefile.inc files.
86
87 ***
88
89 For prettifying mkcmake output, one can use
90
91 export SHRTOUT=yes
92 mkcmake all
93
94 ***
95
96 If your top-level Makefile looks like this
97
98 Makefile:
99 SUBPRJ = libA:progA libB:progB
100 .include <mkc.subprj.mk>
101
102 one can use
103
104 mkcmake all-progB
105
106 for building progB subproject without probA and libA. In this case libB
107 will also be built as it is a dependency. The same for
108
109 mkcmake install-progB
110 mkcmake test-progB
111 ...
112
113 and others. "all", "install", "test" and others are listed in variable
114 TARGETS.
115
116 ***
117
118 In traditional BSD mk files bsd.subdir.mk is allowed in any
119 subdirectory. The same is true for mk-configure. However, for better
120 flexibility it is recomended to have mkc.subprj.mk in the top-level
121 Makefile and specify the whole dependency graph of subpojects in
122 it. This allows, for example, building and testing any subproject
123 separately by running one command from top-level directory,
124 i.e. "mkcmake all-sub/sub/project". In this case all required
125 dependencies (and nothing else) will be built recursively. For running
126 mkcmake in subproject's directory, set the variable SRCTOP.
127
128 ***
129
130 SUBPRJ variable (mkc.subprj.mk) may contain subprojects, not
131 associated with any subdirectory. Such subprojects may be used as "the
132 name of subprojects collection". I call them "virtual
133 subprojects". If, for example, you're developing traditional UNIX
134 tools, you may have such projects as POSIX_tools BSD_tools,
135 bin_tools, sbin_tools etc.
136
137 ***
138
139 Subprojects from SUBDIR (mkc.subdir.mk) and SUBPRJ (mkc.subprj.mk) may
140 have slashes inside.
141
142 ***
143
144 NODEPS variable may be used for stripping unnecessary
145 dependencies. This is especially useful for target "test". In the
146 following example "mkcmake test" tests only programs but not libraries
147 (recursively). That is, it runs targets "test-tools/prog1",
148 "test-tools/prog2", "test-tools/prog3" and "test-tools/prog4"
149 but "test-libs/foo" and others.
150
151 Example:
152 SUBPRJ = libs/foo:tools/prog1
153 SUBPRJ += libs/bar:tools/prog2
154 SUBPRJ += libs/foo:tools/prog3 libs/bar:tools/prog3
155 SUBPRJ += libs/qux:tools/prog4
156
157 NODEPS += test-libs/*:test test-libs/*:test-tools/*
158
159 .include <mkc.subprj.mk>
160
161 ***
162
163 Makefile.common and Makefile.inc included implicitely by subprojects
164 may be used for common code. For examples, in these files one can do
165 something like this.
166
167 VERSION = 1.2.3
168 INTEXTS_REPLS += version ${VERSION}
169
170 for replacing @version@ with real version.
171
172 ***
173
174 If your project consists of libraries and executables, use
175 mkc.subprj.mk and its LIBDEPS variable. Even if you prefer shared
176 libraries, users will be able to link them statically with a help
177 STATICLIBS variable specified in environment. For this to work you
178 have to use += for STATICLIBS in Makefiles.
00 ============================================================
1 Plan 0.26.0
1 Plan 0.28.0
22
3 - CLEANFILES: pod2htmd.tmp pod2htmi.tmp only if POD is built
3 - check awk capabilities at build time
4 - Hide regression tests details
5 - "bmake -k regrtest/check" (mkc.minitest.mk?)
46
5 - DISTCLEANFILES: .depend for C/C++ projects
7 - strndup(SunOS-5.10, -fgetln,_compatlib)
8 - PRId64
9 - leveldb, strtoll, strtoull
10 - wmemcpy, strnlen
11 - wcsdup
12 - CFLAGS0
613
7 - MKC_FEATURES: err(err,warn etc.), fgetln(via getline(3))
814 - Special marker for checks that cannot be possible in cross-compiling
15
16 - regression tests without garbage, make it look like paexec\
17
18 - MKC_FEATURES: inttypes
919
1020 Some thoughts inspired by talks with Michael Crogan
1121
1222 - MKASNEEDED=yes => ld --as-needed
1323
14 - VARIANTS for libraries.
15
1624 - _mkc_done_<prj>_<trg>
1725
1826 - project "roundup" for testing
1927
20 - Better explain how "test" target works, maybe as a couple of slides
21 in the PDF presentation. With and without mkc.minitest.mk.
22 - One more example/ for TARGETS, demonstrating such things as
23 "mkcmake all_clang/all_gcc" or "valgrind_test"/"gcov_test" etc.
24 - Additional slides in PDF for virtual subprojects.
25 Notes about "virtual subproject" in examples/.
26 - Notes in examples/hello_dictd and other examples based on
27 mkc.subprj.mk about what mkc.subprj.mk really does. Reference (man page)
28 is not enough for newcomers. Notes about clean-SUBPRJ, all-SUBPRJ etc.
29 - Better explain ../Makefile.inc included automatically. For those who
30 are not familiar with *BSD it is not obvious how to use it.
3128 - "errorcheck/configure" tests should be run in parallel. Something
3229 like shlock(1) or flock(1) is needed for this.
33 - Example is needed for how to embed autoconf-based subproject into a
34 project based on mk-configure. The sad fact is autoconf/automake is
35 everywhere. So, it would be nice to integrate mk-c into reality.
36 mkc_imp.autotools.mk is needed for this.
3730 - Alternative .depend generation, e.g. like it is described in GNU
3831 make info files
39 - Higher priority for fixing handling of dependencies between
40 libraries and programs. In addition examples/ is needed for
32 - Additional examples/ is needed for
4133 triggering rebuild of subproject if "something" was rebuild in
4234 another subproject (build script for example).
4335 - Interdependencies between targetX-subprjA and targetY-subprjB (for
4638 <<<depend-project1:errorcheck-autotools_based_project2>>>!!!
4739 - Steal cool features from Simon Gerraty's mk files and analyse
4840 "meta mode" he invented.
49 - Better support for working without installation to /. -rpath, additional
50 directories for objects, binaries and libs.
51 - symlinks in object directories to source files for easier running
52 unitest, for example. lndir(1).
5341
5442 Some "targets" from TARGETS should set MKCHECKS to "no"
5543
5644 ronn(1) : markdown to man pages
57
58 Reimplement linkme.mk. It is not flexible enough.
59 - Additional type of dependencies in mkc.subprjs.mk (LIBDEPS =
60 libfoo:bar ...), pass them to subprojects using enironment and
61 include appropriate libfoo/linkme.mk if it is
62 available. Otherwise, use default -l and -I.
63 or
64 - keep linkme.mk and avoid direct use of CPPFLAGS, LDADD and
65 DPLIBDIRS. Instead use special variables XXX.includes,
66 XXX.ldflags, XXX.ldadd, SRCDIR_<lib> and OBJDIR_<lib>.
6745
6846 custom test failed -> exit status of mkcmake should not be zero
6947 MKC_CUSTOM_ERR.qqqq -> error message before exiting just like
7856
7957 - BINSUBDIR, LIBSUBDIR, LIBEXECSUBDIR etc...
8058 - Fix USE_SSP support for clang (-mllvm -stack-protector-buffer-size=1)
81 - @sysconfdir@/mkc.conf
8259 - USE_RPATH
8360 - OBJCOPTS_<proj>
8461 - Regression tests:
124101 run generated executables, i.e. not ready
125102 for cross-compilation
126103
127 = symlinks to executables and libraries in ${OBJDIR}/{bin,lib}
128
129104 = support for gettext
130
131 = xxxDIR variable for /var
132105
133106 = mkclint?
134107
144117 = shared libraries support for nwcc and other compilers.
145118
146119 = Comparison with quagmire, kBuild, CMake, scons, waf, framewerk, pmk,
147 MagicMakefiles, bjam, pymake, bitmake, pkgconf,
120 MagicMakefiles, bjam, pymake, bitmake, pkgconf, Gradle
148121 http://sourceforge.net/projects/mkbuild etc.
149122
150123 = Often compilers need special options to compile pthread code.
00 CLEANDIRS += ${.CURDIR}/usr ${.CURDIR}/opt
11
2 .ifdef SRCDIR_custom
2 .ifdef SRCDIR_builtins
33 # regression test for mk-configure
44 MKC_CACHEDIR = ${.CURDIR}
5 BUILTINSDIR = ${SRCDIR_custom}
5 BUILTINSDIR = ${SRCDIR_builtins}
66 FEATURESDIR = ${SRCDIR_features}
77 SHRTOUT = no
88 .export MKC_CACHEDIR BUILTINSDIR FEATURESDIR SHRTOUT
0 FOREIGN = autotools
1 FSRCDIR = proj
2
3 AT_USE_AUTOMAKE = no
4 AT_MAKE = ${BUILTIN.prog_gmake}
5
6 MKC_CHECK_BUILTINS = prog_gmake
7 MKCHECKS = yes # we need path to gmake for target "clean"
8
9 # The following line is for regression tests.
10 # In real life we don't need this.
11 all: mkgen
12
13 .include "test.mk"
14 .include <mkc.mk>
0 Hello autoconf
1 =========== all ============
2 /objdir/AUTHORS
3 /objdir/COPYING
4 /objdir/ChangeLog
5 /objdir/Makefile
6 /objdir/Makefile.in
7 /objdir/NEWS
8 /objdir/README
9 /objdir/config.h
10 /objdir/config.h.in
11 /objdir/config.log
12 /objdir/config.status
13 /objdir/configure
14 /objdir/configure.ac
15 /objdir/hello_autoconf
16 /objdir/hello_autoconf.c
17 ========== clean ===========
18 /objdir/AUTHORS
19 /objdir/COPYING
20 /objdir/ChangeLog
21 /objdir/Makefile
22 /objdir/Makefile.in
23 /objdir/NEWS
24 /objdir/README
25 /objdir/config.h
26 /objdir/config.h.in
27 /objdir/config.log
28 /objdir/config.status
29 /objdir/configure
30 /objdir/configure.ac
31 /objdir/hello_autoconf.c
32 ========== all SHRTOUT=yes ===========
33 MKGEN:
34 CONFIGURE:
35 configure: creating ./config.status
36 AUTOTOOLS:
37 ======= cleandir ==========
38 /objdir/AUTHORS
39 /objdir/COPYING
40 /objdir/ChangeLog
41 /objdir/Makefile.in
42 /objdir/NEWS
43 /objdir/README
44 /objdir/configure.ac
45 /objdir/hello_autoconf.c
0 Aleksey Cheusov <vle@gmx.net>
0 Copyright (c) 2014 by Aleksey Cheusov <vle@gmx.net>
1
2 Redistribution and use in source and binary forms, with or without
3 modification, are permitted provided that the following conditions
4 are met:
5
6 1. Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 2. Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in the
11 documentation and/or other materials provided with the
12 distribution.
13
14 THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
15 CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
16 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
19 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
23 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0 # GNU Make is required
1
2 srcdir = @srcdir@
3
4 CC ?= @CC@
5
6 CFLAGS ?= @CFLAGS@
7 CPPFLAGS ?= @CPPFLAGS@
8 LDFLAGS ?= @LDFLAGS@
9 LIBS ?= @LIBS@
10
11 CPPFLAGS += -I. -I${srcdir}
12 CFLAGS += -DMSG='"$(shell echo Hello autoconf)"'
13
14 .PHONY: all clean distclean
15
16 all: hello_autoconf
17
18 %: %.c
19 ${CC} -o $@ ${CPPFLAGS} ${CFLAGS} $< ${LDFLAGS} ${LIBS}
20
21 clean:
22 -rm -f hello_autoconf
23
24 distclean: clean # mk-configure removes almost everything
25 -rm -f ${srcdir}/config.h.in config.h
0 No news is good news
0 This is a trivial autoconf-based project.
0 dnl
1 dnl Process this file with autoconf to create configure.
2
3 # Initialize Autoconf
4 AC_PREREQ([2.60])
5 AC_INIT([hello_autotools], [0.28.0],
6 [https://github.com/cheusov/mk-configure])
7 AC_CONFIG_SRCDIR([Makefile.in])
8 AC_CONFIG_HEADERS([config.h])
9
10 dnl Checks for functions
11 AC_CHECK_HEADERS([stdio.h])
12
13 AC_OUTPUT([Makefile])
0 #include <config.h>
1
2 #ifdef HAVE_STDIO_H
3 #include <stdio.h>
4 #endif
5
6 int main (int argc, char **argv)
7 {
8 puts (MSG);
9 return 0;
10 }
0 EXCL_RE='autom4te[.]cache'
1
2 .PHONY : test_output
3 test_output:
4 @ \
5 ${.OBJDIR}/hello_autoconf; \
6 rm -rf ${.OBJDIR}${PREFIX}; \
7 \
8 echo =========== all ============; \
9 find ${.OBJDIR} -type f | grep -Ev '${EXCL_RE}' | \
10 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
11 \
12 echo ========== clean ===========; \
13 ${MAKE} ${MAKEFLAGS} clean > /dev/null; \
14 find ${.OBJDIR} -type f | grep -vE '${EXCL_RE}' | \
15 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
16 \
17 echo ========== all SHRTOUT=yes ===========; \
18 ${MAKE} ${MAKEFLAGS} all SHRTOUT=yes | \
19 grep -E '^[[:alpha:]]+:'; \
20 \
21 echo ======= cleandir ==========; \
22 ${MAKE} ${MAKEFLAGS} cleandir > /dev/null; \
23 find ${.OBJDIR} -type f | grep -vE '${EXCL_RE}' | \
24 mkc_test_helper "${PREFIX}" "${.OBJDIR}"
25
26 .include <mkc.minitest.mk>
0 FOREIGN = autotools
1 FSRCDIR = proj
2
3 DISTCLEANFILES += ${.CURDIR}/${FSRCDIR}/hello_autotools-config.h.in
4
5
6 # the following is for regression tests. In real life we don't need this.
7 all: mkgen
8
9 .include "test.mk"
10 .include <mkc.mk>
0 Hello AutoShi^H^H^HTools!
1 =========== all ============
2 /objdir/.deps/main.Po
3 /objdir/AUTHORS
4 /objdir/COPYING
5 /objdir/ChangeLog
6 /objdir/Makefile
7 /objdir/Makefile.am
8 /objdir/Makefile.in
9 /objdir/NEWS
10 /objdir/README
11 /objdir/aclocal.m4
12 /objdir/config.log
13 /objdir/config.status
14 /objdir/configure
15 /objdir/configure.ac
16 /objdir/hello_autotools
17 /objdir/hello_autotools-config.h
18 /objdir/hello_autotools-config.h.in
19 /objdir/main.c
20 /objdir/main.o
21 /objdir/stamp-h1
22 ========= install ==========
23 /objdir/prefix
24 /objdir/prefix/bin
25 /objdir/prefix/bin/hello_autotools
26 ======== uninstall =========
27 /objdir/prefix
28 /objdir/prefix/bin
29 ========== clean ===========
30 /objdir/.deps/main.Po
31 /objdir/AUTHORS
32 /objdir/COPYING
33 /objdir/ChangeLog
34 /objdir/Makefile
35 /objdir/Makefile.am
36 /objdir/Makefile.in
37 /objdir/NEWS
38 /objdir/README
39 /objdir/aclocal.m4
40 /objdir/config.log
41 /objdir/config.status
42 /objdir/configure
43 /objdir/configure.ac
44 /objdir/hello_autotools-config.h
45 /objdir/hello_autotools-config.h.in
46 /objdir/main.c
47 /objdir/stamp-h1
48 ========== all SHRTOUT=yes ===========
49 MKGEN:
50 CONFIGURE:
51 configure: creating ./config.status
52 AUTOTOOLS:
53 ======= cleandir ==========
54 /objdir/AUTHORS
55 /objdir/COPYING
56 /objdir/ChangeLog
57 /objdir/Makefile.am
58 /objdir/NEWS
59 /objdir/README
60 /objdir/configure.ac
61 /objdir/main.c
0 Aleksey Cheusov <vle@gmx.net>
0 Copyright (c) 2014 by Aleksey Cheusov <vle@gmx.net>
1
2 Redistribution and use in source and binary forms, with or without
3 modification, are permitted provided that the following conditions
4 are met:
5
6 1. Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 2. Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in the
11 documentation and/or other materials provided with the
12 distribution.
13
14 THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
15 CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
16 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
19 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
23 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0 bin_PROGRAMS = hello_autotools
1
2 hello_autotools_SOURCES = main.c
0 No news is good news
0 This is a trivial autotools-based project.
0 dnl
1 dnl Process this file with autoconf to create configure.
2
3 # Initialize Autoconf
4 AC_PREREQ([2.60])
5 AC_INIT([hello_autotools], [0.28.0],
6 [https://github.com/cheusov/mk-configure])
7 AC_CONFIG_SRCDIR([Makefile.am])
8 AC_CONFIG_HEADERS([hello_autotools-config.h])
9
10 # Initialize Automake
11 AM_INIT_AUTOMAKE
12
13 dnl Checks for functions
14 AC_CHECK_HEADERS([stdio.h])
15
16 AC_OUTPUT([Makefile])
0 #include <hello_autotools-config.h>
1
2 #ifdef HAVE_STDIO_H
3 #include <stdio.h>
4 #endif
5
6 int main (int argc, char **argv)
7 {
8 puts ("Hello AutoShi^H^H^HTools!");
9 return 0;
10 }
0 EXCL_RE='autom4te[.]cache'
1
2 .PHONY : test_output
3 test_output:
4 @ \
5 ${.OBJDIR}/hello_autotools; \
6 rm -rf ${.OBJDIR}${PREFIX}; \
7 \
8 echo =========== all ============; \
9 find ${.OBJDIR} -type f | grep -Ev '${EXCL_RE}' | \
10 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
11 \
12 echo ========= install ==========; \
13 ${MAKE} ${MAKEFLAGS} install -j3 \
14 DESTDIR=${.OBJDIR} > /dev/null; \
15 find ${.OBJDIR}${PREFIX} -type f -o -type d | \
16 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
17 \
18 echo ======== uninstall =========; \
19 ${MAKE} ${MAKEFLAGS} -j4 uninstall \
20 DESTDIR=${.OBJDIR} > /dev/null; \
21 find ${.OBJDIR}${PREFIX} -type f -o -type d | \
22 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
23 \
24 echo ========== clean ===========; \
25 ${MAKE} ${MAKEFLAGS} clean > /dev/null; \
26 find ${.OBJDIR} -type f | grep -vE '${EXCL_RE}' | \
27 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
28 \
29 echo ========== all SHRTOUT=yes ===========; \
30 ${MAKE} ${MAKEFLAGS} all SHRTOUT=yes | \
31 grep -E '^[[:alpha:]]+:'; \
32 \
33 echo ======= cleandir ==========; \
34 ${MAKE} ${MAKEFLAGS} cleandir > /dev/null; \
35 find ${.OBJDIR} -type f | grep -vE '${EXCL_RE}' | \
36 mkc_test_helper "${PREFIX}" "${.OBJDIR}"
37
38 .include <mkc.minitest.mk>
1616
1717 YACC = ${"${BUILTIN.prog_bison}" != "":?${BUILTIN.prog_bison} -y:}
1818 LEX = ${BUILTIN.prog_flex}
19 LEXLIB = -lfl
19 LEXLIB = #-lfl
2020
2121 .if empty(BUILTIN.prog_flex)
2222 MKC_ERR_MSG += "Cannot find flex, good bye!"
0 LIBDEPS = libcmpt:prog1 libcmpt:prog2
1 COMPATLIB = libcmpt
2
3 .include "test.mk"
4 .include <mkc.subprj.mk>
0 MKC_FEATURES = strlcpy strlcat getline progname fgetln err
0 =========== all ============
1 /objdir/Makefile
2 /objdir/Makefile.inc
3 /objdir/_mkc_compiler_type.err
4 /objdir/_mkc_compiler_type.res
5 /objdir/_mkc_func0_getexecname_stdlib_h.c
6 /objdir/_mkc_func0_getexecname_stdlib_h.err
7 /objdir/_mkc_func0_getexecname_stdlib_h.res
8 /objdir/_mkc_func0_getprogname_stdlib_h.c
9 /objdir/_mkc_func0_getprogname_stdlib_h.err
10 /objdir/_mkc_func0_getprogname_stdlib_h.res
11 /objdir/_mkc_func1_setprogname_stdlib_h.c
12 /objdir/_mkc_func1_setprogname_stdlib_h.err
13 /objdir/_mkc_func1_setprogname_stdlib_h.res
14 /objdir/_mkc_func3_err_err_h.c
15 /objdir/_mkc_func3_err_err_h.err
16 /objdir/_mkc_func3_err_err_h.res
17 /objdir/_mkc_func3_errx_err_h.c
18 /objdir/_mkc_func3_errx_err_h.err
19 /objdir/_mkc_func3_errx_err_h.res
20 /objdir/_mkc_func3_fgetln_stdio_h.c
21 /objdir/_mkc_func3_fgetln_stdio_h.err
22 /objdir/_mkc_func3_fgetln_stdio_h.res
23 /objdir/_mkc_func3_getline_stdio_h.c
24 /objdir/_mkc_func3_getline_stdio_h.err
25 /objdir/_mkc_func3_getline_stdio_h.res
26 /objdir/_mkc_func3_strlcat_string_h.c
27 /objdir/_mkc_func3_strlcat_string_h.err
28 /objdir/_mkc_func3_strlcat_string_h.res
29 /objdir/_mkc_func3_strlcpy_string_h.c
30 /objdir/_mkc_func3_strlcpy_string_h.err
31 /objdir/_mkc_func3_strlcpy_string_h.res
32 /objdir/_mkc_func3_verr_err_h.c
33 /objdir/_mkc_func3_verr_err_h.err
34 /objdir/_mkc_func3_verr_err_h.res
35 /objdir/_mkc_func3_verrx_err_h.c
36 /objdir/_mkc_func3_verrx_err_h.err
37 /objdir/_mkc_func3_verrx_err_h.res
38 /objdir/_mkc_funclib_err.c
39 /objdir/_mkc_funclib_err.err
40 /objdir/_mkc_funclib_err.res
41 /objdir/_mkc_funclib_errx.c
42 /objdir/_mkc_funclib_errx.err
43 /objdir/_mkc_funclib_errx.res
44 /objdir/_mkc_funclib_fgetln.c
45 /objdir/_mkc_funclib_fgetln.err
46 /objdir/_mkc_funclib_fgetln.res
47 /objdir/_mkc_funclib_getline.c
48 /objdir/_mkc_funclib_getline.err
49 /objdir/_mkc_funclib_getline.res
50 /objdir/_mkc_funclib_getprogname.c
51 /objdir/_mkc_funclib_getprogname.err
52 /objdir/_mkc_funclib_getprogname.res
53 /objdir/_mkc_funclib_setprogname.c
54 /objdir/_mkc_funclib_setprogname.err
55 /objdir/_mkc_funclib_setprogname.res
56 /objdir/_mkc_funclib_strlcat.c
57 /objdir/_mkc_funclib_strlcat.err
58 /objdir/_mkc_funclib_strlcat.res
59 /objdir/_mkc_funclib_strlcpy.c
60 /objdir/_mkc_funclib_strlcpy.err
61 /objdir/_mkc_funclib_strlcpy.res
62 /objdir/_mkc_funclib_verr.c
63 /objdir/_mkc_funclib_verr.err
64 /objdir/_mkc_funclib_verr.res
65 /objdir/_mkc_funclib_verrx.c
66 /objdir/_mkc_funclib_verrx.err
67 /objdir/_mkc_funclib_verrx.res
68 /objdir/_mkc_header_err_h.c
69 /objdir/_mkc_header_err_h.err
70 /objdir/_mkc_header_err_h.res
71 /objdir/_mkc_prog_cc.err
72 /objdir/_mkc_prog_cc.res
73 /objdir/_mkc_variable_program_invocation_short_name_errno_h.c
74 /objdir/_mkc_variable_program_invocation_short_name_errno_h.err
75 /objdir/_mkc_variable_program_invocation_short_name_errno_h.res
76 /objdir/expect.out
77 /objdir/hello_compatlib.test.out.tmp
78 /objdir/libcmpt/Makefile
79 /objdir/libcmpt/libcmpt.a
80 /objdir/libcmpt/libcmpt_pic.a
81 /objdir/prog1/Makefile
82 /objdir/prog1/prog1
83 /objdir/prog1/prog1.c
84 /objdir/prog1/prog1.o
85 /objdir/prog2/Makefile
86 /objdir/prog2/prog2
87 /objdir/prog2/prog2.c
88 /objdir/prog2/prog2.o
89 /objdir/test.mk
0 LIB = cmpt
1
2 .include <mkc.lib.mk>
0 PROG = prog1
1
2 WARNS = 4
3
4 MKC_REQD = 0.27.0
5
6 .include <mkc.prog.mk>
0 #include <stdio.h>
1 #include <string.h>
2
3 #include <mkc_strlcpy.h>
4 #include <mkc_strlcat.h>
5 #include <mkc_getline.h>
6 #include <mkc_progname.h>
7
8 static const char message [] = "Theo de Raadt said: \"The strlcpy() and strlcat() functions provide a consistent, unambiguous API to help the programmer write more bullet-proof code.\"";
9
10 int main (int argc, char ** argv)
11 {
12 char *buf = NULL;
13 size_t size = 0;
14 ssize_t len = 0;
15 char small_buf [15];
16 char said [19];
17
18 setprogname (argv [0]);
19
20 while (len = getline (&buf, &size, stdin), len != -1){
21 len = strlen (buf);
22 if (len > 0 && buf [len-1] == '\n')
23 buf [len-1] = 0;
24
25 strlcpy (small_buf, "foo17", sizeof (small_buf));
26 strlcat (small_buf, buf, sizeof (small_buf));
27 puts (small_buf);
28 }
29
30 strlcpy (said, message, sizeof (said));
31 puts (said);
32
33 printf ("short progname=%s\n", getprogname ());
34 printf ("full progname=%s\n", argv [0]);
35
36 return 0;
37 }
0 PROG = prog2
1
2 WARNS = 4
3
4 MKC_REQD = 0.27.0
5
6 .include <mkc.prog.mk>
0 #include <stdio.h>
1 #include <string.h>
2 #include <stdlib.h>
3
4 #include <mkc_fgetln.h>
5 #include <mkc_err.h>
6
7 int main (int argc, char ** argv)
8 {
9 char *buf, *lbuf;
10 size_t len;
11
12 while ((lbuf = buf = fgetln (stdin, &len)) != NULL) {
13 if (len > 0 && buf [len - 1] == '\n')
14 buf[len - 1] = '\0';
15 else if ((lbuf = strndup (buf, len + 1)) == NULL)
16 err (1, NULL);
17 printf ("%s\n", lbuf);
18
19 if (lbuf != buf)
20 free (lbuf);
21 }
22 return 0;
23 }
0 FUNCS_RE=(fgetln|progname|strlcat|strlcpy|getline)[.]o
1
2 .PHONY : test_output
3 test_output :
4 @set -e; \
5 echo =========== all ============; \
6 find ${.OBJDIR} -type f | grep -Ev '${FUNCS_RE}' | \
7 grep -vE 'libcmpt/.*[.]os?$$' | \
8 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
9 \
10 true =========== cleandir ============; \
11 ${MAKE} ${MAKEFLAGS} distclean > /dev/null
12
13 .include <mkc.minitest.mk>
1111
1212 SRCS = hello_msg1.cpp hello_msg2.cpp
1313
14 MKC_SOURCE_FUNCLIBS = dummy # a part of regression test
15 MKC_SOURCE_DIR.dummy.c := ${.PARSEDIR}
16
1417 .include <mkc.lib.mk>
0 /* we do use this function, this is just a part of regression test */
1 void dummy_func (void);
2 void dummy_func (void)
3 {
4 /* we do nothing here */
5 }
0 PATH.cxxlib := ${.PARSEDIR}
0 PATH.cxxlib := ${.PARSEDIR:tA}
11
2 CPPFLAGS += -I${PATH.cxxlib}/include
2 DPINCDIRS += ${PATH.cxxlib}/include
33 DPLIBDIRS += ${PATH.cxxlib}
4 LDADD0 += -lcxxlib
4 DPLDADD += cxxlib
11 hello world 2!
22 =========== all ============
33 /objdir/Makefile
4 /objdir/_mkc_compiler_type.err
5 /objdir/_mkc_compiler_type.res
46 /objdir/_mkc_cxx_type.err
57 /objdir/_mkc_cxx_type.res
8 /objdir/_mkc_funclib_dummy.c
9 /objdir/_mkc_funclib_dummy.err
10 /objdir/_mkc_funclib_dummy.res
611 /objdir/_mkc_prog_cxx.err
712 /objdir/_mkc_prog_cxx.res
813 /objdir/cxxapp/Makefile
1015 /objdir/cxxapp/cxxapp.cc
1116 /objdir/cxxapp/cxxapp.o
1217 /objdir/cxxlib/Makefile
18 /objdir/cxxlib/dummy.c
19 /objdir/cxxlib/dummy.o
20 /objdir/cxxlib/dummy.os
1321 /objdir/cxxlib/hello_msg1.cpp
1422 /objdir/cxxlib/hello_msg1.o
1523 /objdir/cxxlib/hello_msg1.os
4250 ======== uninstall =========
4351 ========== clean ===========
4452 /objdir/Makefile
53 /objdir/_mkc_compiler_type.err
54 /objdir/_mkc_compiler_type.res
4555 /objdir/_mkc_cxx_type.err
4656 /objdir/_mkc_cxx_type.res
57 /objdir/_mkc_funclib_dummy.c
58 /objdir/_mkc_funclib_dummy.err
59 /objdir/_mkc_funclib_dummy.res
4760 /objdir/_mkc_prog_cxx.err
4861 /objdir/_mkc_prog_cxx.res
4962 /objdir/cxxapp/Makefile
5063 /objdir/cxxapp/cxxapp.cc
5164 /objdir/cxxlib/Makefile
65 /objdir/cxxlib/dummy.c
5266 /objdir/cxxlib/hello_msg1.cpp
5367 /objdir/cxxlib/hello_msg2.cpp
5468 /objdir/cxxlib/include/hello_msg.h
6377 /objdir/cxxapp/Makefile
6478 /objdir/cxxapp/cxxapp.cc
6579 /objdir/cxxlib/Makefile
80 /objdir/cxxlib/dummy.c
6681 /objdir/cxxlib/hello_msg1.cpp
6782 /objdir/cxxlib/hello_msg2.cpp
6883 /objdir/cxxlib/include/hello_msg.h
44 rm -rf ${.OBJDIR}${PREFIX}; \
55 LD_LIBRARY_PATH=${.CURDIR}/cxxlib:$$LD_LIBRARY_PATH; \
66 DYLD_LIBRARY_PATH=${.CURDIR}/cxxlib:$$LD_LIBRARY_PATH; \
7 export LD_LIBRARY_PATH DYLD_LIBRARY_PATH; \
7 LIBRARY_PATH=$$LIBRARY_PATH:$$LD_LIBRARY_PATH; \
8 export LD_LIBRARY_PATH DYLD_LIBRARY_PATH LIBRARY_PATH; \
89 ${.CURDIR}/cxxapp/cxxapp; \
910 \
1011 echo =========== all ============; \
0 SUBPRJ = libcommon:dict
1 SUBPRJ += libcommon:dictd
2 SUBPRJ += libcommon:dictzip
3 SUBPRJ += libcommon:dictfmt
4 SUBPRJ += libmaa:dict
5 SUBPRJ += libmaa:dictd
6 SUBPRJ += libmaa:dictzip
7 SUBPRJ += libmaa:dictfmt
8 SUBPRJ += libdz:dictzip
0 LIBDEPS = libcommon:dict
1 LIBDEPS += libcommon:dictd
2 LIBDEPS += libcommon:dictzip
3 LIBDEPS += libcommon:dictfmt
4 LIBDEPS += libmaa:dict
5 LIBDEPS += libmaa:dictd
6 LIBDEPS += libmaa:dictzip
7 LIBDEPS += libmaa:dictfmt
8 LIBDEPS += libdz:dictzip
9
10 INTERNALLIBS += libcommon
911
1012 # Subproject "doc" has no dependencies
1113 SUBPRJ += doc
22
33 WARNS = 4
44
5 .include "../libcommon/linkme.mk"
6 .include "../libmaa/linkme.mk"
7
85 .include <mkc.prog.mk>
22
33 WARNS = 4
44
5 .include "../libcommon/linkme.mk"
6 .include "../libmaa/linkme.mk"
7
85 .include <mkc.prog.mk>
22
33 WARNS = 4
44
5 .include "../libcommon/linkme.mk"
6 .include "../libmaa/linkme.mk"
7
85 .include <mkc.prog.mk>
22
33 WARNS = 4
44
5 .include "../libcommon/linkme.mk"
6 .include "../libdz/linkme.mk"
7 .include "../libmaa/linkme.mk"
8
95 .include <mkc.prog.mk>
1919 dictzip: fake5=5
2020 dictzip: fake6=6
2121 =========== nm ============
22 libmaa fake4
23 libmaa fake5
24 libmaa fake6
25 libdz fake3
22 symbol fake4
23 symbol fake5
24 symbol fake6
25 =
26 symbol fake3
2627 =========== all ============
2728 /objdir/Makefile
2829 /objdir/Makefile.inc
7071 /objdir/libcommon/Makefile
7172 /objdir/libcommon/iswalnum.c
7273 /objdir/libcommon/iswalnum.o
74 /objdir/libcommon/iswalnum.os
7375 /objdir/libcommon/libcommon.a
74 /objdir/libcommon/linkme.mk
76 /objdir/libcommon/libcommon_pic.a
7577 /objdir/libcommon/str.c
7678 /objdir/libcommon/str.o
79 /objdir/libcommon/str.os
7780 /objdir/libdz/Makefile
7881 /objdir/libdz/dz.c
7982 /objdir/libdz/dz.o
8386 /objdir/libdz/libdz.so
8487 /objdir/libdz/libdz.so.1
8588 /objdir/libdz/libdz.so.1.0
86 /objdir/libdz/linkme.mk
8789 /objdir/libmaa/Makefile
8890 /objdir/libmaa/export.sym
8991 /objdir/libmaa/libmaa.a
9092 /objdir/libmaa/libmaa.so
9193 /objdir/libmaa/libmaa.so.1
9294 /objdir/libmaa/libmaa.so.1.2.0
93 /objdir/libmaa/linkme.mk
9495 /objdir/libmaa/log.c
9596 /objdir/libmaa/log.o
9697 /objdir/libmaa/log.os
101102 /objdir/libmaa/set.o
102103 /objdir/libmaa/set.os
103104 /objdir/test.mk
105 ========= INTERNALLIBS ==========
106 installdirs ===> examples/hello_dictd/libmaa
107 installdirs ===> examples/hello_dictd/dict
108 installdirs ===> examples/hello_dictd/dictd
109 installdirs ===> examples/hello_dictd/libdz
110 installdirs ===> examples/hello_dictd/dictzip
111 installdirs ===> examples/hello_dictd/dictfmt
112 install ===> examples/hello_dictd/libmaa
113 install ===> examples/hello_dictd/dict
114 install ===> examples/hello_dictd/dictd
115 install ===> examples/hello_dictd/libdz
116 install ===> examples/hello_dictd/dictzip
117 install ===> examples/hello_dictd/dictfmt
118 uninstall ===> examples/hello_dictd/libmaa
119 uninstall ===> examples/hello_dictd/dict
120 uninstall ===> examples/hello_dictd/dictd
121 uninstall ===> examples/hello_dictd/libdz
122 uninstall ===> examples/hello_dictd/dictzip
123 uninstall ===> examples/hello_dictd/dictfmt
104124 ========= installdirs ==========
105125 /objdir/prefix
106126 /objdir/prefix/bin
168188 /objdir/libcommon/Makefile
169189 /objdir/libcommon/iswalnum.c
170190 /objdir/libcommon/iswalnum.o
191 /objdir/libcommon/iswalnum.os
171192 /objdir/libcommon/libcommon.a
172 /objdir/libcommon/linkme.mk
193 /objdir/libcommon/libcommon_pic.a
173194 /objdir/libcommon/str.c
174195 /objdir/libcommon/str.o
196 /objdir/libcommon/str.os
175197 /objdir/libdz/Makefile
176198 /objdir/libdz/dz.c
177199 /objdir/libdz/dz.o
181203 /objdir/libdz/libdz.so
182204 /objdir/libdz/libdz.so.1
183205 /objdir/libdz/libdz.so.1.0
184 /objdir/libdz/linkme.mk
185206 /objdir/libmaa/Makefile
186207 /objdir/libmaa/export.sym
187208 /objdir/libmaa/libmaa.a
188209 /objdir/libmaa/libmaa.so
189210 /objdir/libmaa/libmaa.so.1
190211 /objdir/libmaa/libmaa.so.1.2.0
191 /objdir/libmaa/linkme.mk
192212 /objdir/libmaa/log.c
193213 /objdir/libmaa/log.o
194214 /objdir/libmaa/log.os
220240 /objdir/hello_dictd.test.out.tmp
221241 /objdir/libcommon/Makefile
222242 /objdir/libcommon/iswalnum.c
223 /objdir/libcommon/linkme.mk
224 /objdir/libcommon/str.c
225 /objdir/libdz/Makefile
226 /objdir/libdz/dz.c
227 /objdir/libdz/export.sym
228 /objdir/libdz/linkme.mk
229 /objdir/libmaa/Makefile
230 /objdir/libmaa/export.sym
231 /objdir/libmaa/linkme.mk
243 /objdir/libcommon/str.c
244 /objdir/libdz/Makefile
245 /objdir/libdz/dz.c
246 /objdir/libdz/export.sym
247 /objdir/libmaa/Makefile
248 /objdir/libmaa/export.sym
232249 /objdir/libmaa/log.c
233250 /objdir/libmaa/prime.c
234251 /objdir/libmaa/set.c
254271 /objdir/hello_dictd.test.out.tmp
255272 /objdir/libcommon/Makefile
256273 /objdir/libcommon/iswalnum.c
257 /objdir/libcommon/linkme.mk
258 /objdir/libcommon/str.c
259 /objdir/libdz/Makefile
260 /objdir/libdz/dz.c
261 /objdir/libdz/export.sym
262 /objdir/libdz/linkme.mk
263 /objdir/libmaa/Makefile
264 /objdir/libmaa/export.sym
265 /objdir/libmaa/linkme.mk
274 /objdir/libcommon/str.c
275 /objdir/libdz/Makefile
276 /objdir/libdz/dz.c
277 /objdir/libdz/export.sym
278 /objdir/libmaa/Makefile
279 /objdir/libmaa/export.sym
266280 /objdir/libmaa/log.c
267281 /objdir/libmaa/prime.c
268282 /objdir/libmaa/set.c
295309 /objdir/libcommon
296310 /objdir/libcommon/Makefile
297311 /objdir/libcommon/iswalnum.c
298 /objdir/libcommon/linkme.mk
299312 /objdir/libcommon/str.c
300313 /objdir/libdz
301314 /objdir/libdz/Makefile
302315 /objdir/libdz/dz.c
303316 /objdir/libdz/export.sym
304 /objdir/libdz/linkme.mk
305317 /objdir/libmaa
306318 /objdir/libmaa/Makefile
307319 /objdir/libmaa/export.sym
308 /objdir/libmaa/linkme.mk
309320 /objdir/libmaa/log.c
310321 /objdir/libmaa/prime.c
311322 /objdir/libmaa/set.c
349360 /objdir/libcommon
350361 /objdir/libcommon/Makefile
351362 /objdir/libcommon/iswalnum.c
352 /objdir/libcommon/linkme.mk
353363 /objdir/libcommon/str.c
354364 /objdir/libdz
355365 /objdir/libdz/Makefile
356366 /objdir/libdz/dz.c
357367 /objdir/libdz/export.sym
358 /objdir/libdz/linkme.mk
359368 /objdir/libmaa
360369 /objdir/libmaa/Makefile
361370 /objdir/libmaa/export.sym
362 /objdir/libmaa/linkme.mk
363371 /objdir/libmaa/log.c
364372 /objdir/libmaa/prime.c
365373 /objdir/libmaa/set.c
409417 /objdir/hello_dictd.test.out.tmp
410418 /objdir/libcommon/Makefile
411419 /objdir/libcommon/iswalnum.c
412 /objdir/libcommon/linkme.mk
413 /objdir/libcommon/str.c
414 /objdir/libdz/Makefile
415 /objdir/libdz/dz.c
416 /objdir/libdz/export.sym
417 /objdir/libdz/linkme.mk
418 /objdir/libmaa/Makefile
419 /objdir/libmaa/export.sym
420 /objdir/libmaa/linkme.mk
420 /objdir/libcommon/str.c
421 /objdir/libdz/Makefile
422 /objdir/libdz/dz.c
423 /objdir/libdz/export.sym
424 /objdir/libmaa/Makefile
425 /objdir/libmaa/export.sym
421426 /objdir/libmaa/log.c
422427 /objdir/libmaa/prime.c
423428 /objdir/libmaa/set.c
451456 /objdir/libcommon/Makefile
452457 /objdir/libcommon/iswalnum.c
453458 /objdir/libcommon/iswalnum.o
459 /objdir/libcommon/iswalnum.os
454460 /objdir/libcommon/libcommon.a
455 /objdir/libcommon/linkme.mk
461 /objdir/libcommon/libcommon_pic.a
456462 /objdir/libcommon/str.c
457463 /objdir/libcommon/str.o
458 /objdir/libdz/Makefile
459 /objdir/libdz/dz.c
460 /objdir/libdz/export.sym
461 /objdir/libdz/linkme.mk
464 /objdir/libcommon/str.os
465 /objdir/libdz/Makefile
466 /objdir/libdz/dz.c
467 /objdir/libdz/export.sym
462468 /objdir/libmaa/Makefile
463469 /objdir/libmaa/export.sym
464470 /objdir/libmaa/libmaa.a
465471 /objdir/libmaa/libmaa.so
466472 /objdir/libmaa/libmaa.so.1
467473 /objdir/libmaa/libmaa.so.1.2.0
468 /objdir/libmaa/linkme.mk
469474 /objdir/libmaa/log.c
470475 /objdir/libmaa/log.o
471476 /objdir/libmaa/log.os
505510 /objdir/libcommon/Makefile
506511 /objdir/libcommon/iswalnum.c
507512 /objdir/libcommon/iswalnum.o
513 /objdir/libcommon/iswalnum.os
508514 /objdir/libcommon/libcommon.a
509 /objdir/libcommon/linkme.mk
515 /objdir/libcommon/libcommon_pic.a
510516 /objdir/libcommon/str.c
511517 /objdir/libcommon/str.o
512 /objdir/libdz/Makefile
513 /objdir/libdz/dz.c
514 /objdir/libdz/export.sym
515 /objdir/libdz/linkme.mk
518 /objdir/libcommon/str.os
519 /objdir/libdz/Makefile
520 /objdir/libdz/dz.c
521 /objdir/libdz/export.sym
516522 /objdir/libmaa/Makefile
517523 /objdir/libmaa/export.sym
518524 /objdir/libmaa/libmaa.a
519525 /objdir/libmaa/libmaa.so
520526 /objdir/libmaa/libmaa.so.1
521527 /objdir/libmaa/libmaa.so.1.2.0
522 /objdir/libmaa/linkme.mk
523528 /objdir/libmaa/log.c
524529 /objdir/libmaa/log.o
525530 /objdir/libmaa/log.os
591596 /objdir/hello_dictd.test.out.tmp
592597 /objdir/libcommon/Makefile
593598 /objdir/libcommon/iswalnum.c
594 /objdir/libcommon/linkme.mk
595 /objdir/libcommon/str.c
596 /objdir/libdz/Makefile
597 /objdir/libdz/dz.c
598 /objdir/libdz/export.sym
599 /objdir/libdz/linkme.mk
600 /objdir/libmaa/Makefile
601 /objdir/libmaa/export.sym
602 /objdir/libmaa/linkme.mk
599 /objdir/libcommon/str.c
600 /objdir/libdz/Makefile
601 /objdir/libdz/dz.c
602 /objdir/libdz/export.sym
603 /objdir/libmaa/Makefile
604 /objdir/libmaa/export.sym
603605 /objdir/libmaa/log.c
604606 /objdir/libmaa/prime.c
605607 /objdir/libmaa/set.c
625627 /objdir/hello_dictd.test.out.tmp
626628 /objdir/libcommon/Makefile
627629 /objdir/libcommon/iswalnum.c
628 /objdir/libcommon/linkme.mk
629 /objdir/libcommon/str.c
630 /objdir/libdz/Makefile
631 /objdir/libdz/dz.c
632 /objdir/libdz/export.sym
633 /objdir/libdz/linkme.mk
634 /objdir/libmaa/Makefile
635 /objdir/libmaa/export.sym
636 /objdir/libmaa/linkme.mk
630 /objdir/libcommon/str.c
631 /objdir/libdz/Makefile
632 /objdir/libdz/dz.c
633 /objdir/libdz/export.sym
634 /objdir/libmaa/Makefile
635 /objdir/libmaa/export.sym
637636 /objdir/libmaa/log.c
638637 /objdir/libmaa/prime.c
639638 /objdir/libmaa/set.c
682681 /objdir/libcommon/Makefile
683682 /objdir/libcommon/iswalnum.c
684683 /objdir/libcommon/iswalnum.o
684 /objdir/libcommon/iswalnum.os
685685 /objdir/libcommon/libcommon.a
686 /objdir/libcommon/linkme.mk
686 /objdir/libcommon/libcommon_pic.a
687687 /objdir/libcommon/str.c
688688 /objdir/libcommon/str.o
689 /objdir/libdz/Makefile
690 /objdir/libdz/dz.c
691 /objdir/libdz/export.sym
692 /objdir/libdz/linkme.mk
689 /objdir/libcommon/str.os
690 /objdir/libdz/Makefile
691 /objdir/libdz/dz.c
692 /objdir/libdz/export.sym
693693 /objdir/libmaa/Makefile
694694 /objdir/libmaa/export.sym
695695 /objdir/libmaa/libmaa.a
696696 /objdir/libmaa/libmaa.so
697697 /objdir/libmaa/libmaa.so.1
698698 /objdir/libmaa/libmaa.so.1.2.0
699 /objdir/libmaa/linkme.mk
699 /objdir/libmaa/log.c
700 /objdir/libmaa/log.o
701 /objdir/libmaa/log.os
702 /objdir/libmaa/prime.c
703 /objdir/libmaa/prime.o
704 /objdir/libmaa/prime.os
705 /objdir/libmaa/set.c
706 /objdir/libmaa/set.o
707 /objdir/libmaa/set.os
708 /objdir/test.mk
709 =========== all with MKPIE=yes ============
710 /objdir/Makefile
711 /objdir/Makefile.inc
712 /objdir/_mkc_compiler_type.err
713 /objdir/_mkc_compiler_type.res
714 /objdir/_mkc_funclib_deflate.c
715 /objdir/_mkc_funclib_deflate.err
716 /objdir/_mkc_funclib_deflate.res
717 /objdir/_mkc_funclib_deflate_z.c
718 /objdir/_mkc_funclib_deflate_z.err
719 /objdir/_mkc_funclib_deflate_z.res
720 /objdir/_mkc_header_zlib_h.c
721 /objdir/_mkc_header_zlib_h.err
722 /objdir/_mkc_header_zlib_h.res
723 /objdir/_mkc_prog_cc.err
724 /objdir/_mkc_prog_cc.res
725 /objdir/dict/Makefile
726 /objdir/dict/dict
727 /objdir/dict/dict.1
728 /objdir/dict/dict.c
729 /objdir/dict/dict.cat1
730 /objdir/dict/dict.o
731 /objdir/dictd/Makefile
732 /objdir/dictd/dictd
733 /objdir/dictd/dictd.8
734 /objdir/dictd/dictd.c
735 /objdir/dictd/dictd.cat8
736 /objdir/dictd/dictd.o
737 /objdir/dictfmt/Makefile
738 /objdir/dictfmt/dictfmt
739 /objdir/dictfmt/dictfmt.1
740 /objdir/dictfmt/dictfmt.c
741 /objdir/dictfmt/dictfmt.cat1
742 /objdir/dictfmt/dictfmt.o
743 /objdir/dictzip/Makefile
744 /objdir/dictzip/dictzip
745 /objdir/dictzip/dictzip.1
746 /objdir/dictzip/dictzip.c
747 /objdir/dictzip/dictzip.cat1
748 /objdir/dictzip/dictzip.o
749 /objdir/doc/Makefile
750 /objdir/doc/doc.txt
751 /objdir/expect.out
752 /objdir/hello_dictd.test.out.tmp
753 /objdir/libcommon/Makefile
754 /objdir/libcommon/iswalnum.c
755 /objdir/libcommon/iswalnum.o
756 /objdir/libcommon/iswalnum.os
757 /objdir/libcommon/libcommon.a
758 /objdir/libcommon/libcommon_pic.a
759 /objdir/libcommon/str.c
760 /objdir/libcommon/str.o
761 /objdir/libcommon/str.os
762 /objdir/libdz/Makefile
763 /objdir/libdz/dz.c
764 /objdir/libdz/dz.o
765 /objdir/libdz/dz.os
766 /objdir/libdz/export.sym
767 /objdir/libdz/libdz.a
768 /objdir/libdz/libdz.so
769 /objdir/libdz/libdz.so.1
770 /objdir/libdz/libdz.so.1.0
771 /objdir/libmaa/Makefile
772 /objdir/libmaa/export.sym
773 /objdir/libmaa/libmaa.a
774 /objdir/libmaa/libmaa.so
775 /objdir/libmaa/libmaa.so.1
776 /objdir/libmaa/libmaa.so.1.2.0
777 /objdir/libmaa/log.c
778 /objdir/libmaa/log.o
779 /objdir/libmaa/log.os
780 /objdir/libmaa/prime.c
781 /objdir/libmaa/prime.o
782 /objdir/libmaa/prime.os
783 /objdir/libmaa/set.c
784 /objdir/libmaa/set.o
785 /objdir/libmaa/set.os
786 /objdir/test.mk
787 =========== all with STATICLIBS=everything... ============
788 /objdir/Makefile
789 /objdir/Makefile.inc
790 /objdir/_mkc_compiler_type.err
791 /objdir/_mkc_compiler_type.res
792 /objdir/_mkc_funclib_deflate.c
793 /objdir/_mkc_funclib_deflate.err
794 /objdir/_mkc_funclib_deflate.res
795 /objdir/_mkc_funclib_deflate_z.c
796 /objdir/_mkc_funclib_deflate_z.err
797 /objdir/_mkc_funclib_deflate_z.res
798 /objdir/_mkc_header_zlib_h.c
799 /objdir/_mkc_header_zlib_h.err
800 /objdir/_mkc_header_zlib_h.res
801 /objdir/_mkc_prog_cc.err
802 /objdir/_mkc_prog_cc.res
803 /objdir/dict/Makefile
804 /objdir/dict/dict
805 /objdir/dict/dict.1
806 /objdir/dict/dict.c
807 /objdir/dict/dict.cat1
808 /objdir/dict/dict.o
809 /objdir/dictd/Makefile
810 /objdir/dictd/dictd
811 /objdir/dictd/dictd.8
812 /objdir/dictd/dictd.c
813 /objdir/dictd/dictd.cat8
814 /objdir/dictd/dictd.o
815 /objdir/dictfmt/Makefile
816 /objdir/dictfmt/dictfmt
817 /objdir/dictfmt/dictfmt.1
818 /objdir/dictfmt/dictfmt.c
819 /objdir/dictfmt/dictfmt.cat1
820 /objdir/dictfmt/dictfmt.o
821 /objdir/dictzip/Makefile
822 /objdir/dictzip/dictzip
823 /objdir/dictzip/dictzip.1
824 /objdir/dictzip/dictzip.c
825 /objdir/dictzip/dictzip.cat1
826 /objdir/dictzip/dictzip.o
827 /objdir/doc/Makefile
828 /objdir/doc/doc.txt
829 /objdir/expect.out
830 /objdir/hello_dictd.test.out.tmp
831 /objdir/libcommon/Makefile
832 /objdir/libcommon/iswalnum.c
833 /objdir/libcommon/iswalnum.o
834 /objdir/libcommon/iswalnum.os
835 /objdir/libcommon/libcommon.a
836 /objdir/libcommon/libcommon_pic.a
837 /objdir/libcommon/str.c
838 /objdir/libcommon/str.o
839 /objdir/libcommon/str.os
840 /objdir/libdz/Makefile
841 /objdir/libdz/dz.c
842 /objdir/libdz/dz.o
843 /objdir/libdz/dz.os
844 /objdir/libdz/export.sym
845 /objdir/libdz/libdz.a
846 /objdir/libdz/libdz_pic.a
847 /objdir/libmaa/Makefile
848 /objdir/libmaa/export.sym
849 /objdir/libmaa/libmaa.a
850 /objdir/libmaa/libmaa_pic.a
700851 /objdir/libmaa/log.c
701852 /objdir/libmaa/log.o
702853 /objdir/libmaa/log.os
44
55 WARNS = 4
66
7 MKINSTALL = no
8
97 .include <mkc.lib.mk>
+0
-5
examples/hello_dictd/libcommon/linkme.mk less more
0 PATH.common := ${.PARSEDIR}
1
2 CPPFLAGS += -I${PATH.common}
3 DPLIBDIRS += ${PATH.common}
4 LDADD0 += -lcommon
44 return 3;
55 }
66
7 /* fake must not be exported */
8 int fake2 (void);
7 /* fake22 must not be exported */
8 int fake22 (void);
99
10 int fake2 (void)
10 int fake22 (void)
1111 {
12 return 2;
12 return 22;
1313 }
+0
-5
examples/hello_dictd/libdz/linkme.mk less more
0 PATH.dz := ${.PARSEDIR}
1
2 CPPFLAGS += -I${PATH.dz}
3 DPLIBDIRS += ${PATH.dz}
4 LDADD0 += -ldz
+0
-5
examples/hello_dictd/libmaa/linkme.mk less more
0 PATH.maa := ${.PARSEDIR}
1
2 CPPFLAGS += -I${PATH.maa}
3 DPLIBDIRS += ${PATH.maa}
4 LDADD0 += -lmaa
00 next_level != expr ${.MAKE.LEVEL} + 1
1
2 run_nm := env NM=${NM:Q} OPSYS=${OPSTS:Q} mkc_test_nm
13
24 .PHONY : test_output
35 test_output :
810 rm -rf ${.OBJDIR}${PREFIX}; \
911 LD_LIBRARY_PATH=${.CURDIR}/libdz:${.CURDIR}/libmaa:$$LD_LIBRARY_PATH; \
1012 DYLD_LIBRARY_PATH=${.CURDIR}/libdz:${.CURDIR}/libmaa:$$LD_LIBRARY_PATH; \
11 export LD_LIBRARY_PATH DYLD_LIBRARY_PATH; \
13 LIBRARY_PATH=$$LIBRARY_PATH:$$LD_LIBRARY_PATH; \
14 export LD_LIBRARY_PATH DYLD_LIBRARY_PATH LIBRARY_PATH; \
1215 ${.CURDIR}/dict/dict; \
1316 ${.CURDIR}/dictd/dictd; \
1417 ${.CURDIR}/dictfmt/dictfmt; \
1619 \
1720 echo =========== nm ============; \
1821 case ${OPSYS} in \
19 OpenBSD) \
20 ${NM} ${.CURDIR}/libmaa/libmaa*.so | awk '$$2=="T" {print "libmaa " $$3}'; \
21 ${NM} ${.CURDIR}/libdz/libdz*.so | awk '$$2=="T" {print "libdz " $$3}';; \
22 *BSD|SunOS|DragonFly) \
23 ${NM} -P ${.CURDIR}/libmaa/libmaa*.so | awk 'NF==4 && $$2=="T" {print "libmaa " $$1}'; \
24 ${NM} -P ${.CURDIR}/libdz/libdz*.so | awk 'NF==4 && $$2=="T" {print "libdz " $$1}';; \
25 Linux) \
26 ${NM} -P ${.CURDIR}/libmaa/libmaa*.so | awk 'NF==4 && $$2 ~ /^[DT]$$/ {print "libmaa " $$1}'; \
27 ${NM} -P ${.CURDIR}/libdz/libdz*.so | awk 'NF==4 && $$2 ~ /^[DT]$$/ {print "libdz " $$1}';; \
22 *BSD|DragonFly|SunOS|Linux) \
23 ${run_nm} ${OBJDIR_libmaa}/libmaa*.so; \
24 echo =; \
25 ${run_nm} ${OBJDIR_libdz}/libdz*.so;; \
2826 *) \
29 printf 'libmaa fake4\nlibmaa fake5\nlibmaa fake6\nlibdz fake3\n';; \
27 printf 'symbol fake4\nsymbol fake5\nsymbol fake6\n=\nsymbol fake3\n';; \
3028 esac; \
3129 \
3230 echo =========== all ============; \
3432 find ${.OBJDIR} -type f -o -type l | \
3533 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
3634 \
35 echo ========= INTERNALLIBS ==========; \
36 { ${MAKE} ${MAKEFLAGS} installdirs DESTDIR=${.OBJDIR}; \
37 ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR}; \
38 ${MAKE} ${MAKEFLAGS} uninstall DESTDIR=${.OBJDIR}; } 2>&1 | awk '/^(un)?install/'; \
39 rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/home ${.OBJDIR}/Users; \
3740 echo ========= installdirs ==========; \
3841 ${MAKE} ${MAKEFLAGS} installdirs DESTDIR=${.OBJDIR} > /dev/null; \
3942 find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \
6366 ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
6467 find ${.OBJDIR} -type f -o -type l | \
6568 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
66 rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/home; \
69 rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/home ${.OBJDIR}/Users; \
6770 echo =========== MKOBJDIRS=auto ============; \
6871 env TARGETS=fake ${MAKE} ${MAKEFLAGS} fake \
6972 MKCHECKS=no MAKEOBJDIRPREFIX=${.OBJDIR}/obj1 > /dev/null; \
167170 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
168171 unset NOSUBDIR; \
169172 \
173 echo =========== all with MKPIE=yes ============; \
174 ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
175 ${MAKE} ${MAKEFLAGS} -j4 all MKPIE=yes > /dev/null; \
176 find ${.OBJDIR} -type f -o -type l | \
177 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
178 \
179 echo =========== all with STATICLIBS=everything... ============; \
180 ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
181 env STATICLIBS='libmaa libdz' ${MAKE} ${MAKEFLAGS} -j4 all > /dev/null; \
182 find ${.OBJDIR} -type f -o -type l | \
183 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
184 \
170185 echo =========== print_deps ============; \
171186 ${MAKE} ${MAKEFLAGS} print_deps | grep -E '^(all|test)'; \
172187 echo =====; \
0 PROG = hello
1
2 WARNS = 4
3
4 MKC_FEATURES = err warn
5
6 MKC_REQD = 0.26.0
7
8 .include "test.mk"
9 .include <mkc.mk>
0 ======= ex ==========
1 hello: warnx test1: Cannot allocate memory
2 hello: errx test1: Cannot allocate memory
3 $?=21
4 hello: warnx test2, six=6: Cannot allocate memory
5 hello: errx test2, six=6: Cannot allocate memory
6 $?=22
7 errx(3): invalid argv
8 $?=94
9 hello: warn test1
10 hello: err test1
11 $?=11
12 hello: warn test2, five=5
13 hello: err test2, five=5
14 $?=12
15 err(3): invalid argv
16 $?=93
17 ======= CLEANFILES ==========
18 hello.o
19 progname.o
20 err.o
21 warn.o
22 ======= cleandir ==========
0 #include <errno.h>
1 #include <string.h>
2 #include <stdio.h>
3
4 #include <mkc_err.h>
5 #include <mkc_warn.h>
6
7 int main (int argc, char ** argv)
8 {
9 --argc;
10 ++argv;
11
12 if (argc != 2)
13 return (90);
14
15 if (!strcmp (argv [0], "errx")){
16 switch (argv [1][0]){
17 case '1':
18 warnx ("warn test1");
19 errx (11, "err test1");
20 break;
21 case '2':
22 warnx ("warn test2, five=%d", 5);
23 errx (12, "err test2, five=%d", 5);
24 break;
25 default:
26 fprintf (stderr, "err(3): invalid argv\n");
27 return 93;
28 }
29 }else if (!strcmp (argv [0], "err")){
30 switch (argv [1][0]){
31 case '1':
32 errno = ENOMEM;
33 warn ("warnx test1");
34 errno = ENOMEM;
35 err (21, "errx test1");
36 break;
37 case '2':
38 errno = ENOMEM;
39 warn ("warnx test2, six=%d", 6);
40 errno = ENOMEM;
41 err (22, "errx test2, six=%d", 6);
42 break;
43 default:
44 fprintf (stderr, "errx(3): invalid argv\n");
45 return 94;
46 }
47 }else{
48 fprintf (stderr, "bad err id '%s'\n", argv [0]);
49 return (91);
50 }
51
52 return 0;
53 }
0 SUBST_CMD=sed -e 's,Not enough space,Cannot allocate memory,'
1
2 .PHONY : test_output
3 test_output:
4 @\
5 echo ======= ex ==========; \
6 { ${.OBJDIR}/hello err 1 2>&1 >/dev/null; echo '$$?='$$?; } | ${SUBST_CMD}; \
7 { ${.OBJDIR}/hello err 2 2>&1 >/dev/null; echo '$$?='$$?; } | ${SUBST_CMD}; \
8 { ${.OBJDIR}/hello err 3 2>&1 >/dev/null; echo '$$?='$$?; } | ${SUBST_CMD}; \
9 ${.OBJDIR}/hello errx 1 2>&1 >/dev/null; echo '$$?='$$?; \
10 ${.OBJDIR}/hello errx 2 2>&1 >/dev/null; echo '$$?='$$?; \
11 ${.OBJDIR}/hello errx 3 2>&1 >/dev/null; echo '$$?='$$?; \
12 echo ======= CLEANFILES ==========; \
13 ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \
14 awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}'; \
15 echo ======= cleandir ==========; \
16 ${MAKE} ${MAKEFLAGS} cleandir > /dev/null
17
18 .include <mkc.minitest.mk>
0 MKC_FEATURES = fgetln err
1
2 PROG = hello
3
4 WARNS = 4
5
6 MKC_REQD = 0.26.0
7
8 .include "test.mk"
9 .include <mkc.prog.mk>
0 # Copyright (c) 2009, Aleksey Cheusov <vle@gmx.net>
1 # All rights reserved.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions
5 # are met:
6 # 1. Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer.
8 # 2. Redistributions in binary form must reproduce the above copyright
9 # notice, this list of conditions and the following disclaimer in the
10 # documentation and/or other materials provided with the distribution.
11 #
12 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
13 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
14 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
15 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
16 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22 # POSSIBILITY OF SUCH DAMAGE.
23 =========== all ============
24 /objdir/Makefile
25 /objdir/_mkc_compiler_type.err
26 /objdir/_mkc_compiler_type.res
27 /objdir/_mkc_func0_getexecname_stdlib_h.c
28 /objdir/_mkc_func0_getexecname_stdlib_h.err
29 /objdir/_mkc_func0_getexecname_stdlib_h.res
30 /objdir/_mkc_func0_getprogname_stdlib_h.c
31 /objdir/_mkc_func0_getprogname_stdlib_h.err
32 /objdir/_mkc_func0_getprogname_stdlib_h.res
33 /objdir/_mkc_func1_setprogname_stdlib_h.c
34 /objdir/_mkc_func1_setprogname_stdlib_h.err
35 /objdir/_mkc_func1_setprogname_stdlib_h.res
36 /objdir/_mkc_func3_err_err_h.c
37 /objdir/_mkc_func3_err_err_h.err
38 /objdir/_mkc_func3_err_err_h.res
39 /objdir/_mkc_func3_errx_err_h.c
40 /objdir/_mkc_func3_errx_err_h.err
41 /objdir/_mkc_func3_errx_err_h.res
42 /objdir/_mkc_func3_fgetln_stdio_h.c
43 /objdir/_mkc_func3_fgetln_stdio_h.err
44 /objdir/_mkc_func3_fgetln_stdio_h.res
45 /objdir/_mkc_func3_getline_stdio_h.c
46 /objdir/_mkc_func3_getline_stdio_h.err
47 /objdir/_mkc_func3_getline_stdio_h.res
48 /objdir/_mkc_func3_verr_err_h.c
49 /objdir/_mkc_func3_verr_err_h.err
50 /objdir/_mkc_func3_verr_err_h.res
51 /objdir/_mkc_func3_verrx_err_h.c
52 /objdir/_mkc_func3_verrx_err_h.err
53 /objdir/_mkc_func3_verrx_err_h.res
54 /objdir/_mkc_funclib_err.c
55 /objdir/_mkc_funclib_err.err
56 /objdir/_mkc_funclib_err.res
57 /objdir/_mkc_funclib_errx.c
58 /objdir/_mkc_funclib_errx.err
59 /objdir/_mkc_funclib_errx.res
60 /objdir/_mkc_funclib_fgetln.c
61 /objdir/_mkc_funclib_fgetln.err
62 /objdir/_mkc_funclib_fgetln.res
63 /objdir/_mkc_funclib_getline.c
64 /objdir/_mkc_funclib_getline.err
65 /objdir/_mkc_funclib_getline.res
66 /objdir/_mkc_funclib_getprogname.c
67 /objdir/_mkc_funclib_getprogname.err
68 /objdir/_mkc_funclib_getprogname.res
69 /objdir/_mkc_funclib_setprogname.c
70 /objdir/_mkc_funclib_setprogname.err
71 /objdir/_mkc_funclib_setprogname.res
72 /objdir/_mkc_funclib_verr.c
73 /objdir/_mkc_funclib_verr.err
74 /objdir/_mkc_funclib_verr.res
75 /objdir/_mkc_funclib_verrx.c
76 /objdir/_mkc_funclib_verrx.err
77 /objdir/_mkc_funclib_verrx.res
78 /objdir/_mkc_header_err_h.c
79 /objdir/_mkc_header_err_h.err
80 /objdir/_mkc_header_err_h.res
81 /objdir/_mkc_prog_cc.err
82 /objdir/_mkc_prog_cc.res
83 /objdir/_mkc_variable_program_invocation_short_name_errno_h.c
84 /objdir/_mkc_variable_program_invocation_short_name_errno_h.err
85 /objdir/_mkc_variable_program_invocation_short_name_errno_h.res
86 /objdir/expect.out
87 /objdir/hello
88 /objdir/hello.c
89 /objdir/hello.o
90 /objdir/hello_fgetln.test.out.tmp
91 /objdir/test.mk
92 ======= CLEANFILES ==========
93 hello.o
94 getline.o
95 fgetln.o
96 progname.o
97 err.o
98 ======= cleandir ==========
0 #include <stdio.h>
1 #include <string.h>
2 #include <stdlib.h>
3
4 #include <mkc_fgetln.h>
5 #include <mkc_err.h>
6
7 int main (int argc, char ** argv)
8 {
9 char *buf, *lbuf;
10 size_t len;
11
12 while ((lbuf = buf = fgetln (stdin, &len)) != NULL) {
13 if (len > 0 && buf [len - 1] == '\n')
14 buf[len - 1] = '\0';
15 else if ((lbuf = strndup (buf, len + 1)) == NULL)
16 err (1, NULL);
17 printf ("%s\n", lbuf);
18
19 if (lbuf != buf)
20 free (lbuf);
21 }
22 return 0;
23 }
0 FUNCS_RE=(fgetln|getline|err|progname)[.]o
1
2 .PHONY : test_output
3 test_output:
4 @set -e; \
5 ${.OBJDIR}/hello < ${.CURDIR}/../hello_strlcpy2/input.in; \
6 rm -rf ${.OBJDIR}${PREFIX}; \
7 \
8 echo =========== all ============; \
9 find ${.OBJDIR} -type f | grep -Ev '${FUNCS_RE}' | \
10 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
11 \
12 echo ======= CLEANFILES ==========; \
13 ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \
14 awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}'; \
15 echo ======= cleandir ==========; \
16 ${MAKE} ${MAKEFLAGS} cleandir > /dev/null
17
18 .include <mkc.minitest.mk>
0 =========== vars ============
1 CLEANFILES=/path/to/hello_files.test.out pod2htmd.tmp pod2htmi.tmp shell_func.cat7 shell_func.html7 shell_func.info
2 DISTCLEANFILES=/path/to/_mkc_*
03 =========== all ============
14 /objdir/DEBIAN/control
25 /objdir/Makefile
0 =========== vars ============
1 CLEANFILES=/path/to/hello_files.test.out pod2htmd.tmp pod2htmi.tmp shell_func.cat7 shell_func.html7 shell_func.info
2 DISTCLEANFILES=/path/to/_mkc_*
03 =========== all ============
14 /objdir/DEBIAN/control
25 /objdir/Makefile
33 MKCATPAGES=yes; export MKCATPAGES; \
44 rm -rf ${.OBJDIR}${PREFIX}; \
55 \
6 echo =========== vars ============; \
7 echo CLEANFILES=${CLEANFILES:Q} | \
8 mkc_test_helper_paths; \
9 echo DISTCLEANFILES=${DISTCLEANFILES:Q} | \
10 mkc_test_helper_paths; \
611 echo =========== all ============; \
712 ${MAKE} ${MAKEFLAGS} -j4 all > /dev/null; \
813 find ${.OBJDIR} -type f -o -type l | \
0 LIBDEPS += libs/libfoo:libs/libfooqux
1 LIBDEPS += libs/libbar:progs/fooquxfoobar
2 LIBDEPS += libs/libfooqux:progs/fooquxfoobar
3 LIBDEPS += libs/libfoo:progs/foobaz libs/libbaz:progs/foobaz
4
5 .include "test.mk"
6 .include <mkc.mk>
0 =========== fooquxfoobar ============
1 I am foo
2 and qux
3 I am foo
4 I am bar
5 =========== foobaz ============
6 I am foo
7 I am baz
8 =========== depends ============
9 bar.o bar.o bar.o: bar.c bar.h
10 baz.o baz.o baz.o: baz.c include/baz.h
11 foo.o foo.o foo.o: foo.c foo.h
12 foobaz.o foobaz.o foobaz.o: foobaz.c /objdir/libs/libfoo/foo.h /objdir/libs/libbaz/include/baz.h
13 fooqux.o fooqux.o fooqux.o: fooqux.c fooqux.h /objdir/libs/libfoo/foo.h
14 fooquxfoobar.o fooquxfoobar.o fooquxfoobar.o: fooquxfoobar.c /objdir/libs/libfooqux/fooqux.h /objdir/libs/libfoo/foo.h /objdir/libs/libbar/bar.h
15 ======= install ==========
16 /objdir/prefix/bin/foobaz
17 /objdir/prefix/bin/fooquxfoobar
18 /objdir/prefix/include/bar.h
19 /objdir/prefix/include/baz.h
20 /objdir/prefix/include/foo.h
21 /objdir/prefix/include/fooqux.h
22 /objdir/prefix/lib/libbar.a
23 /objdir/prefix/lib/libbar.so
24 /objdir/prefix/lib/libbar.so.0
25 /objdir/prefix/lib/libbar.so.0.0
26 /objdir/prefix/lib/libbazbaz.a
27 /objdir/prefix/lib/libfoo.a
28 /objdir/prefix/lib/libfoo.so
29 /objdir/prefix/lib/libfoo.so.0
30 /objdir/prefix/lib/libfoo.so.0.0
31 /objdir/prefix/lib/libfooqux.a
32 /objdir/prefix/lib/libfooqux.so
33 /objdir/prefix/lib/libfooqux.so.0
34 /objdir/prefix/lib/libfooqux.so.0.0
35 =========== all with STATICLIBS=... ============
36 /objdir/Makefile
37 /objdir/_mkc_compiler_type.err
38 /objdir/_mkc_compiler_type.res
39 /objdir/_mkc_prog_cc.err
40 /objdir/_mkc_prog_cc.res
41 /objdir/expect.out
42 /objdir/hello_libdeps.test.out.tmp
43 /objdir/libs/libbar/Makefile
44 /objdir/libs/libbar/bar.c
45 /objdir/libs/libbar/bar.h
46 /objdir/libs/libbar/bar.o
47 /objdir/libs/libbar/bar.os
48 /objdir/libs/libbar/libbar.a
49 /objdir/libs/libbar/libbar_pic.a
50 /objdir/libs/libbaz/Makefile
51 /objdir/libs/libbaz/baz.c
52 /objdir/libs/libbaz/baz.o
53 /objdir/libs/libbaz/include/baz.h
54 /objdir/libs/libbaz/libbazbaz.a
55 /objdir/libs/libbaz/linkme.mk
56 /objdir/libs/libfoo/Makefile
57 /objdir/libs/libfoo/foo.c
58 /objdir/libs/libfoo/foo.h
59 /objdir/libs/libfoo/foo.o
60 /objdir/libs/libfoo/foo.os
61 /objdir/libs/libfoo/libfoo.a
62 /objdir/libs/libfoo/libfoo_pic.a
63 /objdir/libs/libfoo/linkme.mk
64 /objdir/libs/libfooqux/Makefile
65 /objdir/libs/libfooqux/fooqux.c
66 /objdir/libs/libfooqux/fooqux.h
67 /objdir/libs/libfooqux/fooqux.o
68 /objdir/libs/libfooqux/fooqux.os
69 /objdir/libs/libfooqux/libfooqux.a
70 /objdir/libs/libfooqux/libfooqux.so
71 /objdir/libs/libfooqux/libfooqux.so.0
72 /objdir/libs/libfooqux/libfooqux.so.0.0
73 /objdir/progs/foobaz/Makefile
74 /objdir/progs/foobaz/foobaz
75 /objdir/progs/foobaz/foobaz.c
76 /objdir/progs/foobaz/foobaz.o
77 /objdir/progs/fooquxfoobar/Makefile
78 /objdir/progs/fooquxfoobar/fooquxfoobar
79 /objdir/progs/fooquxfoobar/fooquxfoobar.c
80 /objdir/progs/fooquxfoobar/fooquxfoobar.o
81 /objdir/test.mk
82 ========= install with STATICLIBS=... ==========
83 /objdir/prefix
84 /objdir/prefix/bin
85 /objdir/prefix/bin/foobaz
86 /objdir/prefix/bin/fooquxfoobar
87 /objdir/prefix/include
88 /objdir/prefix/include/bar.h
89 /objdir/prefix/include/baz.h
90 /objdir/prefix/include/foo.h
91 /objdir/prefix/include/fooqux.h
92 /objdir/prefix/lib
93 /objdir/prefix/lib/libbar.a
94 /objdir/prefix/lib/libbar_pic.a
95 /objdir/prefix/lib/libbazbaz.a
96 /objdir/prefix/lib/libfoo.a
97 /objdir/prefix/lib/libfoo_pic.a
98 /objdir/prefix/lib/libfooqux.a
99 /objdir/prefix/lib/libfooqux.so
100 /objdir/prefix/lib/libfooqux.so.0
101 /objdir/prefix/lib/libfooqux.so.0.0
102 symbol foo
103 symbol fooqux
104 ======= distclean ==========
105 /objdir/Makefile
106 /objdir/expect.out
107 /objdir/hello_libdeps.test.out.tmp
108 /objdir/libs/libbar/Makefile
109 /objdir/libs/libbar/bar.c
110 /objdir/libs/libbar/bar.h
111 /objdir/libs/libbaz/Makefile
112 /objdir/libs/libbaz/baz.c
113 /objdir/libs/libbaz/include/baz.h
114 /objdir/libs/libbaz/linkme.mk
115 /objdir/libs/libfoo/Makefile
116 /objdir/libs/libfoo/foo.c
117 /objdir/libs/libfoo/foo.h
118 /objdir/libs/libfoo/linkme.mk
119 /objdir/libs/libfooqux/Makefile
120 /objdir/libs/libfooqux/fooqux.c
121 /objdir/libs/libfooqux/fooqux.h
122 /objdir/progs/foobaz/Makefile
123 /objdir/progs/foobaz/foobaz.c
124 /objdir/progs/fooquxfoobar/Makefile
125 /objdir/progs/fooquxfoobar/fooquxfoobar.c
126 /objdir/test.mk
0 LIB = bar
1 INCS = bar.h
2
3 SHLIB_MAJOR = 0
4 SHLIB_MINOR = 0
5
6 WARNS = 4
7
8 .include <mkc.mk>
0 #include "bar.h"
1
2 #include <stdio.h>
3
4 void bar (void)
5 {
6 puts ("I am bar");
7 }
0 #ifndef _BAR_H_
1 #define _BAR_H_
2
3 void bar (void);
4
5 #endif // _BAR_H_
0 LIB = bazbaz # LIB name is not equal to ${.CURDIR:T}!
1 SRCS = baz.c
2 INCS = baz.h
3 INCSSRCDIR = include
4
5 CPPFLAGS += ${INCSSRCDIR}
6
7 WARNS = 4
8
9 .include <mkc.mk>
0 #include "baz.h"
1
2 #include <stdio.h>
3
4 void baz (void)
5 {
6 puts ("I am baz");
7 }
0 #ifndef _BAZ_H_
1 #define _BAZ_H_
2
3 void baz (void);
4
5 #endif // _BAZ_H_
0 PATH.baz := ${.PARSEDIR:tA}
1
2 DPINCDIRS += ${PATH.baz}/include # non-default dir for headers
3 DPLIBDIRS += ${OBJDIR_libs_libbaz}
4 DPLDADD += bazbaz # non-default library name
0 LIB = foo
1 INCS = foo.h
2
3 SHLIB_MAJOR = 0
4 SHLIB_MINOR = 0
5
6 WARNS = 4
7
8 .include <mkc.mk>
0 #include "foo.h"
1
2 #include <stdio.h>
3
4 void foo (void)
5 {
6 puts ("I am foo");
7 }
0 #ifndef _FOO_H_
1 #define _FOO_H_
2
3 void foo (void);
4
5 #endif // _FOO_H_
0 # empty linkme.mk is useless, this is a part of regression tests
0 LIB = fooqux
1 INCS = fooqux.h
2
3 SHLIB_MAJOR = 0
4 SHLIB_MINOR = 0
5
6 WARNS = 4
7
8 .include <mkc.mk>
0 #include "fooqux.h"
1
2 #include <stdio.h>
3
4 void fooqux (void)
5 {
6 foo ();
7 puts (" and qux");
8 }
0 #ifndef _FOOQUX_H_
1 #define _FOOQUX_H_
2
3 #include "foo.h"
4
5 void fooqux (void);
6
7 #endif // _FOOQUX_H_
0 PROG = foobaz
1
2 WARNS = 4
3
4 .include <mkc.mk>
0 #include "foo.h"
1 #include "baz.h"
2
3 #include <stdio.h>
4
5 int main (int argc, char **argv)
6 {
7 foo ();
8 baz ();
9 return 0;
10 }
0 PROG = fooquxfoobar
1
2 WARNS = 4
3
4 .include <mkc.mk>
0 #include "fooqux.h"
1 #include "bar.h"
2
3 #include <stdio.h>
4
5 int main (int argc, char **argv)
6 {
7 fooqux ();
8 foo ();
9 bar ();
10 return 0;
11 }
0 run_nm := env NM=${NM:Q} OPSYS=${OPSTS:Q} mkc_test_nm
1
2 .PHONY : test_output
3 test_output:
4 @set -e; LC_ALL=C; export LC_ALL; \
5 LD_LIBRARY_PATH=${OBJDIR_libs_libfoo}:${OBJDIR_libs_libfooqux}:${OBJDIR_libs_libbar}:${OBJDIR_libs_libbaz}; \
6 DYLD_LIBRARY_PATH=$$LD_LIBRARY_PATH; \
7 LIBRARY_PATH=$$LIBRARY_PATH:$$LD_LIBRARY_PATH; \
8 export LD_LIBRARY_PATH DYLD_LIBRARY_PATH LIBRARY_PATH; \
9 echo =========== fooquxfoobar ============; \
10 ${OBJDIR_progs_fooquxfoobar}/fooquxfoobar; \
11 echo =========== foobaz ============; \
12 ${OBJDIR_progs_foobaz}/foobaz; \
13 rm -rf ${.OBJDIR}${PREFIX}; \
14 \
15 echo =========== depends ============; \
16 ${MAKE} ${MAKEFLAGS} -j4 depend > /dev/null; \
17 mkc_long_lines `find ${.CURDIR} -type f -name .depend` | \
18 awk '!/^#/ {for (i=1; i <= NF; ++i) if ($$i ~ /^\// && $$i !~ /mk-configure/) $$i = ""; print $$0; }' | \
19 awk '{$$1 = $$1; gsub(/[.]o[ps]/, ".o"); print $$0}' | sort | \
20 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
21 \
22 echo ======= install ==========; \
23 ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} > /dev/null; \
24 find ${.OBJDIR}${PREFIX} -type f -o -type l | \
25 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
26 rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/Users ${.OBJDIR}/home; \
27 \
28 echo =========== all with STATICLIBS=... ============; \
29 ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
30 env STATICLIBS='libfoo libbar' ${MAKE} ${MAKEFLAGS} -j4 all > /dev/null; \
31 find ${.OBJDIR} -type f -o -type l | \
32 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
33 \
34 echo ========= install with STATICLIBS=... ==========; \
35 env STATICLIBS='libfoo libbar' ${MAKE} ${MAKEFLAGS} install DESTDIR=${.OBJDIR} > /dev/null; \
36 find ${.OBJDIR}${PREFIX} -type f -o -type l -o -type d | \
37 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
38 case ${OPSYS} in \
39 *BSD|DragonFly|SunOS|Linux) \
40 ${run_nm} ${OBJDIR_libfooqux}/libfooqux.so;; \
41 *) \
42 printf 'symbol foo\nsymbol fooqux\n';; \
43 esac; \
44 rm -rf ${.OBJDIR}${PREFIX} ${.OBJDIR}/usr ${.OBJDIR}/home ${.OBJDIR}/Users; \
45 \
46 echo ======= distclean ==========; \
47 ${MAKE} ${MAKEFLAGS} distclean > /dev/null; \
48 find ${.OBJDIR} -type f | \
49 mkc_test_helper "${PREFIX}" "${.OBJDIR}"
50
51 .include <mkc.minitest.mk>
66 SCRIPTS = ${INSCRIPTS}
77
88 INTEXTS_REPLS = LUA ${PROG.lua}
9 MKC_CHECK_PROGS = lua
9 MKC_REQUIRE_PROGS = lua
1010
1111 .include "test.mk"
1212 .include <mkc.lib.mk>
0 MKC_REQUIRE_BUILTINS += prog_gawk prog_flex prog_gm4 prog_bison
0 MKC_REQUIRE_BUILTINS += prog_gawk prog_flex prog_gm4 prog_bison prog_gmake
11
22 SCRIPTS = fake
33
4 test: error-check
5 @echo ${CUSTOM.prog_gawk}
6 @echo ${CUSTOM.prog_gm4}
7 @echo ${CUSTOM.prog_flex}
8 @echo ${CUSTOM.prog_bison}
4 test: errorcheck
5 @echo GNU awk: ${CUSTOM.prog_gawk}
6 @echo GNU m4: ${CUSTOM.prog_gm4}
7 @echo GNU make: ${CUSTOM.prog_gmake}
8 @echo flex: ${CUSTOM.prog_flex}
9 @echo bison: ${CUSTOM.prog_bison}
910
1011 .include <mkc.prog.mk>
22
33 WARNS = 4
44
5 SCRIPTS = hello_world2 hello_world3
5 INSCRIPTS = hello_world3
6 SCRIPTS = hello_world2 ${INSCRIPTS}
67 SCRIPTS += ${:!echo more_scripts/*!:N*/CVS}
78
89 SCRIPTSDIR_more_scripts_script1 = ${BINDIR}/subdir1
1213 SCRIPTSDIR_more_scripts_script3 = ${BINDIR}/subdir3
1314 SCRIPTSNAME_more_scripts_script3 = myscript3
1415
16 MKC_REQUIRE_PROGS = awk
17 INTEXTS_REPLS = AWK ${PROG.awk}
18
1519 MAN = hello_world.1
1620
1721 MKC_REQD = 0.10.0
44 /objdir/Makefile
55 /objdir/_mkc_compiler_type.err
66 /objdir/_mkc_compiler_type.res
7 /objdir/_mkc_prog_awk.err
8 /objdir/_mkc_prog_awk.res
79 /objdir/_mkc_prog_cc.err
810 /objdir/_mkc_prog_cc.res
911 /objdir/expect.out
1214 /objdir/hello_world1
1315 /objdir/hello_world2
1416 /objdir/hello_world3
17 /objdir/hello_world3.in
1518 /objdir/main.c
1619 /objdir/main.o
1720 /objdir/more_scripts/script1
4144 /objdir/Makefile
4245 /objdir/_mkc_compiler_type.err
4346 /objdir/_mkc_compiler_type.res
47 /objdir/_mkc_prog_awk.err
48 /objdir/_mkc_prog_awk.res
4449 /objdir/_mkc_prog_cc.err
4550 /objdir/_mkc_prog_cc.res
4651 /objdir/expect.out
4752 /objdir/hello_scripts.test.out.tmp
4853 /objdir/hello_world.1
4954 /objdir/hello_world2
50 /objdir/hello_world3
55 /objdir/hello_world3.in
5156 /objdir/main.c
5257 /objdir/more_scripts/script1
5358 /objdir/more_scripts/script2
6065 /objdir/hello_scripts.test.out.tmp
6166 /objdir/hello_world.1
6267 /objdir/hello_world2
63 /objdir/hello_world3
68 /objdir/hello_world3.in
6469 /objdir/main.c
6570 /objdir/more_scripts/script1
6671 /objdir/more_scripts/script2
7176 /objdir/Makefile
7277 /objdir/_mkc_compiler_type.err
7378 /objdir/_mkc_compiler_type.res
79 /objdir/_mkc_prog_awk.err
80 /objdir/_mkc_prog_awk.res
7481 /objdir/_mkc_prog_cc.err
7582 /objdir/_mkc_prog_cc.res
7683 /objdir/expect.out
8087 /objdir/hello_world1
8188 /objdir/hello_world2
8289 /objdir/hello_world3
90 /objdir/hello_world3.in
8391 /objdir/main.c
8492 /objdir/main.o
8593 /objdir/more_scripts/script1
+0
-6
examples/hello_scripts/hello_world3 less more
0 #!/usr/bin/awk -f
1
2 BEGIN {
3 print "Hello World 3!"
4 exit 0
5 }
0 #!@AWK@ -f
1
2 BEGIN {
3 print "Hello World 3!"
4 exit 0
5 }
8787 /objdir/strlcpy.c
8888 /objdir/test.mk
8989 ======= CLEANFILES ==========
90 hello.o
9091 strlcpy.o
9192 getline.o
92 hello.o
3131 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
3232 \
3333 echo ======= CLEANFILES ==========; \
34 ${MAKE} ${MAKEFLAGS} print-values VARS='CLEANFILES' MKCHECKS=no | \
35 awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o$$/) print $$i}'
34 ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \
35 awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}'
3636
3737 .include <mkc.minitest.mk>
8787 /objdir/missing/strlcpy.c
8888 /objdir/test.mk
8989 ======= CLEANFILES ==========
90 hello.o
9091 strlcpy.o
9192 getline.o
92 hello.o
3131 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
3232 \
3333 echo ======= CLEANFILES ==========; \
34 ${MAKE} ${MAKEFLAGS} print-values VARS='CLEANFILES' MKCHECKS=no | \
35 awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o$$/) print $$i}'
34 ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \
35 awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}'
3636
3737 .include <mkc.minitest.mk>
22
33 WARNS = 4
44
5 MKC_FEATURES = strlcpy strlcat getline
5 MKC_FEATURES = strlcpy strlcat getline progname
66
77 MKC_REQD = 0.26.0
88
2121 foo17# ARISING
2222 foo17# POSSIBI
2323 Theo de Raadt said
24 short progname=hello
25 full progname=/path/to/hello
2426 =========== all ============
2527 /objdir/Makefile
2628 /objdir/_mkc_compiler_type.err
2729 /objdir/_mkc_compiler_type.res
30 /objdir/_mkc_func0_getexecname_stdlib_h.c
31 /objdir/_mkc_func0_getexecname_stdlib_h.err
32 /objdir/_mkc_func0_getexecname_stdlib_h.res
33 /objdir/_mkc_func0_getprogname_stdlib_h.c
34 /objdir/_mkc_func0_getprogname_stdlib_h.err
35 /objdir/_mkc_func0_getprogname_stdlib_h.res
36 /objdir/_mkc_func1_setprogname_stdlib_h.c
37 /objdir/_mkc_func1_setprogname_stdlib_h.err
38 /objdir/_mkc_func1_setprogname_stdlib_h.res
2839 /objdir/_mkc_func3_getline_stdio_h.c
2940 /objdir/_mkc_func3_getline_stdio_h.err
3041 /objdir/_mkc_func3_getline_stdio_h.res
3748 /objdir/_mkc_funclib_getline.c
3849 /objdir/_mkc_funclib_getline.err
3950 /objdir/_mkc_funclib_getline.res
51 /objdir/_mkc_funclib_getprogname.c
52 /objdir/_mkc_funclib_getprogname.err
53 /objdir/_mkc_funclib_getprogname.res
54 /objdir/_mkc_funclib_setprogname.c
55 /objdir/_mkc_funclib_setprogname.err
56 /objdir/_mkc_funclib_setprogname.res
4057 /objdir/_mkc_funclib_strlcat.c
4158 /objdir/_mkc_funclib_strlcat.err
4259 /objdir/_mkc_funclib_strlcat.res
4562 /objdir/_mkc_funclib_strlcpy.res
4663 /objdir/_mkc_prog_cc.err
4764 /objdir/_mkc_prog_cc.res
65 /objdir/_mkc_variable_program_invocation_short_name_errno_h.c
66 /objdir/_mkc_variable_program_invocation_short_name_errno_h.err
67 /objdir/_mkc_variable_program_invocation_short_name_errno_h.res
4868 /objdir/expect.out
4969 /objdir/hello
5070 /objdir/hello.c
6181 /objdir/Makefile
6282 /objdir/_mkc_compiler_type.err
6383 /objdir/_mkc_compiler_type.res
84 /objdir/_mkc_func0_getexecname_stdlib_h.c
85 /objdir/_mkc_func0_getexecname_stdlib_h.err
86 /objdir/_mkc_func0_getexecname_stdlib_h.res
87 /objdir/_mkc_func0_getprogname_stdlib_h.c
88 /objdir/_mkc_func0_getprogname_stdlib_h.err
89 /objdir/_mkc_func0_getprogname_stdlib_h.res
90 /objdir/_mkc_func1_setprogname_stdlib_h.c
91 /objdir/_mkc_func1_setprogname_stdlib_h.err
92 /objdir/_mkc_func1_setprogname_stdlib_h.res
6493 /objdir/_mkc_func3_getline_stdio_h.c
6594 /objdir/_mkc_func3_getline_stdio_h.err
6695 /objdir/_mkc_func3_getline_stdio_h.res
73102 /objdir/_mkc_funclib_getline.c
74103 /objdir/_mkc_funclib_getline.err
75104 /objdir/_mkc_funclib_getline.res
105 /objdir/_mkc_funclib_getprogname.c
106 /objdir/_mkc_funclib_getprogname.err
107 /objdir/_mkc_funclib_getprogname.res
108 /objdir/_mkc_funclib_setprogname.c
109 /objdir/_mkc_funclib_setprogname.err
110 /objdir/_mkc_funclib_setprogname.res
76111 /objdir/_mkc_funclib_strlcat.c
77112 /objdir/_mkc_funclib_strlcat.err
78113 /objdir/_mkc_funclib_strlcat.res
81116 /objdir/_mkc_funclib_strlcpy.res
82117 /objdir/_mkc_prog_cc.err
83118 /objdir/_mkc_prog_cc.res
119 /objdir/_mkc_variable_program_invocation_short_name_errno_h.c
120 /objdir/_mkc_variable_program_invocation_short_name_errno_h.err
121 /objdir/_mkc_variable_program_invocation_short_name_errno_h.res
84122 /objdir/expect.out
85123 /objdir/hello.c
86124 /objdir/hello_strlcpy3.test.out.tmp
94132 /objdir/input.in
95133 /objdir/test.mk
96134 ======= CLEANFILES ==========
135 hello.o
97136 strlcpy.o
98137 strlcat.o
99138 getline.o
100 hello.o
139 progname.o
33 #include <mkc_strlcpy.h>
44 #include <mkc_strlcat.h>
55 #include <mkc_getline.h>
6 #include <mkc_progname.h>
67
78 static const char message [] = "Theo de Raadt said: \"The strlcpy() and strlcat() functions provide a consistent, unambiguous API to help the programmer write more bullet-proof code.\"";
89
1314 ssize_t len = 0;
1415 char small_buf [15];
1516 char said [19];
17
18 setprogname (argv [0]);
1619
1720 while (len = getline (&buf, &size, stdin), len != -1){
1821 len = strlen (buf);
2730 strlcpy (said, message, sizeof (said));
2831 puts (said);
2932
33 printf ("short progname=%s\n", getprogname ());
34 printf ("full progname=%s\n", argv [0]);
35
3036 return 0;
3137 }
0 FUNCS_RE=(strlcat|strlcpy|getline)[.]o
0 FUNCS_RE=(strlcat|strlcpy|getline|progname)[.]o
11
22 .PHONY : test_output
33 test_output:
44 @set -e; \
5 ${.OBJDIR}/hello < ${.CURDIR}/input.in; \
5 ${.OBJDIR}/hello < ${.CURDIR}/input.in | \
6 mkc_test_helper_paths; \
67 rm -rf ${.OBJDIR}${PREFIX}; \
78 MKCATPAGES=yes; export MKCATPAGES; \
89 \
3334 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
3435 \
3536 echo ======= CLEANFILES ==========; \
36 ${MAKE} ${MAKEFLAGS} print-values VARS='CLEANFILES' MKCHECKS=no | \
37 awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o$$/) print $$i}'
37 ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \
38 awk '{for(i=1; i<=NF; ++i) if ($$i ~ /[.]o.?$$/) print $$i}'
3839
3940 .include <mkc.minitest.mk>
00 PROG = prog1
1 SCRIPTS = prog1.sh prog1.awk
1 SCRIPTS = prog1.sh ${INSCRIPTS}
2 INSCRIPTS = prog1.awk
23
34 WARNS = 4
5
6 MKC_REQUIRE_PROGS = awk
7 INTEXTS_REPLS = AWK ${PROG.awk}
48
59 # Do not set SCRIPTSNAME in project's Makefile!
610 # This is just a regression test.
99 /objdir/expect.out
1010 /objdir/prog1
1111 /objdir/prog1.awk
12 /objdir/prog1.awk.in
1213 /objdir/prog1.c
1314 /objdir/prog1.o
1415 /objdir/prog1.sh
2223 ========== clean ===========
2324 /objdir/Makefile
2425 /objdir/expect.out
25 /objdir/prog1.awk
26 /objdir/prog1.awk.in
2627 /objdir/prog1.c
2728 /objdir/prog1.sh
2829 /objdir/prog1.test.out.tmp
3031 ======= distclean ==========
3132 /objdir/Makefile
3233 /objdir/expect.out
33 /objdir/prog1.awk
34 /objdir/prog1.awk.in
3435 /objdir/prog1.c
3536 /objdir/prog1.sh
3637 /objdir/prog1.test.out.tmp
+0
-6
examples/hello_subdirs/prog1/prog1.awk less more
0 #!/usr/bin/awk -f
1
2 BEGIN {
3 print "Hello World1-3"
4 exit 0
5 }
0 #!@AWK@ -f
1
2 BEGIN {
3 print "Hello World1-3"
4 exit 0
5 }
0 PATH.hello1 := ${.PARSEDIR}
0 PATH.hello1 := ${.PARSEDIR:tA}
11
2 CPPFLAGS += -I${PATH.hello1}
2 DPINCDIRS += ${PATH.hello1}
33 DPLIBDIRS += ${PATH.hello1}
4 LDADD0 += -lhello1
4 DPLDADD += hello1
0 PATH.hello2 := ${.PARSEDIR}
0 PATH.hello2 := ${.PARSEDIR:tA}
11
2 CPPFLAGS += -I${PATH.hello2}/include
2 DPINCDIRS += ${PATH.hello2}/include
33 DPLIBDIRS += ${PATH.hello2}
4 LDADD0 += -lhello2
4 DPLDADD += hello2
88 rm -rf ${.OBJDIR}${PREFIX}; \
99 LD_LIBRARY_PATH=${.CURDIR}/libhello1:${.CURDIR}/libhello2:$$LD_LIBRARY_PATH; \
1010 DYLD_LIBRARY_PATH=${.CURDIR}/libhello1:${.CURDIR}/libhello2:$$LD_LIBRARY_PATH; \
11 LIBRARY_PATH=$$LIBRARY_PATH:$$LD_LIBRARY_PATH; \
1112 MKINSTALLDIRS=no; \
12 export LD_LIBRARY_PATH DYLD_LIBRARY_PATH; \
13 export LD_LIBRARY_PATH DYLD_LIBRARY_PATH LIBRARY_PATH; \
1314 ${.CURDIR}/hello/hello_subprojects; \
1415 ${.CURDIR}/hello/hello_subprojects2; \
1516 \
2021 echo ===== all SHRTOUT=yes ======; \
2122 ${MAKE} ${MAKEFLAGS} clean > /dev/null; \
2223 ${MAKE} ${MAKEFLAGS} all SHRTOUT=YES 2>&1 | \
24 grep -v warning: | \
2325 mkc_test_helper_paths; \
2426 \
2527 echo ========= installdirs ==========; \
0 SUBPRJ = libs/foo:tools/prog1
1 SUBPRJ += libs/bar:tools/prog2
2 SUBPRJ += libs/foo:tools/prog3 libs/bar:tools/prog3
3 SUBPRJ += libs/qux:tools/prog4
0 LIBDEPS = libs/foo:tools/prog1
1 LIBDEPS += libs/bar:tools/prog2
2 LIBDEPS += libs/foo:tools/prog3 libs/bar:tools/prog3
3 LIBDEPS += libs/qux:tools/prog4
44
55 # target "check" is used for testing because "test" is used by mk-configure
66 TARGETS = check
4646 /objdir/libs/bar/bar.h
4747 /objdir/libs/bar/bar.o
4848 /objdir/libs/bar/libbar.a
49 /objdir/libs/bar/linkme.mk
5049 /objdir/libs/foo/Makefile
5150 /objdir/libs/foo/foo.c
5251 /objdir/libs/foo/foo.h
5352 /objdir/libs/foo/foo.o
5453 /objdir/libs/foo/libfoo.a
55 /objdir/libs/foo/linkme.mk
5654 /objdir/libs/qux/Makefile
5755 /objdir/libs/qux/libqux.a
58 /objdir/libs/qux/linkme.mk
5956 /objdir/libs/qux/qux.c
6057 /objdir/libs/qux/qux.h
6158 /objdir/libs/qux/qux.h.in
142139 /objdir/libs/bar/Makefile
143140 /objdir/libs/bar/bar.c
144141 /objdir/libs/bar/bar.h
145 /objdir/libs/bar/linkme.mk
146 /objdir/libs/foo/Makefile
147 /objdir/libs/foo/foo.c
148 /objdir/libs/foo/foo.h
149 /objdir/libs/foo/linkme.mk
150 /objdir/libs/qux/Makefile
151 /objdir/libs/qux/linkme.mk
142 /objdir/libs/foo/Makefile
143 /objdir/libs/foo/foo.c
144 /objdir/libs/foo/foo.h
145 /objdir/libs/qux/Makefile
152146 /objdir/libs/qux/qux.c
153147 /objdir/libs/qux/qux.h.in
154148 /objdir/test.mk
167161 /objdir/libs/bar/Makefile
168162 /objdir/libs/bar/bar.c
169163 /objdir/libs/bar/bar.h
170 /objdir/libs/bar/linkme.mk
171 /objdir/libs/foo/Makefile
172 /objdir/libs/foo/foo.c
173 /objdir/libs/foo/foo.h
174 /objdir/libs/foo/linkme.mk
175 /objdir/libs/qux/Makefile
176 /objdir/libs/qux/linkme.mk
164 /objdir/libs/foo/Makefile
165 /objdir/libs/foo/foo.c
166 /objdir/libs/foo/foo.h
167 /objdir/libs/qux/Makefile
177168 /objdir/libs/qux/qux.c
178169 /objdir/libs/qux/qux.h.in
179170 /objdir/test.mk
196187 /objdir/libs/bar/Makefile
197188 /objdir/libs/bar/bar.c
198189 /objdir/libs/bar/bar.h
199 /objdir/libs/bar/linkme.mk
200190 /objdir/libs/foo/Makefile
201191 /objdir/libs/foo/foo.c
202192 /objdir/libs/foo/foo.h
203193 /objdir/libs/foo/foo.o
204194 /objdir/libs/foo/libfoo.a
205 /objdir/libs/foo/linkme.mk
206 /objdir/libs/qux/Makefile
207 /objdir/libs/qux/linkme.mk
195 /objdir/libs/qux/Makefile
208196 /objdir/libs/qux/qux.c
209197 /objdir/libs/qux/qux.h.in
210198 /objdir/test.mk
229217 /objdir/libs/bar/Makefile
230218 /objdir/libs/bar/bar.c
231219 /objdir/libs/bar/bar.h
232 /objdir/libs/bar/linkme.mk
233220 /objdir/libs/foo/Makefile
234221 /objdir/libs/foo/foo.c
235222 /objdir/libs/foo/foo.h
236223 /objdir/libs/foo/foo.o
237224 /objdir/libs/foo/libfoo.a
238 /objdir/libs/foo/linkme.mk
239 /objdir/libs/qux/Makefile
240 /objdir/libs/qux/linkme.mk
225 /objdir/libs/qux/Makefile
241226 /objdir/libs/qux/qux.c
242227 /objdir/libs/qux/qux.h.in
243228 /objdir/test.mk
262247 /objdir/libs/bar/Makefile
263248 /objdir/libs/bar/bar.c
264249 /objdir/libs/bar/bar.h
265 /objdir/libs/bar/linkme.mk
266250 /objdir/libs/foo/Makefile
267251 /objdir/libs/foo/foo.c
268252 /objdir/libs/foo/foo.h
269253 /objdir/libs/foo/foo.o
270254 /objdir/libs/foo/libfoo.a
271 /objdir/libs/foo/linkme.mk
272 /objdir/libs/qux/Makefile
273 /objdir/libs/qux/linkme.mk
255 /objdir/libs/qux/Makefile
274256 /objdir/libs/qux/qux.c
275257 /objdir/libs/qux/qux.h.in
276258 /objdir/test.mk
297279 /objdir/libs/bar/bar.h
298280 /objdir/libs/bar/bar.o
299281 /objdir/libs/bar/libbar.a
300 /objdir/libs/bar/linkme.mk
301 /objdir/libs/foo/Makefile
302 /objdir/libs/foo/foo.c
303 /objdir/libs/foo/foo.h
304 /objdir/libs/foo/linkme.mk
305 /objdir/libs/qux/Makefile
306 /objdir/libs/qux/linkme.mk
282 /objdir/libs/foo/Makefile
283 /objdir/libs/foo/foo.c
284 /objdir/libs/foo/foo.h
285 /objdir/libs/qux/Makefile
307286 /objdir/libs/qux/qux.c
308287 /objdir/libs/qux/qux.h.in
309288 /objdir/test.mk
330309 /objdir/libs/bar/bar.h
331310 /objdir/libs/bar/bar.o
332311 /objdir/libs/bar/libbar.a
333 /objdir/libs/bar/linkme.mk
334 /objdir/libs/foo/Makefile
335 /objdir/libs/foo/foo.c
336 /objdir/libs/foo/foo.h
337 /objdir/libs/foo/linkme.mk
338 /objdir/libs/qux/Makefile
339 /objdir/libs/qux/linkme.mk
312 /objdir/libs/foo/Makefile
313 /objdir/libs/foo/foo.c
314 /objdir/libs/foo/foo.h
315 /objdir/libs/qux/Makefile
340316 /objdir/libs/qux/qux.c
341317 /objdir/libs/qux/qux.h.in
342318 /objdir/test.mk
363339 /objdir/libs/bar/bar.h
364340 /objdir/libs/bar/bar.o
365341 /objdir/libs/bar/libbar.a
366 /objdir/libs/bar/linkme.mk
367342 /objdir/libs/foo/Makefile
368343 /objdir/libs/foo/foo.c
369344 /objdir/libs/foo/foo.h
370345 /objdir/libs/foo/foo.o
371346 /objdir/libs/foo/libfoo.a
372 /objdir/libs/foo/linkme.mk
373 /objdir/libs/qux/Makefile
374 /objdir/libs/qux/linkme.mk
347 /objdir/libs/qux/Makefile
375348 /objdir/libs/qux/qux.c
376349 /objdir/libs/qux/qux.h.in
377350 /objdir/test.mk
399372 /objdir/libs/bar/Makefile
400373 /objdir/libs/bar/bar.c
401374 /objdir/libs/bar/bar.h
402 /objdir/libs/bar/linkme.mk
403 /objdir/libs/foo/Makefile
404 /objdir/libs/foo/foo.c
405 /objdir/libs/foo/foo.h
406 /objdir/libs/foo/linkme.mk
375 /objdir/libs/foo/Makefile
376 /objdir/libs/foo/foo.c
377 /objdir/libs/foo/foo.h
407378 /objdir/libs/qux/Makefile
408379 /objdir/libs/qux/libqux.a
409 /objdir/libs/qux/linkme.mk
410380 /objdir/libs/qux/qux.c
411381 /objdir/libs/qux/qux.h
412382 /objdir/libs/qux/qux.h.in
487457 filelist
488458 install
489459 installdirs
460 mkgen
490461 obj
491462 test
492463 uninstall
+0
-5
examples/tools/libs/bar/linkme.mk less more
0 PATH.bar := ${.PARSEDIR}
1
2 CPPFLAGS += -I${PATH.bar}
3 DPLIBDIRS += ${PATH.bar}
4 LDADD0 += -lbar
+0
-5
examples/tools/libs/foo/linkme.mk less more
0 PATH.foo := ${.PARSEDIR}
1
2 CPPFLAGS += -I${PATH.foo}
3 DPLIBDIRS += ${PATH.foo}
4 LDADD0 += -lfoo
+0
-5
examples/tools/libs/qux/linkme.mk less more
0 PATH.qux := ${.PARSEDIR}
1
2 CPPFLAGS += -I${PATH.qux}
3 DPLIBDIRS += ${PATH.qux}
4 LDADD0 += -lqux
77 check:
88 @: do something useful
99
10 .include "../../libs/foo/linkme.mk"
1110 .include <mkc.prog.mk>
77 check:
88 @: do something useful
99
10 .include "../../libs/bar/linkme.mk"
1110 .include <mkc.prog.mk>
77 check:
88 @: do something useful
99
10 .include "../../libs/foo/linkme.mk"
11 .include "../../libs/bar/linkme.mk"
12
1310 .include <mkc.prog.mk>
66 check:
77 @: do something useful
88
9 .include "../../libs/qux/linkme.mk"
109 .include <mkc.prog.mk>
0 SUBPRJ = libs/foo:tools/prog1
1 SUBPRJ += libs/bar:tools/prog2
2 SUBPRJ += libs/foo:tools/prog3 libs/bar:tools/prog3
3 SUBPRJ += libs/qux:tools/prog4
0 LIBDEPS = libs/foo:tools/prog1
1 LIBDEPS += libs/bar:tools/prog2
2 LIBDEPS += libs/foo:tools/prog3 libs/bar:tools/prog3
3 LIBDEPS += libs/qux:tools/prog4
44
55 SUBPRJ += tools/prog1:tests/prog1
66 SUBPRJ += tools/prog2:tests/prog2
5050 /objdir/libs/bar/bar.h
5151 /objdir/libs/bar/bar.o
5252 /objdir/libs/bar/libbar.a
53 /objdir/libs/bar/linkme.mk
5453 /objdir/libs/foo/Makefile
5554 /objdir/libs/foo/foo.c
5655 /objdir/libs/foo/foo.h
5756 /objdir/libs/foo/foo.o
5857 /objdir/libs/foo/libfoo.a
59 /objdir/libs/foo/linkme.mk
6058 /objdir/libs/qux/Makefile
6159 /objdir/libs/qux/libqux.a
62 /objdir/libs/qux/linkme.mk
6360 /objdir/libs/qux/qux.c
6461 /objdir/libs/qux/qux.h
6562 /objdir/libs/qux/qux.h.in
150147 /objdir/libs/bar/Makefile
151148 /objdir/libs/bar/bar.c
152149 /objdir/libs/bar/bar.h
153 /objdir/libs/bar/linkme.mk
154 /objdir/libs/foo/Makefile
155 /objdir/libs/foo/foo.c
156 /objdir/libs/foo/foo.h
157 /objdir/libs/foo/linkme.mk
158 /objdir/libs/qux/Makefile
159 /objdir/libs/qux/linkme.mk
150 /objdir/libs/foo/Makefile
151 /objdir/libs/foo/foo.c
152 /objdir/libs/foo/foo.h
153 /objdir/libs/qux/Makefile
160154 /objdir/libs/qux/qux.c
161155 /objdir/libs/qux/qux.h.in
162156 /objdir/test.mk
179173 /objdir/libs/bar/Makefile
180174 /objdir/libs/bar/bar.c
181175 /objdir/libs/bar/bar.h
182 /objdir/libs/bar/linkme.mk
183 /objdir/libs/foo/Makefile
184 /objdir/libs/foo/foo.c
185 /objdir/libs/foo/foo.h
186 /objdir/libs/foo/linkme.mk
187 /objdir/libs/qux/Makefile
188 /objdir/libs/qux/linkme.mk
176 /objdir/libs/foo/Makefile
177 /objdir/libs/foo/foo.c
178 /objdir/libs/foo/foo.h
179 /objdir/libs/qux/Makefile
189180 /objdir/libs/qux/qux.c
190181 /objdir/libs/qux/qux.h.in
191182 /objdir/test.mk
212203 /objdir/libs/bar/Makefile
213204 /objdir/libs/bar/bar.c
214205 /objdir/libs/bar/bar.h
215 /objdir/libs/bar/linkme.mk
216206 /objdir/libs/foo/Makefile
217207 /objdir/libs/foo/foo.c
218208 /objdir/libs/foo/foo.h
219209 /objdir/libs/foo/foo.o
220210 /objdir/libs/foo/libfoo.a
221 /objdir/libs/foo/linkme.mk
222 /objdir/libs/qux/Makefile
223 /objdir/libs/qux/linkme.mk
211 /objdir/libs/qux/Makefile
224212 /objdir/libs/qux/qux.c
225213 /objdir/libs/qux/qux.h.in
226214 /objdir/test.mk
249237 /objdir/libs/bar/Makefile
250238 /objdir/libs/bar/bar.c
251239 /objdir/libs/bar/bar.h
252 /objdir/libs/bar/linkme.mk
253240 /objdir/libs/foo/Makefile
254241 /objdir/libs/foo/foo.c
255242 /objdir/libs/foo/foo.h
256243 /objdir/libs/foo/foo.o
257244 /objdir/libs/foo/libfoo.a
258 /objdir/libs/foo/linkme.mk
259 /objdir/libs/qux/Makefile
260 /objdir/libs/qux/linkme.mk
245 /objdir/libs/qux/Makefile
261246 /objdir/libs/qux/qux.c
262247 /objdir/libs/qux/qux.h.in
263248 /objdir/test.mk
288273 /objdir/libs/bar/bar.h
289274 /objdir/libs/bar/bar.o
290275 /objdir/libs/bar/libbar.a
291 /objdir/libs/bar/linkme.mk
292 /objdir/libs/foo/Makefile
293 /objdir/libs/foo/foo.c
294 /objdir/libs/foo/foo.h
295 /objdir/libs/foo/linkme.mk
296 /objdir/libs/qux/Makefile
297 /objdir/libs/qux/linkme.mk
276 /objdir/libs/foo/Makefile
277 /objdir/libs/foo/foo.c
278 /objdir/libs/foo/foo.h
279 /objdir/libs/qux/Makefile
298280 /objdir/libs/qux/qux.c
299281 /objdir/libs/qux/qux.h.in
300282 /objdir/test.mk
325307 /objdir/libs/bar/bar.h
326308 /objdir/libs/bar/bar.o
327309 /objdir/libs/bar/libbar.a
328 /objdir/libs/bar/linkme.mk
329 /objdir/libs/foo/Makefile
330 /objdir/libs/foo/foo.c
331 /objdir/libs/foo/foo.h
332 /objdir/libs/foo/linkme.mk
333 /objdir/libs/qux/Makefile
334 /objdir/libs/qux/linkme.mk
310 /objdir/libs/foo/Makefile
311 /objdir/libs/foo/foo.c
312 /objdir/libs/foo/foo.h
313 /objdir/libs/qux/Makefile
335314 /objdir/libs/qux/qux.c
336315 /objdir/libs/qux/qux.h.in
337316 /objdir/test.mk
362341 /objdir/libs/bar/bar.h
363342 /objdir/libs/bar/bar.o
364343 /objdir/libs/bar/libbar.a
365 /objdir/libs/bar/linkme.mk
366344 /objdir/libs/foo/Makefile
367345 /objdir/libs/foo/foo.c
368346 /objdir/libs/foo/foo.h
369347 /objdir/libs/foo/foo.o
370348 /objdir/libs/foo/libfoo.a
371 /objdir/libs/foo/linkme.mk
372 /objdir/libs/qux/Makefile
373 /objdir/libs/qux/linkme.mk
349 /objdir/libs/qux/Makefile
374350 /objdir/libs/qux/qux.c
375351 /objdir/libs/qux/qux.h.in
376352 /objdir/test.mk
402378 /objdir/libs/bar/Makefile
403379 /objdir/libs/bar/bar.c
404380 /objdir/libs/bar/bar.h
405 /objdir/libs/bar/linkme.mk
406 /objdir/libs/foo/Makefile
407 /objdir/libs/foo/foo.c
408 /objdir/libs/foo/foo.h
409 /objdir/libs/foo/linkme.mk
381 /objdir/libs/foo/Makefile
382 /objdir/libs/foo/foo.c
383 /objdir/libs/foo/foo.h
410384 /objdir/libs/qux/Makefile
411385 /objdir/libs/qux/libqux.a
412 /objdir/libs/qux/linkme.mk
413386 /objdir/libs/qux/qux.c
414387 /objdir/libs/qux/qux.h
415388 /objdir/libs/qux/qux.h.in
454427 obj/tools/prog4/prog4
455428 obj/tools/prog4/prog4.o
456429 =========== print_deps ============
430 all-tools/prog1 all-tests/prog1
431 all-tools/prog2 all-tests/prog2
432 all-tools/prog3 all-tests/prog3
433 all-tools/prog4 all-tests/prog4
457434 all-libs/foo all-tools/prog1
458435 all-libs/bar all-tools/prog2
459436 all-libs/foo all-tools/prog3
460437 all-libs/bar all-tools/prog3
461438 all-libs/qux all-tools/prog4
462 all-tools/prog1 all-tests/prog1
463 all-tools/prog2 all-tests/prog2
464 all-tools/prog3 all-tests/prog3
465 all-tools/prog4 all-tests/prog4
466439 all-libs/bar libs/bar
467440 all-libs/foo libs/foo
468441 all-libs/qux libs/qux
+0
-5
examples/tools2/libs/bar/linkme.mk less more
0 PATH.bar := ${.PARSEDIR}
1
2 CPPFLAGS += -I${PATH.bar}
3 DPLIBDIRS += libs/${PATH.bar:T}
4 LDADD0 += -lbar
+0
-5
examples/tools2/libs/foo/linkme.mk less more
0 PATH.foo := ${.PARSEDIR}
1
2 CPPFLAGS += -I${PATH.foo}
3 DPLIBDIRS += libs/${PATH.foo:T}
4 LDADD0 += -lfoo
+0
-5
examples/tools2/libs/qux/linkme.mk less more
0 PATH.qux := ${.PARSEDIR}
1
2 CPPFLAGS += -I${OBJDIR_libs_qux}
3 DPLIBDIRS += libs/${PATH.qux:T}
4 LDADD0 += -lqux
77 check:
88 @: do something useful
99
10 .include "../../libs/foo/linkme.mk"
1110 .include <mkc.prog.mk>
77 check:
88 @: do something useful
99
10 .include "../../libs/bar/linkme.mk"
1110 .include <mkc.prog.mk>
77 check:
88 @: do something useful
99
10 .include "../../libs/foo/linkme.mk"
11 .include "../../libs/bar/linkme.mk"
12
1310 .include <mkc.prog.mk>
66 check:
77 @: do something useful
88
9 .include "../../libs/qux/linkme.mk"
109 .include <mkc.prog.mk>
0 static void _mkcfake(void)
1 {
2 }
0 /* $NetBSD: err.c,v 1.4 2004/08/23 03:32:12 jlam Exp $ */
1
2 /*
3 * Copyright 1997-2000 Luke Mewburn <lukem@netbsd.org>.
4 * Copyright 2014 Aleksey Cheusov <vle@gmx.net>.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
24 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
26 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
27 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 #include <stdarg.h>
31 #include <stdlib.h>
32 #include <string.h>
33 #include <stdio.h>
34 #include <errno.h>
35
36 #include <mkc_progname.h>
37 #include <mkc_err.h>
38
39 #if !HAVE_FUNC3_ERR_ERR_H
40 void err (int eval, const char *fmt, ...)
41 {
42 va_list ap;
43 int sverrno;
44
45 sverrno = errno;
46 fprintf (stderr, "%s: ", getprogname ());
47 va_start (ap, fmt);
48 if (fmt != NULL) {
49 vfprintf (stderr, fmt, ap);
50 fprintf (stderr, ": ");
51 }
52 va_end (ap);
53 fprintf (stderr, "%s\n", strerror (sverrno));
54 exit (eval);
55 }
56 #endif
57
58 #if !HAVE_FUNC3_ERRX_ERR_H
59 void errx (int eval, const char *fmt, ...)
60 {
61 va_list ap;
62
63 fprintf (stderr, "%s: ", getprogname ());
64 va_start (ap, fmt);
65 if (fmt != NULL)
66 vfprintf (stderr, fmt, ap);
67 va_end (ap);
68 fprintf (stderr, "\n");
69 exit (eval);
70 }
71 #endif
72
73 #if !HAVE_FUNC3_VERR_ERR_H
74 void verr (int eval, const char *fmt, va_list ap)
75 {
76 int sverrno;
77
78 sverrno = errno;
79 fprintf (stderr, "%s: ", getprogname ());
80 if (fmt != NULL) {
81 vfprintf (stderr, fmt, ap);
82 fprintf (stderr, ": ");
83 }
84 fprintf (stderr, "%s\n", strerror (sverrno));
85 exit (eval);
86 }
87 #endif
88
89 #if !HAVE_FUNC3_VERRX_ERR_H
90 void verrx (int eval, const char *fmt, va_list ap)
91 {
92 fprintf (stderr, "%s: ", getprogname ());
93 if (fmt != NULL)
94 vfprintf (stderr, fmt, ap);
95 fprintf (stderr, "\n");
96 exit (eval);
97 }
98 #endif
0 /*
1 * Copyright (c) 2005 Hector Garcia Alvarez
2 * Copyright (c) 2005, 2008-2012 Guillem Jover <guillem@hadrons.org>
3 * Copyright (c) 2014 Aleksey Cheusov <vle@gmx.net>
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
17 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
18 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
19 * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28 #include <stdio.h>
29 #include <string.h>
30
31 #include <mkc_getline.h>
32 #include <mkc_fgetln.h>
33
34 struct filebuf {
35 FILE *fp;
36 char *buf;
37 size_t len;
38 };
39
40 #define FILEBUF_POOL_ITEMS 128
41
42 static struct filebuf fb_pool [FILEBUF_POOL_ITEMS];
43 static int fb_pool_cur;
44
45 char * fgetln (FILE *stream, size_t *len)
46 {
47 struct filebuf *fb;
48 ssize_t nread;
49
50 /* Try to diminish the possibility of several fgetln() calls being
51 * used on different streams, by using a pool of buffers per file. */
52 fb = &fb_pool [fb_pool_cur];
53 if (fb->fp != stream && fb->fp != NULL) {
54 fb_pool_cur++;
55 fb_pool_cur %= FILEBUF_POOL_ITEMS;
56 fb = &fb_pool [fb_pool_cur];
57 }
58 fb->fp = stream;
59
60 nread = getline (&fb->buf, &fb->len, stream);
61 /* Note: the getdelim/getline API ensures nread != 0. */
62 if (nread == -1) {
63 *len = 0;
64 return NULL;
65 } else {
66 *len = (size_t) nread;
67 return fb->buf;
68 }
69 }
0 /********************************************************************\
1 Copyright (c) 2014 by Aleksey Cheusov
2
3 See LICENSE file in the distribution.
4 \********************************************************************/
5
6 #ifndef _MKC_ERR_H_
7 #define _MKC_ERR_H_
8
9 #include <stdarg.h>
10
11 #if HAVE_HEADER_ERR_H
12 #include <err.h>
13 #endif
14
15 #ifdef MKC_ERR_IS_FINE
16
17 #include <err.h>
18
19 #else
20 #if !HAVE_FUNC3_ERR_ERR_H
21 void err (int, const char *, ...);
22 #endif
23 #if !HAVE_FUNC3_ERRX_ERR_H
24 void errx (int, const char *, ...);
25 #endif
26 #if !HAVE_FUNC3_VERR_ERR_H
27 void verr (int, const char *, va_list);
28 #endif
29 #if !HAVE_FUNC3_VERRX_ERR_H
30 void verrx (int, const char *, va_list);
31 #endif
32
33 #endif /* MKC_ERR_IS_FINE */
34
35 #endif // _MKC_ERR_H_
0 /********************************************************************\
1 Copyright (c) 2014 by Aleksey Cheusov
2
3 See LICENSE file in the distribution.
4 \********************************************************************/
5
6 #ifndef _MKC_FGETLN_H_
7 #define _MKC_FGETLN_H_
8
9 #include <stdio.h>
10
11 #ifndef HAVE_FUNC3_FGETLN_STDIO_H
12 char *fgetln (FILE *stream, size_t *len);
13 #endif
14
15 #endif // _MKC_FGETLN_H_
11 #
22 # See LICENSE file in the distribution.
33 ############################################################
4 .ifndef _MKC_IMP_F_RB_MK
5 _MKC_IMP_F_RB_MK := 1
46
57 MKC_CHECK_DEFINES += RB_ENTRY:sys/tree.h
68 MKC_CHECK_DEFINES += SPLAY_ENTRY:sys/tree.h
9
10 .endif # _MKC_IMP_F_RB_MK
11 #
22 # See LICENSE file in the distribution.
33 ############################################################
4 .include <mkc.configure.mk>
4 .ifndef _MKC_IMP_F_SYSQUEUE_MK
5 _MKC_IMP_F_SYSQUEUE_MK := 1
6
7 .include <mkc_imp.conf-cleanup.mk>
58
69 _macro = SLIST SIMPLEQ STAILQ LIST TAILQ TAILQ
710
1013 _macro.${m} = 1
1114 .endfor
1215
13 MKC_NOAUTO.orig := ${MKC_NOAUTO}
14 MKC_NOAUTO = 1
15
16 .include <mkc.configure.mk>
16 .include <mkc_imp.conf-cleanup.mk>
1717
1818 .for f in ${MKC_FEATURES}
1919 .if defined(_macro.${f}) && !${HAVE_DEFINE.${m}_ENTRY.sys/queue.h:U0}
2929 .undef _macro.${m}
3030 .endfor
3131
32 MKC_NOAUTO := ${MKC_NOAUTO.orig}
33
3432 .undef bad
3533 .undef _macro
36 .undef MKC_NOAUTO.orig
34
35 .endif # _MKC_IMP_F_SYSQUEUE_MK
0 # Copyright (c) 2014 by Aleksey Cheusov
1 #
2 # See LICENSE file in the distribution.
3 ############################################################
4 .ifndef _MKC_IMP_F_ERR_MK
5 _MKC_IMP_F_ERR_MK := 1
6
7 .include <mkc_imp.f_progname.mk>
8
9 .include <mkc_imp.conf-cleanup.mk>
10
11 MKC_CHECK_HEADERS += err.h
12 MKC_CHECK_FUNCLIBS += err errx verr verrx
13 MKC_CHECK_FUNCS3 += err:err.h errx:err.h verr:err.h verrx:err.h
14
15 .include <mkc_imp.conf-cleanup.mk>
16
17 .if ${HAVE_FUNCLIB.err:U0} && ${HAVE_FUNCLIB.errx:U0} && \
18 ${HAVE_FUNCLIB.verr:U0} && ${HAVE_FUNCLIB.verrx:U0} && \
19 ${HAVE_FUNC3.err.err_h:U0} && ${HAVE_FUNC3.errx.err_h:U0} && \
20 ${HAVE_FUNC3.verr.err_h:U0} && ${HAVE_FUNC3.verrx.err_h:U0}
21 CFLAGS += -DMKC_ERR_IS_FINE
22 .else
23 MKC_SRCS += ${FEATURESDIR}/err/err.c
24 .endif
25
26 .include <mkc_imp.conf-final.mk>
27
28 .endif #_MKC_IMP_F_ERR_MK
0 # Copyright (c) 2014 by Aleksey Cheusov
1 #
2 # See LICENSE file in the distribution.
3 .ifndef _MKC_IMP.F_FGETLN_MK
4 _MKC_IMP.F_FGETLN_MK := 1
5
6 .include <mkc_imp.f_getline.mk>
7
8 MKC_SOURCE_FUNCLIBS += fgetln
9 MKC_SOURCE_DIR.fgetln.c = ${FEATURESDIR}/fgetln
10 MKC_CHECK_FUNCS3 += fgetln:stdio.h
11
12 .endif # _MKC_IMP.F_FGETLN_MK
00 # Copyright (c) 2014 by Aleksey Cheusov
11 #
22 # See LICENSE file in the distribution.
3 .ifndef _MKC_IMP.F_GETLINE_MK
4 _MKC_IMP.F_GETLINE_MK := 1
35
46 MKC_SOURCE_FUNCLIBS += getline
57 MKC_SOURCE_DIR.getline.c = ${FEATURESDIR}/getline
68 MKC_CHECK_FUNCS3 += getline:stdio.h
9
10 .endif # _MKC_IMP.F_GETLINE_MK
00 # Copyright (c) 2014 by Aleksey Cheusov
11 #
22 # See LICENSE file in the distribution.
3 .ifndef _MKC_IMP_F_LIBDL_MK
4 _MKC_IMP_F_LIBDL_MK := 1
35
46 MKC_COMMON_DEFINES += -D_GNU_SOURCE
57
68 MKC_REQUIRE_FUNCLIBS += dlopen:dl
79 MKC_REQUIRE_FUNCS2 += dlopen:dlfcn.h
10
11 .endif # _MKC_IMP_F_LIBDL_MK
00 # Copyright (c) 2014 by Aleksey Cheusov
11 #
22 # See LICENSE file in the distribution.
3 .ifndef _MKC_IMP_F_LIBM_MK
4 _MKC_IMP_F_LIBM_MK := 1
35
46 MKC_CHECK_FUNCLIBS += sqrt:m
7
8 .endif #_MKC_IMP_F_LIBM_MK
0 # Copyright (c) 2014 by Aleksey Cheusov
1 #
2 # See LICENSE file in the distribution.
3 ############################################################
4 .ifndef _MKC_IMP.F_PROGNAME_MK
5 _MKC_IMP.F_PROGNAME_MK := 1
6
7 MKC_COMMON_DEFINES += -D_GNU_SOURCE
8
9 MKC_CHECK_FUNCLIBS += getprogname setprogname
10 MKC_CHECK_FUNCS0 += getprogname:stdlib.h getexecname:stdlib.h
11 MKC_CHECK_FUNCS1 += setprogname:stdlib.h
12 MKC_CHECK_VARS += program_invocation_short_name:errno.h
13
14 .include <mkc_imp.conf-cleanup.mk>
15
16 .if ${HAVE_FUNCLIB.getprogname:U0} && \
17 ${HAVE_FUNCLIB.setprogname:U0} && \
18 ${HAVE_FUNC0.getprogname.stdlib_h:U0} && \
19 ${HAVE_FUNC1.setprogname.stdlib_h:U0}
20 CFLAGS += -DMKC_PROGNAME_IS_FINE
21 .else
22 MKC_SRCS += ${FEATURESDIR}/progname/progname.c
23 .endif
24
25 .include <mkc_imp.conf-final.mk>
26
27 .endif # _MKC_IMP.F_PROGNAME_MK
00 # Copyright (c) 2014 by Aleksey Cheusov
11 #
22 # See LICENSE file in the distribution.
3 .ifndef _MKC_IMP_F_STRLCAT_MK
4 _MKC_IMP_F_STRLCAT_MK := 1
35
46 MKC_SOURCE_FUNCLIBS += strlcat
57 MKC_SOURCE_DIR.strlcat.c = ${FEATURESDIR}/strlcat
68 MKC_CHECK_FUNCS3 += strlcat:string.h
9
10 .endif # _MKC_IMP_F_STRLCAT_MK
00 # Copyright (c) 2014 by Aleksey Cheusov
11 #
22 # See LICENSE file in the distribution.
3 .ifndef _MKC_IMP_F_STRLCPY_MK
4 _MKC_IMP_F_STRLCPY_MK := 1
35
46 MKC_SOURCE_FUNCLIBS += strlcpy
57 MKC_SOURCE_DIR.strlcpy.c = ${FEATURESDIR}/strlcpy
68 MKC_CHECK_FUNCS3 += strlcpy:string.h
9
10 .endif #_MKC_IMP_F_STRLCPY_MK
0 # Copyright (c) 2014 by Aleksey Cheusov
1 #
2 # See LICENSE file in the distribution.
3 ############################################################
4 .ifndef _MKC_IMP_F_WARN_MK
5 _MKC_IMP_F_WARN_MK := 1
6
7 .include <mkc_imp.f_progname.mk>
8
9 .include <mkc_imp.conf-cleanup.mk>
10
11 MKC_CHECK_HEADERS += err.h
12 MKC_CHECK_FUNCLIBS += warn warnx vwarn vwarnx
13 MKC_CHECK_FUNCS2 += warn:err.h warnx:err.h vwarn:err.h vwarnx:err.h
14
15 .include <mkc_imp.conf-cleanup.mk>
16
17 .if ${HAVE_FUNCLIB.warn:U0} && ${HAVE_FUNCLIB.warnx:U0} && \
18 ${HAVE_FUNCLIB.vwarn:U0} && ${HAVE_FUNCLIB.vwarnx:U0} && \
19 ${HAVE_FUNC2.warn.err_h:U0} && ${HAVE_FUNC2.warnx.err_h:U0} && \
20 ${HAVE_FUNC2.vwarn.err_h:U0} && ${HAVE_FUNC2.vwarnx.err_h:U0}
21 CFLAGS += -DMKC_WARN_IS_FINE
22 .else
23 MKC_SRCS += ${FEATURESDIR}/warn/warn.c
24 .endif
25
26 .include <mkc_imp.conf-final.mk>
27
28 .endif # _MKC_IMP_F_WARN_MK
0 /********************************************************************\
1 Copyright (c) 2014 by Aleksey Cheusov
2
3 See LICENSE file in the distribution.
4 \********************************************************************/
5
6 #ifndef _MKC_PROGNAME_H_
7 #define _MKC_PROGNAME_H_
8
9 #ifdef MKC_PROGNAME_IS_FINE
10
11 #include <stdlib.h>
12
13 #else
14
15 #if !HAVE_FUNC1_SETPROGNAME_STDLIB_H
16 void setprogname (const char *progname);
17 #endif
18
19 #if !HAVE_FUNC0_GETPROGNAME_STDLIB_H
20 const char * getprogname (void);
21 #endif
22
23 #endif /* MKC_PROGNAME_IS_FINE */
24
25 #endif // _MKC_PROGNAME_H_
0 /********************************************************************\
1 Copyright (c) 2014 by Aleksey Cheusov
2
3 See LICENSE file in the distribution.
4 \********************************************************************/
5
6 #ifndef _MKC_WARN_H_
7 #define _MKC_WARN_H_
8
9 #include <stdarg.h>
10
11 #if HAVE_HEADER_ERR_H
12 #include <err.h>
13 #endif
14
15 #ifdef MKC_WARN_IS_FINE
16
17 #include <err.h>
18
19 #else
20 #if !HAVE_FUNC2_WARN_ERR_H
21 void warn (const char *, ...);
22 #endif
23 #if !HAVE_FUNC2_WARNX_ERR_H
24 void warnx (const char *, ...);
25 #endif
26 #if !HAVE_FUNC2_VWARN_ERR_H
27 void vwarn (const char *, va_list);
28 #endif
29 #if !HAVE_FUNC2_VWARNX_ERR_H
30 void vwarnx (const char *, va_list);
31 #endif
32
33 #endif /* MKC_WARN_IS_FINE */
34
35 #endif // _MKC_WARN_H_
0 /*
1 * Copyright (c) 2014 by Aleksey Cheusov
2 * See LICENSE file in the distribution.
3 */
4
5 #include <string.h>
6 #include <stdlib.h>
7 #include <errno.h>
8
9 #include <mkc_progname.h>
10
11 static const char *__prog = NULL;
12
13 const char * getprogname (void)
14 {
15 if (__prog)
16 return __prog;
17
18 #ifdef HAVE_FUNC0_GETEXECNAME_STDLIB_H
19 /* SunOS */
20 setprogname (getexecname ());
21 return getprogname ();
22 #elif defined(HAVE_VAR_PROGRAM_INVOCATION_SHORT_NAME_ERRNO_H)
23 return program_invocation_short_name;
24 #else
25 return "<unset_progname>";
26 #endif
27 }
28
29 void setprogname (const char *progname)
30 {
31 const char *s = strrchr (progname, '/');
32 __prog = progname;
33
34 if (s)
35 __prog = s + 1;
36 }
0 /* $NetBSD: warn.c,v 1.4 2004/08/23 03:32:12 jlam Exp $ */
1
2 /*
3 * Copyright 1997-2000 Luke Mewburn <lukem@netbsd.org>.
4 * Copyright 2014 Aleksey Cheusov <vle@gmx.net>.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
24 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
26 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
27 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 #include <stdarg.h>
31 #include <stdlib.h>
32 #include <string.h>
33 #include <stdio.h>
34 #include <errno.h>
35
36 #include <mkc_progname.h>
37 #include <mkc_warn.h>
38
39 #if !HAVE_FUNC2_WARN_ERR_H
40 void warn (const char *fmt, ...)
41 {
42 va_list ap;
43 int sverrno;
44
45 sverrno = errno;
46 fprintf (stderr, "%s: ", getprogname ());
47 va_start (ap, fmt);
48 if (fmt != NULL) {
49 vfprintf (stderr, fmt, ap);
50 fprintf (stderr, ": ");
51 }
52 va_end (ap);
53 fprintf (stderr, "%s\n", strerror (sverrno));
54 }
55 #endif
56
57 #if !HAVE_FUNC2_WARNX_ERR_H
58 void warnx (const char *fmt, ...)
59 {
60 va_list ap;
61
62 fprintf (stderr, "%s: ", getprogname ());
63 va_start (ap, fmt);
64 if (fmt != NULL)
65 vfprintf (stderr, fmt, ap);
66 va_end (ap);
67 fprintf (stderr, "\n");
68 }
69 #endif
70
71 #if !HAVE_FUNC2_VWARN_ERR_H
72 void vwarn (const char *fmt, va_list ap)
73 {
74 int sverrno;
75
76 sverrno = errno;
77 fprintf (stderr, "%s: ", getprogname ());
78 if (fmt != NULL) {
79 vfprintf (stderr, fmt, ap);
80 fprintf (stderr, ": ");
81 }
82 fprintf (stderr, "%s\n", strerror (sverrno));
83 }
84 #endif
85
86 #if !HAVE_FUNC2_VWARNX_ERR_H
87 void vwarnx (const char *fmt, va_list ap)
88 {
89 fprintf (stderr, "%s: ", getprogname ());
90 if (fmt != NULL)
91 vfprintf (stderr, fmt, ap);
92 fprintf (stderr, "\n");
93 }
94 #endif
0 SCRIPTS = mkc_test_helper
0 SCRIPTS = mkc_test_helper ${INSCRIPTS}
1 INSCRIPTS = mkc_long_lines
12
23 .include <mkc.mk>
0 #!@AWK@ -f
1
2 ############################################################
3 # Copyright (c) 2014 by Aleksey Cheusov
4 #
5 # See LICENSE file in the distribution.
6 ############################################################
7
8 # processes backslash in the end of line
9
10 /\\$/ {
11 printf "%s", substr($0, 1, length($0)-1)
12 next
13 }
14 {
15 print
16 }
0 #!/bin/sh
1
2 : ${OPSYS:=`uname -s`}
3 : ${NM:=nm}
4
5 case ${OPSYS} in
6 *BSD|DragonFly)
7 ${NM} "$@" |
8 grep -Ev 'fini|init' |
9 awk '$2=="T" {print "symbol " $3}'
10 ;;
11 SunOS)
12 ${NM} -P "$@" |
13 grep -Ev 'fini|init' |
14 awk 'NF==4 && $2=="T" {print "symbol " $1}'
15 ;;
16 Linux)
17 ${NM} "$@" |
18 grep -Ev 'fini|init' |
19 awk 'NF==3 && $2 ~ /^[DT]$/ {print "symbol " $3}'
20 ;;
21 esac
0 # Copyright (c) 2014 by Aleksey Cheusov
1 #
2 # See LICENSE file in the distribution.
3 ############################################################
4
05 .sinclude "cheusov_local_settings.mk" # for debugging
16
27 ##################################################
3 SUBPRJ_DFLT = custom helpers mk scripts features
4 SUBPRJ = examples doc presentation ${SUBPRJ_DFLT}
8 SUBPRJ_DFLT = builtins helpers mk scripts features doc
9 SUBPRJ = examples presentation ${SUBPRJ_DFLT}
510
611 tests = configure_test mkinstall mkshlib mkstaticlib mkpiclib \
712 mkprofilelib mkdll pkg_config_0 pkg_config_1 pkg_config_1_1 pkg_config_2 \
813 lua_dirs rec_makefiles reqd reqd2 reqd3 reqd4 reqd_clean_cache \
914 intexts_cleantrg require_prototype test_subprj_dash test_mkc_vs_PROG \
1015 test_mkc_vs_LIB test_mkc_vs_SUBDIR test_mkc_vs_SUBPRJ endianess \
11 create_cachedir sys_queue predopost_targets
16 create_cachedir sys_queue predopost_targets FSRCDIR
1217 .for t in ${tests}
1318 SUBPRJ += tests/${t}:tests
1419 .endfor
1924 hello_strlcpy3 hello_customtests hello_customtests2 hello_requirements \
2025 hello_iconv hello_cxx hello_cxxlib hello_dictd hello_lua hello_lua2 \
2126 hello_lua3 hello_superfs hello_xxzip hello_progs hello_progs2 tools \
22 tools2 pkgconfig3 hello_SLIST hello_RBTREE # hello_require_tools
27 tools2 pkgconfig3 hello_SLIST hello_RBTREE hello_errwarn hello_fgetln \
28 hello_autotools hello_autoconf hello_libdeps hello_compatlib \
29 hello_require_tools
2330 .for t in ${examples}
2431 SUBPRJ += examples/${t}:tests
2532 .endfor
3542 DIST_TARGETS = pdf clean-mk clean-scripts mkc_clean
3643
3744 INSTALL = ${.CURDIR}/scripts/mkc_install
38 PATH := ${OBJDIR_custom}:${OBJDIR_helpers}:${.CURDIR}/helpers:${OBJDIR_scripts}:${.CURDIR}/scripts:${PATH}
45 PATH := ${OBJDIR_builtins}:${OBJDIR_helpers}:${.CURDIR}/helpers:${OBJDIR_scripts}:${.CURDIR}/scripts:${PATH}
3946
4047 .export SHRTOUT INSTALL PATH
4148
0 FILES = sys.mk mkc.configure.mk configure.mk mkc.mk \
1 mkc.init.mk mkc_imp.intexts.mk mkc_imp.mk \
2 mkc.minitest.mk mkc_imp.pkg-config.mk \
0 FILES = sys.mk mkc.configure.mk mkc_imp.conf.mk mkc_imp.conf-cleanup.mk \
1 mkc.mk mkc.init.mk mkc_imp.intexts.mk mkc_imp.mk \
2 mkc.minitest.mk mkc_imp.pkg-config.mk mkc_imp.dpvars.mk \
33 mkc_imp.files.mk mkc_imp.inc.mk mkc_imp.info.mk mkc_imp.lib.mk \
44 mkc_imp.links.mk mkc_imp.man.mk mkc_imp.prog.mk \
55 mkc_imp.subprj.mk mkc_imp.conf-final.mk mkc_imp.rules.mk \
1616 #################################################
1717 .for i in prog_mkdep prog_nbmkdep
1818 MKC_CHECK_CUSTOM += ${i}
19 MKC_CUSTOM_FN.${i} = ${.CURDIR}/../custom/${i}
19 MKC_CUSTOM_FN.${i} = ${.CURDIR}/../builtins/${i}
2020 .endfor
2121
2222 MKC_CHECK_PROGS += makedepend
3737 MKC_ERR_MSG += "mkdep(1) cannot be found"
3838 .endif
3939
40 .if exists(/usr/xpg4/bin/nm)
41 PROG.nm ?= /usr/xpg4/bin/nm
42 .else
43 MKC_REQUIRE_PROGS += nm
44 .endif
45
4046 makedepend_cmd ?= makedepend
4147
4248 INTEXTS_REPLS += mkdep_cmd ${mkdep_cmd}
4349 INTEXTS_REPLS += makedepend_cmd ${makedepend_cmd}
4450 INTEXTS_REPLS += mkdep_type ${mkdep_type}
4551 INTEXTS_REPLS += featuresdir ${FEATURESDIR}
52 INTEXTS_REPLS += NM ${PROG.nm}
4653
4754 #################################################
4855 .include <mkc.mk>
+0
-352
mk/configure.mk less more
0 # Copyright (c) 2009-2013, Aleksey Cheusov <vle@gmx.net>
1 # All rights reserved.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions
5 # are met:
6 # 1. Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer.
8 # 2. Redistributions in binary form must reproduce the above copyright
9 # notice, this list of conditions and the following disclaimer in the
10 # documentation and/or other materials provided with the distribution.
11 #
12 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
13 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
14 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
15 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
16 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22 # POSSIBILITY OF SUCH DAMAGE.
23
24 ######################################################################
25 # See mk-configure(7) for documentation
26 #
27
28 # user defined variables
29 MKC_SHOW_CACHED ?= 0 # set it to `1' to show "...(cached)..." lines
30 MKC_DELETE_TMPFILES ?= 0 # set it to `1' to delete temporary files
31 MKC_CACHEDIR ?= ${.OBJDIR} # directory for cache and intermediate files
32 MKC_COMMON_HEADERS ?= # list of headers always #included
33 MKC_NOCACHE ?= # 1 or yes for disabling cache
34 MKC_CUSTOM_DIR ?=${.CURDIR} # directory with custom tests.c
35 MKC_SOURCE_DIR ?=${.CURDIR} # directory with missing strlcat.c etc.
36
37 #
38 MKC_SOURCE_FUNCLIBS ?=
39 _MKC_SOURCE_FUNCS = ${MKC_SOURCE_FUNCLIBS:C/:.*//}
40
41 # .endif for the next .if is in the end of file
42 .if ${MKCHECKS:Uno:tl} == "yes"
43
44 HAVE_FUNCLIB.main ?= 1
45
46 .if defined(MKC_COMMON_DEFINES.${TARGET_OPSYS})
47 CPPFLAGS += ${MKC_COMMON_DEFINES.${TARGET_OPSYS}}
48 .endif
49 .if defined(MKC_COMMON_DEFINES)
50 CPPFLAGS += ${MKC_COMMON_DEFINES}
51 .endif
52
53 #
54 _MKC_CPPFLAGS := ${CPPFLAGS}
55 _MKC_CFLAGS := ${CFLAGS}
56 _MKC_CXXFLAGS := ${CXXFLAGS}
57 _MKC_FFLAGS := ${FFLAGS}
58 _MKC_LDFLAGS := ${LDFLAGS}
59 _MKC_LDADD := ${LDADD}
60
61 mkc.environ=CC='${CC}' CXX='${CXX}' FC='${FC}' CPPFLAGS='${_MKC_CPPFLAGS}' CFLAGS='${_MKC_CFLAGS}' CXXFLAGS='${_MKC_CXXFLAGS}' FFLAGS='${_MKC_FFLAGS}' LDFLAGS='${_MKC_LDFLAGS}' LDADD='${_MKC_LDADD}' LEX='${LEX}' YACC='${YACC}' MKC_CACHEDIR='${MKC_CACHEDIR}' MKC_COMMON_HEADERS='${MKC_COMMON_HEADERS}' MKC_DELETE_TMPFILES='${MKC_DELETE_TMPFILES}' MKC_SHOW_CACHED='${MKC_SHOW_CACHED}' MKC_NOCACHE='${MKC_NOCACHE}' MKC_VERBOSE=1
62
63 ######################################################
64 # checking for builtin checks
65 .for i in ${MKC_CHECK_BUILTINS} ${MKC_REQUIRE_BUILTINS}
66 MKC_CUSTOM_FN.${i} ?= ${BUILTINSDIR}/${i:S/endianess/endianness/}
67 MKC_CHECK_CUSTOM += ${i}
68 MKC_REQUIRE_CUSTOM += ${MKC_REQUIRE_BUILTINS:M${i}}
69 .endfor
70
71 ######################################################
72 # checking for headers
73 .for h in ${MKC_CHECK_HEADERS} ${MKC_REQUIRE_HEADERS}
74 .if !defined(HAVE_HEADER.${h:S|.|_|g:S|/|_|g})
75 HAVE_HEADER.${h:S|.|_|g:S|/|_|g} != env ${mkc.environ} mkc_check_header ${h}
76 .endif
77 .if ${HAVE_HEADER.${h:S|.|_|g:S|/|_|g}}
78 .if empty(MKC_REQUIRE_HEADERS:U:M${h})
79 MKC_CFLAGS += -DHAVE_HEADER_${h:tu:S|.|_|g:S|/|_|g}=${HAVE_HEADER.${h:S|.|_|g:S|/|_|g}}
80 .endif
81 .elif !empty(MKC_REQUIRE_HEADERS:U:M${h})
82 _fake != env ${mkc.environ} mkc_check_header -d ${h} && echo
83 MKC_ERR_MSG += "ERROR: cannot find header ${h}"
84 .endif
85 .endfor
86
87 .undef MKC_CHECK_HEADERS
88 .undef MKC_REQUIRE_HEADERS
89
90 ######################################################
91 # checking for functions in libraries
92 .for f in ${MKC_CHECK_FUNCLIBS:U} ${MKC_SOURCE_FUNCLIBS:U} ${MKC_REQUIRE_FUNCLIBS:U}
93 .if !defined(HAVE_FUNCLIB.${f:S/:/./g})
94 HAVE_FUNCLIB.${f:S/:/./g} != env ${mkc.environ} mkc_check_funclib ${f:S/:/ /g}
95 .endif
96 .if !defined(HAVE_FUNCLIB.${f:C/:.*//})
97 HAVE_FUNCLIB.${f:C/:.*//} != env ${mkc.environ} mkc_check_funclib ${f:C/:.*//}
98 .endif
99 .if ${HAVE_FUNCLIB.${f:C/:.*//}} != ${HAVE_FUNCLIB.${f:S/:/./g}}
100 .if empty(MKC_NOAUTO_FUNCLIBS:U:S/:/./g:M${f:S/:/./g}) && empty(MKC_NOAUTO_FUNCLIBS:U:M1) && ${HAVE_FUNCLIB.${f:S/:/./g}} && !${HAVE_FUNCLIB.${f:C/:.*//}}
101 MKC_LDADD += -l${f:C/^.*://}
102 .endif
103 .endif
104 .if !${HAVE_FUNCLIB.${f:S/:/./g}} && !${HAVE_FUNCLIB.${f:C/:.*//}} && !empty(_MKC_SOURCE_FUNCS:M${f:C/:.*//})
105 MKC_SRCS += ${MKC_SOURCE_DIR.${f:C/:.*//}.c:U${MKC_SOURCE_DIR}}/${f:C/:.*//}.c
106 .endif
107 .endfor # f
108
109 .for f in ${MKC_REQUIRE_FUNCLIBS:U}
110 .if !${HAVE_FUNCLIB.${f:S/:/./g}} && !${HAVE_FUNCLIB.${f:C/:.*//}}
111 _fake != env ${mkc.environ} mkc_check_funclib -d ${f:C/:.*//} && echo
112 _fake != env ${mkc.environ} mkc_check_funclib -d ${f:S/:/ /g} && echo
113 MKC_ERR_MSG += "ERROR: cannot find function ${f}"
114 .endif
115 .endfor # f
116
117 .undef MKC_CHECK_FUNCLIBS
118 .undef MKC_REQUIRE_FUNCLIBS
119
120 ######################################################
121 # checking for sizeof(xxx)
122 .for t in ${MKC_CHECK_SIZEOF:U}
123 .if !defined(SIZEOF.${t:S|.|_|g:S|-|_|g:S|*|P|g:S|/|_|g:S|:|.|g})
124 SIZEOF.${t:S|.|_|g:S|-|_|g:S|*|P|g:S|/|_|g:S|:|.|g} != env ${mkc.environ} mkc_check_sizeof ${t:S/:/ /g}
125 .endif
126 .if ${SIZEOF.${t:S|.|_|g:S|-|_|g:S|*|P|g:S|/|_|g:S|:|.|g}} != failed
127 MKC_CFLAGS += -DSIZEOF_${t:S/-/_/g:S| |_|g:S|*|P|g:S|:|_|g:S|.|_|g:tu}=${SIZEOF.${t:S|.|_|g:S|-|_|g:S|*|P|g:S|/|_|g:S|:|.|g}}
128 .endif
129 .endfor
130
131 .undef MKC_CHECK_SIZEOF
132
133 ######################################################
134 # checking for declared #define
135 .for d in ${MKC_CHECK_DEFINES:U} ${MKC_REQUIRE_DEFINES:U}
136 .if !defined(HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g})
137 HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_decl define ${d:S/:/ /g}
138 .endif
139 .if ${HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g}}
140 .if empty(MKC_REQUIRE_DEFINES:U:M${d})
141 MKC_CFLAGS += -DHAVE_DEFINE_${d:tu:S/:/_/g:S/./_/g:S|/|_|g}=1
142 .endif
143 .endif
144 .endfor
145
146 .for d in ${MKC_REQUIRE_DEFINES:U}
147 .if !${HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g}}
148 _fake != env ${mkc.environ} mkc_check_decl -d define ${d:S/:/ /g} && echo
149 MKC_ERR_MSG += "ERROR: cannot find declaration of define ${d}"
150 .endif
151 .endfor
152
153 .undef MKC_CHECK_DEFINES
154 .undef MKC_REQUIRE_DEFINES
155
156 ######################################################
157 # checking for declared type
158 .for t in ${MKC_CHECK_TYPES:U} ${MKC_REQUIRE_TYPES:U}
159 .if !defined(HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g})
160 HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_decl type ${t:S/:/ /g}
161 .endif
162 .if ${HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g}}
163 .if empty(MKC_REQUIRE_TYPES:U:M${t})
164 MKC_CFLAGS += -DHAVE_TYPE_${t:tu:S/:/_/g:S/./_/g:S|/|_|g}=1
165 .endif
166 .endif
167 .endfor
168
169 .for t in ${MKC_REQUIRE_TYPES:U}
170 .if !${HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g}}
171 _fake != env ${mkc.environ} mkc_check_decl -d type ${t:S/:/ /g} && echo
172 MKC_ERR_MSG += "ERROR: cannot find declaration of type ${t}"
173 .endif
174 .endfor
175
176 .undef MKC_CHECK_TYPES
177 .undef MKC_REQUIRE_TYPES
178
179 ######################################################
180 # checking for declared variables
181 .for d in ${MKC_CHECK_VARS:U} ${MKC_REQUIRE_VARS:U}
182 .if !defined(HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g})
183 HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_decl variable ${d:S/:/ /g}
184 .endif
185 .if ${HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g}}
186 .if empty(MKC_REQUIRE_VARS:U:M${d})
187 MKC_CFLAGS += -DHAVE_VAR_${d:tu:S/:/_/g:S/./_/g:S|/|_|g}=1
188 .endif
189 .endif
190 .endfor
191
192 .for d in ${MKC_REQUIRE_VARS:U}
193 .if !${HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g}}
194 _fake != env ${mkc.environ} mkc_check_decl -d variable ${d:S/:/ /g} && echo
195 MKC_ERR_MSG += "ERROR: cannot find declaration of variable ${d}"
196 .endif
197 .endfor
198
199 .undef MKC_CHECK_VARS
200 .undef MKC_REQUIRE_VARS
201
202 ######################################################
203 # checking for struct members
204 .for m in ${MKC_CHECK_MEMBERS:U} ${MKC_REQUIRE_MEMBERS:U}
205 .if !defined(HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g})
206 HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g} != env ${mkc.environ} mkc_check_decl member ${m:S/:/ /g}
207 .endif
208 .if ${HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g}}
209 .if empty(MKC_REQUIRE_MEMBERS:U:M${m})
210 MKC_CFLAGS += -DHAVE_MEMBER_${m:tu:S/:/_/g:S/./_/g:S|/|_|g:S/-/_/g}=1
211 .endif
212 .endif
213 .endfor
214
215 .for m in ${MKC_REQUIRE_MEMBERS:U}
216 .if !${HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g}}
217 _fake != env ${mkc.environ} mkc_check_decl -d member ${m:S/:/ /g} && echo
218 MKC_ERR_MSG += "ERROR: cannot find member ${m}"
219 .endif
220 .endfor
221
222 .undef MKC_CHECK_MEMBERS
223 .undef MKC_REQUIRE_MEMBERS
224
225 ######################################################
226 # checking for declared functions
227 .for n in 0 1 2 3 4 5 6 7 8 9
228
229 .for d in ${MKC_CHECK_FUNCS${n}:U} ${MKC_REQUIRE_FUNCS${n}:U}
230 .if !defined(HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g})
231 HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_decl func${n} ${d:S/:/ /g}
232 .endif
233 .if ${HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g}}
234 .if empty(MKC_REQUIRE_FUNCS${n}:U:M${d})
235 MKC_CFLAGS += -DHAVE_FUNC${n}_${d:tu:S/:/_/g:S/./_/g:S|/|_|g}=1
236 .endif
237 .endif
238 .endfor # d
239
240 .for d in ${MKC_REQUIRE_FUNCS${n}:U}
241 .if !${HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g}}
242 _fake != env ${mkc.environ} mkc_check_decl -d func${n} ${d:S/:/ /g} && echo
243 MKC_ERR_MSG += "ERROR: cannot find declaration of function ${d}"
244 .endif
245 .endfor # d
246
247 MKC_CHECK_FUNCS${n} := # workaround for buggy bmake-20110606
248 MKC_REQUIRE_FUNCS${n} := # workaround for buggy bmake-20110606
249
250 .undef MKC_CHECK_FUNCS${n}
251 .undef MKC_REQUIRE_FUNCS${n}
252
253 .endfor # n
254
255 ######################################################
256 # custom checks
257 .for c in ${MKC_CHECK_CUSTOM} ${MKC_REQUIRE_CUSTOM}
258 .if !defined(CUSTOM.${c})
259 .if !defined(MKC_CUSTOM_FN.${c})
260 MKC_CUSTOM_FN.${c} = ${c}.c
261 .endif
262 .if empty(MKC_CUSTOM_FN.${c}:M/*)
263 MKC_CUSTOM_FN.${c} := ${MKC_CUSTOM_DIR}/${MKC_CUSTOM_FN.${c}}
264 .endif
265 .if ${c} == "endianess"
266 .warning "endianess test deprecated; use endianness instead"
267 .endif
268 CUSTOM.${c} != env ${mkc.environ} mkc_check_custom ${MKC_CUSTOM_FN.${c}}
269 .endif
270 .if !empty(CUSTOM.${c}) && ${CUSTOM.${c}} != 0
271 .if empty(MKC_REQUIRE_CUSTOM:U:M${c})
272 MKC_CFLAGS += -DCUSTOM_${c:tu}=${CUSTOM.${c}}
273 .endif
274 .endif
275 .endfor
276
277 .for c in ${MKC_REQUIRE_CUSTOM}
278 .if empty(CUSTOM.${c}) || ${CUSTOM.${c}} == 0
279 _fake != env ${mkc.environ} mkc_check_custom -d ${MKC_CUSTOM_FN.${c}} && echo
280 MKC_ERR_MSG += "ERROR: custom test ${c} failed"
281 .endif
282 .endfor
283
284 .for c in ${MKC_CHECK_BUILTINS}
285 BUILTIN.${c} = ${CUSTOM.${c}}
286 .endfor
287
288 ######################################################
289 # checking for programs
290 .for p in ${MKC_CHECK_PROGS} ${MKC_REQUIRE_PROGS}
291 p_ := ${p}
292 prog_id := ${MKC_PROG.id.${p:S|+|x|g}:U${p}:S|/|_|g}
293 .ifdef PROG.${prog_id}
294 .elif !empty(p_:M/*)
295 PROG.${prog_id} = ${p}
296 .else
297 PROG.${prog_id} != env ${mkc.environ} mkc_check_prog -i '${prog_id}' '${p}'
298 .endif # !defined(PROG.${prog_id})
299 .ifndef HAVE_PROG.${prog_id}
300 .if !empty(PROG.${prog_id}) && exists(${PROG.${prog_id}})
301 HAVE_PROG.${prog_id} = 1
302 .else
303 HAVE_PROG.${prog_id} = 0
304 .endif
305 .endif # ifndef HAVE_PROG.${prog_id}
306
307 .if !${HAVE_PROG.${prog_id}} && !empty(MKC_REQUIRE_PROGS:U1:M${p})
308 _fake != env ${mkc.environ} mkc_check_prog -d -i '${prog_id}' '${p}' && echo
309 MKC_ERR_MSG += "ERROR: cannot find program ${p}"
310 .endif
311 .endfor # p
312
313 .undef MKC_CHECK_PROGS
314 .undef MKC_REQUIRE_PROGS
315
316 .undef MKC_CHECK_CUSTOM
317 .undef MKC_REQUIRE_CUSTOM
318
319 ######################################################
320 # prototype checks
321 .for p in ${MKC_CHECK_PROTOTYPES} ${MKC_REQUIRE_PROTOTYPES}
322 .if !defined(HAVE_PROTOTYPE.${p})
323 HAVE_PROTOTYPE.${p} != env ${mkc.environ} mkc_check_decl prototype \
324 ${MKC_PROTOTYPE_FUNC.${p}:Q} ${MKC_PROTOTYPE_HEADERS.${p}}
325 .endif # !defined(HAVE_PROTOTYPE.${p})
326 .if ${HAVE_PROTOTYPE.${p}}
327 MKC_CFLAGS += -DHAVE_PROTOTYPE_${p:tu}=1
328 .elif !empty(MKC_REQUIRE_PROTOTYPES:U:M${p})
329 _fake != env ${mkc.environ} mkc_check_decl -d prototype \
330 ${MKC_PROTOTYPE_FUNC.${p}:Q} ${MKC_PROTOTYPE_HEADERS.${p}}; echo
331 MKC_ERR_MSG += "ERROR: prototype test ${p} failed"
332 .endif # ${PROTOTYPE.${p}}
333 .endfor # p
334
335 .undef MKC_CHECK_PROTOTYPES
336 .undef MKC_REQUIRE_PROTOTYPES
337
338 ######################################################
339 # final assignment
340 .include <mkc_imp.conf-final.mk>
341
342 .endif # MKCHECKS == yes
343
344 ######################################################
345 ######################################################
346 ######################################################
347 .for i in ${_MKC_SOURCE_FUNCS}
348 CLEANFILES += ${i}.o
349 .endfor
350
351 .undef MKC_SOURCE_FUNCLIBS
55 .include <mkc_imp.preinit.mk>
66 .include <mkc.init.mk>
77
8 .include <configure.mk>
8 .include <mkc_imp.conf.mk>
99
1010 .PHONY: configure
1111 configure: errorcheck
0 # Copyright (c) 2009-2013 by Aleksey Cheusov
0 # Copyright (c) 2009-2014 by Aleksey Cheusov
11 # Copyright (c) 1994-2009 The NetBSD Foundation, Inc.
22 # Copyright (c) 1988, 1989, 1993 The Regents of the University of California
33 # Copyright (c) 1988, 1989 by Adam de Boor
1616 ###########
1717 SHORTPRJNAME ?= yes
1818
19 .ifdef DPLIBDIRS
20 .for _dir in ${DPLIBDIRS}
21 .ifndef DPLIBDIRS.${_dir}
22 .if ${SHORTPRJNAME:tl} == "yes"
23 DPLIBDIRS.${_dir} = ${OBJDIR_${_dir:T}}
24 .else
25 DPLIBDIRS.${_dir} = ${OBJDIR_${_dir:S,/,_,g}}
26 .endif
27 .if ${TARGET_OPSYS} == "HP-UX"
28 LDFLAGS0 += ${CFLAGS.cctold}+b ${CFLAGS.cctold}${LIBDIR}
29 .endif
30 LDFLAGS0 += -L${DPLIBDIRS.${_dir}}
31 .endif
32 .endfor
33
34 #.undef DPLIBDIRS
35
36 .endif # DPLIBDIRS
37
3819 ######################################################################
3920 .ifndef __initialized__
4021 __initialized__ := 1
5435
5536 .for p in ${PROGS}
5637 SRCS.${p} ?= ${p}.c
57 SRCS.${p} += ${SRCS} # SRCS may be changed by mkc_imp.configure.mk
38 SRCS.${p} += ${SRCS} # SRCS may be changed by mkc_imp.conf.mk
5839 _srcsall += ${SRCS.${p}}
5940 .endfor
6041
6344 SRCS ?= ${PROG}.c
6445 SRCS.${PROG} ?= ${SRCS}
6546 _srcsall += ${SRCS}
47 .elif ${.CURDIR:T} == ${COMPATLIB:U}
48 SRCS ?= ${FEATURESDIR}/_mkcfake.c
49 _srcsall += ${SRCS}
6650 .elif defined(LIB)
6751 SRCS ?= ${LIB}.c
6852 _srcsall += ${SRCS}
7054
7155 .if !empty(_srcsall:U:M*.cxx) || !empty(_srcsall:U:M*.cpp) || !empty(_srcsall:U:M*.C) || !empty(_srcsall:U:M*.cc)
7256 src_type += cxx
73 LDCOMPILER = yes
7457 LDREAL ?= ${CXX}
7558 .elif !empty(_srcsall:U:M*.pas) || !empty(_srcsall:U:M*.p)
7659 src_type += pas
77 LDCOMPILER = yes
7860 LDREAL ?= ${PC}
7961 .endif
80
81 LDCOMPILER.Interix = yes
82 LDCOMPILER.Darwin = yes
83 #LDCOMPILER.HP-UX= yes
84 LDCOMPILER ?= ${LDCOMPILER.${TARGET_OPSYS}:Uyes}
8562
8663 .if !empty(_srcsall:U:M*.c) || !empty(_srcsall:U:M*.l) || !empty(_srcsall:U:M*.y) || defined(MKC_SOURCE_FUNCLIBS)
8764 src_type += c
8966
9067 src_type ?= 0
9168
92 .if ${LDCOMPILER:tl} == "yes"
9369 LDREAL ?= ${CC}
94 .endif
9570
9671 .if defined(PROGS)
9772 LDREAL ?= ${CC}
10176
10277 MKC_CACHEDIR ?= ${.OBJDIR} # directory for cache and intermediate files
10378
104 init_make_level ?= 0 # for mkc.configure.mk
79 init_make_level ?= 0 # for mkc_imp.conf.mk
10580
10681 .if ${.MAKE.LEVEL} == ${init_make_level}
10782 SRCTOP ?= ${.CURDIR}
12499
125100 .if defined(MAKECONF) && exists(${MAKECONF})
126101 .include "${MAKECONF}"
102 .elif defined(MKC_SYSCONFDIR) && exists(${MKC_SYSCONFDIR}/mk-c.conf)
103 .include "${MKC_SYSCONFDIR}/mk-c.conf"
127104 .elif defined(MKC_SYSCONFDIR) && exists(${MKC_SYSCONFDIR}/mk.conf)
128105 .include "${MKC_SYSCONFDIR}/mk.conf"
129 .elif exists(/etc/mk.conf)
130 .include "/etc/mk.conf"
131106 .endif
132107
133108 .if ${OPSYS:Ux} == "SunOS"
154129 LIBEXECDIR ?= ${PREFIX}/libexec
155130 INCSDIR ?= ${PREFIX}/include
156131 DATADIR ?= ${PREFIX}/share
132 SHAREDSTATEDIR ?= ${PREFIX}/com
133 VARDIR ?= ${PREFIX}/var
157134 SYSCONFDIR ?= ${PREFIX}/etc
158135 INFODIR ?= ${PREFIX}/info
159136 MANDIR ?= ${PREFIX}/man
260237 SHLIB_MAJOR ?= 1
261238 .endif # MKDLL
262239
263 .if defined(SHLIB_MAJOR)
240 INTERNALLIBS += ${COMPATLIB}
241 STATICLIBS += ${INTERNALLIBS}
242
243 .if defined(SHLIB_MAJOR) && empty(STATICLIBS:M${.CURDIR:T})
264244 MKSHLIB ?= yes
265245 .else
266246 MKSHLIB ?= no
267247 .endif # SHLIB_MAJOR
268248
269 MKPICLIB ?= no
270 MKPROFILELIB ?= no
249 .if !empty(STATICLIBS:M${.CURDIR:T})
250 MKPICLIB ?= yes
251 .else
252 MKPICLIB ?= no
253 .endif
254
255 MKPROFILELIB ?= no
271256
272257 MKINSTALLDIRS ?= yes
273258
324309
325310 CC ?= cc
326311 CFLAGS ?=
327 COMPILE.c ?= ${_V} ${CC_PREFIX} ${CC} ${CFLAGS} ${CPPFLAGS} ${_CFLAGS.ssp} ${_CFLAGS.pie} ${CFLAGS.warns} -c
312 COMPILE.c ?= ${_V} ${CC_PREFIX} ${CC} ${CFLAGS} ${_CPPFLAGS} ${_CFLAGS.ssp} ${_CFLAGS.pie} ${CFLAGS.warns} -c
328313 MESSAGE.c ?= @${_MESSAGE} "CC: ${.IMPSRC}"
329314
330315 CXX ?= c++
331316 CXXFLAGS += ${CFLAGS}
332 COMPILE.cc ?= ${_V} ${CXX_PREFIX} ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${_CXXFLAGS.ssp} ${_CXXFLAGS.pie} ${CXXFLAGS.warns} -c
317 COMPILE.cc ?= ${_V} ${CXX_PREFIX} ${CXX} ${CXXFLAGS} ${_CPPFLAGS} ${_CXXFLAGS.ssp} ${_CXXFLAGS.pie} ${CXXFLAGS.warns} -c
333318 MESSAGE.cc ?= @${_MESSAGE} "CXX: ${.IMPSRC}"
334319
335320 OBJC ?= ${CC}
336321 OBJCFLAGS ?= ${CFLAGS}
337 COMPILE.m ?= ${_V} ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
322 COMPILE.m ?= ${_V} ${OBJC} ${OBJCFLAGS} ${_CPPFLAGS} -c
338323 MESSAGE.m ?= @${_MESSAGE} "OBJC: ${.IMPSRC}"
339324
340325 CPP ?= cpp
341326 CPPFLAGS ?=
327
328 _CPPFLAGS = ${CPPFLAGS0} ${CPPFLAGS}
342329
343330 FC ?= f77
344331 FFLAGS ?= -O
345332 RFLAGS ?=
346333 COMPILE.f ?= ${_V} ${FC} ${FFLAGS} -c
347334 MESSAGE.f ?= @${_MESSAGE} "FC: ${.IMPSRC}"
348 COMPILE.F ?= ${_V} ${FC} ${FFLAGS} ${CPPFLAGS} -c
335 COMPILE.F ?= ${_V} ${FC} ${FFLAGS} ${_CPPFLAGS} -c
349336 MESSAGE.F ?= ${MESSAGE.f}
350337 COMPILE.r ?= ${_V} ${FC} ${FFLAGS} ${RFLAGS} -c
351338 MESSAGE.r ?= ${MESSAGE.f}
368355 LD ?= ${LD.${TARGET_OPSYS}:Uld}
369356 LDFLAGS ?=
370357
358 .if ${OPSYS} == "Haiku"
359 LN ?= ln -s
360 LN_S ?= ln -s
361 .else
371362 LN ?= ln
372363 LN_S ?= ${LN} -s
364 .endif
373365
374366 LORDER ?= lorder
375367
379371
380372 PC ?= pc
381373 PFLAGS ?=
382 COMPILE.p ?= ${_V} ${PC} ${PFLAGS} ${CPPFLAGS} -c
374 COMPILE.p ?= ${_V} ${PC} ${PFLAGS} ${_CPPFLAGS} -c
383375 MESSAGE.p ?= @${_MESSAGE} "PC: ${.IMPSRC}"
384376
385377 SHELL ?= sh
392384 YFLAGS ?=
393385 YACC.y ?= ${_V} ${YACC} ${YFLAGS}
394386 MESSAGE.y ?= @${_MESSAGE} "YACC: ${.IMPSRC}"
387
388 MESSAGE.mkgen ?= @${_MESSAGE} "MKGEN:"
395389
396390 TAR ?= tar
397391 GZIP ?= gzip
434428 ###########
435429
436430 TARGETS += all install clean cleandir depend test \
437 installdirs uninstall errorcheck filelist obj
431 installdirs uninstall errorcheck filelist obj mkgen
438432 TARGETS := ${TARGETS:O:u}
439433
440 ALLTARGETS += all install clean cleandir depend uninstall installdirs \
441 bin_tar bin_targz bin_tarbz2 bin_zip bin_deb
434 ALLTARGETS += errorcheck all install clean cleandir depend uninstall installdirs \
435 mkgen bin_tar bin_targz bin_tarbz2 bin_zip bin_deb
442436
443437 VERBOSE_ECHO ?= echo
444438
44
55 TEST_PREREQS ?= all
66
7 _tmp_out:=${.OBJDIR}/${.CURDIR:T}.test.out
8
79 .PHONY : test
810 test: ${TEST_PREREQS}
911 @echo 'Testing ${.CURDIR}... ' 1>&2; \
1012 set -e; cd ${.CURDIR}; \
11 tmp_out=${.OBJDIR}/${.CURDIR:T}.test.out; \
12 ${RM} -f $$tmp_out; \
13 ${MAKE} ${MAKEFLAGS} test_output > $$tmp_out.tmp; \
14 mv $$tmp_out.tmp $$tmp_out; \
13 ${RM} -f ${_tmp_out}; \
14 ${MAKE} ${MAKEFLAGS} test_output > ${_tmp_out}.tmp; \
15 mv ${_tmp_out}.tmp ${_tmp_out}; \
1516 if test -f ${.CURDIR}/expect.${OPSYS}.out; then \
1617 expect=${.CURDIR}/expect.${OPSYS}.out; \
1718 else \
1819 expect=${.CURDIR}/expect.out; \
1920 fi; \
20 diff $$expect $$tmp_out && \
21 diff $$expect ${_tmp_out} && \
2122 echo ' succeeded' 1>&2 || \
2223 { echo ' FAILED' 1>&2; false; }
2324
0 # Copyright (c) 2014 by Aleksey Cheusov
1 #
2 # See LICENSE file in the distribution.
3 ############################################################
4
5 .include <mkc_imp.conf.mk>
6
7 .undef MKC_NOAUTO
8 .undef MKC_NOSRCSAUTO
3737 .for i in ${MKC_LDADD}
3838 LDADD += ${i}
3939 .endfor
40 .for i in ${MKC_SRCS}
40 .if !${MKC_NOSRCSAUTO:U0}
41 . for i in ${MKC_SRCS}
4142 SRCS += ${i}
42 .endfor
43 . endfor
44 .endif
4345 .endif # .if MKC_AUTO
4446
4547 .undef MKC_CPPFLAGS
0 # Copyright (c) 2009-2014, Aleksey Cheusov <vle@gmx.net>
1 # All rights reserved.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions
5 # are met:
6 # 1. Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer.
8 # 2. Redistributions in binary form must reproduce the above copyright
9 # notice, this list of conditions and the following disclaimer in the
10 # documentation and/or other materials provided with the distribution.
11 #
12 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
13 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
14 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
15 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
16 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22 # POSSIBILITY OF SUCH DAMAGE.
23
24 ######################################################################
25 # See mk-configure(7) for documentation
26 #
27
28 # user defined variables
29 MKC_SHOW_CACHED ?= 0 # set it to `1' to show "...(cached)..." lines
30 MKC_DELETE_TMPFILES ?= 0 # set it to `1' to delete temporary files
31 MKC_CACHEDIR ?= ${.OBJDIR} # directory for cache and intermediate files
32 MKC_COMMON_HEADERS ?= # list of headers always #included
33 MKC_NOCACHE ?= # 1 or yes for disabling cache
34 MKC_CUSTOM_DIR ?=${.CURDIR} # directory with custom tests.c
35 MKC_SOURCE_DIR ?=${.CURDIR} # directory with missing strlcat.c etc.
36 .if ${COMPATLIB:U} == ${.CURDIR:T}
37 MKC_NOSRCSAUTO ?= 1
38 .else
39 MKC_NOSRCSAUTO ?= 0
40 .endif
41
42 #
43 MKC_SOURCE_FUNCLIBS ?=
44 _MKC_SOURCE_FUNCS = ${MKC_SOURCE_FUNCLIBS:C/:.*//}
45
46 # .endif for the next .if is in the end of file
47 .if ${MKCHECKS:Uno:tl} == "yes"
48
49 HAVE_FUNCLIB.main ?= 1
50
51 .if defined(MKC_COMMON_DEFINES.${TARGET_OPSYS})
52 CPPFLAGS += ${MKC_COMMON_DEFINES.${TARGET_OPSYS}}
53 .endif
54 .if defined(MKC_COMMON_DEFINES)
55 CPPFLAGS += ${MKC_COMMON_DEFINES}
56 .endif
57
58 #
59 _MKC_CPPFLAGS := ${CPPFLAGS}
60 _MKC_CFLAGS := ${CFLAGS}
61 _MKC_CXXFLAGS := ${CXXFLAGS}
62 _MKC_FFLAGS := ${FFLAGS}
63 _MKC_LDFLAGS := ${LDFLAGS}
64 _MKC_LDADD := ${LDADD}
65
66 mkc.environ=CC='${CC}' CXX='${CXX}' FC='${FC}' CPPFLAGS='${_MKC_CPPFLAGS}' CFLAGS='${_MKC_CFLAGS}' CXXFLAGS='${_MKC_CXXFLAGS}' FFLAGS='${_MKC_FFLAGS}' LDFLAGS='${_MKC_LDFLAGS}' LDADD='${_MKC_LDADD}' LEX='${LEX}' YACC='${YACC}' MKC_CACHEDIR='${MKC_CACHEDIR}' MKC_COMMON_HEADERS='${MKC_COMMON_HEADERS}' MKC_DELETE_TMPFILES='${MKC_DELETE_TMPFILES}' MKC_SHOW_CACHED='${MKC_SHOW_CACHED}' MKC_NOCACHE='${MKC_NOCACHE}' MKC_VERBOSE=1
67
68 ######################################################
69 # checking for builtin checks
70 .for i in ${MKC_CHECK_BUILTINS} ${MKC_REQUIRE_BUILTINS}
71 MKC_CUSTOM_FN.${i} ?= ${BUILTINSDIR}/${i:S/endianess/endianness/}
72 MKC_CHECK_CUSTOM += ${i}
73 MKC_REQUIRE_CUSTOM += ${MKC_REQUIRE_BUILTINS:M${i}}
74 .endfor
75
76 ######################################################
77 # checking for headers
78 .for h in ${MKC_CHECK_HEADERS} ${MKC_REQUIRE_HEADERS}
79 .if !defined(HAVE_HEADER.${h:S|.|_|g:S|/|_|g})
80 HAVE_HEADER.${h:S|.|_|g:S|/|_|g} != env ${mkc.environ} mkc_check_header ${h}
81 .endif
82 .if ${HAVE_HEADER.${h:S|.|_|g:S|/|_|g}}
83 .if empty(MKC_REQUIRE_HEADERS:U:M${h})
84 MKC_CFLAGS += -DHAVE_HEADER_${h:tu:S|.|_|g:S|/|_|g}=${HAVE_HEADER.${h:S|.|_|g:S|/|_|g}}
85 .endif
86 .elif !empty(MKC_REQUIRE_HEADERS:U:M${h})
87 _fake != env ${mkc.environ} mkc_check_header -d ${h} && echo
88 MKC_ERR_MSG += "ERROR: cannot find header ${h}"
89 .endif
90 .endfor
91
92 .undef MKC_CHECK_HEADERS
93 .undef MKC_REQUIRE_HEADERS
94
95 ######################################################
96 # checking for functions in libraries
97 .for f in ${MKC_CHECK_FUNCLIBS:U} ${MKC_SOURCE_FUNCLIBS:U} ${MKC_REQUIRE_FUNCLIBS:U}
98 .if !defined(HAVE_FUNCLIB.${f:S/:/./g})
99 HAVE_FUNCLIB.${f:S/:/./g} != env ${mkc.environ} mkc_check_funclib ${f:S/:/ /g}
100 .endif
101 .if !defined(HAVE_FUNCLIB.${f:C/:.*//})
102 HAVE_FUNCLIB.${f:C/:.*//} != env ${mkc.environ} mkc_check_funclib ${f:C/:.*//}
103 .endif
104 .if ${HAVE_FUNCLIB.${f:C/:.*//}} != ${HAVE_FUNCLIB.${f:S/:/./g}}
105 .if empty(MKC_NOAUTO_FUNCLIBS:U:S/:/./g:M${f:S/:/./g}) && empty(MKC_NOAUTO_FUNCLIBS:U:M1) && ${HAVE_FUNCLIB.${f:S/:/./g}} && !${HAVE_FUNCLIB.${f:C/:.*//}}
106 MKC_LDADD += -l${f:C/^.*://}
107 .endif
108 .endif
109 .if !${HAVE_FUNCLIB.${f:S/:/./g}} && !${HAVE_FUNCLIB.${f:C/:.*//}} && !empty(_MKC_SOURCE_FUNCS:M${f:C/:.*//})
110 MKC_SRCS += ${MKC_SOURCE_DIR.${f:C/:.*//}.c:U${MKC_SOURCE_DIR}}/${f:C/:.*//}.c
111 .endif
112 .endfor # f
113
114 .for f in ${MKC_REQUIRE_FUNCLIBS:U}
115 .if !${HAVE_FUNCLIB.${f:S/:/./g}} && !${HAVE_FUNCLIB.${f:C/:.*//}}
116 _fake != env ${mkc.environ} mkc_check_funclib -d ${f:C/:.*//} && echo
117 _fake != env ${mkc.environ} mkc_check_funclib -d ${f:S/:/ /g} && echo
118 MKC_ERR_MSG += "ERROR: cannot find function ${f}"
119 .endif
120 .endfor # f
121
122 .undef MKC_CHECK_FUNCLIBS
123 .undef MKC_REQUIRE_FUNCLIBS
124
125 ######################################################
126 # checking for sizeof(xxx)
127 .for t in ${MKC_CHECK_SIZEOF:U}
128 .if !defined(SIZEOF.${t:S|.|_|g:S|-|_|g:S|*|P|g:S|/|_|g:S|:|.|g})
129 SIZEOF.${t:S|.|_|g:S|-|_|g:S|*|P|g:S|/|_|g:S|:|.|g} != env ${mkc.environ} mkc_check_sizeof ${t:S/:/ /g}
130 .endif
131 .if ${SIZEOF.${t:S|.|_|g:S|-|_|g:S|*|P|g:S|/|_|g:S|:|.|g}} != failed
132 MKC_CFLAGS += -DSIZEOF_${t:S/-/_/g:S| |_|g:S|*|P|g:S|:|_|g:S|.|_|g:tu}=${SIZEOF.${t:S|.|_|g:S|-|_|g:S|*|P|g:S|/|_|g:S|:|.|g}}
133 .endif
134 .endfor
135
136 .undef MKC_CHECK_SIZEOF
137
138 ######################################################
139 # checking for declared #define
140 .for d in ${MKC_CHECK_DEFINES:U} ${MKC_REQUIRE_DEFINES:U}
141 .if !defined(HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g})
142 HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_decl define ${d:S/:/ /g}
143 .endif
144 .if ${HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g}}
145 .if empty(MKC_REQUIRE_DEFINES:U:M${d})
146 MKC_CFLAGS += -DHAVE_DEFINE_${d:tu:S/:/_/g:S/./_/g:S|/|_|g}=1
147 .endif
148 .endif
149 .endfor
150
151 .for d in ${MKC_REQUIRE_DEFINES:U}
152 .if !${HAVE_DEFINE.${d:S/./_/g:S/:/./g:S|/|_|g}}
153 _fake != env ${mkc.environ} mkc_check_decl -d define ${d:S/:/ /g} && echo
154 MKC_ERR_MSG += "ERROR: cannot find declaration of define ${d}"
155 .endif
156 .endfor
157
158 .undef MKC_CHECK_DEFINES
159 .undef MKC_REQUIRE_DEFINES
160
161 ######################################################
162 # checking for declared type
163 .for t in ${MKC_CHECK_TYPES:U} ${MKC_REQUIRE_TYPES:U}
164 .if !defined(HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g})
165 HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_decl type ${t:S/:/ /g}
166 .endif
167 .if ${HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g}}
168 .if empty(MKC_REQUIRE_TYPES:U:M${t})
169 MKC_CFLAGS += -DHAVE_TYPE_${t:tu:S/:/_/g:S/./_/g:S|/|_|g}=1
170 .endif
171 .endif
172 .endfor
173
174 .for t in ${MKC_REQUIRE_TYPES:U}
175 .if !${HAVE_TYPE.${t:S/./_/g:S/:/./g:S|/|_|g}}
176 _fake != env ${mkc.environ} mkc_check_decl -d type ${t:S/:/ /g} && echo
177 MKC_ERR_MSG += "ERROR: cannot find declaration of type ${t}"
178 .endif
179 .endfor
180
181 .undef MKC_CHECK_TYPES
182 .undef MKC_REQUIRE_TYPES
183
184 ######################################################
185 # checking for declared variables
186 .for d in ${MKC_CHECK_VARS:U} ${MKC_REQUIRE_VARS:U}
187 .if !defined(HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g})
188 HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_decl variable ${d:S/:/ /g}
189 .endif
190 .if ${HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g}}
191 .if empty(MKC_REQUIRE_VARS:U:M${d})
192 MKC_CFLAGS += -DHAVE_VAR_${d:tu:S/:/_/g:S/./_/g:S|/|_|g}=1
193 .endif
194 .endif
195 .endfor
196
197 .for d in ${MKC_REQUIRE_VARS:U}
198 .if !${HAVE_VAR.${d:S/./_/g:S/:/./g:S|/|_|g}}
199 _fake != env ${mkc.environ} mkc_check_decl -d variable ${d:S/:/ /g} && echo
200 MKC_ERR_MSG += "ERROR: cannot find declaration of variable ${d}"
201 .endif
202 .endfor
203
204 .undef MKC_CHECK_VARS
205 .undef MKC_REQUIRE_VARS
206
207 ######################################################
208 # checking for struct members
209 .for m in ${MKC_CHECK_MEMBERS:U} ${MKC_REQUIRE_MEMBERS:U}
210 .if !defined(HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g})
211 HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g} != env ${mkc.environ} mkc_check_decl member ${m:S/:/ /g}
212 .endif
213 .if ${HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g}}
214 .if empty(MKC_REQUIRE_MEMBERS:U:M${m})
215 MKC_CFLAGS += -DHAVE_MEMBER_${m:tu:S/:/_/g:S/./_/g:S|/|_|g:S/-/_/g}=1
216 .endif
217 .endif
218 .endfor
219
220 .for m in ${MKC_REQUIRE_MEMBERS:U}
221 .if !${HAVE_MEMBER.${m:S/./_/g:S/:/./g:S|/|_|g:S/-/_/g}}
222 _fake != env ${mkc.environ} mkc_check_decl -d member ${m:S/:/ /g} && echo
223 MKC_ERR_MSG += "ERROR: cannot find member ${m}"
224 .endif
225 .endfor
226
227 .undef MKC_CHECK_MEMBERS
228 .undef MKC_REQUIRE_MEMBERS
229
230 ######################################################
231 # checking for declared functions
232 .for n in 0 1 2 3 4 5 6 7 8 9
233
234 .for d in ${MKC_CHECK_FUNCS${n}:U} ${MKC_REQUIRE_FUNCS${n}:U}
235 .if !defined(HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g})
236 HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g} != env ${mkc.environ} mkc_check_decl func${n} ${d:S/:/ /g}
237 .endif
238 .if ${HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g}}
239 .if empty(MKC_REQUIRE_FUNCS${n}:U:M${d})
240 MKC_CFLAGS += -DHAVE_FUNC${n}_${d:tu:S/:/_/g:S/./_/g:S|/|_|g}=1
241 .endif
242 .endif
243 .endfor # d
244
245 .for d in ${MKC_REQUIRE_FUNCS${n}:U}
246 .if !${HAVE_FUNC${n}.${d:S/./_/g:S/:/./g:S|/|_|g}}
247 _fake != env ${mkc.environ} mkc_check_decl -d func${n} ${d:S/:/ /g} && echo
248 MKC_ERR_MSG += "ERROR: cannot find declaration of function ${d}"
249 .endif
250 .endfor # d
251
252 MKC_CHECK_FUNCS${n} := # workaround for buggy bmake-20110606
253 MKC_REQUIRE_FUNCS${n} := # workaround for buggy bmake-20110606
254
255 .undef MKC_CHECK_FUNCS${n}
256 .undef MKC_REQUIRE_FUNCS${n}
257
258 .endfor # n
259
260 ######################################################
261 # custom checks
262 .for c in ${MKC_CHECK_CUSTOM} ${MKC_REQUIRE_CUSTOM}
263 .if !defined(CUSTOM.${c})
264 .if !defined(MKC_CUSTOM_FN.${c})
265 MKC_CUSTOM_FN.${c} = ${c}.c
266 .endif
267 .if empty(MKC_CUSTOM_FN.${c}:M/*)
268 MKC_CUSTOM_FN.${c} := ${MKC_CUSTOM_DIR}/${MKC_CUSTOM_FN.${c}}
269 .endif
270 .if ${c} == "endianess"
271 .warning "endianess test deprecated; use endianness instead"
272 .endif
273 CUSTOM.${c} != env ${mkc.environ} mkc_check_custom ${MKC_CUSTOM_FN.${c}}
274 .endif
275 .if !empty(CUSTOM.${c}) && ${CUSTOM.${c}} != 0
276 .if empty(MKC_REQUIRE_CUSTOM:U:M${c})
277 MKC_CFLAGS += -DCUSTOM_${c:tu}=${CUSTOM.${c}}
278 .endif
279 .endif
280 .endfor
281
282 .for c in ${MKC_REQUIRE_CUSTOM}
283 .if empty(CUSTOM.${c}) || ${CUSTOM.${c}} == 0
284 _fake != env ${mkc.environ} mkc_check_custom -d ${MKC_CUSTOM_FN.${c}} && echo
285 MKC_ERR_MSG += "ERROR: custom test ${c} failed"
286 .endif
287 .endfor
288
289 .for c in ${MKC_CHECK_BUILTINS}
290 BUILTIN.${c} = ${CUSTOM.${c}}
291 .endfor
292
293 ######################################################
294 # checking for programs
295 .for p in ${MKC_CHECK_PROGS} ${MKC_REQUIRE_PROGS}
296 p_ := ${p}
297 prog_id := ${MKC_PROG.id.${p:S|+|x|g}:U${p}:S|/|_|g}
298 .ifdef PROG.${prog_id}
299 .elif !empty(p_:M/*)
300 PROG.${prog_id} = ${p}
301 .else
302 PROG.${prog_id} != env ${mkc.environ} mkc_check_prog -i '${prog_id}' '${p}'
303 .endif # !defined(PROG.${prog_id})
304 .ifndef HAVE_PROG.${prog_id}
305 .if !empty(PROG.${prog_id}) && exists(${PROG.${prog_id}})
306 HAVE_PROG.${prog_id} = 1
307 .else
308 HAVE_PROG.${prog_id} = 0
309 .endif
310 .endif # ifndef HAVE_PROG.${prog_id}
311
312 .if !${HAVE_PROG.${prog_id}} && !empty(MKC_REQUIRE_PROGS:U1:M${p})
313 _fake != env ${mkc.environ} mkc_check_prog -d -i '${prog_id}' '${p}' && echo
314 MKC_ERR_MSG += "ERROR: cannot find program ${p}"
315 .endif
316 .endfor # p
317
318 .undef MKC_CHECK_PROGS
319 .undef MKC_REQUIRE_PROGS
320
321 .undef MKC_CHECK_CUSTOM
322 .undef MKC_REQUIRE_CUSTOM
323
324 ######################################################
325 # prototype checks
326 .for p in ${MKC_CHECK_PROTOTYPES} ${MKC_REQUIRE_PROTOTYPES}
327 .if !defined(HAVE_PROTOTYPE.${p})
328 HAVE_PROTOTYPE.${p} != env ${mkc.environ} mkc_check_decl prototype \
329 ${MKC_PROTOTYPE_FUNC.${p}:Q} ${MKC_PROTOTYPE_HEADERS.${p}}
330 .endif # !defined(HAVE_PROTOTYPE.${p})
331 .if ${HAVE_PROTOTYPE.${p}}
332 MKC_CFLAGS += -DHAVE_PROTOTYPE_${p:tu}=1
333 .elif !empty(MKC_REQUIRE_PROTOTYPES:U:M${p})
334 _fake != env ${mkc.environ} mkc_check_decl -d prototype \
335 ${MKC_PROTOTYPE_FUNC.${p}:Q} ${MKC_PROTOTYPE_HEADERS.${p}}; echo
336 MKC_ERR_MSG += "ERROR: prototype test ${p} failed"
337 .endif # ${PROTOTYPE.${p}}
338 .endfor # p
339
340 .undef MKC_CHECK_PROTOTYPES
341 .undef MKC_REQUIRE_PROTOTYPES
342
343 .else # MKCHECKS == yes
344
345 .for i in ${_MKC_SOURCE_FUNCS}
346 MKC_SRCS += ${i} # for changing CLEANFILES
347 .endfor
348
349 .endif # MKCHECKS?
350
351 ######################################################
352 # final assignments
353 .include <mkc_imp.conf-final.mk>
354
355 ######################################################
356 ######################################################
357 ######################################################
358
359 .undef MKC_SOURCE_FUNCLIBS
11 # Copyright (c) 1994-2009 The NetBSD Foundation, Inc.
22
33 ######################################################################
4 .ifndef _MKC_IMP_DEP_MK
4 .if !defined(_MKC_IMP_DEP_MK) && !empty(_SRCS_ALL)
55 _MKC_IMP_DEP_MK := 1
66
77 DISTCLEANFILES += .depend ${__DPSRCS.d} ${CLEANDEPEND}
4343
4444 .if ${MKDEP_TYPE:U} == "makedepend"
4545 MKDEP.c = ${MAKEDEPEND} -f- ${ddash} ${MKDEPFLAGS} \
46 ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET}
46 ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS} > ${.TARGET}
4747 MKDEP.m = ${MKDEP} -f- ${ddash} ${MKDEPFLAGS} \
48 ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET}
48 ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS} > ${.TARGET}
4949 MKDEP.cc = ${MKDEP} -f- ${ddash} ${MKDEPFLAGS} \
50 ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET}
50 ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS} > ${.TARGET}
5151 MKDEP.s = ${MKDEP} -f- ${ddash} ${MKDEPFLAGS} \
52 ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS} > ${.TARGET}
52 ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS} > ${.TARGET}
5353 .else
5454 MKDEP.c = ${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \
55 ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS}
55 ${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS}
5656 MKDEP.m = ${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \
57 ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS}
57 ${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS}
5858 MKDEP.cc = ${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \
59 ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS}
59 ${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS}
6060 MKDEP.s = ${MKDEP} -f ${.TARGET} ${ddash} ${MKDEPFLAGS} \
61 ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${CPPFLAGS}
61 ${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} ${_CPPFLAGS}
6262 .endif
6363
6464 .depend: ${__DPSRCS.d}
7474
7575 .c.d:
7676 ${MESSAGE.dep}
77 @env CC=${MKDEP_CC} ${MKDEP.c} ${.IMPSRC}
77 @env CC=${MKDEP_CC:Q} ${MKDEP.c} ${.IMPSRC}
7878
7979 .m.d:
8080 ${MESSAGE.dep}
8282
8383 .s.d .S.d:
8484 ${MESSAGE.dep}
85 @env CC=${MKDEP_CC} ${MKDEP.s} ${.IMPSRC}
85 @env CC=${MKDEP_CC:Q} ${MKDEP.s} ${.IMPSRC}
8686
8787 .C.d .cc.d .cpp.d .cxx.d:
8888 ${MESSAGE.dep}
89 @env CC=${MKDEP_CC} ${MKDEP.cc} ${.IMPSRC}
89 @env CC=${MKDEP_CC:Q} ${MKDEP.cc} ${.IMPSRC}
9090
9191 .endif # defined(SRCS)
9292
0 # Copyright (c) 2014 by Aleksey Cheusov
1 #
2 # See LICENSE file in the distribution.
3 ############################################################
4
5 .for i in ${DPLDADD}
6 . if ( ${MKPIE:U:tl} == "yes" || defined(SHLIB_MAJOR) ) && !empty(STATICLIBS:Mlib${i})
7 LDADD0 += -l${i}_pic
8 . else
9 LDADD0 += -l${i}
10 . endif
11 .endfor
12
13 .for i in ${DPLIBDIRS}
14 . if ${TARGET_OPSYS} == "HP-UX"
15 LDFLAGS0 += ${CFLAGS.cctold}+b ${CFLAGS.cctold}${LIBDIR}
16 . endif
17 LDFLAGS0 += -L${i}
18 .endfor
19
20 .for i in ${DPINCDIRS:O:u}
21 CPPFLAGS0 += -I${i}
22 .endfor
23
24 .undef DPLIBDIRS
25 .undef DPINCDIRS
26 .undef DPLDADD
0 # Copyright (c) 2014 by Aleksey Cheusov
1 #
2 # See LICENSE file in the distribution.
3 ############################################################
4
5 .ifndef _MKC_IMP_FOREIGN_AUTOTOOLS_MK
6 _MKC_IMP_FOREIGN_AUTOTOOLS_MK := 1
7
8 MESSAGE.atconf ?= @${_MESSAGE} "CONFIGURE:"
9 MESSAGE.autotools ?= @${_MESSAGE} "AUTOTOOLS:"
10
11 MKC_REQUIRE_PROGS += autoreconf
12
13 AT_USE_AUTOMAKE ?= yes
14 AT_MAKE ?= ${MAKE}
15 AT_AUTORECONF_ARGS ?= -is -f
16
17 .if empty(FSRCDIR)
18 MKC_ERR_MSG += "FSRCDIR should not be empty"
19 .elif empty(FSRCDIR:M/*)
20 _FSRCDIR = ${.CURDIR}/${FSRCDIR}
21 .else
22 _FSRCDIR = ${FSRCDIR}
23 .endif
24
25 .if ${.OBJDIR} == ${.CURDIR}
26 .OBJDIR = ${_FSRCDIR}
27 .endif
28 _FOBJDIR = ${.OBJDIR}
29
30 _CONFIGURE_ARGS = --prefix ${PREFIX:Q} --bindir=${BINDIR:Q} \
31 --sbindir=${SBINDIR:Q} --libexecdir=${LIBEXECDIR} \
32 --sysconfdir=${SYSCONFDIR:Q} --sharedstatedir=${SHAREDSTATEDIR:Q} \
33 --localstatedir=${VARDIR:Q} --libdir=${LIBDIR:Q} \
34 --includedir=${INCSDIR:Q} --datarootdir=${DATADIR:Q} \
35 --infodir=${INFODIR:Q} --localedir=${DATADIR:Q}/locale \
36 --mandir=${MANDIR:Q} --docdir=${DATADIR:Q}/doc/${PROJECTNAME} \
37 --srcdir=${_FSRCDIR} ${AT_CONFIGURE_ARGS}
38
39 _CONFIGURE_ENV = CC=${CC:Q} CFLAGS=${CFLAGS:Q} \
40 CXX=${CXX:Q} CXXFLAGS=${CXXFLAGS:Q} \
41 CPPFLAGS=${_CPPFLAGS:Q} \
42 LDFLAGS=${LDFLAGS:Q} LIBS=${LDADD:Q} CPP=${CPP:Q} ${AT_CONFIGURE_ENV}
43
44 _AT_MAKE_ENV = ${DESTDIR:DDESTDIR=${DESTDIR:Q}} ${AT_MAKE_ENV}
45
46 realdo_mkgen:
47 ${MESSAGE.mkgen}
48 ${_V} ${PROG.autoreconf} ${AT_AUTORECONF_ARGS} ${_FSRCDIR}
49
50 realdo_errorcheck: check_mkc_err_msg .WAIT at_do_errorcheck
51
52 at_do_errorcheck: .PHONY
53 ${MESSAGE.atconf}
54 ${_V} cd ${_FOBJDIR}; env ${_CONFIGURE_ENV} ${_FSRCDIR}/configure ${_CONFIGURE_ARGS}
55
56 .for i in all clean cleandir install uninstall
57 realdo_${i}: at_do_${i}
58 at_do_${i}: .PHONY
59 ${MESSAGE.autotools}
60 ${_V} set -e; \
61 cd ${_FOBJDIR}; \
62 if test -f Makefile; then \
63 env ${_AT_MAKE_ENV} ${AT_MAKE} ${AT_MAKEFLAGS} ${.TARGET:S/^at_do_//:S/cleandir/distclean/}; \
64 fi
65 .endfor
66
67 DISTCLEANDIRS += ${_FSRCDIR}/autom4te.cache
68 DISTCLEANFILES += ${_FSRCDIR}/aclocal.m4 ${_FOBJDIR}/config.log \
69 ${_FOBJDIR}/config.status ${_FSRCDIR}/configure ${_FSRCDIR}/depcomp \
70 ${_FSRCDIR}/INSTALL ${_FSRCDIR}/install-sh ${_FOBJDIR}/Makefile \
71 ${_FSRCDIR}/missing ${_FSRCDIR}/compile ${_FOBJDIR}/stamp-h1
72
73 .if ${AT_USE_AUTOMAKE:tl:U} == yes
74 DISTCLEANFILES += ${_FSRCDIR}/Makefile.in
75 MKC_REQUIRE_PROGS += automake
76 .endif
77
78 .endif # _MKC_IMP_FOREIGN_AUTOTOOLS_MK
1111
1212 .if defined(INCS)
1313 INCSSRCDIR ?= .
14 CPPFLAGS += -I${INCSSRCDIR}
14 CPPFLAGS0 += -I${INCSSRCDIR}
1515
1616 .if ${MKINSTALL:tl} == "yes"
1717 destination_incs = ${INCS:@I@${DESTDIR}${INCSDIR}/$I@}
0 # Copyright (c) 2009-2010 by Aleksey Cheusov
0 # Copyright (c) 2009-2014 by Aleksey Cheusov
11 #
22 # See LICENSE file in the distribution.
33 ############################################################
2121 INTEXTS_SED += -e 's,@datadir@,${DATADIR},g'
2222 INTEXTS_SED += -e 's,@mandir@,${MANDIR},g'
2323 INTEXTS_SED += -e 's,@incsdir@,${INCSDIR},g'
24 INTEXTS_SED += -e 's,@vardir@,${VARDIR},g'
25 INTEXTS_SED += -e 's,@sharedstatedir@,${SHAREDSTATEDIR},g'
2426
25 .if !make(clean) && !make(cleandir) && !make(distclean)
26 .for _pattern _repl in ${INTEXTS_REPLS}
27 .if !make(clean) && !make(cleandir) && !make(distclean) #&& empty(MKC_ERR_MSG)
28 . if !empty(INTEXTS_REPLS) && ${INTEXTS_REPLS:[\#]:M*[13579]} != ""
29 MKC_ERR_MSG += "ERROR: odd number of tokens in INTEXTS_REPLS"
30 . else
31 . for _pattern _repl in ${INTEXTS_REPLS}
2732 INTEXTS_SED += -e 's,@${_pattern}@,${_repl},g'
28 .endfor
33 . endfor
34 . endif
2935 .endif
3036
3137 .for i in ${INFILES}
0 # Copyright (c) 2009-2010 by Aleksey Cheusov
0 # Copyright (c) 2009-2014 by Aleksey Cheusov
11 # Copyright (c) 1994-2009 The NetBSD Foundation, Inc.
22 # Copyright (c) 1988, 1989, 1993 The Regents of the University of California
33 # Copyright (c) 1988, 1989 by Adam de Boor
109109 .endif # !commands(...)
110110
111111 CLEANFILES += \
112 ${OBJS} ${POBJS} ${SOBJS} \
113 lib${LIB}${SHLIB_EXT} lib${LIB}${SHLIB_EXT1} \
114 lib${LIB}${SHLIB_EXT2} lib${LIB}${SHLIB_EXT3} ${SHLIBFN}
112 ${OBJS} ${POBJS} ${SOBJS}
115113
116114 .if !target(libinstall)
117115 # Make sure it gets defined
118116 libinstall::
117
118 CLEANFILES += lib${LIB}.a lib${LIB}_pic.a lib${LIB}_p.a
119119
120120 # MKSTATICLIB
121121 .if ${MKSTATICLIB:tl} != "no"
123123 .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
124124 .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a
125125 UNINSTALLFILES.lib += ${DESTDIR}${LIBDIR}/lib${LIB}.a
126 CLEANFILES += lib${LIB}.a
127126
128127 ${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
129128 .endif
134133 .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
135134 .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
136135 UNINSTALLFILES.lib += ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
137 CLEANFILES += lib${LIB}_p.a
138136
139137 ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
140138 .endif
141139
142140 # MKPICLIB
143141 .if ${MKPICLIB:tl} != "no"
144 CLEANFILES += lib${LIB}_pic.a
145 .endif
146
147 .if ${MKPICLIB:tl} != "no"
148142 libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
149143 .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
150144 .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
151 UNINSTALLFILES.lib += ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
145 UNINSTALLFILES.lib += ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
152146
153147 ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
154148 .endif
162156 .if ${MKDLL:tl} == "no"
163157 UNINSTALLFILES.lib += ${DESTDIR}${LIBDIR}/lib${LIB}${SHLIB_EXT} \
164158 ${DESTDIR}${LIBDIR}/lib${LIB}${SHLIB_EXT1}
159 CLEANFILES += \
160 lib${LIB}${SHLIB_EXT} lib${LIB}${SHLIB_EXT1} \
161 lib${LIB}${SHLIB_EXT2} ${SHLIB_EXT3:Dlib${LIB}${SHLIB_EXT3}}
162 .else
163 CLEANFILES += ${SHLIBFN}
165164 .endif
166165
167166 ${DESTDIR}${LIBDIR}/${SHLIBFN}: ${SHLIBFN}
3535 LIB = ${LUA_CMODULE:S|.|/|:T}
3636 SRCS ?= ${LUA_CMODULE:S/./_/g}.c
3737 MKDLL = Only
38 LDCOMPILER = Yes
3938 DLL_EXT = .so
4039 LIBDIR = ${LUA_CMODDIR}/${LUA_CMODULE:S|.|/|g:H}
4140 .endif # defined(LUA_CMODULES)
0 # Copyright (c) 2009-2013 by Aleksey Cheusov
0 # Copyright (c) 2009-2014 by Aleksey Cheusov
11 #
22 # See LICENSE file in the distribution.
33 ############################################################
88 .endif
99
1010 .ifdef SUBPRJS
11 SUBPRJ += ${SUBPRJS} # for backward compatility only, use SUBPRJ!
11 SUBPRJ += ${SUBPRJS} # for backward compatibility only, use SUBPRJ!
1212 .endif # defined(SUBPRJS)
13
14 .include <mkc_imp.lua.mk>
15 .include <mkc_imp.pod.mk>
16 .include <mkc.init.mk>
17
18 .ifdef AXCIENT_LIBDEPS # This feature was proposed by axcient.com developers
19 all_deps != mkc_get_deps ${.CURDIR:S,^${SUBPRJSRCTOP}/,,}
20 . for p in ${all_deps}
21 _mkfile = ${SUBPRJSRCTOP}/${p}/linkme.mk
22 . if exists(${_mkfile})
23 . include "${_mkfile}"
24 . endif
25 DPLDADD ?= ${p:T:S/^lib//}
26 DPLIBDIRS ?= ${OBJDIR_${p:S,/,_,g}}
27 DPINCDIRS ?= ${SRCDIR_${p:S,/,_,g}} ${OBJDIR_${p:S,/,_,g}}
28 . include <mkc_imp.dpvars.mk>
29 . endfor
30 .endif
31
32 .ifdef DPLIBDIRS
33 .warning "This way of using DPLIBDIRS is deprecated since 2014-08-21"
34 _DPLIBDIRS := ${DPLIBDIRS}
35 . for _dir in ${_DPLIBDIRS}
36 DPLIBDIRS = ${OBJDIR_${_dir:S,^${SUBPRJSRCTOP}/,,:S,/,_,g}}
37 . include <mkc_imp.dpvars.mk>
38 . endfor
39 . undef _DPLIBDIRS
40 . undef DPLIBDIRS
41 .endif
42
43 .if defined(LIBDEPS)
44 SUBPRJ += ${LIBDEPS} # library dependencies
45 AXCIENT_LIBDEPS := ${LIBDEPS}
46 EXPORT_VARNAMES += AXCIENT_LIBDEPS
47 .endif # defined(LIBDEPS)
1348
1449 .if !defined(LIB) && !defined(SUBPRJ)
1550 _use_prog := 1
1651 .endif
1752
18 .include <mkc_imp.lua.mk>
19 .include <mkc_imp.pod.mk>
20
21 .include <mkc.init.mk>
53 .ifdef FOREIGN
54 .include <mkc_imp.foreign_${FOREIGN}.mk>
55 .endif
2256 .include <mkc_imp.rules.mk>
2357 .include <mkc_imp.obj.mk>
2458
5589 .endif # SUBPRJ
5690
5791 ###########
58 .PHONY : print-values
59 print-values :
92 .PHONY : print_values
93 print_values :
6094 .for v in ${VARS}
6195 @printf "%s=%s\n" ${v} ${${v}:Q}
6296 .endfor
6397
64 .PHONY : print-values2
65 print-values2 :
98 .PHONY : print_values2
99 print_values2 :
66100 .for v in ${VARS}
67101 @printf "%s\n" ${${v}:Q}
68102 .endfor
69103
70104 ###########
71 .PHONY: realerrorcheck
72
73 __errorcheck: .USE
105 check_mkc_err_msg:
74106 @if test -n '${MKC_ERR_MSG}'; then \
75107 for msg in '' ${MKC_ERR_MSG}; do \
76108 fn=`printf '%s\n' "$$msg" | sed -n 's/^%%%: //p'`; \
82114 exit $$ex; \
83115 fi
84116
85 do_all : realerrorcheck
86 realerrorcheck: __errorcheck
117 all: pre_errorcheck .WAIT do_errorcheck .WAIT post_errorcheck .WAIT pre_all .WAIT do_all .WAIT post_all
118 realdo_errorcheck: check_mkc_err_msg
87119
88120 .include <mkc_imp.checkprogs.mk>
89 .include <configure.mk>
121 .include <mkc_imp.conf-cleanup.mk>
90122
91123 # features
92124 .for f in ${MKC_FEATURES}
93125 .include <mkc_imp.f_${f}.mk>
94126 .endfor
95 .include <configure.mk>
127 .include <mkc_imp.conf-cleanup.mk>
96128 CFLAGS += ${MKC_FEATURES:D-I${FEATURESDIR}}
97129
98130 .if !defined(MKC_ERR_MSG) || make(clean) || make(cleandir) || make(distclean)
1515 .if empty(j:U:M*[.]*)
1616 EXPORT_VARNAMES += OBJDIR_${i:S,/,_,g}
1717 . if ${MKRELOBJDIR:tl} == "yes"
18 OBJDIR_${j} = ${.OBJDIR}/${i}
18 OBJDIR_${j} := ${.OBJDIR}/${i}
1919 . elif defined(MAKEOBJDIRPREFIX)
20 OBJDIR_${j} = ${MAKEOBJDIRPREFIX}${.CURDIR}
20 OBJDIR_${j} := ${MAKEOBJDIRPREFIX}${.CURDIR}
2121 . elif defined(MAKEOBJDIR)
22 OBJDIR_${j} = ${MAKEOBJDIR}
22 OBJDIR_${j} := ${MAKEOBJDIR}
2323 . elif defined(_OBJ_MACHINE_DIR)
24 OBJDIR_${j} = ${.CURDIR}/obj.${MACHINE}
24 OBJDIR_${j} := ${.CURDIR}/obj.${MACHINE}
2525 . elif defined(_OBJ_DIR)
26 OBJDIR_${j} = ${.CURDIR}/obj
26 OBJDIR_${j} := ${.CURDIR}/obj
2727 . else
28 OBJDIR_${j} = ${.CURDIR}/${i}
28 OBJDIR_${j} := ${.CURDIR}/${i}
2929 . endif # MAKEOBJDIRPREFIX...
3030 . if ${SHORTPRJNAME:tl} == "yes" && ${i} != ${j}
3131 OBJDIR_${i:T} := ${OBJDIR_${j}}
1111
1212 .if defined(MKC_CHECK_PKGCONFIG) && !make(clean) && !make(cleandir) && !make(distclean)
1313 MKC_REQUIRE_PROGS+= pkg-config
14 .include <configure.mk>
14 .include <mkc_imp.conf-cleanup.mk>
1515
1616 .if ${HAVE_PROG.pkg-config}
1717
319319 .if ${TARGET_OPSYS:Unone} == "Darwin"
320320 .if ${MKDLL:U} == "no"
321321 LDFLAGS.shared.gcc.Darwin = -dynamiclib -install_name ${LIBDIR}/lib${LIB}${SHLIB_EXTFULL}
322 LDFLAGS.shared.clang.Darwin = -dynamiclib -install_name ${LIBDIR}/lib${LIB}${SHLIB_EXTFULL}
322323 SHLIB_MAJORp1 != expr 1 + ${SHLIB_MAJOR:U0}
323324 LDFLAGS.soname.gcc = -current_version ${SHLIB_MAJORp1}${SHLIB_MINOR:D.${SHLIB_MINOR}}${SHLIB_TEENY:D.${SHLIB_TEENY}}
324325 LDFLAGS.soname.gcc += -compatibility_version ${SHLIB_MAJORp1}
325326 .else
326327 LDFLAGS.shared.gcc.Darwin = -flat_namespace -bundle -undefined suppress
328 LDFLAGS.shared.clang.Darwin = -flat_namespace -bundle -undefined suppress
327329 .endif
328330 .elif ${TARGET_OPSYS:Unone} == "OSF1" && defined(LIB)
329331 CLEANFILES += ${.OBJDIR}/${LIB}_so_locations
370372 .if ${TARGET_OPSYS:Unone} == "Darwin"
371373
372374 COMPILE.s ?= ${AS} ${AFLAGS}
373 COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c
375 COMPILE.S ?= ${CC} ${AFLAGS} ${_CPPFLAGS} -c
374376
375377 .if ${MKDLL:U} != "no"
376378
99 .if !defined(_MKC_IMP_SUBPRJ_MK)
1010 _MKC_IMP_SUBPRJ_MK := 1
1111
12 EXPORT_VARNAMES += STATICLIBS COMPATLIB
13
1214 .for dir in ${SUBPRJ:S/:/ /g}
1315 .if empty(NOSUBDIR:U:M${dir})
1416 __REALSUBPRJ += ${dir}
1719
1820 .for dir in ${NOSUBDIR}
1921 NODEPS += *-${dir}:* *:*-${dir} *-*/${dir}:* *:*-*/${dir}
22 .endfor
23 .for dir in ${INTERNALLIBS}
24 NODEPS += install-${dir}:* install-*/${dir}:* \
25 uninstall-${dir}:* uninstall-*/${dir}:* \
26 installdirs-${dir}:* installdirs-*/${dir}:*
2027 .endfor
2128
2229 .ifndef SUBDIR
120127 esac
121128
122129 ###########
130 SUBPRJSRCTOP = ${.CURDIR}
131 .export SUBPRJSRCTOP
132 ###########
123133
124134 .include <mkc_imp.objdir.mk>
125135
55 MKDEP = @mkdep_cmd@
66 MKDEP_TYPE = @mkdep_type@
77 MAKEDEPEND = @makedepend_cmd@
8 NM = @NM@
66 mkc_check_prog mkc_check_custom \
77 mkc_which mkc_check_compiler \
88 mkc_install ${INSCRIPTS}
9 INSCRIPTS += mkc_check_version mkcmake
9 INSCRIPTS += mkc_check_version mkcmake mkc_get_deps
1010
1111 MAN = mkc_check_funclib.1 mkc_check_header.1 \
1212 mkc_check_sizeof.1 mkc_check_decl.1 \
1717 .sp
1818 ..
1919 .\" ------------------------------------------------------------------
20 .TH MK-CONFIGURE 7 "Dec 1, 2013" "" ""
20 .TH MK-CONFIGURE 7 "Aug 21, 2014" "" ""
2121 .SH NAME
2222 mk-configure \- lightweight replacement for GNU autotools
2323 .SH DESCRIPTION
2626 NetBSD make) and a number of executables. It is intended to simplify
2727 crossplatform development and software building.
2828 .P
29 To get system-specific configuration parameters, mkc.*.mk include
30 files try to include the file specified by the "MAKECONF"
31 variable. If MAKECONF is not set, or no such file exists, the system
32 make configuration file, @sysconfdir@/mk.conf or /etc/mk.conf, is
33 included. If "${SRCTOP}/Makefile.common" file exists it is also included
29 There are only a few top-level makefiles:
30 .BR mkc.init.mk ", " mkc.mk ", " mkc.configure.mk ", " mkc.minitest.mk .
31 Everything else
32 .RB ( mkc_imp.*.mk " files)"
33 is included implicitely. Do not use
34 .B mkc_imp.*.mk
35 files directly! If you do, I cannot guarantee backward compatibility.
36 .B mkc.configure.mk
37 is included automatically by
38 .BR mkc.mk ,
39 but can be included explicitely.
40 .B mkc.minitest.mk
41 provides a trivial support for regression tests and should be included explicitely.
42 Usually mk-c makefiles consist of variables assignments
43 and inclusion of
44 .B mkc.mk
45 in the and.
46 One can also use
47 .BR mkc.prog.mk ", " mkc.lib.mk ", " mkc.files.mk ", " mkc.subdir.mk " and " mkc.subprj.mk
48 instead of
49 .BR mkc.mk .
50 The latter activates
51 .B mkc.lib.mk
52 if variable LIB is set,
53 .B mkc.prog.mk
54 if variables PROG or PROGS are set,
55 .B mkc.subprj.mk
56 if variable SUBPRJ is set,
57 .B mkc.subdir.mk
58 if variable SUBDIR is set,
59 and
60 .B mkc.files.mk
61 otherwise.
62 .B
63 .P
64 To get system-wide configuration parameters, mkc.init.mk loads
65 "${MAKECONF}" file if it exists.
66 Otherwise, it loads
67 @sysconfdir@/mk-c.conf if it exists.
68 If neither ${MAKECONF} nor @sysconfdir@/mk-c.conf exist,
69 it tries to load @sysconfdir@/mk.conf file.
70 If "${SRCTOP}/Makefile.common" file exists it is also included
3471 by all subprojects.
3572 Unless SRCTOP variable is set, "../Makefile.inc"
3673 is also included if exists.
5087 .I Mu
5188 means "May be set in project's Makefile but may be initialized or overriden by user".
5289 .SS "Targets"
53 .BR mkc.prog.mk ", " mkc.lib.mk ", " mkc.files.mk ", " mkc.subdir.mk ", and " mkc.subprj.mk
54 include files provide the following targets:
90 Mk-configure provides the following targets:
5591 .IP all
5692 build everything.
5793 .IP clean
85121 if MKOBJDIR is "yes", creates object directories (${.OBJDIR}) according
86122 to MAKEOBJDIR and MAKEOBJPREFIX variables. Current umask is used for
87123 this.
124 .VE
125 .IP mkgen
126 .RB See " mkc_imp.foreign_autotools.mk" .
88127 .IP "bin_tar, bin_targz, bin_tarbz2, bin_zip, bin_deb"
89128 build software, install it to a temporary directory (using DESTDIR)
90129 and create .tar/.tar.gz/.tar.bz2/.zip/.deb archive
103142 All targets in this list have
104143 .IR pre\_* ", " do\_* " and " post\_*
105144 counterparts. See ALLTARGETS for details.
106 .SS "Common variables"
107 The following variables control how various files are compiled/built.
145 .SS "mkc.init.mk"
146 This file is included by
147 .BR mkc.mk " and " mkc.configure.mk
148 automatically but can be used by users directly.
149 .B mkc.init.mk
150 uses the following variables.
108151 .IP AR
109152 Create, modify, and extract from archives.
110153 .RI < Iu >
175218 .IP CPPFLAGS_<project>
176219 Similar to CPPFLAGS but for project ${PROJECTNAME}.
177220 .RI < "U" >
221 .IP CPPFLAGS0
222 The same as CPPFLAGS but CPPFLAGS0 are passed to the compiler before CPPFLAGS.
223 Normally, CPPFLAGS0 should be modified in makefiles and should not
224 be set from environment by user.
178225 .IP FC
179226 Fortran compiler.
180227 .RI < Iu >
369416 Target directory for architecture-independent text files.
370417 .RI < "Iu" >
371418 .RI [ ${PREFIX}/share ]
419 .IP SHAREDSTATEDIR
420 Target directory for modifiable architecture-independent data files.
421 .RI < "Iu" >
422 .RI [ ${PREFIX}/com ]
423 .IP VARDIR
424 Target directory for modifiable single-machine data files.
425 .RI < "Iu" >
426 .RI [ ${PREFIX}/var ]
427 .IP INCSDIR
428 Target directory for header files.
429 .RI < "Iu" >
430 .RI [ ${PREFIX}/include ]
372431 .IP SYSCONFDIR
373432 Target directory for configuration files.
374433 .RI < "Iu" >
550609 Top-level object directory which
551610 defaults to ${.OBJDIR} if ${.MAKE.LEVEL} is 0.
552611 .RI < I >
553 .SS "mkc.init.mk"
554 This file sets most important mk-configure variables, for example,
555 OPSYS, PREFIX, CC_TYPE etc. and is included automatically by
556 .BR mkc.files.mk ", " mkc.lib.mk ", " mkc.prog.mk ", " mkc.subdir.mk " and " mkc.subprj.mk
557612 .SS "mkc.files.mk"
558613 The include file
559614 .B mkc.files.mk
560 handles the FILES variables and is included
615 handles the FILES variable and is included
561616 from
562617 .BR mkc.lib.mk " and " mkc.prog.mk .
563 .B mkc_imp.files.mk
564618 List of supported variables:
565619 .IP FILES
566620 The list of files to install.
708762 Similar to LDFLAGS but for project ${PROJECTNAME}.
709763 .IP LDFLAGS0
710764 The same as LDFLAGS but LDFLAGS0 and LDADD0 are passed to the linker before LDFLAGS and LDADD.
711 Normally LDFLAGS0 and LDADD0 should be modified in makefiles and should not
765 Normally, LDFLAGS0 and LDADD0 should be modified in makefiles and should not
712766 be set from environment by user.
713767 .RI < "M" >
714768 .IP "BINDIR, BINMODE, BINOWN and BINGRP"
739793 be exported.
740794 .RI < "M" >
741795 .RI [ no ]
796 .IP DPINCDIRS
797 See LIBDEPS in section
798 .BR mk.subprj.mk .
799 .IP DPLIBDIRS
800 See LIBDEPS in section
801 .BR mk.subprj.mk .
802 .IP DPLDADD
803 See LIBDEPS in section
804 .BR mk.subprj.mk .
742805 .PP
743806 .B mkc.prog.mk
744807 includes
747810 .SS "mkc.lib.mk"
748811 The include file
749812 .B mkc.lib.mk
750 has support for building a static or dynanic library. It has a
751 limited number of suffixes.
813 has support for building a static and dynanic library or DLL.
752814 .B mkc.lib.mk
753815 uses the following variables:
754816 .IP LIB
823885 .\"
824886 .\" It has rules for building profiled objects; profiled libraries are
825887 .\" built by default.
826 .IP LDCOMPILER
827 If "yes", ${CC} is used for linking instead of ${LD}.
828 For C++ sources ${CXX} is used for linking.
829 .RI < "Iu" >
830 .RI [ yes ]
831888 .IP MKSHLIB
832889 If not "no", build and install shared library provided that SHLIB_MAJOR is defined.
833890 .RI < "IMu" >
856913 all symbols are exported.
857914 .RI < "M" >
858915 []
916 .IP DPINCDIRS
917 See LIBDEPS in section
918 .BR mk.subprj.mk .
919 .IP DPLIBDIRS
920 See LIBDEPS in section
921 .BR mk.subprj.mk .
922 .IP DPLDADD
923 See LIBDEPS in section
924 .BR mk.subprj.mk .
859925 .\" .IP "COPTS.lib<lib> OBJCCOPTS.lib<lib> LDADD.lib<lib> CPPFLAGS.lib<lib> CXXFLAGS.lib<lib>"
860926 .\" These provide a way to specify additions to the associated
861927 .\" variables in a way that applies only to a particular
924990 subdirectory doesn't exist the subproject becomes "virtual" and may be
925991 used to group several subprojects into a new virtual one.
926992 .RI < "M" >
993 .IP LIBDEPS
994 A list of library dependencies. Each token is a colon-separated pair.
995 Its first component is a library subproject (dependency), the second
996 one is the subproject for library or executable. The value of this
997 variable is automatically added to SUBPRJ. Library dependencies listed
998 in LIBDEPS automatically change CPPFLAGS0, LDFLAGS0 and LDADD0 of
999 approptiate subprojects.
1000 .RI < "M" >
1001 Suppose, we have <library:program> pair in LIBDEPS, also suppose that variable
1002 .B library
1003 is set to "library" subdirectory and variable
1004 .B program
1005 is set to "program" subdirectory.
1006 ${SRCDIR_library}/linkme.mk file is automatically included from
1007 ${SRCDIR_program}/Makefile if it exists. In this file
1008 .RI "DPLDADD [" "${library:T:S/^lib//}" "],"
1009 .RI "DPLIBDIRS [" "${OBJDIR_${library:S,/,_,g}}" "] and"
1010 .RI "DPINCDIRS [" "${SRCDIR_${library:S,/,_,g}} ${OBJDIR_${library:S,/,_,g}}" "],"
1011 may be set to non-default values. These three variables then changes
1012 LDADD0, LDFLAGS0 and CPPFLAGS0 respectively in subproject "program".
1013 The dependency graph specified by variable LIBDEPS is available to all
1014 subproject via environment.
1015 .IP STATICLIBS
1016 A list of subprojects (basenames) with static libraries. If dependency is
1017 mentioned in this variable, the suffix _pic is automatically added
1018 for PIE-executables or shared libraries that depend on this library.
1019 This variable is automatically passed to subprojects via environment.
1020 .RI < Mu >
1021 .RI [ "" ]
1022 .IP INTERNALLIBS
1023 A list of subprojects (basenames) with internal libraries.
1024 These libraries are static and not installed by target "install".
1025 .RI < M >
1026 .RI [ "" ]
1027 .IP COMPATLIB
1028 Subproject's basename for compatibility library.
1029 If this variable is set, MKC_SOURCE_FUNCLIBS and FEATURES
1030 do not change SRCS for subprojects other than ${COMPATLIB}.
1031 .RI < M >
1032 .RI [ "" ]
9271033 .IP SUBPRJ_DFLT
9281034 List of projects built and installed by default.
9291035 The default is all projects listed in SUBPRJ.
9921098 top-level ${.CURDIR} in paths.
9931099 .RI < "Iu" >
9941100 .RI [ no ]
1101 .IP SUBPRJSRCTOP
1102 This variables contains ${.CURDIR} directory and is passed to subprojects.
1103 .RI < "I" >
1104 .RI [ ${.CURDIR} ]
9951105 .P
9961106 .B mkc.subprj.mk
9971107 provides the following targets:
13251435 .RS
13261436 Avalable values:
13271437 .TP
1328 .BR prog_flex ", " prog_bison ", " prog_gawk ", " prog_gm4
1329 Find flex, bison, GNU awk or GNU m4 by analysing program's help and/or
1330 version messages. If found, BUILTIN.prog_<progname> is set to a path,
1331 otherwise it is set to an empty string. Note that
1438 .BR prog_flex ", " prog_bison ", " prog_gawk ", " prog_gm4 ", " prog_gmake
1439 Find flex, bison, GNU awk, GNU m4 or GNU make respectively
1440 by analysing program's help and/or
1441 version messages. If found, BUILTIN.prog_<progname> is set to the path,
1442 otherwise it is set to empty string. Note that
13321443 .I gawk
13331444 may be found as
13341445 .IR awk ,
13371448 .IR yacc ,
13381449 .I gm4
13391450 as
1340 .IR m4
1341 and
1451 .IR m4 ,
13421452 .I flex
13431453 as
1344 .IR lex .
1454 .IR lex " and"
1455 .I gmake
1456 as
1457 .IR make .
13451458 .TP
13461459 .BR prog_mkdep ", " prog_nbmkdep
13471460 Find traditional BSD mkdep(1) or recent NetBSD version of it respectively.
14991612 mkc_strlcat.h header.
15001613 .TP
15011614 .B strlcpy
1502 The same as strlcat.
1615 Similar to strlcat.
15031616 .TP
15041617 .B getline
15051618 This feature corresponds to getline(3) function which is a part of POSIX2008
15091622 implementation is available in libc. If not, getline.c provided by
15101623 mk-configure is added to SRCS and declaration is provided in
15111624 mkc_getline.h header.
1625 .TP
1626 .B progname
1627 This feature provides getprogname(3) and setprogname(3) functions
1628 available in *BSD.
1629 .TP
1630 .B fgetln
1631 This feature provides fgetln(3) BSD-ism.
1632 .TP
1633 .B err
1634 This feature provides err(3), errx(3), verr(3) and verrx(3) BSD-isms.
1635 .TP
1636 .B warn
1637 This feature provides warn(3), warnx(3), vwarn(3) and vwarnx(3) BSD-isms.
15121638 .TP
15131639 .B libm
15141640 This feature checks whether libm is available and if yes, adds -lm to
16591785 .RI @ "" "datadir@ ${DATADIR}"
16601786 .RI @ "" "sysconfdir@ ${SYSCONFDIR}"
16611787 .RI @ "" "incsdir@ ${INCSDIR}"
1788 .RI @ "" "vardir@ ${VARDIR}"
1789 .RI @ "" "sharedstate@ ${SHAREDSTATEDIR}"
16621790 .VE
16631791 The following variables are provided:
16641792 .IP INFILES
17761904 This module provides installation of header files and provides
17771905 the following variables:
17781906 .IP INCSDIR
1779 Target directory for includes.
1780 .RI < "Iu" >
1781 .RI [ ${PREFIX}/include ]
1907 See
1908 .BR mkc.init.mk .
17821909 .IP INCS
17831910 The list of include files.
17841911 .RI < "M" >
18992026 Compiler passed to mkdep(1).
19002027 .RI < "Iu" >
19012028 .RI [ "${CC}" ].
2029 .SS "mkc_imp.foreign_autotools.mk"
2030 This module is activated if variable FOREIGN is set to "autotools" and provides
2031 support for building external projects using autotools.
2032 It also provides a recursive target
2033 .B mkgen
2034 for generating "configure" script, "Makefile.in" file etc. using
2035 .BR autoreconf(1) " utility."
2036 The following variables are provided:
2037 .IP FSRCDIR
2038 Relative (to ${.CURDIR}) or absolute directory to autotools-based sources.
2039 .IP AT_MAKE
2040 Make(1)-like utility for the project.
2041 .RI < "Imu" >
2042 .RI [ "${MAKE}" ].
2043 .IP AT_USE_AUTOMAKE
2044 If "yes",
2045 .B automake(1)
2046 is used.
2047 .RI < "M" >
2048 .RI [ yes ].
2049 .IP AT_CONFIGURE_ARGS
2050 Extra arguments passed to "configure" script set in addition to
2051 standard ones (--prefix, --bindir etc.).
2052 .RI < "Mu" >
2053 .RI [ "" ].
2054 .IP AT_CONFIGURE_ENV
2055 Environment variables for "configure" script set in addition to
2056 standard ones (CC, CFLAGS etc.).
2057 .RI < "Mu" >
2058 .RI [ "" ].
2059 .IP AT_AUTORECONF_ARGS
2060 Arguments passed to
2061 .BR autoreconf(1) .
2062 .RI < "U" >
2063 .RI [ "-sif" ].
19022064 .SH "CROSS COMPILATION"
19032065 The following variables are used for compiling software using cross-tools.
19042066 .IP MACHINE_GNU_PLATFORM
19272089 Path to mk.conf file .include-ed by mkc.*.mk files
19282090 .SH "FILES"
19292091 .IP @sysconfdir@/mk.conf
1930 .include-ed by mkc.*.mk if exists
1931 .IP /etc/mk.conf
1932 .include-ed by mkc.*.mk if exists
2092 .include-ed by mkc.init.mk if exists
19332093 .SH "BUGS"
19342094 Target
19352095 .IR errorcheck " (" configure ")"
00 #!/bin/sh
11
22 ############################################################
3 # Copyright (c) 2009-2010 by Aleksey Cheusov
3 # Copyright (c) 2009-2014 by Aleksey Cheusov
44 #
55 # See LICENSE file in the distribution.
66 ############################################################
0 #!@AWK@ -f
1
2 # Usage: mkc_get_deps
3 # $1 -- project name
4 # ENVIRON ["AXCIENT_LIBDEPS"] -- dep1:prj1 dep2:prj2 ...
5
6 function print_all_deps (prj, i,next_prj){
7 if (prj in processed)
8 return
9
10 processed [prj]=1
11
12 for (i=1; i <= count [prj]; ++i){
13 next_prj = graph[prj, i]
14 print_all_deps(next_prj)
15 }
16
17 if (topprj != prj)
18 result [++result_sz] = prj
19 }
20
21 BEGIN {
22 topprj = ARGV [1]
23 if (!topprj)
24 exit(10)
25
26 cnt = split(ENVIRON ["AXCIENT_LIBDEPS"], deps, / +|:/)
27 if (int(cnt/2)*2 != cnt)
28 exit(11)
29
30 for (i=1; i <= cnt; i += 2){
31 from = deps [i]
32 to = deps [i+1]
33 graph[to, ++count [to]] = from
34 }
35
36 print_all_deps(topprj)
37
38 for (i=result_sz; i >= 1; --i)
39 print result [i]
40
41 print "" # for bmake
42 }
0 FOREIGN = autotools
1 TEST_PREREQS =
2
3 .include "test.mk"
4 .include <mkc.mk>
0 =========== all ============
1 FSRCDIR should not be empty
2 *** Error code 1
0 .PHONY : test_output
1 test_output :
2 @set -e; \
3 \
4 echo =========== all ============; \
5 ${MAKE} ${MAKEFLAGS} all 2>&1 | head -n 2; \
6 \
7 ${MAKE} ${MAKEFLAGS} cleandir > /dev/null
8
9 .include <mkc.minitest.mk>
00 .PATH: ../../examples/hello_cxxlib/cxxlib
11
2 MKDLL= yes
2 MKDLL = only
33
44 .include "../../examples/hello_cxxlib/cxxlib/Makefile"
55 .include "../mkpiclib/test.mk"
00 =========== all ============
11 /objdir/Makefile
2 /objdir/_mkc_compiler_type.err
3 /objdir/_mkc_compiler_type.res
24 /objdir/_mkc_cxx_type.err
35 /objdir/_mkc_cxx_type.res
6 /objdir/_mkc_funclib_dummy.c
7 /objdir/_mkc_funclib_dummy.err
8 /objdir/_mkc_funclib_dummy.res
49 /objdir/_mkc_prog_cxx.err
510 /objdir/_mkc_prog_cxx.res
611 /objdir/cxxlib.so
12 /objdir/dummy.os
713 /objdir/expect.out
8 /objdir/hello_msg1.o
914 /objdir/hello_msg1.os
10 /objdir/hello_msg2.o
1115 /objdir/hello_msg2.os
12 /objdir/libcxxlib.a
1316 /objdir/mkdll.test.out.tmp
1417 ========= install ==========
1518 /objdir/prefix
2023 /objdir/prefix/include/impl/hello_msg2.h
2124 /objdir/prefix/lib
2225 /objdir/prefix/lib/cxxlib.so
23 /objdir/prefix/lib/libcxxlib.a
2426 ======== uninstall =========
2527 ========== clean ===========
2628 /objdir/Makefile
29 /objdir/_mkc_compiler_type.err
30 /objdir/_mkc_compiler_type.res
2731 /objdir/_mkc_cxx_type.err
2832 /objdir/_mkc_cxx_type.res
33 /objdir/_mkc_funclib_dummy.c
34 /objdir/_mkc_funclib_dummy.err
35 /objdir/_mkc_funclib_dummy.res
2936 /objdir/_mkc_prog_cxx.err
3037 /objdir/_mkc_prog_cxx.res
3138 /objdir/expect.out
3239 /objdir/mkdll.test.out.tmp
40 ======= CLEANFILES ==========
41 /objdir/mkdll.test.out
42 cxxlib.so
43 dummy.o
44 dummy.op
45 dummy.os
46 hello_msg1.o
47 hello_msg1.op
48 hello_msg1.os
49 hello_msg2.o
50 hello_msg2.op
51 hello_msg2.os
52 libcxxlib.a
53 libcxxlib_p.a
54 libcxxlib_pic.a
55 ======= UNINSTALLFILES ==========
56 /prefix/include/hello_msg.h
57 /prefix/include/impl/hello_msg1.h
58 /prefix/include/impl/hello_msg2.h
59 /prefix/lib/cxxlib.so
3360 ======= distclean ==========
3461 /objdir/Makefile
3562 /objdir/expect.out
00 =========== all ============
11 /objdir/Makefile
2 /objdir/_mkc_compiler_type.err
3 /objdir/_mkc_compiler_type.res
24 /objdir/_mkc_cxx_type.err
35 /objdir/_mkc_cxx_type.res
6 /objdir/_mkc_funclib_dummy.c
7 /objdir/_mkc_funclib_dummy.err
8 /objdir/_mkc_funclib_dummy.res
49 /objdir/_mkc_prog_cxx.err
510 /objdir/_mkc_prog_cxx.res
11 /objdir/dummy.os
612 /objdir/expect.out
713 /objdir/hello_msg1.os
814 /objdir/hello_msg2.os
2127 ======== uninstall =========
2228 ========== clean ===========
2329 /objdir/Makefile
30 /objdir/_mkc_compiler_type.err
31 /objdir/_mkc_compiler_type.res
2432 /objdir/_mkc_cxx_type.err
2533 /objdir/_mkc_cxx_type.res
34 /objdir/_mkc_funclib_dummy.c
35 /objdir/_mkc_funclib_dummy.err
36 /objdir/_mkc_funclib_dummy.res
2637 /objdir/_mkc_prog_cxx.err
2738 /objdir/_mkc_prog_cxx.res
2839 /objdir/expect.out
2940 /objdir/mkpiclib.test.out.tmp
3041 /objdir/test.mk
42 ======= CLEANFILES ==========
43 /objdir/mkpiclib.test.out
44 dummy.o
45 dummy.op
46 dummy.os
47 hello_msg1.o
48 hello_msg1.op
49 hello_msg1.os
50 hello_msg2.o
51 hello_msg2.op
52 hello_msg2.os
53 libcxxlib.a
54 libcxxlib_p.a
55 libcxxlib_pic.a
56 ======= UNINSTALLFILES ==========
57 /prefix/include/hello_msg.h
58 /prefix/include/impl/hello_msg1.h
59 /prefix/include/impl/hello_msg2.h
60 /prefix/lib/libcxxlib_pic.a
3161 ======= distclean ==========
3262 /objdir/Makefile
3363 /objdir/expect.out
2424 find ${.OBJDIR} -type f | \
2525 mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
2626 \
27 echo ======= CLEANFILES ==========; \
28 ${MAKE} ${MAKEFLAGS} print_values VARS='CLEANFILES' MKCHECKS=no | \
29 awk '{for(i=1; i<=NF; ++i) print $$i}' | \
30 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
31 echo ======= UNINSTALLFILES ==========; \
32 ${MAKE} ${MAKEFLAGS} print_values2 VARS='UNINSTALLFILES' MKCHECKS=no | \
33 awk '{for(i=1; i<=NF; ++i) print $$i}' | \
34 mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
2735 echo ======= distclean ==========; \
2836 ${MAKE} ${MAKEFLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
2937 find ${.OBJDIR} -type f | \
00 =========== all ============
11 /objdir/Makefile
2 /objdir/_mkc_compiler_type.err
3 /objdir/_mkc_compiler_type.res
24 /objdir/_mkc_cxx_type.err
35 /objdir/_mkc_cxx_type.res
6 /objdir/_mkc_funclib_dummy.c
7 /objdir/_mkc_funclib_dummy.err
8 /objdir/_mkc_funclib_dummy.res
49 /objdir/_mkc_prog_cxx.err
510 /objdir/_mkc_prog_cxx.res
11 /objdir/dummy.o
12 /objdir/dummy.op
13 /objdir/dummy.os
614 /objdir/expect.out
715 /objdir/hello_msg1.o
816 /objdir/hello_msg1.op
3038 ======== uninstall =========
3139 ========== clean ===========
3240 /objdir/Makefile
41 /objdir/_mkc_compiler_type.err
42 /objdir/_mkc_compiler_type.res
3343 /objdir/_mkc_cxx_type.err
3444 /objdir/_mkc_cxx_type.res
45 /objdir/_mkc_funclib_dummy.c
46 /objdir/_mkc_funclib_dummy.err
47 /objdir/_mkc_funclib_dummy.res
3548 /objdir/_mkc_prog_cxx.err
3649 /objdir/_mkc_prog_cxx.res
3750 /objdir/expect.out
3851 /objdir/mkprofilelib.test.out.tmp
52 ======= CLEANFILES ==========
53 /objdir/mkprofilelib.test.out
54 dummy.o
55 dummy.op
56 dummy.os
57 hello_msg1.o
58 hello_msg1.op
59 hello_msg1.os
60 hello_msg2.o
61 hello_msg2.op
62 hello_msg2.os
63 libcxxlib.a
64 libcxxlib.so
65 libcxxlib.so.1
66 libcxxlib.so.1.0
67 libcxxlib.so.1.0.5
68 libcxxlib_p.a
69 libcxxlib_pic.a
70 ======= UNINSTALLFILES ==========
71 /prefix/include/hello_msg.h
72 /prefix/include/impl/hello_msg1.h
73 /prefix/include/impl/hello_msg2.h
74 /prefix/lib/libcxxlib.a
75 /prefix/lib/libcxxlib.so
76 /prefix/lib/libcxxlib.so.1
77 /prefix/lib/libcxxlib.so.1.0.5
78 /prefix/lib/libcxxlib_p.a
3979 ======= distclean ==========
4080 /objdir/Makefile
4181 /objdir/expect.out
00 =========== all ============
11 /objdir/Makefile
2 /objdir/_mkc_compiler_type.err
3 /objdir/_mkc_compiler_type.res
24 /objdir/_mkc_cxx_type.err
35 /objdir/_mkc_cxx_type.res
6 /objdir/_mkc_funclib_dummy.c
7 /objdir/_mkc_funclib_dummy.err
8 /objdir/_mkc_funclib_dummy.res
49 /objdir/_mkc_prog_cxx.err
510 /objdir/_mkc_prog_cxx.res
11 /objdir/dummy.o
612 /objdir/expect.out
713 /objdir/hello_msg1.o
814 /objdir/hello_msg2.o
2026 ======== uninstall =========
2127 ========== clean ===========
2228 /objdir/Makefile
29 /objdir/_mkc_compiler_type.err
30 /objdir/_mkc_compiler_type.res
2331 /objdir/_mkc_cxx_type.err
2432 /objdir/_mkc_cxx_type.res
33 /objdir/_mkc_funclib_dummy.c
34 /objdir/_mkc_funclib_dummy.err
35 /objdir/_mkc_funclib_dummy.res
2536 /objdir/_mkc_prog_cxx.err
2637 /objdir/_mkc_prog_cxx.res
2738 /objdir/expect.out
2839 /objdir/mkshlib.test.out.tmp
40 ======= CLEANFILES ==========
41 /objdir/mkshlib.test.out
42 dummy.o
43 dummy.op
44 dummy.os
45 hello_msg1.o
46 hello_msg1.op
47 hello_msg1.os
48 hello_msg2.o
49 hello_msg2.op
50 hello_msg2.os
51 libcxxlib.a
52 libcxxlib_p.a
53 libcxxlib_pic.a
54 ======= UNINSTALLFILES ==========
55 /prefix/include/hello_msg.h
56 /prefix/include/impl/hello_msg1.h
57 /prefix/include/impl/hello_msg2.h
58 /prefix/lib/libcxxlib.a
2959 ======= distclean ==========
3060 /objdir/Makefile
3161 /objdir/expect.out
00 =========== all ============
11 /objdir/Makefile
2 /objdir/_mkc_compiler_type.err
3 /objdir/_mkc_compiler_type.res
24 /objdir/_mkc_cxx_type.err
35 /objdir/_mkc_cxx_type.res
6 /objdir/_mkc_funclib_dummy.c
7 /objdir/_mkc_funclib_dummy.err
8 /objdir/_mkc_funclib_dummy.res
49 /objdir/_mkc_prog_cxx.err
510 /objdir/_mkc_prog_cxx.res
11 /objdir/dummy.os
612 /objdir/expect.out
713 /objdir/hello_msg1.os
814 /objdir/hello_msg2.os
2228 ======== uninstall =========
2329 ========== clean ===========
2430 /objdir/Makefile
31 /objdir/_mkc_compiler_type.err
32 /objdir/_mkc_compiler_type.res
2533 /objdir/_mkc_cxx_type.err
2634 /objdir/_mkc_cxx_type.res
35 /objdir/_mkc_funclib_dummy.c
36 /objdir/_mkc_funclib_dummy.err
37 /objdir/_mkc_funclib_dummy.res
2738 /objdir/_mkc_prog_cxx.err
2839 /objdir/_mkc_prog_cxx.res
2940 /objdir/expect.out
3041 /objdir/mkstaticlib.test.out.tmp
42 ======= CLEANFILES ==========
43 /objdir/mkstaticlib.test.out
44 dummy.o
45 dummy.op
46 dummy.os
47 hello_msg1.o
48 hello_msg1.op
49 hello_msg1.os
50 hello_msg2.o
51 hello_msg2.op
52 hello_msg2.os
53 libcxxlib.a
54 libcxxlib.so
55 libcxxlib.so.1
56 libcxxlib.so.1.0
57 libcxxlib.so.1.0.5
58 libcxxlib_p.a
59 libcxxlib_pic.a
60 ======= UNINSTALLFILES ==========
61 /prefix/include/hello_msg.h
62 /prefix/include/impl/hello_msg1.h
63 /prefix/include/impl/hello_msg2.h
64 /prefix/lib/libcxxlib.so
65 /prefix/lib/libcxxlib.so.1
66 /prefix/lib/libcxxlib.so.1.0.5
3167 ======= distclean ==========
3268 /objdir/Makefile
3369 /objdir/expect.out
00 .ifndef REAL_TARGETS
1 .for i in clean cleandir install all uninstall installdirs depend \
1 .for i in errorcheck clean cleandir install all uninstall installdirs depend \
22 bin_tar bin_targz bin_tarbz2 bin_zip bin_deb
33 pre_${i} do_${i} post_${i}:
44 @echo "fake target ${.TARGET}"
00 =========== {pre,do,post}_recursive ============
1 ==================================================
2 errorcheck ===> tests/predopost_targets/lib
3 fake target pre_errorcheck
4 fake target do_errorcheck
5 fake target post_errorcheck
6 ==================================================
7 errorcheck ===> tests/predopost_targets/others
8 fake target pre_errorcheck
9 fake target do_errorcheck
10 fake target post_errorcheck
11 ==================================================
12 errorcheck ===> tests/predopost_targets/lua
13 fake target pre_errorcheck
14 fake target do_errorcheck
15 fake target post_errorcheck
116 ==================================================
217 clean ===> tests/predopost_targets/lib
318 fake target pre_clean
5671 fake target post_install
5772 ==================================================
5873 all ===> tests/predopost_targets/lib
74 fake target pre_errorcheck
75 fake target do_errorcheck
76 fake target post_errorcheck
5977 fake target pre_all
6078 fake target do_all
6179 fake target post_all
6280 ==================================================
6381 all ===> tests/predopost_targets/others
82 fake target pre_errorcheck
83 fake target do_errorcheck
84 fake target post_errorcheck
6485 fake target pre_all
6586 fake target do_all
6687 fake target post_all
6788 ==================================================
6889 all ===> tests/predopost_targets/lua
90 fake target pre_errorcheck
91 fake target do_errorcheck
92 fake target post_errorcheck
6993 fake target pre_all
7094 fake target do_all
7195 fake target post_all
33 \
44 { \
55 echo '=========== {pre,do,post}_recursive ============'; \
6 for t in clean cleandir install all uninstall installdirs depend; do \
6 for t in errorcheck clean cleandir install all uninstall installdirs depend; do \
77 ${MAKE} ${MAKEFLAGS} -j1 $$t | \
88 grep -v checking; \
99 done ; \
0 ERROR: We need mk-configure v.999.0.0 while 0.27.0 is detected
0 ERROR: We need mk-configure v.999.0.0 while 0.28.0 is detected
0 ERROR: We need mk-configure v.999.0.0 while 0.27.0 is detected
0 ERROR: We need mk-configure v.999.0.0 while 0.28.0 is detected
0 ERROR: We need mk-configure v.999.0.0 while 0.27.0 is detected
0 ERROR: We need mk-configure v.999.0.0 while 0.28.0 is detected
0 ERROR: We need mk-configure v.999.0.0 while 0.27.0 is detected
0 ERROR: We need mk-configure v.999.0.0 while 0.28.0 is detected
11 "bmake-20110606 or newer is required"
22 =========== all ============
33 /objdir/Makefile
77 MKC_REQD = 0.26.0
88
99 test: all
10 .include "test.mk"
1011 .include <mkc.prog.mk>
0 test:
1 @set -e; \
2 ${MAKE} ${MAKEFLAGS} cleandir > /dev/null