Domanda

I have a hand of commands which each works perfectly in the console when isolated. To ease my work, I collected them into a 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' `

Yet, when It is within my makefile, I get the following error :

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

What does this error means ? How to make it works ? Did I made a small typo ?

È stato utile?

Soluzione

There is the full fix:

# 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' `

I was misusing the makefile syntaxe. I was starting each step by a process name (i.e. topojsoning, bad) :

processName: sourcefile
    command

should start with the target file (final.json, good):

targetfile: sourcefile
    command
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top