On Tuesday, June 23rd, 2026 at 9:25 AM, David Deutsch <[email protected]> wrote:

> To translate what your command is "saying" to make:
> 
> make -f myfile.mk trlfn
> 
> equates to "read myfile.mk and then execute the recipe to produce the
> target trlfn".
> 
> But trlfn is not a target because it has no recipe.
> 
>  > Would there be no prerequisites for such cases?
> 
> Prerequisites are targets that need to be resolved before building the
> desired targets. They are not dynamic bits of code like in your example.
> 
>  > If I want to build my program with gcc, I might need to set compiler
> options by specifying what I want to the makefile.  How would it be a
> wrong idea?
> 
> That's an entirely separate topic. You typically set compiler flags with
> an environment variable. NOT with a target (.PHONY or otherwise)
> 
> I also slightly misread your makefile because it's so off-syntax:
> 
> trlfn: hopc += --transliterate-file-names
> 
> This makes even less sense than I thought - if hopc is your executable,
> you cannot "add to it" with +=, which is an extension to an existing
> variable (although it might work slightly by accidend by just assuming
> that "hopc" is a string that you then append to)
> 
> The target shape that you want could be something like
> 
> # myfile.mk
> 
> hopc-result.trlfn:
>      hopc --transliterate-file-names
> 
> hopc-result.ndf:
>      hopc --node-files
> 
> hopc-result.trlfn.ndf:
>      hopc --transliterate-file-names --node-files
> 
> and then call it via
> 
> make -f myfile.mk hopc-result.trlfn
> 
> but that's overly contrived.
> 
> 
> Anyhow - maybe what you're actually looking for here IS an environment
> variable?

hopc accumulates options for makeinfo.  

Using multiple options, I would have something like

--html --split=node --transliterate-file-names --node-files


Then I would need the call 


$(hmldir)/antares.html: $(srcs) | $$(@D)
        makeinfo $(opts) --html $(hopc) -o $@ $<

What would you suggest?  Have looked at how emacs generates
its documentation and it uses a makefile that calls makeinfo.
 
>  > I do not think I am using wrong tool for the job.
> 
> You're using make like a bash script. That's not inherently wrong, but
> what Make really wants to do is resolve dependency graphs to build
> targets via their recipes.
> 
> -David
> 


Reply via email to