1 ##############################################################################
2 # Copyright (c) 2015 Ericsson AB and others.
3 # stefan.k.berg@ericsson.com
4 # jonas.bjurel@ericsson.com
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
11 ############################################################################
12 # BEGIN of variables to customize
17 BUILD_DIR := $(shell pwd)
19 export CONFIG_SPEC_SCRIPT
20 export MAVEN_OPTS = -Xmx1024m -XX:MaxPermSize=512m
21 MAINTAINER = "Main Tainer <main.tainer@example.org>"
24 DEPEND = openjdk-8-jdk
25 TARGET_BUILD_PATH="/tmp/controller/opendaylight/distribution/opendaylight-karaf/target/"
26 MAVEN_SPEC = $(BUILD_DIR)/odl_maven/settings.xml
29 # END of variables to customize
30 #############################################################################
37 rm -f "$(BUILD_BASE)/f_odl"
38 ln -s "$(shell readlink -e $(BUILD_DIR))/f_odl" "$(shell readlink -e $(BUILD_BASE))/f_odl"
40 .PHONY: check-cache-validity
42 @if [ $(git ls-remote $(ODL_MAIN_REPO) $(ODL_MAIN_TAG) | awk '{print $(NF-1)}') -ne $(cat $(CACHE_DIR)/.versions | grep odl | awk '{print $NF}') ]; then @echo "Cache is not up to date, stopping!"; exit 1; fi
47 ifeq ($(ODL_MAIN_REPO),)
48 @echo "No config-spec target for ODL, nothing to build"
51 ifeq ($(shell if [ -e .odl-build.log ];then cat .odl-build.log; fi;),$(ODL_MAIN_TAG))
52 @cd /tmp && git clone $(ODL_MAIN_REPO) && cd /tmp/controller && git checkout $(ODL_MAIN_TAG)
54 @echo "ODL is up to date"
56 @if [ ! -d "/tmp/controller" ]; then\
57 cd /tmp && git clone $(ODL_MAIN_REPO);\
60 @if [ "$(UNIT_TEST)" = "FALSE" ]; then\
61 echo "Building ODL without unit test";\
62 cd /tmp/controller &&\
63 git checkout $(ODL_MAIN_TAG) &&\
64 mvn -D maven.test.skip=true -gs $(MAVEN_SPEC) clean install;\
66 echo "Building ODL with unit test";\
67 cd /tmp/controller &&\
68 git checkout $(ODL_MAIN_TAG) &&\
69 mvn -gs $(MAVEN_SPEC) clean install;\
72 @echo "odl" `git -C /tmp/controller show | grep commit | rev | cut -f1 -d " "` >> $(BUILD_BASE)/.versions
73 @./make-odl-deb.sh -N $(ODL_SHORT_NAME)_`cd /tmp/controller; git rev-parse --short HEAD` -n $(ODL_SHORT_NAME) -v "$(ODL_VERSION)" -t "$(ODL_MAIN_TAG)" -m $(MAINTAINER) -d $(DEPEND) -p $(TARGET_BUILD_PATH)
74 @echo $(ODL_MAIN_TAG) > .odl-build.log
78 .PHONY: clean $(SUBCLEAN)
80 @rm -Rf /tmp/controller