GithubHelp home page GithubHelp logo

Comments (4)

eradman avatar eradman commented on June 16, 2024

Thanks @itsleeowen! I like what you're trying to do here--I'll try it myself. I often get people started by providing example makefiles.

What does setting SHELL do in this example? Is this required?

from entr.

leefernandes avatar leefernandes commented on June 16, 2024

It's a way to specify which shell make should use. I don't believe bin/bash is required for this example, I believe make defaults to /bin/sh.

https://www.gnu.org/software/make/manual/html_node/Choosing-the-Shell.html

I'm using this for local development with a suite of docker services, specifically for a frontend service which runs four separate tasks based on file type and writes to a build volume... transpile typescript, copy media assets, bundle css, and copy html templates.

Running the tasks separately with entr via make -j results in a faster build time for the developer actively working on the project, rather than repeating each of the 4 tasks whenever any of the file types is changed. Performance is still great, CPU usage remains low.

go-task is another where you can pair file patterns with a single task among a group, using yaml for configuration:
https://github.com/go-task/examples/blob/master/go-web-app/Taskfile.yml

from entr.

eradman avatar eradman commented on June 16, 2024

Based only on the documentation for make, parallel behavior is not very easy to understand. The first problem I ran into is that each implementation of Make has it's own system for identifying parallel work and preventing fork bombs when -j is used. This is from the OpenBSD's make(1) man page:

In parallel mode, -j n only limits the number of direct children of make.
During recursive invocations, each level may multiply the total number of
processes by n. However, make includes some heuristics to try to prevent
catastrophic behavior: if a command is marked as expensive, or preceded by
‘+’, or seems to invoke a program that looks sufficiently like ‘make’, make
will assume recursive invocation, and not start any new process until said
command has finished running. Thus the number of processes run directly or
indirectly by make will increase linearly with each level of recursion instead
of exponentially.

So the heuristics for this version of BSD make prevents this example from running in parallel. gmake also has some oddities, for example I kept observing this warning

gmake[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.

My intuition so far is that build tools designed from the start to work effectively in parallel like go-task or ninja will be better.

from entr.

leefernandes avatar leefernandes commented on June 16, 2024

👍 Sounds good, it's working fine on my end so far.

from entr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.