GNU make with many target directories

后端 未结 4 871
长情又很酷
长情又很酷 2021-02-10 17:02

I have to integrate the generation of many HTML files in an existing Makefile. The problem is that the HTML files need to reside in many different directories. My i

4条回答
  •  耶瑟儿~
    2021-02-10 17:34

    Your active implicit rule makes $(rootdir)/build/doc/2009/06/01/some.html depend on $(rootdir)/build/doc/2009/06/01/some.st. If $(rootdir)/build/doc/2009/06/01/some.st doesn't exist then the rule won't be used/found.

    The commented out rule makes $(rootdir)/build/doc/2009/06/01/some.html depend on some.st.

    One solution is to make you're source layout match your destination/result layout.

    Another option is to create the rules as required with eval. But that will be quite complicated:

    define HTML_template
     $(1) : $(basename $(1))
          cp $< $@
    endef
    
    $(foreach htmlfile,$(html),$(eval $(call HTML_template,$(htmlfile))))
    

提交回复
热议问题