Makefile: Start two targets in parallel
Created on November 13, 2025
make
In my case, I want to bundle js and css with esbuild.
Here are the two targets that I want to run at the same time:
bundle/js/watch:
@./node_modules/.bin/esbuild \
ui/static/bundle.js \
--bundle \
--format=esm \
--platform=browser \
--outfile=ui/static/dist/main.js \
--watch=forever
bundle/css/watch:
@./node_modules/.bin/esbuild \
ui/static/bundle.css \
--bundle \
--minify \
--loader:.woff=file \
--loader:.woff2=file \
--asset-names=assets/[name]-[hash] \
--outfile=ui/static/dist/styles.css \
--legal-comments=none \
--watch=forever
Option 0:
bundle/watch: bundle/js/watch bundle/css/watch
Then execute with make -j2 bundle/watch.
Option 1:
bundle/watch:
$(MAKE) -j2 bundle/js/watch bundle/css/watch
Then execute with make bundle/watch.
Option 2:
MAKEFLAGS += -j2
bundle/watch: bundle/js/watch bundle/css/watch