4 ms·
The data model of makefiles is perfect for watching and rebuilding. All you need to add is something that monitors the source files for any changes and runs 'ma
by akvadrako 9y ago
The data model of makefiles is perfect for watching and rebuilding. All you need to add is something that monitors the source files for any changes and runs 'make'.
- josephg 9y agoThat sounds like a great idea. Does anything like that exist already?
- shoo 9y agosomething along the lines of inotify: http://man7.org/linux/man-pages/man1/inotifywait.1.html http://man7.org/linux/man-pages/man1/inotifywait.1.html or just use tup http://gittup.org/tup/ http://gittup.org/tup/
- gall0ws 9y agoIt's trivial to roll your own: https://github.com/gall0ws/watch https://github.com/gall0ws/watch
- petepete 9y agoAlso, entr http://entrproject.org http://entrproject.org
- oso2k 9y agoEasy enough (assuming $SRC is your list of source files and 'all' is top level target) 'make watch' could do this watch: while ! inotifywait -e modify $(SRC) ; do time -p make all; done
- lloeki 9y agoIf you care for it, fswatch is cross-platform: https://github.com/emcrisostomo/fswatch https://github.com/emcrisostomo/fswatch
- AndrewOMartin 9y agoThere's "when-changed" in pip. pip install when-changed when-changed *.tex -c "make all && echo 'done'" Then you can make rule in your make file called "watch" or "build-server" which calls that command, so you just need to write "make watch".
- jbergens 9y agoFor js code you often want hot module reloading which is probably very hard to get with make.
- Yaggo 9y agoYou lose incremental builds of modern bundlers/transpilers, which makes your build time too slow for bigger projects. People nowadays expect to see changes almost in realtime using hot module replacement etc.
- akvadrako 9y agoThat's because those tools aren't designed to play well with others. It's not due to the design of make.
- Yaggo 9y agoI would say it's partly because of the design of make. A Makefile consists of separate commands¹ and is heavily file-based¹, which makes it rather slow and doesn't allow to keep state (in memory) between re-runs. Traditionally this hasn't been bottleneck, because compiling C code was relatively slow operation, but modern web development tools prefer to work with in-memory streams instead of invoking executables for tiny files on disk. I'm not saying you cannot do things with make, but in NodeJS/web ecosystem it just doesn't feel as natural/flexible as the "native" NodeJS-based toolchain. [1] Great for interoperability, but sometimes more tailored solution is worth it.
- akvadrako 9y agoLaunching a process on Linux only takes about 2ms, and make only needs to do it for parts that change. There is no reason you couldn't use a make-based system to get incremental rebuilds with under 100ms latency, which is about as good as most people get with native JS systems.