0

我有一手命令,每个命令在隔离时都可以在控制台中完美运行。为了简化我的工作,我将它们收集到一个 makefile 中:

topojsoning: levels.json
    topojson --id-property none -p name=elev -o final.json levels.json

geojsoning: contours.shp
    ogr2ogr -f GeoJSON -where "elev < 10000" levels.json contours.shp

shaping: crop.tif
    gdal_contour -a elev -fl -1000 -500 -200 -50 0 50 100 200 500 1000 2000 4000 6000 crop.tif contours.shp

boxing: ETOPO1_Ice_g_geotiff.tif
    gdal_translate -projwin -005.48 051.30 10.00 041.00 ETOPO1_Ice_g_geotiff.tif crop.tif
    # ulx uly lrx lry  // W N E S // -005.48 051.30 10.00 041.00

unzip: ETOPO1.zip
    unzip ETOPO1.zip
    touch ETOPO1_Ice_g_geotiff.tif

download:
    curl -o ETOPO1.zip 'http://www.ngdc.noaa.gov/mgg/global/relief/ETOPO1/data/ice_surface/grid_registered/georeferenced_tiff/ETOPO1_Ice_g_geotiff.zip'

clean:
    rm `ls | grep -v 'zip' | grep -v 'Makefile' `

然而,当它在我的 makefile 中时,我收到以下错误:

make: *** No rule to make target ? `levels.json', needed by `topojsoning'.  Stop.

这个错误是什么意思?如何使它起作用?我是不是打错字了?

4

1 回答 1

0

有完整的修复:

# topojsoning: 
final.json: levels.json
    topojson --id-property none -p name=elev -o final.json levels.json

# geojsoning: 
levels.json: contours.shp
    ogr2ogr -f GeoJSON -where "elev < 10000" levels.json contours.shp

# shaping: 
contours.shp: crop.tif
    gdal_contour -a elev -fl -1000 -500 -200 -50 0 50 100 200 500 1000 2000 4000 6000 crop.tif contours.shp

# boxing: 
crop.tif: ETOPO1_Ice_g_geotiff.tif
    gdal_translate -projwin -005.48 051.30 10.00 041.00 ETOPO1_Ice_g_geotiff.tif crop.tif
    # ulx uly lrx lry  // W N E S // -005.48 051.30 10.00 041.00

# unzip:
ETOPO1_Ice_g_geotiff.tif: ETOPO1.zip
    unzip ETOPO1.zip
    touch ETOPO1_Ice_g_geotiff.tif

# download:
ETOPO1.zip:
    curl -o ETOPO1.zip 'http://www.ngdc.noaa.gov/mgg/global/relief/ETOPO1/data/ice_surface/grid_registered/georeferenced_tiff/ETOPO1_Ice_g_geotiff.zip'

clean:
    rm `ls | grep -v 'zip' | grep -v 'Makefile' `

我在滥用 makefile 语法。我从一个进程名称开始每一步(即topojsoning,坏):

processName: sourcefile
    command

应该从目标文件开始(final.json,好):

targetfile: sourcefile
    command
于 2013-08-15T04:40:19.197 回答