blob: 4693918da8f2439d9bf4c76774df76fe9f10845b [file] [log] [blame]
srikanth116e6e82014-08-19 07:22:37 -07001#
2# Copyright (c) 2013 Big Switch Networks, Inc.
3#
4# Licensed under the Eclipse Public License, Version 1.0 (the
5# "License"); you may not use this file except in compliance with the
6# License. You may obtain a copy of the License at
7#
8# http://www.eclipse.org/legal/epl-v10.html
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
13# implied. See the License for the specific language governing
14# permissions and limitations under the License.
15
16SOURCE = $(shell pwd)
17WORKSPACE = $(SOURCE)/workspace
18VIRTUALENV = $(WORKSPACE)/ve
19TOOLS = $(WORKSPACE)/tools
20BUILD_DIR = $(SOURCE)/build
srikanthde50b092014-08-19 08:31:46 -070021#FL_DIR = $(SOURCE)/sdnplatform
srikanth116e6e82014-08-19 07:22:37 -070022
23all: build-sdnplatform
24
25clean-python:
srikanthde50b092014-08-19 08:31:46 -070026# printf 'import setuptools\nsetuptools.setup(name="django_cassandra", version="0.1", packages=["django_cassandra", "django_cassandra.db"])' >$(SOURCE)/django_cassandra_backend/setup.py
srikanth116e6e82014-08-19 07:22:37 -070027 echo '$(SOURCE)' >$$(python -c 'import distutils; print distutils.sysconfig.get_python_lib()')/sdnplatform.pth
28 set -e; \
29 cd $(SOURCE); \
srikanthde50b092014-08-19 08:31:46 -070030# for p in django_cassandra_backend/setup.py sdncon/setup.py cli/setup.py; do
31 for p in sdncon/setup.py cli/setup.py; do \
srikanth116e6e82014-08-19 07:22:37 -070032 echo "+++ Preparing Python virtualenv for $$p"; \
33 ( cd $$(dirname $$p); rm -rf *.egg-info; ARCHFLAGS="-arch i386 -arch x86_64" python $$(basename $$p) develop ); \
34 done
35 ( cd $(SOURCE)/cli ; tools/rebuild_model.sh )
36
37clean-sdnplatform:
srikanthde50b092014-08-19 08:31:46 -070038# cd $(FL_DIR); ant clean
srikanth116e6e82014-08-19 07:22:37 -070039
40clean: reset-cassandra clean-sdnplatform clean-python
41
42stop-cassandra:
srikanthde50b092014-08-19 08:31:46 -070043# $(BUILD_DIR)/kill-port-wait.sh -p 9160
44# @echo "+++ Cassandra stopped"
srikanth116e6e82014-08-19 07:22:37 -070045
46reset-cassandra: stop-cassandra
srikanthde50b092014-08-19 08:31:46 -070047# rm -rf $(VIRTUALENV)/cassandra
48# @echo "+++ Cassandra db deleted"
srikanth116e6e82014-08-19 07:22:37 -070049
50cassandra: start-cassandra
51start-cassandra:
srikanthde50b092014-08-19 08:31:46 -070052# $(BUILD_DIR)/start-and-wait-for-port.sh -p 9160 -l $(VIRTUALENV)/log/cassandra.log $(TOOLS)/cassandra/bin/cassandra
53# @echo "+++ Cassandra running"
srikanth116e6e82014-08-19 07:22:37 -070054
55stop-sdncon:
56 $(BUILD_DIR)/kill-port-wait.sh -p 8000
57 @echo "+++ sdncon stopped"
58
59reset-sdncon: stop-sdncon reset-cassandra start-cassandra
60
61start-sdncon: start-cassandra
62 if ! lsof -iTCP:8000 -sTCP:LISTEN >/dev/null; then \
63 ( \
64 cd $(SOURCE)/sdncon; \
65 [ -d $(VIRTUALENV)/cassandra/data/sdncon ] || python manage.py syncdb --noinput; \
66 $(BUILD_DIR)/start-and-wait-for-port.sh -p 8000 -l $(VIRTUALENV)/log/sdncon.log python manage.py runserver 0.0.0.0:8000; \
67 ); \
68 fi
69 @echo "+++ sdncon running"
70
71stop-sdnplatform:
srikanthde50b092014-08-19 08:31:46 -070072# while pid=$$(lsof -t -iTCP:6633 -sTCP:LISTEN); do kill $${pid}; sleep 1; done
73# @echo "+++ SDN Platform stopped"
srikanth116e6e82014-08-19 07:22:37 -070074
75start-sdnplatform: start-cassandra
srikanthde50b092014-08-19 08:31:46 -070076# if ! lsof -iTCP:6633 -sTCP:LISTEN >/dev/null; then \
77# ( cd $(SOURCE)/sdnplatform; ant run &>$(VIRTUALENV)/log/sdnplatform.log & ); \
78# fi
79# while ! nc -z localhost 6633; do sleep 1; done
80# @echo "+++ SDN Platform running"
srikanth116e6e82014-08-19 07:22:37 -070081
82eclipse:
srikanthde50b092014-08-19 08:31:46 -070083# cd $(FL_DIR); ant eclipse
srikanth116e6e82014-08-19 07:22:37 -070084
85build-sdnplatform:
srikanthde50b092014-08-19 08:31:46 -070086# cd $(FL_DIR); ant dist