Re: [dev] lightweight build system

From: ochern <>
Date: Sun, 23 Jul 2017 23:29:04 +0300

Thanks for the example.

IMHO it looks same in lower part where rules are defined and worse in
the header part where configuring is performed. It looks close to
gmake and other clones that implement extension commands for running
shell one-liner. Unfortunately as more complex becomes configuration
part the more perverted and unreadable it will look when done using
make, at the same time it will keep nice look in pure shell variant.
Yet a lower part, rules part, will not change for both variants. So it
raises a question, what is special in extended make compared to simple
mkmf? Another shortcoming is a dependency on non-standard make. For
example when you use gmake extensions you will not build a package on
openBSD using standard make, you'll have to install gmake first.
Unneeded dependency.

I think that the best part of Make is dependency tracking, that's
rules part. Generally Make language is declarative. Declarative
paradigm brings simplicity, but the side effect is it's limited number
of predefined configurations. On the contrast side is imperative
paradigm. A Shell is an imperative programming language. Imperative
programming is more generic, it means it has no format limits, but it
always lose in size and look compared to declarative. But only when
compared on simple example that fits best in declarative configuration
space. Take for example a simple Make rule and try to implement the
same in Shell. It's rather evident that Shell will look rather ugly in
comparison with Make. At the same time Make loses much when it tries
to bring some control in it's declarative nature.

I thing the best approach is treating Make as a simple command, like
sed, awk etc, and use it inside Shell scripts instead of writing


On Sun, Jul 23, 2017 at 6:36 PM, Greg Reagle <> wrote:
> On Sun, Jul 23, 2017, at 05:38, ochern wrote:
>> . $TOP/build.conf
>> case "$target_os" in
>> gnulinux)
>> SOURCES="$SOURCES linux.c"
>> ;;
>> *)
>> SOURCES="$SOURCES unix.c"
>> ;;
>> esac
>> OBJECTS=`src2obj $SOURCES`
>> PROG=app
>> cat <<EOF >Makefile
>> o.c.:
>> $CC -c $CFLAGS \$< -o \$_AT_
>> EOF
> Here is my attempt to write it in mk:
> < $TOP/build.conf
> SOURCES=$SOURCES generic.c
> SOURCES=$SOURCES `{[ "$target_os" = gnulinux ] && echo linux.c || echo
> unix.c}
> CFLAGS=$CFLAGS `{[ "$target_os" = gnulinux ] && echo
> OBJECTS=`{./src2obj $SOURCES}
> PROG=app
> %.o: %.c
> $CC -c $CFLAGS $prereq -o $target
Received on Sun Jul 23 2017 - 22:29:04 CEST

This archive was generated by hypermail 2.3.0 : Sun Jul 23 2017 - 22:36:36 CEST