BSD Make Extravaganza

signa111 pts0 comments

GitHub - b-aaz/bmake-extravaganza: Pushing BSD-make to places it was not designed for. · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

b-aaz

bmake-extravaganza

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star<br>15

master

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>1 Commit<br>1 Commit

.assets

.assets

basics

basics

mandelbrot

mandelbrot

.gitignore

.gitignore

LICENSE

LICENSE

README.md

README.md

makefile

makefile

View all files

Repository files navigation

The 1st minibrot, 12h to render. 1000x250 z=32, it=64, re=-1.777 im=0

BSD Make extravaganza.

After working with the FreeBSD ports system and reading a good bunch of its<br>makefiles plus the make(1) manpage, a lot, I realized that the language was<br>computationally universal, after this realization I could not suppers the urge<br>of writing a visual demonstration and pushing make to its limits.

A Mandelbrot set renderer came naturally to me, since I had some prior<br>experience of shoving a renderer for it in places it was not designed for, and<br>it was a good enough all encompassing program requiring a good bit of<br>fundamentals to be written. It is also somewhat computationally intensive,<br>which is useful for demonstration purposes.

So this project was born, and here we are, a full blown Mandelbrot set renderer,<br>written in pure BSD make without calling any binaries.

The Mandelbrot set, 36h 18m to render. 1000x500 z=2, it=64, re=-1.4 im=0

How to use this program:

Clone this repository:

git clone https://github.com/b-aaz/bmake-extravaganza<br>cd bmake-extravaganza

To render a low res image based on the predefined defaults:

output.ppm">make > output.ppm

The outputted image can be viewed with image viewers supporting the PPM format.

Using ffmpeg's internal ffplay viewer:

ffplay output.ppm

Or the output can be converted to a more common format like a PNG:

ffmpeg -i output.ppm output.png

To render with different variables:<br>(This will render a 200x100 image with zoom level of 1)

output.ppm">make w=200 h=100 z=1 > output.ppm

Beware! This is a HORRIBLY inefficient renderer, the time needed for rendering<br>even a medium-res image, can easily shot up to a week of 100%, continues, CPU<br>usage based on your input variables, and system specifications.

Tip : Try using input variables that result in "short" calculated constants,<br>When the constants contain many digits (in fraction or decimal) (periodic<br>numbers, etc) all the adder, subtracter, multiplier, and ... functions have to<br>work extra. So a higher res image with "short" constants, can "paradoxically"<br>take less time to render compared to a lower res image with "long"/"periodic"<br>constants.

For more details on the available flags use:

make help

Probable questions and answers:

1. What's the deal with the stripes?

They are a happy accident. I haven't tried to fix them, I like the unique<br>patterns it makes.<br>It is probably due to one of the many edge cases of the sketchy "floating-point"<br>implementation ... .

The Mandelbrot set, 14h to render. 1000x500 z=2, it=10, re=-1.4 im=0

2. How to edit this?

Since Vim didn't have proper syntax highlighting for BSD make I had to write my<br>own, it has been quite useful for this project:<br>bmake.vim

3. TL;DR of how it all works?

In short, the 3 basic operations of addition, subtraction, and multiplication<br>are all implemented based on the simple, decimal, elementary school algorithms.<br>(long addition, simple carry addition/subtraction)<br>They use simple look up tables and apply them iteratively over the input<br>numbers' digits.<br>Division, OTOH, is done by first finding the reciprocal of the denominator, with<br>the Newton-Raphson method, and then multiplying the numerator by it. (Sometimes<br>called "Fast Division")<br>Everything else has been build on these primitives (and a loop "function").<br>Performance was given attention to during this process, but I think there is<br>still a lot of room for improvements.

3.1. Why not use two's (or ten's) complement?

Well in these esoteric situations, many common patterns do not lead to the...

make output render image extravaganza mandelbrot

Related Articles