As it turns out, `file -C` always creates a file named `magic.mgc` in
the current working directory. Navigate to the build directory before
calling it instead of moving the file after.
$(BUILDDIR)/magic.mgc: $(wildcard $(MAGICDIR)/*)
@$(ECHO) "Compiling new magic…"
$(silent)$(call ensuredirectory,$(dir $@))
- $(silent)$(FILE) -C -m $(call quote,$(MAGICDIR))
- $(silent)$(MV) $(call quote,$(MAGICDIR).mgc) $(call quote,$(BUILDDIR)/magic.mgc)
+ $(silent)cd $(call quote,$(BUILDDIR)) && $(FILE) -C -m $(call quote,$(realpath $(MAGICDIR)))
# Generate the main parser.
$(BUILDDIR)/parser.catalog: $(PARSERS)