Project

General

Profile

1 3793 aaronmk
include ../lib/common.Makefile
2
3
4 5250 aaronmk
##### General targets
5
6
.PRECIOUS: %.last_cleanup # don't delete on error
7
8 785 aaronmk
##### Vars/functions
9
10 1272 aaronmk
# Paths
11 895 aaronmk
bin := ../bin
12 4889 aaronmk
inputCoreMaps := VegCore.csv Veg+-VegCore.csv VegCore-VegBIEN.csv \
13
VegX-VegCore.csv
14 5065 aaronmk
vocab := VegCore.csv
15
dict := Veg+-VegCore.csv
16 895 aaronmk
17 785 aaronmk
##### General targets
18
19 4689 aaronmk
all: _always $(inputCoreMaps) ;
20 150 aaronmk
21 383 aaronmk
clean: _always
22 196 aaronmk
	$(RM) $(all)
23 188 aaronmk
24 924 aaronmk
all :=
25
26 785 aaronmk
##### Core maps cleanup
27 198 aaronmk
28 5045 aaronmk
# This tracks VegCore terms that are mapped to VegBIEN but not documented in
29
# VegCore.csv. This file is *not* svn:ignored, so it will show up with a ? when
30
# the user runs `svn st` if there are any unsourced terms.
31
VegCore-VegBIEN.unsourced_terms.csv: VegCore-VegBIEN.csv VegCore.csv
32
	$(bin)/filter_out_ci 0 <$+ >$@
33
	$(bin)/autoremove $@
34
35 895 aaronmk
ifneq ($(filter .%.last_cleanup,$(MAKECMDGOALS)),)
36 3967 aaronmk
37 5065 aaronmk
.VegCore.csv.last_cleanup: .%.last_cleanup: % $(dict)
38
	$(bin)/in_place $< $(bin)/translate 0 $(dict)
39 4850 aaronmk
	$(bin)/in_place $< $(bin)/sort 2 0
40
	touch $@
41 5046 aaronmk
	$(MAKE) VegCore-VegBIEN.unsourced_terms.csv
42 4850 aaronmk
43 4891 aaronmk
.Veg+-VegCore.csv.last_cleanup .VegX-VegCore.csv.last_cleanup: \
44 5067 aaronmk
.%.last_cleanup: % $(dict)
45
	$(bin)/in_place $< $(bin)/translate 1 $(dict)
46 4890 aaronmk
	$(bin)/in_place $< $(bin)/sort_map
47
	touch $@
48 5067 aaronmk
# can't canon because this would remove ? prefixes
49 4890 aaronmk
50 5065 aaronmk
.VegCore-VegBIEN.csv.last_cleanup: .%.last_cleanup: % $(dict) $(vocab)
51
	$(bin)/in_place $< $(bin)/translate 0 $(dict)
52
	$(bin)/in_place $< $(bin)/canon 0 $(vocab)
53 1132 aaronmk
	$(bin)/in_place $< $(bin)/sort_map
54 895 aaronmk
	touch $@
55 4692 aaronmk
	$(bin)/review 1 <$< >for_review/$<
56 5045 aaronmk
	$(MAKE) VegCore-VegBIEN.unsourced_terms.csv
57 3967 aaronmk
58 895 aaronmk
else
59 1824 aaronmk
$(inputCoreMaps): _always
60 895 aaronmk
	$(MAKE) $(@:%=.%.last_cleanup)
61
endif