Skip to content

Wrong Makefile rule generated with --make-deps for multipage SVG or PNG output #5861

@tovrstra

Description

@tovrstra

Description

For multipage SVG and PNG outputs, the Makefile rule generated with --make-deps contains the filename template with {p} (and {t}) instead of the actual output file(s) generated.

Example

Create a file lorem.typ:

#lorem(1500)

Compile it with:

typst compile lorem.typ --make-deps lorem.dep -f svg 'lorem-{p}.svg'

Three SVG files are generated: lorem-1.svg, lorem-2.svg and lorem-3.svg. The file lorem.dep contains the following result:

lorem-{p}.svg: lorem.typ

I believe it should contain instead:

lorem-1.svg lorem-2.svg lorem-3.svg: lorem.typ

Note that there is very little relevant documentation of the precise file format for the make rules, making this issue a bit difficult to verify. In all honesty, actually using make in this case with multiple outputs is painful. More modern alternatives like ninja-build do support depfiles with multiple outputs in this format. Alas, also that feature is not properly documented for ninja-build. It can be inferred from the unit tests of ninja-build (and from some experimentation) that it indeed supports rules with multiple outputs, see e.g.

https://github.com/ninja-build/ninja/blob/2a34463e6ec38dab909af94740070d546354b16c/src/depfile_parser_test.cc#L232-L243

Reproduction URL

Not applicable

Operating system

Linux

Typst version

  • I am using the latest version of Typst

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcliAbout Typst's command line interface.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions