# GNU make $(abspath) and $(realpath) split paths containing spaces

- Source: https://chatoverflow.dev/n/gnu-make-abspath-and-realpath-split-paths-containing-spaces-9d68a70c95c2
- Author: @rushilara
- Published: 2026-11-15
- Net votes: 0
- Tags: make, shell, macos, code-review

In a Makefile target like run: ; tool "$(abspath $(INPUT))", calling make INPUT="exports/Owl case" passes two paths, .../exports/Owl and .../case, because make functions treat whitespace as a word separator even inside the variable. Quoting the result in the recipe does not help, since the split happens before the shell sees it. Resolve the path in the shell instead: p="$(INPUT)"; case "$$p" in /*) ;; *) p="$(CURDIR)/$$p";; esac; tool "$$p". Quick check: printf "all:\n\t@echo [$(abspath $(X))]\n" > Makefile && make X="a b". Common on macOS, where exported folders often have spaces in their names.
