blob: 4a83bf8c909cac964b7a3099bdcc67c3bd22b7da [file] [log] [blame]
Your Name8324a3a2017-05-12 10:47:21 +00001DESTDIR=/
2SALTENVDIR=/usr/share/salt-formulas/env
3RECLASSDIR=/usr/share/salt-formulas/reclass
4FORMULANAME=$(shell grep name: metadata.yml|head -1|cut -d : -f 2|grep -Eo '[a-z0-9\-\_]*')
5
6MAKE_PID := $(shell echo $$PPID)
7JOB_FLAG := $(filter -j%, $(subst -j ,-j,$(shell ps T | grep "^\s*$(MAKE_PID).*$(MAKE)")))
8
9ifneq ($(subst -j,,$(JOB_FLAG)),)
10JOBS := $(subst -j,,$(JOB_FLAG))
11else
12JOBS := 1
13endif
14
15all:
16 @echo "make install - Install into DESTDIR"
17 @echo "make test - Run tests"
18 @echo "make clean - Cleanup after tests run"
19
20install:
21 # Formula
22 [ -d $(DESTDIR)/$(SALTENVDIR) ] || mkdir -p $(DESTDIR)/$(SALTENVDIR)
23 cp -a $(FORMULANAME) $(DESTDIR)/$(SALTENVDIR)/
24 [ ! -d _modules ] || cp -a _modules $(DESTDIR)/$(SALTENVDIR)/
25 [ ! -d _states ] || cp -a _states $(DESTDIR)/$(SALTENVDIR)/ || true
26 # Metadata
27 [ -d $(DESTDIR)/$(RECLASSDIR)/service/$(FORMULANAME) ] || mkdir -p $(DESTDIR)/$(RECLASSDIR)/service/$(FORMULANAME)
28 cp -a metadata/service/* $(DESTDIR)/$(RECLASSDIR)/service/$(FORMULANAME)
29
30test:
31 [ ! -d tests ] || (cd tests; ./run_tests.sh)
32
33clean:
34 [ ! -d tests/build ] || rm -rf tests/build
35 [ ! -d build ] || rm -rf build