-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
28 lines (19 loc) · 1.04 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
daily_csv_files=$(shell curl -L http://download.companieshouse.gov.uk/en_accountsdata.html | bin/extract-filelist.py | sed 's/^/data\//; s/\.zip$$/.csv/')
monthly_csv_files=$(shell curl -L http://download.companieshouse.gov.uk/en_monthlyaccountsdata.html | bin/extract-filelist.py | sed 's/^/data\//; s/\.zip$$/.csv/')
accounts.csv.zip: accounts.csv
zip -o "$@" "$<"
accounts.csv: $(daily_csv_files) $(monthly_csv_files)
( head -1 "$<" ; echo $^ | xargs -n 1 tail +2 ) > "$@"
data/Accounts_Bulk_Data-%.zip:
curl -L -o "$@" http://download.companieshouse.gov.uk/$(@F)
data/Accounts_Monthly_Data-%.zip:
curl -L -o "$@" http://download.companieshouse.gov.uk/$(@F)
data/Accounts_Bulk_Data-%.csv: data/Accounts_Bulk_Data-% bin/extract-accounts.py
bin/extract-accounts.py "$<" > "$@"
data/Accounts_Monthly_Data-%.csv: data/Accounts_Bulk_Data-% bin/extract-accounts.py
bin/extract-accounts.py "$<" > "$@"
data/Accounts_Bulk_Data-%: data/Accounts_Bulk_Data-%.zip
unzip -o "$@" "$<"
# For debugging. E.g. `make print-daily_csv_files`
print-%:
@echo '$*=$($*)'