Using static Makefiles is not always KISS. Sometimes it's simpler to generate Makefile. sh is also available everywhere.
Alex On Sun, Jul 23, 2017 at 2:10 PM, Hiltjo Posthuma <hil...@codemadness.org> wrote: > On Sun, Jul 23, 2017 at 12:38:59PM +0300, ochern wrote: >> Thanks for the extended answer. mk looks very close to Make as I have >> read from the manual. I like Make as it's simple but not in cases when >> I try to build project consisting from multiple files and libraries >> with the need to parametrize configuration, take into account >> different compilers, hosts, targets and dependencies. I can't rely on >> simple Makefile in this case. But I don't like autogenerated bullshit >> from Autohell also. What is the reason to invent any new version of >> Make-like tool when it's possible just to put your old Makefile in >> Shell here-document and parametrize it using Shell full-grain >> programming language. Here is an example of 'mkmf' script that >> generates final Makefile: >> >> # -------------------------------- >> >> . $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 \$@ >> >> EOF >> >> # ---------------------------------- >> >> It's just a simple example. But it shows that we can put Makefile >> inside Shell instead of Shell inside Makefile rules. It give full >> control over the final Makefile using common programming in Shell >> instead of using freaky GNU Make or else extentions that give very >> little. >> Shell is rather standardized and it's not hard to write rather >> portable script. No I don't say about insane portability as Autoconf >> tries to provide, though it doesn't work. Instead I think it's wise to >> support rather modern environments and not care about different old >> osf1-based systems. 99% of current OSes have Bash that is compatible >> with POSIX SH. I made scripts that work fine on all linuxes, bsds, >> macos, solaris, commercial unixes, cygwin, msys. Most problems I had >> with Solaris sh. >> >> According to your schema user must install 9base+rc to be able to >> build a package, right? It's not simpler than just run './configure; >> make'. >> >> I'm not focusing on another build system but rather rethinking >> standard usage of Make by substituting it with 'mkmf' shell scripts >> that wrap Makefile into Shell. This is the core. Every Makefile can be >> substituted by 'mkmf'. mkmf generates Makefile and runs all other mkmf >> scripts in subdirs. So by running a toplevel mkmf we generate a >> hierarchy of makefiles. Additionally we can add toplevel 'configure' >> to provide simple configuration by command-line parameters like >> -prefix, -enable-xxx etc. configure runs and generates toplevel >> build.conf and than runs toplevel mkmf that call all other mkmf >> scripts recursively. Thus we have a simple and flexible build system. >> >> I'd like to read about rc and 9base. Could you give some reference? >> >> Alex >> >> >> On Sun, Jul 23, 2017 at 11:36 AM, Anselm R Garbe <garb...@gmail.com> wrote: >> > Hi Alex, >> > >> > On 23 July 2017 at 09:47, ochern <dexa...@gmail.com> wrote: >> >> I'm new here and I want to ask if somebody is interested in discussing >> >> a development of lightweight build system based on simple Shell and >> >> Make. It would be great to hear the opinions from the community and >> >> may be there would rise a common welth and opportunity to develop >> >> suckless build system :) >> > >> > Imho an almost suckless build system already exists: mk[0]+9base. >> > >> > "Almost" derives from the fact, that 9base or p9p in conjunction with >> > the popular rc shell is kind of an alien citizen in a regular >> > Linux/BSD environment, and thus probably not the easiest choice for >> > gaining straight adoption. Nevertheless, if you dig deeper into all >> > the problems of GNU vs BSD vs Shitwaris etc. userlands, you will >> > notice that it becomes a hard task to find a suitable subset in >> > Makefiles + shell commands that will work almost painfree on most >> > platforms. sbase+ubase doesn't ease the solution, as they don't nicely >> > co-exist with GNU or BSD userlands. >> > >> > In such situations, relying on mk+9base is an excellent choice, as the >> > limitations of mk, rc and its native userland are well understood -- >> > and still mk+9base are a lot(!) smaller in code size than bash for >> > instance. >> > >> > For stali development I considered switching to mk, but concluded it >> > isn't worth the effort as stali can only be built in a Linux >> > environment anyways. >> > >> > To conclude, mk and our just-Makefile based build systems aren't >> > perfect, but they are extremely suckless in comparison to generated >> > GNUmakefiles and GNU authell. >> > >> > Instead on focussing on yet another build system, I would rather >> > suggest to focus on a better mail archiver or to work on a nice >> > bugtracker, that fits well into the mlmmj world of things. >> > >> > [0] http://doc.cat-v.org/bell_labs/mk/mk.pdf >> > >> > Best regards, >> > Anselm >> > >> > > Keep it simple and write portable Makefile's: test it on Linux, *BSD etc. > > make is available everywhere. > > -- > Kind regards, > Hiltjo >