Revision 1289
Added by Aaron Marcuse-Kubitza almost 13 years ago
input.Makefile | ||
---|---|---|
35 | 35 |
--width=$(termCols),$(diff)) |
36 | 36 |
|
37 | 37 |
# Paths |
38 |
datasrc := $(notdir $(realpath .)) |
|
38 | 39 |
root := $(selfDir_uZPPqC).. |
40 |
bin := $(root)/bin |
|
39 | 41 |
mappings := $(root)/mappings |
40 |
datasrc := $(notdir $(realpath .)) |
|
42 |
|
|
43 |
# Commands |
|
44 |
join = $(bin)/join_union_sort |
|
41 | 45 |
psqlOpts := --set ON_ERROR_STOP=1 --quiet |
42 |
psqlAsBien := $(root)/bin/psql_vegbien $(psqlOpts)
|
|
46 |
psqlAsBien := $(bin)/psql_vegbien $(psqlOpts)
|
|
43 | 47 |
|
44 | 48 |
##### General targets |
45 | 49 |
|
... | ... | |
71 | 75 |
|
72 | 76 |
##### Maps |
73 | 77 |
|
78 |
srcMap := maps/src.%.csv |
|
74 | 79 |
fullViaMap := maps/%.full.csv |
75 |
allViaMaps := $(filter-out maps/VegBIEN.%.csv $(fullViaMap),\ |
|
80 |
directMap := maps/VegBIEN.%.csv |
|
81 |
allViaMaps := $(filter-out $(srcMap) $(fullViaMap) $(directMap),\ |
|
76 | 82 |
$(wildcard maps/*.csv)) |
77 | 83 |
via := $(firstword $(sort $(basename $(basename $(notdir $(allViaMaps)))))) |
78 | 84 |
|
79 | 85 |
coreMap := $(mappings)/$(via)-VegBIEN.%.csv |
80 | 86 |
selfMap := $(mappings)/$(via).self.%.csv |
87 |
noEmptyMap := $(mappings)/$(via)-VegBIEN.%.no_empty.csv |
|
81 | 88 |
|
82 | 89 |
viaMaps := $(wildcard $(tablesSort:%=maps/$(via).%.csv)) |
83 | 90 |
viaMaps += $(filter-out $(viaMaps) $(fullViaMap),$(wildcard maps/$(via).*.csv)) |
... | ... | |
87 | 94 |
$(wildcard maps/VegBIEN.*.csv)) |
88 | 95 |
tables := $(directMaps:maps/VegBIEN.%.csv=%) |
89 | 96 |
|
97 |
srcMaps := $(filter-out maps/src.join.%.csv,$(wildcard maps/src.*.csv)) |
|
98 |
srcJoinMaps := $(srcMaps:maps/src.%.csv=maps/src.join.%.csv) |
|
99 |
|
|
90 | 100 |
# Must come before $(root)/% to override it |
91 | 101 |
$(selfMap): _always |
92 | 102 |
-+$(subMake) |
... | ... | |
98 | 108 |
maps := |
99 | 109 |
|
100 | 110 |
maps/VegBIEN.%.csv: maps/$(via).%.csv $(coreMap) |
101 |
$(root)/bin/join_union_sort <$+ >$@ |
|
102 |
|
|
111 |
$(join) <$+ >$@ |
|
103 | 112 |
maps += $(autogenMaps) |
104 | 113 |
|
105 | 114 |
makeFullCsv = $(if $(shell test -e $(word 2,$+) && echo t),\ |
106 |
env ignore=1 $(root)/bin/union <$+|$(root)/bin/sort_map >$@,$(CP) $< $@) |
|
115 |
env ignore=1 $(bin)/union <$+|$(bin)/sort_map >$@,$(CP) $< $@) |
|
116 |
# can't use $(wildcard) because it won't recheck file after $(selfMap) is run |
|
107 | 117 |
|
108 | 118 |
maps/$(via).%.full.csv: maps/$(via).%.csv $(selfMap) |
109 | 119 |
$(makeFullCsv) |
110 |
# can't use $(wildcard) because it won't recheck file after $(selfMap) is run |
|
111 |
|
|
112 | 120 |
maps += $(patsubst maps/%.csv,maps/%.full.csv,$(viaMaps)) |
113 | 121 |
|
122 |
maps/src.join.%.csv: maps/src.%.csv maps/$(via).%.full.csv $(noEmptyMap) |
|
123 |
$(bin)/cols 0 0 <$<|$(bin)/join $(word 2,$+)|$(join) $(word 3,$+) >$@ |
|
124 |
maps += $(srcJoinMaps) |
|
125 |
|
|
114 | 126 |
maps: $(maps) _always ; |
115 | 127 |
|
116 | 128 |
all += $(maps) |
Also available in: Unified diff
input.Makefile: Generate maps/src.join.*.csv, which can be used to determine which DwC fields for a particular dataset do not yet have a join mapping to VegBIEN