Zsolt Haraszti | 8fa9da0 | 2016-09-10 17:34:03 -0700 | [diff] [blame] | 1 | # |
| 2 | # Copyright 2016 the original author or authors. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | |
| 17 | VENVDIR := venv |
| 18 | |
Zsolt Haraszti | 51af339 | 2016-09-10 22:18:45 -0700 | [diff] [blame] | 19 | .PHONY: |
Zsolt Haraszti | 8fa9da0 | 2016-09-10 17:34:03 -0700 | [diff] [blame] | 20 | |
| 21 | default: build |
| 22 | |
| 23 | help: |
| 24 | @echo "Usage: make [<target>]" |
| 25 | @echo "where available targets are:" |
| 26 | @echo |
| 27 | @echo "build : Build the Voltha docker image (default target)" |
Zsolt Haraszti | b71c2a0 | 2016-09-12 13:12:07 -0700 | [diff] [blame] | 28 | @echo "clean : Remove files created by the build and tests" |
Zsolt Haraszti | 8fa9da0 | 2016-09-10 17:34:03 -0700 | [diff] [blame] | 29 | @echo "fetch : Pre-fetch artifacts for subsequent local builds" |
| 30 | @echo "help : Print this help" |
Zsolt Haraszti | 51af339 | 2016-09-10 22:18:45 -0700 | [diff] [blame] | 31 | @echo "rebuild-venv : Rebuild local Python virtualenv from scratch" |
| 32 | @echo "venv : Build local Python virtualenv if did not exist yet" |
| 33 | @echo "utest : Run all unit tests" |
Zsolt Haraszti | 8fa9da0 | 2016-09-10 17:34:03 -0700 | [diff] [blame] | 34 | @echo |
| 35 | |
Nathan Knuth | e65a367 | 2016-09-14 21:36:52 -0700 | [diff] [blame] | 36 | vagrant: |
| 37 | vagrant up |
| 38 | |
Zsolt Haraszti | 51af339 | 2016-09-10 22:18:45 -0700 | [diff] [blame] | 39 | build: fetch utest |
| 40 | docker build -t cord/voltha -f Dockerfile . |
| 41 | |
Zsolt Haraszti | b71c2a0 | 2016-09-12 13:12:07 -0700 | [diff] [blame] | 42 | clean: |
| 43 | find voltha -name '*.pyc' | xargs rm -f |
| 44 | |
Zsolt Haraszti | 51af339 | 2016-09-10 22:18:45 -0700 | [diff] [blame] | 45 | fetch: |
Zsolt Haraszti | f2da1d0 | 2016-09-13 23:21:35 -0700 | [diff] [blame] | 46 | docker pull consul:latest |
| 47 | docker pull fluent/fluentd:latest |
| 48 | docker pull gliderlabs/registrator:latest |
Zsolt Haraszti | 51af339 | 2016-09-10 22:18:45 -0700 | [diff] [blame] | 49 | |
| 50 | purge-venv: |
Zsolt Haraszti | 8fa9da0 | 2016-09-10 17:34:03 -0700 | [diff] [blame] | 51 | rm -fr ${VENVDIR} |
Zsolt Haraszti | 51af339 | 2016-09-10 22:18:45 -0700 | [diff] [blame] | 52 | |
| 53 | rebuild-venv: purge-venv venv |
| 54 | |
| 55 | venv: ${VENVDIR}/.built |
| 56 | |
| 57 | ${VENVDIR}/.built: |
| 58 | @ virtualenv ${VENVDIR} |
| 59 | @ . ${VENVDIR}/bin/activate && \ |
Zsolt Haraszti | 8fa9da0 | 2016-09-10 17:34:03 -0700 | [diff] [blame] | 60 | if ! pip install -r requirements.txt; \ |
| 61 | then \ |
| 62 | echo "On MAC OS X, if the installation failed with an error \n'<openssl/opensslv.h>': file not found,"; \ |
| 63 | echo "see the BUILD.md file for a workaround"; \ |
Zsolt Haraszti | 51af339 | 2016-09-10 22:18:45 -0700 | [diff] [blame] | 64 | else \ |
| 65 | touch ${VENVDIR}/.built; \ |
Zsolt Haraszti | 8fa9da0 | 2016-09-10 17:34:03 -0700 | [diff] [blame] | 66 | fi |
| 67 | |
Zsolt Haraszti | 51af339 | 2016-09-10 22:18:45 -0700 | [diff] [blame] | 68 | utest: venv |
| 69 | @ echo "Executing all unit tests" |
| 70 | . ${VENVDIR}/bin/activate && \ |
| 71 | nosetests tests |