BUILD_ID: Fix git SHA one last time.
[armband.git] / Makefile
1 root:=$(shell pwd)
2
3 all: build
4
5 .PHONY: submodules-init submodules-clean
6 submodules-init:
7         @git submodule -q init
8         @git submodule -q sync
9         @git submodule update --remote
10
11 # Cleans any changes made to submodules
12 submodules-clean:
13         @git submodule -q foreach \
14                 'git am --abort; \
15                 git checkout -q armband-workbench-root; \
16                 git branch -q -D armband-workbench; \
17                 git tag -d armband-workbench-root; \
18                 git reset -q --hard HEAD; git clean -xdff'
19
20 .PHONY: patches-export patches-import
21 # Generate patches from submodules
22 patches-export:
23         @git submodule -q foreach 'mkdir -p ${root}/patches/$$name'
24         @git submodule -q foreach 'git format-patch \
25                 -o ${root}/patches/$$name -N armband-workbench-root \
26             --no-signature'
27         @find ${root}/patches -name '*.patch' -exec sed -i -e '1d' {} \;
28
29 # apply patches from patches/* to respective submodules
30 patches-import:
31         @git submodule -q foreach 'mkdir -p ${root}/patches/$$name'
32         @git submodule -q foreach 'git tag armband-workbench-root'
33         @git submodule -q foreach 'git checkout -q -b armband-workbench'
34         @git submodule -q foreach \
35                 'if [ ! -z "$$(ls ${root}/patches/$$name/)" ]; then \
36                         echo "-- patching $$name"; \
37                         git am ${root}/patches/$$name/*.patch; \
38                 fi'
39 clean-docker:
40         @if [ -d ${root}/upstream/fuel/build ]; then \
41                 sudo make -C ${root}/upstream/fuel/build deepclean; \
42         fi
43         @for container in $(shell sudo docker ps -a -q); do \
44                 sudo docker rm -f -v $${container}; \
45         done
46         @for image in $(shell sudo docker images -q); do \
47                 sudo docker rmi -f $${image}; \
48         done
49
50 clean-build:
51         sudo rm -rf /tmp/fuel-main
52         git -C ${root}/upstream/fuel reset --hard HEAD
53         git -C ${root}/upstream/fuel clean -xdff
54
55 release: export LC_ALL=en_US.UTF-8
56 release: submodules-clean clean-docker clean-build submodules-init patches-import build
57
58 ifneq ($(REVSTATE),)
59     EXTRA_PARAMS="REVSTATE=$(REVSTATE)"
60 endif
61
62 build:
63         cd ${root}/upstream/fuel/build && \
64                 make \
65                         BUILD_FUEL_PLUGINS="f_odlpluginbuild f_bgpvpn-pluginbuild" \
66                         UBUNTU_ARCH="amd64 arm64" \
67                         PRODNO="OPNFV_ARMBAND_FUEL" \
68                         OPNFV_GIT_SHA=$(shell git rev-parse --short HEAD) \
69                         ASTUTE_REPO=${root}/upstream/fuel-astute \
70                         ASTUTE_COMMIT=HEAD \
71                         NAILGUN_REPO=${root}/upstream/fuel-web \
72                         NAILGUN_COMMIT=HEAD \
73                         FUEL_AGENT_REPO=${root}/upstream/fuel-agent \
74                         FUEL_AGENT_COMMIT=HEAD \
75                         FUEL_NAILGUN_AGENT_REPO=${root}/upstream/fuel-nailgun-agent \
76                         FUEL_NAILGUN_AGENT_COMMIT=HEAD \
77                         FUEL_MIRROR_REPO=${root}/upstream/fuel-mirror \
78                         FUEL_MIRROR_COMMIT=HEAD \
79                         FUELLIB_REPO=${root}/upstream/fuel-library \
80                         FUELLIB_COMMIT=HEAD \
81                         ODL_REPO=${root}/upstream/fuel-plugin-opendaylight \
82                         ODL_BRANCH=armband-workbench \
83                         ODL_CHANGE= \
84                         OPNFV_QUAGGE_PACKAGING_REPO="https://github.com/alexandruavadanii/opnfv-quagga-packaging" \
85                         OVS_NSH_DPDK_REPO=${root}/upstream/fuel-plugin-ovs \
86                         OVS_NSH_DPDK_BRANCH=HEAD \
87                         VSPERF_REPO=${root}/upstream/vswitchperf \
88                         VSPERF_BRANCH=armband-workbench \
89                         VSPERF_CHANGE= \
90                         YARDSTICK_REPO=${root}/upstream/yardstick \
91                         YARDSTICK_BRANCH=armband-workbench \
92                         YARDSTICK_CHANGE= \
93                         EXTRA_RPM_REPOS="armband,http://linux.enea.com/mos-repos/centos/mos9.0-centos7/armband/x86_64,10" \
94                         MIRROR_MOS_UBUNTU=linux.enea.com \
95                         $(EXTRA_PARAMS) \
96                         iso 2>&1 | tee ${root}/build.log
97