blob: 36cfc13a26d93cedd7ac1c74a2f2916af1bd7567 [file] [log] [blame]
Filip Pytlounc9c41d32016-01-25 14:54:37 +01001#!/usr/bin/make
2
3MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
4MAKEDIR := $(notdir $(patsubst %/,%,$(dir $(MAKEFILE_PATH))))
5
6# Overrideable parameters
7BUILDDIR ?= ${MAKEDIR}/build
8VENV_DIR ?= ${BUILDDIR}/virtualenv
9SALT_FILE_DIR ?= ${BUILDDIR}/file_root
10SALT_PILLAR_DIR ?= ${BUILDDIR}/pillar_root
11SALT_VERSION ?=
12
13ifndef SALT_VERSION
14 PIP_SALT_VERSION :=
15else
16 PIP_SALT_VERSION := "==${SALT_VERSION}"
17endif
18
19test: setup-virtualenv setup-salt
20 @echo test
21
22setup-salt:
23 @echo "Setting up Salt environment"
24 (test -d ${SALT_FILE_DIR} || \
25 mkdir -p ${SALT_FILE_DIR})
26 (test -d ${SALT_PILLAR_DIR} || \
27 mkdir -p ${SALT_PILLAR_DIR})
28
29
30setup-virtualenv:
31 @echo "Setting up Python virtualenv"
32 (test -d ${BUILDDIR} || \
33 mkdir -p ${BUILDDIR})
34 virtualenv ${VENV_DIR}
35 @echo "Installing Salt ${PIP_SALT_VERSION}"
36 (. ${BUILDDIR}/virtualenv/bin/activate && \
37 pip install salt${PIP_SALT_VERSION})
38
39clean:
40 @echo "Cleaning up ${BUILDDIR}"
41 rm -rf ${BUILDDIR}