1 ##############################################################################
2 # Copyright (c) 2015 Ericsson AB and others.
3 # stefan.k.berg@ericsson.com
4 # jonas.bjurel@ericsson.com
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
13 ############################################################################
14 # BEGIN of variables to customize
17 export UNIT_TEST = FALSE
18 export INTERACTIVE = TRUE
19 export CENTDNLD = http://mirrors.cat.pdx.edu/centos/7.1.1503/isos/x86_64/CentOS-7-x86_64-DVD-1503-01.iso
20 export ISOSRC = file:$(shell pwd)/CentOS-7-x86_64-DVD-1503-01.iso
21 export ISOCACHE = $(shell pwd)/$(shell basename $(ISOSRC))
22 export PRODNO = "OPNFV_BGS"
23 export REVSTATE = "P0000"
24 export NEWISO = $(shell pwd)/release/OPNFV-CentOS-7-x86_64-${REVSTATE}.iso
25 export GENESISRPM = $(shell pwd)/x86_64/opnfv-genesis-0.1-1.x86_64.rpm
27 # Note! Invoke with "make REVSTATE=RXXXX all" to make release build!
28 # Invoke with ICOCACHE=/full/path/to/iso if cached ISO is in non-standard location.
31 export BUILD_BASE := $(shell pwd)
32 export CACHE_DIR := $(BUILD_BASE)/cache
33 export VERSION_FILE := $(BUILD_BASE)/.versions
34 export TOPDIR := $(shell pwd)
36 CENTDIR := $(TOPDIR)/centiso
38 # END of variables to customize
39 #############################################################################
41 SUBCLEAN = $(addsuffix .clean,$(SUBDIRS))
46 @echo "Versions of cached build results built by" $(shell hostname) "at" $(shell date -u) > $(VERSION_FILE)
47 @echo "cache.mk" $(shell md5sum $(BUILD_BASE)/cache.mk | cut -f1 -d " ") >> $(VERSION_FILE)
48 @echo "config.mk" $(shell md5sum $(BUILD_BASE)/config.mk | cut -f1 -d " ") >> $(VERSION_FILE)
50 ############################################################################
51 # BEGIN of Include definitions
56 # END Include definitions
57 #############################################################################
60 test -s $(ISOCACHE) || { wget -nv $(CENTDNLD) ; }
62 .PHONY: mount-centiso umount-centiso
63 mount-centiso: $(ISOCACHE)
64 @echo "Mounting CentOS ISO in $(CENTDIR)"
66 @fuseiso $(ISOCACHE) $(CENTDIR)
70 @echo "Unmounting CentOS ISO from $(CENTDIR)"
71 @fusermount -u $(CENTDIR)
75 .PHONY: build-clean $(SUBCLEAN)
76 build-clean: $(SUBCLEAN)
82 .PHONY: clean $(SUBCLEAN)
83 clean: clean-cache $(SUBCLEAN)
88 @rm -f $(BUILD_BASE)/.versions
91 $(MAKE) -C $* -f Makefile clean
95 rpmbuild --clean opnfv-genesis.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)'
99 pushd ../../ && git archive --format=tar --prefix=opnfv-genesis-0.1/ HEAD | gzip > foreman/build/opnfv-genesis.tar.gz
100 rpmbuild -ba opnfv-genesis.spec -D '_topdir %(echo `pwd`)' -D '_builddir %(echo `pwd`)' -D '_sourcedir %(echo `pwd`)' -D '_rpmdir %(echo `pwd`)' -D '_specdir %(echo `pwd`)' -D '_srcrpmdir %(echo `pwd`)'
104 instack: instack.qcow2
109 .PHONY: instack-clean
111 @virsh destroy instack 2> /dev/null || echo -n ''
112 @virsh undefine instack 2> /dev/null || echo -n ''
113 @virsh destroy baremetal_0 2> /dev/null || echo -n ''
114 @virsh undefine baremetal_0 2> /dev/null || echo -n ''
115 @virsh destroy baremetal_1 2> /dev/null || echo -n ''
116 @virsh undefine baremetal_1 2> /dev/null || echo -n ''
122 # Todo: Make things smarter - we shouldn't need to clean everything
123 # betwen make invocations.
125 iso: build-clean $(ISOCACHE) instack.qcow2 rpm
127 @mkdir centos release
128 cp -r $(CENTDIR)/* centos
130 # modify the installer iso's contents
131 @cp -f isolinux.cfg centos/isolinux/isolinux.cfg
132 @cp $(GENESISRPM) centos/Packages
133 # regenerate yum repo data
134 @echo "Generating new yum metadata"
135 createrepo --update -g ../c7-opnfv-x86_64-comps.xml centos
137 @echo "Building OPNFV iso"
138 mkisofs -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -V "OPNFV CentOS 7 x86_64" -R -J -v -T -o $(NEWISO) centos
139 @printf "\n\nISO is built at $(NEWISO)\n\n"