9c3d22d9fb1b3c74f562e692c2c064bf91dfa006
[genesis.git] / fuel / build / opendaylight / Makefile
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 ##############################################################################
10
11 ############################################################################
12 # BEGIN of variables to customize
13 #
14 SHELL = /bin/bash
15 include ../config.mk
16
17 BUILD_DIR := $(shell pwd)
18 GIT_DIR := /tmp
19 export CONFIG_SPEC_SCRIPT
20 export MAVEN_OPTS = -Xmx1024m -XX:MaxPermSize=512m
21 MAINTAINER = "Main Tainer <main.tainer@example.org>"
22 ODL_SHORT_NAME = odl
23 ODL_VERSION = 0.1-1
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
27
28 #
29 # END of variables to customize
30 #############################################################################
31
32 .PHONY: all
33 all:    odl
34
35 .PHONY: setup
36 setup:
37         @if [ ! -d "$(TOPDIR)/f_odl" ]; then ln -s "$(realpath $(BUILD_DIR))/f_odl" "$(realpath $(TOPDIR))/f_odl";  fi
38
39 .PHONY: odl
40 odl:
41 ifeq ($(ODL_MAIN_REPO),)
42         @echo "No config-spec target for ODL, nothing to build"
43 else
44
45 ifeq ($(shell if [ -e .odl-build.log ];then cat .odl-build.log; fi;),$(ODL_MAIN_TAG))
46         @cd /tmp && git clone $(ODL_MAIN_REPO) && cd /tmp/controller && git checkout $(ODL_MAIN_TAG)
47         @echo "ODL is up to date"
48 else
49         @if [ ! -d "/tmp/controller" ]; then cd /tmp && git clone $(ODL_MAIN_REPO); fi;
50         @cd /tmp/controller && git checkout $(ODL_MAIN_TAG) && mvn -Dmaven.test.skip=true -gs $(MAVEN_SPEC) clean install;
51         @./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)
52         @echo $(ODL_MAIN_TAG) > .odl-build.log
53 endif
54 endif
55
56 .PHONY: clean $(SUBCLEAN)
57 clean: $(SUBCLEAN)
58         @rm -Rf /tmp/controller
59         @rm -f .odl-build.log
60         @./make-odl-deb.sh -C
61
62 .PHONY: release
63 release: