在我的Gentoo机器上使用make (即GNU 3.82)和下面的Makefile,我想知道为什么每次执行make data/spectra/o4_greenblatt_296K.dat时都更新目标data/spectra/o4_greenblatt_296K.dat,即使文件params/base/fwhm.dat、params/base/wavelength_grid.dat和data/raw/o4green_gpp.dat都没有改变,而且文件data/spectra/o4_greenblatt_296K.dat已经存在:
FWHM = params/base/fwhm.dat
WLGRID = params/base/wavelength_grid.dat
$(WLGRID): code/create_wavelength_grid.py
cp code/create_wavelength_grid.py params/base/wavelength_grid.dat
$(FWHM): code/create_fwhm_param.py
cp code/create_fwhm_param.py params/base/fwhm.dat
data/raw/o4green_gpp.dat:
echo 1 > data/raw//o4green_gpp.dat
input_spectra_o4_raw: data/raw/o4green_gpp.dat
data/spectra/o4_greenblatt_296K.dat: $(WLGRID) $(FWHM) input_spectra_o4_raw
echo 1 > data/spectra/o4_greenblatt_296K.dat
input_spectra_o4: data/spectra/o4_greenblatt_296K.dat如果你们能帮到新手的话,我们会非常感激的:)
发布于 2013-09-12 14:26:23
我猜想这是因为没有名为input_spectra_o4_raw的文件,这是data/spectra/o4_greenblatt_296K.dat的先决条件。
这个决定看上去有点像这样:
1. params/base/wavelength_grid.dat and params/base/fwhm.dat are both up to date
2. check input_spectra_o4_raw - file does not exist, so build it first
3. there is a target for input_spectra_o4_raw, and it's prerequisite
data/raw/o4green_gpp.dat is up to date, so run all the commands to build
input_spectra_o4_raw (there are none, though, so we essentially just mark that we've
done everything we need to for input_spectra_o4_raw and that we built it new)
4. we just built input_spectra_o4_raw, so data/spectra/o4_greenblatt_296K.dat is out of
date with respect to that prerequisite and needs to be rebuilt您应该研究如何使用.PHONY:伪目标。
https://stackoverflow.com/questions/18764544
复制相似问题