GNU将复制文件复制到发行版目录 [英] GNU make copy files to distro directory

查看:94
本文介绍了GNU将复制文件复制到发行版目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将源html(和图像等)保存在单独的目录中,以进行源代码控制. 制作发行版的一部分是将复制文件复制到输出文件夹并设置属性.

I keep my source html (and images etc.) in separate directories for source control. Part of making the distro is to have make copy files to output folder and set the attributes.

今天我的makefile显示(提取):

Today my makefile shows (extract):

%.html:
    /usr/bin/install -c -p -m 644 $< $@ 

www: $(HTMLDST)/firmware.html $(HTMLDST)/firmware_status.html $(HTMLDST)/index.html
$(HTMLDST)/firmware.html: $(HTMLSRC)/firmware.html 
$(HTMLDST)/firmware_status.html: $(HTMLSRC)/firmware_status.html 
$(HTMLDST)/index.html: $(HTMLSRC)/index.html 

仅显示了三个html文件,但实际上有很多.

This is shown with only three html files, but in reality, there are lots.

我只想列出文件名(不带路径),并进行源和目标之间的比较,并复制已更新的文件.

I would like to just list the filenames (without paths) and have make do the comparison between source and destination and copy the files that have been updated.

预先感谢您 索伦

推荐答案

这应该做到:

$(HTMLDST)/%.html: $(HTMLSRC)/%.html
    /usr/bin/install -c -p -m 644 $< $@ 

www: $(HTMLDST)/firmware.html $(HTMLDST)/firmware_status.html $(HTMLDST)/index.html

或者,为简便起见:

HTMLFILES = firmware firmware_status index

DESTFILES = $(patsubst %,$(HTMLDST)/%.html,$(HTMLFILES))

$(HTMLDST)/%.html: $(HTMLSRC)/%.html
    /usr/bin/install -c -p -m 644 $< $@ 

.PHONY: www
www: $(DESTFILES)

这篇关于GNU将复制文件复制到发行版目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆