Project

General

Profile

« Previous | Next » 

Revision 3574

input.Makefile: Maps building: maps/$(via).%.csv: Auto-create by copying the src map if doesn't exist. Existing maps discovery: Look up via format in src maps' roots if no via map already exists.

View differences:

inputs/input.Makefile
114 114
dbExport := $(firstword $(wildcard src/db.*.sql))
115 115
endif
116 116

  
117
srcMaps := $(wildcard maps/src.*.csv)
118
srcRoots := $(srcMaps:maps/src.%.csv=$(mappings)/roots/%.sh)
119

  
117 120
srcMap := maps/src.%.csv
118 121
fullViaMap := maps/%.full.csv
119 122
directMap := maps/VegBIEN.%.csv
......
121 124
$(wildcard maps/*.csv))
122 125
via := $(firstword $(sort $(basename $(basename $(notdir $(allViaMaps))))))
123 126

  
127
# Look up via in src maps' roots
128
ifeq ($(via),)
129
ifneq ($(srcRoots),)
130
via := $(firstword $(sort\
131
$(shell $(SED) -n 's/^export out_root="([0-9A-Za-z_-]+).*$$/\1/p' $(srcRoots))))
132
endif
133
endif
134

  
124 135
coreMap := $(mappings)/$(via)-VegBIEN.%.csv
125 136
coreSelfMap := $(mappings)/$(via).self.%.csv
126 137

  
127 138
viaMaps := $(wildcard $(tablesSort:%=maps/$(via).%.csv))
139
viaMaps += $(filter-out $(viaMaps),$(srcMaps:maps/src.%=maps/$(via).%))
128 140
viaMaps += $(filter-out $(viaMaps) $(fullViaMap),$(wildcard maps/$(via).*.csv))
129 141

  
130 142
autogenMaps := $(subst $(via).,VegBIEN.,$(viaMaps))
......
180 192
maps :=
181 193
createOnlyMaps :=
182 194

  
183
srcMaps := $(wildcard maps/src.*.csv)
184

  
185 195
srcRoot = $(mappings)/roots/$*.sh
186 196
mkSrcMap = $(catSrcs)|(. $(srcRoot); env datasrc=$(datasrc) $(bin)/src_map >$@)
187 197

  
......
227 237
	touch $@
228 238
# Include comment column so commented mappings are never removed
229 239
else
230
maps/$(via).%.csv: _always
240
maps/$(via).%.csv: maps/src.%.csv _always
241
	$(if $(wildcard $@),,$(if $(wildcard $<),$(CP) $< $@))
231 242
	+$(selfMake) $(@:maps/%=maps/.%.last_cleanup)
232 243
endif
233 244

  

Also available in: Unified diff