Add Makefile
Signed-off-by: Stanislav Bogatyrev <stanislav@nspcc.ru>
This commit is contained in:
parent
c37d141314
commit
83270949e0
4 changed files with 73 additions and 1 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
tmp/
|
||||
in/
|
||||
locode_db
|
58
Makefile
Normal file
58
Makefile
Normal file
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
VERSION ?= "$(shell git describe --tags --match "v*" --dirty --always --abbrev=8 2>/dev/null || cat VERSION 2>/dev/null || echo "develop")"
|
||||
NEOFSCLI ?= neofs-cli
|
||||
|
||||
.PHONY: all clean version help unlocode
|
||||
|
||||
DIRS = in tmp
|
||||
|
||||
space := $(subst ,, )
|
||||
|
||||
all: $(DIRS) locode_db
|
||||
|
||||
$(DIRS):
|
||||
@echo "⇒ Ensure dir: $@"
|
||||
@mkdir -p $@
|
||||
|
||||
in/airports.dat:
|
||||
wget -c https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports.dat -O in/airports.dat
|
||||
|
||||
in/countries.dat:
|
||||
wget -c https://raw.githubusercontent.com/jpatokal/openflights/master/data/countries.dat -O in/countries.dat
|
||||
|
||||
in/continents.geojson: $(DIRS)
|
||||
zcat continents.geojson.gz > in/continents.geojson
|
||||
|
||||
unlocode:
|
||||
wget -c https://service.unece.org/trade/locode/loc221csv.zip -O tmp/loc221csv.zip
|
||||
unzip -u tmp/loc221csv.zip -d in/
|
||||
|
||||
locode_db: unlocode in/continents.geojson in/airports.dat in/countries.dat
|
||||
$(NEOFSCLI) util locode generate \
|
||||
--airports in/airports.dat \
|
||||
--continents in/continents.geojson \
|
||||
--countries in/countries.dat \
|
||||
--in in/2022-1\ UNLOCODE\ CodeListPart1.csv,in/2022-1\ UNLOCODE\ CodeListPart2.csv,in/2022-1\ UNLOCODE\ CodeListPart3.csv \
|
||||
--subdiv in/2022-1\ SubdivisionCodes.csv \
|
||||
--out locode_db
|
||||
|
||||
# Print version
|
||||
version:
|
||||
@echo $(VERSION)
|
||||
|
||||
# Show this help prompt
|
||||
help:
|
||||
@echo ' Usage:'
|
||||
@echo ''
|
||||
@echo ' make <target>'
|
||||
@echo ''
|
||||
@echo ' Targets:'
|
||||
@echo ''
|
||||
@awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9_-]+ ?:/{ print " ", $$1, comment }' $(MAKEFILE_LIST) | column -t -s ':' | grep -v 'IGNORE' | sort -u
|
||||
|
||||
# Clean up
|
||||
clean:
|
||||
rm -f in/*
|
||||
rm -f tmp/*
|
||||
rm -f locode_db
|
12
README.md
12
README.md
|
@ -30,7 +30,17 @@ more in [NeoFS Specification](https://github.com/nspcc-dev/neofs-spec).
|
|||
- [OpenFlight Countries](https://raw.githubusercontent.com/jpatokal/openflights/master/data/countries.dat)
|
||||
database
|
||||
|
||||
## Run
|
||||
## Quick start
|
||||
|
||||
Just run `make` to generate `locode_db` file for use with NeoFS InnerRing nodes.
|
||||
|
||||
``` shell
|
||||
$ make
|
||||
...
|
||||
--out locode_db
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
First unzip file with GeoJSON continents from this repository.
|
||||
```
|
||||
|
|
1
VERSION
Normal file
1
VERSION
Normal file
|
@ -0,0 +1 @@
|
|||
v0.2.1
|
Loading…
Reference in a new issue