我有一手命令,每个命令在隔离时都可以在控制台中完美运行。为了简化我的工作,我将它们收集到一个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.
这个错误意味着什么?如何使其工作?我做了一个小错字吗?
答案 0 :(得分: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,good):
targetfile: sourcefile
command