Filip Pytloun | 940f66d | 2016-04-14 14:11:51 +0200 | [diff] [blame] | 1 | DESTDIR=/ |
| 2 | SALTENVDIR=/usr/share/salt-formulas/env |
| 3 | RECLASSDIR=/usr/share/salt-formulas/reclass |
| 4 | FORMULANAME=$(shell grep name: metadata.yml|head -1|cut -d : -f 2|grep -Eo '[a-z0-9\-]*') |
| 5 | |
| 6 | all: |
| 7 | @echo "make install - Install into DESTDIR" |
| 8 | @echo "make test - Run tests" |
| 9 | @echo "make clean - Cleanup after tests run" |
| 10 | |
| 11 | install: |
| 12 | # Formula |
| 13 | [ -d $(DESTDIR)/$(SALTENVDIR) ] || mkdir -p $(DESTDIR)/$(SALTENVDIR) |
| 14 | cp -a $(FORMULANAME) $(DESTDIR)/$(SALTENVDIR)/ |
| 15 | [ ! -d _modules ] || cp -a _modules $(DESTDIR)/$(SALTENVDIR)/ |
| 16 | [ ! -d _states ] || cp -a _states $(DESTDIR)/$(SALTENVDIR)/ || true |
| 17 | # Metadata |
| 18 | [ -d $(DESTDIR)/$(RECLASSDIR)/service/$(FORMULANAME) ] || mkdir -p $(DESTDIR)/$(RECLASSDIR)/service/$(FORMULANAME) |
| 19 | cp -a metadata/service/* $(DESTDIR)/$(RECLASSDIR)/service/$(FORMULANAME) |
| 20 | |
| 21 | test: |
| 22 | [ ! -d tests ] || (cd tests; ./run_tests.sh) |
| 23 | |
| 24 | clean: |
| 25 | [ ! -d tests/build ] || rm -rf tests/build |
| 26 | [ ! -d build ] || rm -rf build |