开发者

Recursive in Makefile... any other solutions?

What I want to do is to compress all css in all subfolders under a certain folder.

for example, I have

/resources/css/
/resources/css/parent.css
/resources/css/child.css
/resources/css/import/import.css

something like this... (above is just an example, file开发者_如何学Go names are not being used in real-world).

So, I tried searching for doing recursion in Makefile. But seems like it's not a recommended way, but then was told to use "include" and have Makefile under each sub-folders and the most parent Makefile should call sub-folder's Makefile.

But! I don't like this way of doing. I don't want to create Makefile for every sub-folder.

Is there a other way to handle this case? Any other tool suggestions, I'm willing to learn and try out.

I just want to do simple one command to compress all the css under my folder. (even js). Thanks!


In your Makefile,

# Define a variable that encompasses all of the CSS files:
CSSFILES := $(shell find . -name '*.css')

# Target compressed versions of each
default: $(CSSFILES:%.css=%.compressed.css)

# Tell Make how to compress (tab leading command line)
%.compressed.css: %.css
        compresscommand --input $< --output $@
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜