Removing OpenSteak Project
[genesis.git] / foreman / build / Makefile
1 ##############################################################################
2 # Copyright (c) 2015 Ericsson AB and others.
3 # stefan.k.berg@ericsson.com
4 # jonas.bjurel@ericsson.com
5 # dradez@redhat.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 ##############################################################################
11
12 SHELL = /bin/bash
13 ############################################################################
14 # BEGIN of variables to customize
15 #
16 #Input args
17 export UNIT_TEST = FALSE
18 export INTERACTIVE = TRUE
19 export ISOSRC = file:$(shell pwd)/CentOS-7.0-1406-x86_64-Minimal.iso
20 export ISOCACHE = $(shell pwd)/$(shell basename $(ISOSRC))
21 export PRODNO = "OPNFV_BGS"
22 export REVSTATE = "P0000"
23 export NEWISO = $(shell pwd)/release/OPNFV-CentOS-7-x86_64-${REVSTATE}.iso
24 export VBOXRPM = $(shell pwd)/VirtualBox-4.3-4.3.26_98988_fedora18-1.x86_64.rpm
25 export VAGRANTRPM = $(shell pwd)/vagrant_1.7.2_x86_64.rpm
26
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.
29
30 #Build variables
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)
35
36 CENTDIR := $(TOPDIR)/centiso
37 #
38 # END of variables to customize
39 #############################################################################
40
41 SUBCLEAN = $(addsuffix .clean,$(SUBDIRS))
42
43
44 .PHONY: all
45 all: iso
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)
49
50 ############################################################################
51 # BEGIN of Include definitions
52 #
53 include config.mk
54 include cache.mk
55 #
56 # END Include definitions
57 #############################################################################
58
59 $(ISOCACHE):
60         #cp ~/Downloads/opnfv_iso/CentOS-7.0-1406-x86_64-Minimal.iso $(ISOCACHE)
61
62 .PHONY: mount-centiso umount-centiso
63 mount-centiso: $(ISOCACHE)
64         @echo "Mounting CentOS ISO in $(CENTDIR)"
65         @mkdir -p $(CENTDIR)
66         @fuseiso $(ISOCACHE) $(CENTDIR)
67
68 umount-centiso:
69         @set +e
70         @echo "Unmounting CentOS ISO from $(CENTDIR)"
71         @fusermount -u $(CENTDIR)
72         @rmdir $(CENTDIR)
73         @set -e
74
75 .PHONY: build-clean $(SUBCLEAN)
76 build-clean: $(SUBCLEAN)
77         @rm -Rf centos
78         @rm -Rf release
79         @rm -Rf newiso
80         @rm -f $(NEWISO)
81
82 .PHONY: clean $(SUBCLEAN)
83 clean:  clean-cache $(SUBCLEAN)
84         @rm -f *.iso
85         @rm -Rf release
86         @rm -Rf newiso
87         @rm -f $(NEWISO)
88         @rm -f $(BUILD_BASE)/.versions
89
90 $(SUBCLEAN): %.clean:
91         $(MAKE) -C $* -f Makefile clean
92
93 # Todo: Make things smarter - we shouldn't need to clean everything
94 # betwen make invocations.
95 .PHONY: iso
96 iso:    build-clean mount-centiso $(ISOCACHE) $(VBOXRPM) $(VAGRANTRPM)
97         @mkdir centos release
98         cp -r $(CENTDIR)/* centos
99         @make umount-centiso
100         # modify the installer iso's contents
101         @rm -rf centos/repodata
102         @cp -f isolinux.cfg centos/isolinux/isolinux.cfg
103         @cp $(VBOXRPM) centos/Packages
104         @cp $(VAGRANTRPM) centos/Packages
105         # regenerate yum repo data
106         @echo "Generating new yum metadata"
107         createrepo centos/Packages -g ../../c7-opnfv-x86_64-comps.xml -o centos
108         # build the iso
109         @echo "Building OPNFV iso"
110         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
111         @printf "\n\nISO is built at $(NEWISO)\n\n"