一个批量转换coffee的Makefile

左手 posted @ 2013年6月03日 18:35 in 积累点滴 with tags makefile 批量转换coffee , 1418 阅读

有一个小需求,将一个目录包括子目录中的coffee文件批量转换到另一个指定的目录中,同时保挂子目录的结构。改了一个类似的Makefile。发一下备忘:

coffeeBaseDir=coffee/
coffeeDir=$(abspath $(coffeeBaseDir))
jsBaseDir=js/
jsDir=$(abspath $(jsBaseDir))

jsFile=$(shell find $(coffeeBaseDir) -type f -name *.coffee | sed 's@^$(coffeeBaseDir)@$(jsDir)/@g' | sed 's@\.coffee$$@\.js@g')

jsDeploy: $(jsFile)

$(jsDir)/%.js: $(coffeeDir)/%.coffee
	@mkdir -p `sed 's@/[^/]\+$$@/@g' <<< '$@'`
	coffee -bp $< > $@

test:
	@echo $(jsFile)

clean:
	@rm js -fr
	@echo 'clean success!'

测试结果:

 

>find coffee -type f
coffee/abc.coffee/3.coffee
coffee/abc.coffee/1.coffee
coffee/abc.coffee/2.coffee
coffee/p1/3.coffee
coffee/p1/1.coffee
coffee/p1/2.coffee
coffee/p2/3.coffee
coffee/p2/1.coffee
coffee/p2/2.coffee
coffee/p3/3.coffee
coffee/p3/1.coffee
coffee/p3/2.coffee

>find js -type f
js/abc.coffee/2.js
js/abc.coffee/1.js
js/abc.coffee/3.js
js/p1/2.js
js/p1/1.js
js/p1/3.js
js/p2/2.js
js/p2/1.js
js/p2/3.js
js/p3/2.js
js/p3/1.js
js/p3/3.js

 

Avatar_small
Public Financial Man 说:
2022年8月02日 16:07

The idea brought to track the funds released through various central government schemes. This acknowledge proper expenditure at every level of scheme implementation. Public Financial Management System is an online software develop by the Controller General of Accounts, Department of Expenditure, Ministry of Finance, Government of India. Public Financial Management System The idea brought to track the funds released through various central government schemes. This acknowledge proper expenditure at every level of scheme implementation.

Avatar_small
UP Board 9th Model P 说:
2022年8月20日 18:54

UP Board 9th Class Model Paper in Hindi Pdf, UP Board 9th Class Model Paper 2023, and UP Board 9th Model Paper UP Board Hindi Sample Paper for Class 9 UP Board English Book Solution for Class 9 Hindi Answer for Class 9 UP Board 9th Model Paper 2023 on the UP Board Model Paper in Hindi for Class 9 Model Paper for Class 9 of the UP Board U.P. Board Download the UP Board Class 9th English Book Class 9th (IX) Question Papers for the UP Board in 2023, Sample Model Paper Free Downloadable 2019 UP Board Intermediate Sample Model Question Papers Model Math & Elementary Math UP Board Class 10th Question Papers 2023 UP Board Class (IX) Question Papers.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter