On Sun, 14 Jan 2024 19:40:46 +0000, bart <
b...@freeuk.com> wrote in
<uo1dbu$img2$
1...@dont-email.me>:
> Started a new thread as the last one went somewhat off-topic regarding
> 'CPP tags'.
>
> Everyone is getting tired of me mouthing off about Make and friends, and
> I'm fed up of not being believed when I talk about the problems it
> introduces.
>
> I thought I'd try one more attempt at finding a small C project that
> used make to see if it really was as bad as I was saying.
>
> There is a small test file I have called piet.c, an esoteric language
> interpreter. I couldn't find the original project but there is one
> called npiet.c (
https://www.bertnase.de/npiet/).
>
> It contains these files:
>
> c:\xxx\npiet-1.3f>dir 09/08/2020 12:41 5,574 ChangeLog
> 26/06/2004 16:53 461
config.h.in 09/08/2020 13:18
> 140,516 configure 05/08/2011 19:19 584
>
configure.in 06/06/2004 17:48 17,984 COPYING 09/08/2020
> 12:41 <DIR> examples 09/08/2020 12:17 <DIR>
> foo 06/06/2004 12:25 4,771 install-sh 09/08/2020
> 13:18 44 Makefile 04/12/2014 20:59
> 2,743 Makefile.in 05/08/2011 21:26 2,116
> npiet-foogol.1 09/08/2020 13:18 98,071 npiet-foogol.c
> 19/11/2014 19:17 45,555 npiet-foogol.y 04/08/2011
> 21:14 4,446 npiet.1 09/08/2020 12:35 68,150
> npiet.c 29/01/2005 19:29 17,801 npietedit 26/09/2004
> 21:53 1,064 npietedit.1 27/01/2014 17:24
> 1,436 README.npiet
>
> There is a makefile (which only contains the message to run ./configure)
> and a configure script.
>
> If try and do make under Windows, it actually does some tests,
> concluding that I don't have gcc, cc or cl installed, and fails on 'No C
> Compiler'.
>
> If I run this 4800-line script under WSL, it produces a 140-line
> makefile. The makefile tries to build 3 programs, the main 'npiet', and
> two more, but those have dependencies that will fail even under WSL.
>
> Actually, 'npiet' is successfully created, but that fact is lost amongst
> all the errors.
>
> Now that I have a makefile, could it work under Windows for building
> 'npiet.exe'? Apparently not, because the makefile is Linux-specific.
>
> So, under actual Windows, both 'make' and './configure' were useless.
>
> But you will say, This is obviously for Linux, what did you expect?
>
> ===============================
>
> Here I will reveal a secret: as soon as I saw that list of files, and
> saw that make required configure, I tried this anyway:
>
> c:\xxx\npiet-1.3f> mcc npiet Compiling npiet.c to npiet.exe
>
> It just worked! And it seems to run:
>
> c:\xxx\npiet-1.3f> npiet examples\nfib.ppm 0
> 1
> 1
> 2
> 3
> 5
> 8
> 13 21 34 55 89 144 233 377 610 987
>
> (The nfib.ppm file is a block of coloured pixels. You can see examples
> at the link. I've no idea how it works; I just use these as test
> programs.)
>
> Apparently it works on Windows just fine, no thanks to the Readme,
> makefile and configure files.
>
> ===============================
>
> So, I ask again, why this obsession that C developers have with make and
> configure files? It's taken a simple, one-file program and made it
> impossible to build on my favoured OS, if you were to follow the make
> route.
>
> Actually, if I look inside npiet.c, it does explain how to build the
> program with a bare compiler. This is also where I put build info when I
> distribute C programs. To hell with make.
Take a look in your Makefile for other make rules. You
missed another couple of files in the directory, which appear
to be related: npiet-foogol.c and npiet-foogol.y.
The .y is for lex(1) and yacc(1), for which GNU
has flex and bison. What does your all-inclusive
C compiler do with .y files?
Also, if you don't know what it does, try running "man npiet.1" or
"man npiet-foogol.1" in your WSL instance -- the *.1 files are
the man pages.
Finally, it's possible the developer just wanted to try out
autoconf. Can't really know what they were thinking...
--
-v