1 |
7362
|
aaronmk
|
selfDir_XlThrr := $(dir $(lastword $(MAKEFILE_LIST)))
|
2 |
|
|
root := $(selfDir_XlThrr)../../..
|
3 |
|
|
include $(root)/lib/common.Makefile
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
##### Vars/functions
|
7 |
|
|
|
8 |
7364
|
aaronmk
|
unzip = unzip -d $@ $<
|
9 |
|
|
|
10 |
7362
|
aaronmk
|
##### General targets
|
11 |
|
|
|
12 |
7364
|
aaronmk
|
all: _always extract ;
|
13 |
7362
|
aaronmk
|
|
14 |
|
|
##### Downloads
|
15 |
|
|
|
16 |
|
|
urlPrefix := http://apps.fs.fed.us/fiadb-downloads/
|
17 |
|
|
|
18 |
|
|
states := AS GU PW AL AK AZ AR CA CO CT DE DC FL GA HI ID IL IN IA KS KY LA ME\
|
19 |
|
|
MD MA MI MN MS MO MT NE NV NH NJ NM NY NC ND OH OK OR PA PR RI SC SD TN TX UT\
|
20 |
|
|
VT VI VA WA WV WI WY
|
21 |
|
|
|
22 |
7364
|
aaronmk
|
allZips := $(states:%=%.zip)
|
23 |
7362
|
aaronmk
|
|
24 |
7364
|
aaronmk
|
download: _always $(allZips) ;
|
25 |
|
|
|
26 |
7362
|
aaronmk
|
%.zip:
|
27 |
|
|
-wget -O $@ $(urlPrefix)$@
|
28 |
|
|
# ignore errors if wget not installed
|
29 |
7364
|
aaronmk
|
|
30 |
|
|
##### Extraction
|
31 |
|
|
|
32 |
|
|
zips := $(wildcard $(allZips))
|
33 |
|
|
zips := $(if $(zips),$(zips),$(allZips))
|
34 |
|
|
dirs := $(zips:%.zip=%/)
|
35 |
|
|
|
36 |
|
|
extract: _always $(dirs) ;
|
37 |
|
|
|
38 |
|
|
%: %.zip
|
39 |
|
|
$(if $(wildcard $@),,$(unzip))
|
40 |
|
|
|
41 |
|
|
##### Table bundling
|