Project

General

Profile

« Previous | Next » 

Revision 250

Added uninstallation of inputs to Makefiles

View differences:

scripts/Makefile
1 1
# Make
2 2
SHELL := /bin/bash
3
subMake = $(if $(wildcard $(@D)/Makefile*),$(MAKE) $(@F:!%=%) --directory=$(@D),)
3 4

  
4 5
# OS
5 6
os := $(shell uname)
......
35 36
_not_file:
36 37
.PHONY: _not_file
37 38

  
38
%/: _not_file
39
	-$(if $(wildcard $@/Makefile*),$(MAKE) --directory=$@ ,)
40
# ignore errors in sub-makes
41

  
42 39
#####
43 40

  
44 41
install: _not_file core mysql inputs test
45 42
	@$(done)
46 43

  
47
uninstall: _not_file rm_mysql rm_core
44
uninstall: _not_file rm_inputs rm_mysql rm_core
48 45

  
49 46
reinstall: _not_file uninstall install
50 47

  
......
135 132

  
136 133
#####
137 134

  
138
inputs: _not_file $(wildcard ../../inputs/*/)
135
inputsDir := ../../inputs
136
inputs := $(wildcard $(inputsDir)/*/)
139 137

  
138
inputs: _not_file $(inputs:%=%!install)
139

  
140
$(inputsDir)/%/!install: _not_file
141
	-$(subMake)
142
# ignore errors in sub-makes
143

  
144
rm_inputs: _not_file $(inputs:%=%!uninstall)
145

  
146
$(inputsDir)/%/!uninstall: _not_file
147
	-$(subMake)
148
# ignore errors in sub-makes
149

  
140 150
#####
141 151

  
142 152
test: _not_file test-map
scripts/util/inputs_Makefile
1
ifndef db
2
$(error db variable must be set)
3
endif
4

  
1 5
self_3d1bc249 := $(dir $(lastword $(MAKEFILE_LIST)))
2 6

  
3
mysql := mysql --user=bien --password='$(shell cat \
7
mysql := mysql --user=root --password='$(shell cat \
4 8
$(self_3d1bc249)/bien_password)'
5 9

  
10
#####
11

  
6 12
all: _not_file install
7 13

  
8 14
.SUFFIXES:
9 15

  
10 16
_not_file:
11 17
.PHONY: _not_file
18

  
19
#####
20

  
21
install: _not_file
22
	$(mysql) <$(db).sql
23
	echo "GRANT ALL ON $(db).* TO 'bien'@'localhost';"|$(mysql)
24

  
25
uninstall: _not_file
26
	echo "DROP DATABASE IF EXISTS $(db);"|$(mysql)
27

  
28
reinstall: _not_file uninstall install

Also available in: Unified diff