Revision 1921
Added by Aaron Marcuse-Kubitza almost 13 years ago
inputs/input.Makefile | ||
---|---|---|
1 | 1 |
##### Configuration |
2 | 2 |
|
3 |
# Command line |
|
3 | 4 |
log ?= $(if $(test),,1) |
4 | 5 |
profile ?= |
5 | 6 |
reverify ?= 1 |
7 |
debug ?= |
|
8 |
|
|
9 |
# Makefile |
|
10 |
tablesSort ?= plots organisms stems specimens |
|
6 | 11 |
exts ?= csv tsv txt xml |
7 | 12 |
test_n ?= 2 |
8 |
tablesSort ?= plots organisms stems specimens |
|
9 | 13 |
|
10 | 14 |
##### Vars/functions |
11 | 15 |
|
... | ... | |
102 | 106 |
$(call addDirWithIgnore,test,$$'*.out\n*.xml') |
103 | 107 |
$(call addDirWithIgnore,verify,$$'*.out') |
104 | 108 |
|
105 |
##### Installation |
|
106 |
|
|
107 |
install: _always src/install import/install ; |
|
108 |
|
|
109 |
uninstall: _always import/uninstall src/uninstall ; |
|
110 |
|
|
111 |
reinstall: _always uninstall install ; |
|
112 |
|
|
113 |
##### Staging tables |
|
114 |
|
|
115 |
import/install: _always |
|
116 |
-echo "CREATE SCHEMA $(datasrc);"|$(psqlAsBien) |
|
117 |
# ignore errors if schema exists |
|
118 |
|
|
119 |
import/uninstall: _always |
|
120 |
echo "DROP SCHEMA IF EXISTS $(datasrc) CASCADE;"|$(psqlAsBien) |
|
121 |
|
|
122 | 109 |
##### Existing maps discovery |
123 | 110 |
|
124 | 111 |
srcMap := maps/src.%.csv |
... | ... | |
139 | 126 |
$(wildcard maps/VegBIEN.*.csv)) |
140 | 127 |
tables := $(directMaps:maps/VegBIEN.%.csv=%) |
141 | 128 |
|
129 |
##### Installation |
|
130 |
|
|
131 |
install: _always src/install import/install ; |
|
132 |
|
|
133 |
uninstall: _always import/uninstall src/uninstall ; |
|
134 |
|
|
135 |
reinstall: _always uninstall install ; |
|
136 |
|
|
137 |
##### Staging tables |
|
138 |
|
|
139 |
import/install: _always import/schema $(addprefix import/install-,$(tables)) ; |
|
140 |
|
|
141 |
import/uninstall: _always import/rm_schema ; |
|
142 |
# rm_schema will also drop all staging tables |
|
143 |
|
|
144 |
import/schema: _always |
|
145 |
-echo 'CREATE SCHEMA "$(datasrc)";'|$(psqlAsBien) |
|
146 |
# ignore errors if schema exists |
|
147 |
|
|
148 |
import/rm_schema: _always |
|
149 |
echo 'DROP SCHEMA IF EXISTS "$(datasrc)" CASCADE;'|$(psqlAsBien) |
|
150 |
|
|
151 |
import/install-%: _always |
|
152 |
env datasrc=$(datasrc) table=$* $(withCatSrcs) $(bin)/csv2ddl$(if\ |
|
153 |
$(debug),|tee /dev/fd/2)|$(psqlAsBien) |
|
154 |
#-echo "COPY $(datasrc).;"|$(psqlAsBien) |
|
155 |
|
|
142 | 156 |
##### Sources |
143 | 157 |
|
144 | 158 |
srcs = $(shell $(bin)/sort_filenames $(wildcard $(exts:%=src/*.$*.%))) |
Also available in: Unified diff
input.Makefile: Moved Installation, Staging tables after Existing maps discovery because they depend on it. Staging tables: Create a staging table for each table a map spreadsheet is available for. Put double quotes around the schema name so its case is preserved.