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
18 export BUILD_BASE = $(shell pwd)
19 export DEB_DEST := $(BUILD_BASE)/release/packages/ubuntu/pool/main
20 export PUPPET_DEST := $(BUILD_BASE)/release/puppet/modules
22 ISOSRC = file:$(shell pwd)/fuel-6.0.1.iso
23 ISOCACHE = $(shell pwd)/$(shell basename $(ISOSRC))
26 NEWISO = $(shell pwd)/release/opnfv-${REVSTATE}.iso
27 DOCKERIMG = opnfv.org/ubuntu-builder:14.04
28 # Note! Invoke with "make REVSTATE=RXXXX iso" to make release build!
29 # Invoke with ICOCACHE=/full/path/to/iso if cached ISO is in non-standard location.
31 # END of variables to customize
32 #############################################################################
33 export TOPDIR := $(shell pwd)
34 ORIGDIR := $(TOPDIR)/origiso
37 SUBDIRS += f_opnfv_puppet
39 SUBDIRS += f_l23network
40 SUBDIRS += f_resolvconf
46 SUBDIRS += f_comm_java
56 # f_example is only an example of how to generate a .deb package and
57 # should not be enabled in official builds.
60 SUBCLEAN = $(addsuffix .clean,$(SUBDIRS))
64 @docker version >/dev/null 2>&1 || (echo 'No Docker installation available'; exit 1)
66 @docker/runcontext $(DOCKERIMG) $(MAKE) $(MAKEFLAGS) iso
69 # Clone Fuel to non-persistent location and build
70 cd /tmp && git clone $(FUEL_MAIN_REPO)
71 cd /tmp/fuel-main && git checkout $(FUEL_MAIN_TAG)
72 # Setup cgroups for docker-in-docker
73 sudo /root/enable_dockerx2
74 # Patch to fix race condition when doing "Docker-in-Docker" build
75 cd /tmp/fuel-main && patch -p1 < $(TOPDIR)/fuel-main_1.patch
76 # Patch to make the sandbox chroot in Fuel succeed with package
77 # installation in a Docker build
78 cd /tmp/fuel-main && patch -p1 < $(TOPDIR)/fuel-main_2.patch
79 # Remove Docker optimizations, otherwise multistrap will fail during
81 sudo rm -f /etc/apt/apt.conf.d/docker*
83 cd /tmp/fuel-main && ./prepare-build-env.sh
84 cd /tmp/fuel-main && make iso
85 mv /tmp/fuel-main/build/artifacts/fuel*.iso .
87 .PHONY: mount-origiso umount-origiso
88 mount-origiso: $(ISOCACHE)
89 @echo "Mounting original ISO in $(ORIGDIR)"
91 @fuseiso $(ISOCACHE) $(ORIGDIR)
94 @echo "Unmounting original ISO from $(ORIGDIR)"
95 @fusermount -u $(ORIGDIR)
100 @mkdir -p release/packages/ubuntu/pool/main release/puppet/modules release/isoroot
101 $(MAKE) -C $@ -f Makefile release
103 .PHONY: patch-packages
105 ORIGISO=$(ISOCACHE) REVSTATE=$(REVSTATE) $(MAKE) -C $@ -f Makefile release
109 $(MAKE) -C opendaylight -f Makefile setup
113 $(MAKE) -C opendaylight -f Makefile
115 .PHONY: build-clean $(SUBCLEAN)
116 build-clean: $(SUBCLEAN)
117 $(MAKE) -C patch-packages -f Makefile clean
122 .PHONY: clean $(SUBCLEAN)
123 clean: prepare $(SUBCLEAN)
124 $(MAKE) -C patch-packages -f Makefile clean
125 $(MAKE) -C opendaylight -f Makefile clean
132 $(SUBCLEAN): %.clean:
133 $(MAKE) -C $* -f Makefile clean
135 # Todo: Make things smarter - we shouldn't need to clean everything
136 # betwen make invocations.
138 iso: prepare build-clean odl $(ISOCACHE) $(SUBDIRS) patch-packages
139 install/install.sh iso $(ISOCACHE) $(NEWISO) $(PRODNO) $(REVSTATE)
140 @printf "\n\nProduct ISO is $(NEWISO)\n\n"