一个批量转换coffee的Makefile

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

有一个小需求,将一个目录包括子目录中的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.

Avatar_small
Manav Sampada Attend 说:
2022年12月17日 23:01

EHRMS Manav Sampada Portal, Uttar Pradesh you must read our post all the way through. You will learn how to register, login, Attendance, Payroll, leave apply, Transfer/Promotion, complaint filling and etc at Manav Sampada UP Portal. Manav Sampada Attendance Manav Sampada UP is a one-stop destination for Human Resource Management Solutions (HRMS) across the state of Uttar Pradesh government agencies.

Avatar_small
+1 Question Paper 20 说:
2023年2月15日 18:17

+1 Question Paper 2024 Every one of the students are right now sitting tight for the 11th test Model Paper to be Download. Underneath in this article, we have referenced the total Blueprint for the walk assessment. +1 Question Paper 2024 Students can download the Marking Scheme from the connection given on this page. According to Board 11th Blueprint 2024, the main test is English will happen on seventh March 2024. Board of Secondary Education is otherwise called The Educational board leads secondary school and transitional board tests each year.


登录 *


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