Re: [dev] lightweight build system

From: Greg Reagle <greg.reagle_AT_umbc.edu>
Date: Sun, 23 Jul 2017 11:36:13 -0400

On Sun, Jul 23, 2017, at 05:38, ochern wrote:
> . $TOP/build.conf
>
> case "$target_os" in
> gnulinux)
> SOURCES="$SOURCES linux.c"
> CFLAGS="-DENABLE_LINUX_FEATURES
> ;;
> *)
> SOURCES="$SOURCES unix.c"
> ;;
> esac
>
> OBJECTS=`src2obj $SOURCES`
> PROG=app
>
> cat <<EOF >Makefile
>
> $PROG: $OBJECTS
> $CC -o $PROG $OBJECTS
>
> 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
-DENABLE_LINUX_FEATURES}

OBJECTS=`{./src2obj $SOURCES}
PROG=app

$PROG: $OBJECTS
        $CC -o $PROG $OBJECTS

%.o: %.c
        $CC -c $CFLAGS $prereq -o $target
Received on Sun Jul 23 2017 - 17:36:13 CEST

This archive was generated by hypermail 2.3.0 : Sun Jul 23 2017 - 17:48:37 CEST