Project

General

Profile

1
include ../lib/common.Makefile
2

    
3

    
4
##### General targets
5

    
6
.PRECIOUS: %.last_cleanup # don't delete on error
7

    
8
##### Vars/functions
9

    
10
# Paths
11
bin := ../bin
12
inputCoreMaps := VegCore.csv Veg+-VegCore.csv VegCore-VegBIEN.csv \
13
VegX-VegCore.csv
14
vocab := VegCore.csv
15
dict := Veg+-VegCore.csv
16

    
17
##### General targets
18

    
19
all: _always $(inputCoreMaps) ;
20

    
21
clean: _always
22
	$(RM) $(all)
23

    
24
all :=
25

    
26
##### Core maps cleanup
27

    
28
# 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
ifneq ($(filter .%.last_cleanup,$(MAKECMDGOALS)),)
36

    
37
.VegCore.csv.last_cleanup: .%.last_cleanup: % $(dict)
38
	$(bin)/in_place $< $(bin)/translate 0 $(dict)
39
	$(bin)/in_place $< $(bin)/sort 2 0
40
	touch $@
41
	$(MAKE) VegCore-VegBIEN.unsourced_terms.csv
42

    
43
.Veg+-VegCore.csv.last_cleanup .VegX-VegCore.csv.last_cleanup: \
44
.%.last_cleanup: % $(dict)
45
	$(bin)/in_place $< $(bin)/translate 1 $(dict)
46
	$(bin)/in_place $< $(bin)/sort_map
47
	touch $@
48
# can't canon because this would remove ? prefixes
49

    
50
.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
	$(bin)/in_place $< $(bin)/sort_map
54
	touch $@
55
	$(bin)/review 1 <$< >for_review/$<
56
	$(MAKE) VegCore-VegBIEN.unsourced_terms.csv
57

    
58
else
59
$(inputCoreMaps): _always
60
	$(MAKE) $(@:%=.%.last_cleanup)
61
endif
(5-5/13)