FAQ.md 1.7 KB

Frequently asked questions

Why do interactive targets show no output?

makefilet automatically enables Make's mode of parallel processing (one job per CPU). This inevitably forces Make to manage the outputs of parallel targets. By default makefilet enables the line-based output synchronization in order to improve the arrangement of output.

Make's parallel output handling has a few effects:

  • A command (a line in a target) and its resulting output are emitted together, thus the command itself is emitted only after it has finished its execution. Thus you cannot easily see the command, which is taking a long time to execute right now.
  • Interactive targets (e.g. Flask's or Django development server) show their output only after they are stopped (usually via CTRL-C). Thus the user cannot see the target output, which contains the URL of the local development server.

There are a few ways to avoid these issues:

  • A) force the whole Makefile to be executed in series (MAKEFLAGS += --jobs=1)
  • B) force a specific target to be run in single-job mode (see below)

Running a single target in single-job mode

Starting from an example, which is executed in parallel (default behaviour -> output is hidden):

.PHONY: runserver
runserver: build_assets
    python3 -m flask

Instead you may want to force a single target to be executed in single-job mode (which is good for interactive targets):

.PHONY: _runserver_single_job
_runserver_single_job:
    python3 -m flask

.PHONY: runserver
runserver: build_assets
    $(MAKE) --jobs=1 _runserver_single_job