Project

General

Profile

1
include ../lib/common.Makefile
2

    
3

    
4
##### Vars/functions
5

    
6
# Paths
7
bin := ../bin
8
inputCoreMaps := VegCore.csv Veg+-VegCore.csv VegCore-VegBIEN.csv \
9
VegX-VegCore.csv
10
vocab := VegCore.csv
11
dict := Veg+-VegCore.csv
12

    
13
##### General targets
14

    
15
all: _always $(inputCoreMaps) ;
16

    
17
clean: _always
18
	$(RM) $(all)
19

    
20
all :=
21

    
22
##### Core maps cleanup
23

    
24
# This tracks VegCore terms that are mapped to VegBIEN but not documented in
25
# VegCore.csv. This file is *not* svn:ignored, so it will show up with a ? when
26
# the user runs `svn st` if there are any unsourced terms.
27
VegCore-VegBIEN.unsourced_terms.csv: VegCore-VegBIEN.csv VegCore.csv
28
	$(bin)/filter_out_ci 0 <$+ >$@
29
	$(bin)/autoremove $@
30

    
31
ifneq ($(filter .%.last_cleanup,$(MAKECMDGOALS)),)
32

    
33
.VegCore.csv.last_cleanup: .%.last_cleanup: % $(dict)
34
	$(bin)/in_place $< $(bin)/translate 0 $(dict)
35
	$(bin)/in_place $< env text=1 $(bin)/repl $(dict) 3
36
	$(bin)/in_place $< $(bin)/sort 3 0
37
	$(bin)/in_place $< uniq
38
	touch $@
39
	$(MAKE) VegCore.redmine
40
	$(MAKE) VegCore-VegBIEN.unsourced_terms.csv
41
.PRECIOUS: .VegCore.csv.last_cleanup
42

    
43
.Veg+-VegCore.csv.last_cleanup: .%.last_cleanup: % $(dict)
44
	$(bin)/in_place $< $(bin)/translate 1 $(dict)
45
	$(bin)/in_place $< $(bin)/canon 1 $(vocab)
46
	$(bin)/in_place $< env text=1 $(bin)/repl $(dict) 2
47
	$(bin)/in_place $< $(bin)/sort 2 0
48
	touch $@
49
.PRECIOUS: .Veg+-VegCore.csv.last_cleanup
50

    
51
.VegX-VegCore.csv.last_cleanup: .%.last_cleanup: % $(dict)
52
	$(bin)/in_place $< $(bin)/translate 1 $(dict)
53
	$(bin)/in_place $< $(bin)/sort_map
54
	touch $@
55
# can't canon because this would remove ? prefixes
56
.PRECIOUS: .VegX-VegCore.csv.last_cleanup
57

    
58
.VegCore-VegBIEN.csv.last_cleanup: .%.last_cleanup: % $(dict) $(vocab)
59
	$(bin)/in_place $< $(bin)/translate 0 $(dict)
60
	$(bin)/in_place $< $(bin)/canon 0 $(vocab)
61
	$(bin)/in_place $< $(bin)/sort_map
62
	touch $@
63
	$(bin)/review 1 <$< >for_review/$<
64
	$(MAKE) VegCore-VegBIEN.unsourced_terms.csv
65
.PRECIOUS: .VegCore-VegBIEN.csv.last_cleanup
66

    
67
else
68
$(inputCoreMaps): _always
69
	$(MAKE) $(@:%=.%.last_cleanup)
70
.PRECIOUS: $(inputCoreMaps)
71
endif
72

    
73
# Documentation
74

    
75
VegCore.redmine: VegCore.csv
76
	$(bin)/dict2redmine 0 1 3 <$+ >$@
(5-5/14)