1 |
3793
|
aaronmk
|
include ../lib/common.Makefile
|
2 |
|
|
|
3 |
|
|
|
4 |
785
|
aaronmk
|
##### Vars/functions
|
5 |
|
|
|
6 |
1272
|
aaronmk
|
# Paths
|
7 |
895
|
aaronmk
|
bin := ../bin
|
8 |
1824
|
aaronmk
|
inputCoreMaps := DwC1-DwC2.specimens.csv DwC2-VegBIEN.specimens.csv\
|
9 |
1843
|
aaronmk
|
VegX-VegBIEN.stems.csv
|
10 |
895
|
aaronmk
|
|
11 |
1824
|
aaronmk
|
# Via formats
|
12 |
|
|
coreMaps := $(wildcard *-VegBIEN.*.csv)
|
13 |
|
|
filenameVia = $(shell echo '$(1)'|grep --only-matching --extended-regexp\
|
14 |
|
|
'^[a-zA-Z]+')
|
15 |
|
|
# can't use --ignore-case because in Mac grep, a bug causes it to break [] exprs
|
16 |
|
|
vias := $(strip $(sort $(foreach coreMap,$(coreMaps),$(call filenameVia,$(coreMap)))))
|
17 |
|
|
|
18 |
1272
|
aaronmk
|
# Commands
|
19 |
|
|
|
20 |
1115
|
aaronmk
|
review_ = $(bin)/review <$(1) >for_review/$(1)
|
21 |
|
|
review = $(call review_,$@)
|
22 |
924
|
aaronmk
|
|
23 |
1272
|
aaronmk
|
join = env header_num=1 $(bin)/join_union_sort
|
24 |
1824
|
aaronmk
|
selfMap_ = $(bin)/cols 0 0
|
25 |
3776
|
aaronmk
|
mkSelfMap = $(selfMap_) <$<|$(bin)/sort_map >$@
|
26 |
744
|
aaronmk
|
|
27 |
1272
|
aaronmk
|
define chRoot
|
28 |
|
|
$(bin)/ch_root <$< >$@
|
29 |
|
|
$(review)
|
30 |
|
|
endef
|
31 |
|
|
|
32 |
3795
|
aaronmk
|
define cpReview
|
33 |
|
|
$(cp)
|
34 |
|
|
$(review)
|
35 |
|
|
endef
|
36 |
|
|
|
37 |
785
|
aaronmk
|
##### General targets
|
38 |
|
|
|
39 |
3804
|
aaronmk
|
all: _always $(inputCoreMaps) dwc_maps self_maps ;
|
40 |
150
|
aaronmk
|
|
41 |
383
|
aaronmk
|
clean: _always
|
42 |
196
|
aaronmk
|
$(RM) $(all)
|
43 |
188
|
aaronmk
|
|
44 |
924
|
aaronmk
|
all :=
|
45 |
|
|
|
46 |
785
|
aaronmk
|
##### Core maps cleanup
|
47 |
198
|
aaronmk
|
|
48 |
895
|
aaronmk
|
ifneq ($(filter .%.last_cleanup,$(MAKECMDGOALS)),)
|
49 |
|
|
.%.last_cleanup: %
|
50 |
|
|
$(bin)/in_place $< $(bin)/simplify_xpath
|
51 |
1132
|
aaronmk
|
$(bin)/in_place $< $(bin)/sort_map
|
52 |
895
|
aaronmk
|
touch $@
|
53 |
1115
|
aaronmk
|
$(call review_,$<)
|
54 |
895
|
aaronmk
|
else
|
55 |
1824
|
aaronmk
|
$(inputCoreMaps): _always
|
56 |
895
|
aaronmk
|
$(MAKE) $(@:%=.%.last_cleanup)
|
57 |
|
|
endif
|
58 |
350
|
aaronmk
|
|
59 |
1824
|
aaronmk
|
##### Self maps
|
60 |
|
|
|
61 |
|
|
selfMaps :=
|
62 |
|
|
|
63 |
|
|
viaCoreMap = $(via)-VegBIEN.%.csv
|
64 |
|
|
viaSelfMap = $(via).self.%.csv
|
65 |
|
|
viaCoreMaps = $(wildcard $(subst %,*,$(viaCoreMap)))
|
66 |
|
|
|
67 |
|
|
define selfMapTargets
|
68 |
|
|
selfMaps += $(viaCoreMaps:$(viaCoreMap)=$(viaSelfMap))
|
69 |
|
|
|
70 |
|
|
$(viaSelfMap): $(viaCoreMap)
|
71 |
|
|
$$(mkSelfMap)
|
72 |
|
|
endef
|
73 |
|
|
$(foreach via,$(vias),$(eval $(selfMapTargets)))
|
74 |
|
|
|
75 |
|
|
ifneq ($(filter self_maps,$(MAKECMDGOALS)),)
|
76 |
|
|
self_maps: _always $(selfMaps) ;
|
77 |
|
|
else
|
78 |
|
|
self_maps: _always
|
79 |
|
|
$(MAKE) self_maps
|
80 |
|
|
# re-run make so that cache of existing files for $(viaCoreMaps) is reset
|
81 |
|
|
endif
|
82 |
|
|
|
83 |
|
|
all += $(selfMaps)
|
84 |
|
|
|
85 |
1272
|
aaronmk
|
##### DwC
|
86 |
1115
|
aaronmk
|
|
87 |
1812
|
aaronmk
|
dwcMaps :=
|
88 |
1115
|
aaronmk
|
|
89 |
1452
|
aaronmk
|
DwC.cs-VegBIEN.specimens.csv: DwC1-DwC2.specimens.csv DwC2-VegBIEN.specimens.csv
|
90 |
|
|
$(join) <$+ >$@
|
91 |
1812
|
aaronmk
|
dwcMaps += DwC.cs-VegBIEN.specimens.csv
|
92 |
1452
|
aaronmk
|
|
93 |
1802
|
aaronmk
|
DwC-VegBIEN.specimens.csv: DwC.cs-VegBIEN.specimens.csv
|
94 |
1457
|
aaronmk
|
$(bin)/ci_map $< >$@
|
95 |
1812
|
aaronmk
|
dwcMaps += DwC-VegBIEN.specimens.csv
|
96 |
1118
|
aaronmk
|
|
97 |
1824
|
aaronmk
|
dwc_maps: _always $(dwcMaps) ;
|
98 |
1140
|
aaronmk
|
|
99 |
1812
|
aaronmk
|
all += $(dwcMaps)
|