blob: 18ddc47e02de796c949eb1714527909c22b3d9f2 [file] [log] [blame]
Srikanth Vavilapalli1725e492014-12-01 17:50:52 -08001#
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
21#FL_DIR = $(SOURCE)/sdnplatform
22
23all: build-sdnplatform
24
25clean-python:
26# printf 'import setuptools\nsetuptools.setup(name="django_cassandra", version="0.1", packages=["django_cassandra", "django_cassandra.db"])' >$(SOURCE)/django_cassandra_backend/setup.py
27 echo '$(SOURCE)' >$$(python -c 'import distutils; print distutils.sysconfig.get_python_lib()')/sdnplatform.pth
28 set -e; \
29 cd $(SOURCE); \
30# 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 \
32 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:
38# cd $(FL_DIR); ant clean
39
40clean: reset-cassandra clean-sdnplatform clean-python
41
42stop-cassandra:
43# $(BUILD_DIR)/kill-port-wait.sh -p 9160
44# @echo "+++ Cassandra stopped"
45
46reset-cassandra: stop-cassandra
47# rm -rf $(VIRTUALENV)/cassandra
48# @echo "+++ Cassandra db deleted"
49
50cassandra: start-cassandra
51start-cassandra:
52# $(BUILD_DIR)/start-and-wait-for-port.sh -p 9160 -l $(VIRTUALENV)/log/cassandra.log $(TOOLS)/cassandra/bin/cassandra
53# @echo "+++ Cassandra running"
54
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:
72# while pid=$$(lsof -t -iTCP:6633 -sTCP:LISTEN); do kill $${pid}; sleep 1; done
73# @echo "+++ SDN Platform stopped"
74
75start-sdnplatform: start-cassandra
76# 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"
81
82eclipse:
83# cd $(FL_DIR); ant eclipse
84
85build-sdnplatform:
86# cd $(FL_DIR); ant dist
87clean-srdb: stop-sdncon
88 rm -fr sdncon/sdncon
89 make clean
90 make start-sdncon