summaryrefslogtreecommitdiff
path: root/Makefile
blob: 0da9e66f0602f10fe1846c21afd2533f20f92a77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#
# Copyright (C) 2014, Jaguar Land Rover
#
# This program is licensed under the terms and conditions of the
# Mozilla Public License, version 2.0.  The full text of the 
# Mozilla Public License is at https://www.mozilla.org/MPL/2.0/
#

#
# Makefile for the RVI node.
# 

.PHONY:	all deps compile clean rpm rpmclean

SRC_LIST=BUILD.md \
	CONFIGURE.md \
	doc \
	LICENSE \
	Makefile \
	README.md \
	rebar \
	rebar.config \
	rel \
	RELEASE.md \
	scripts/setup_gen \
	scripts/rvi.service \
	scripts/rvi_ctl \
	scripts/rvi_install.sh \
	components \
	ebin \
	src \
	rvi_sample.config \
	rvi_yocto.config \
	TODO 

VERSION=0.4.0

all: deps compile

deps:
	./rebar get-deps

compile:
	./rebar  compile

recomp:
	./rebar  compile skip_deps=true

clean:   
	./rebar clean

debian_clean:
	rm -rf ./debian_build

rpm_clean:
	rm -rf ./rpm/BUILD/* \
		./rpm/BUILDROOT/* \
		./rpm/RPMS/* \
		./rpm/SOURCES/* \
		./rpm/SRPMS/*

# Create a source tarball
src_tarball: clean
	tar czf ./rvi-$(VERSION).tgz $(SRC_LIST)
		components rvi_sample.config scripts/setup_rvi_node.sh src \
		TODO 

# Create a SOURCES tarball for RPM
rpm_tarball: clean rpm_clean 
	tar czf ./rvi-$(VERSION).tgz $(SRC_LIST) rpm
	mv ./rvi-$(VERSION).tgz ./rpm/SOURCES/

# Create a debian tarball
debian_package: clean debian_clean
	install --mode=0755 -d ./debian_build
# Pack up all relevant files, and debian/,  necessary for a build.
# Add rvi-$(VERSION) at the beginning of each file so
# that theu get packed up into a correctly named subdirectory
# 
	tar czf ./debian_build/rvi_$(VERSION).orig.tar.gz --exclude-vcs --transform="s|^|./rvi-$(VERSION)/|" $(SRC_LIST) debian
# Unpack the created tar file
	(cd ./debian_build; tar xf rvi_$(VERSION).orig.tar.gz)
# Descend into the unpacked directory and build.
	(cd ./debian_build/rvi-$(VERSION); debuild -uc -us)

rpm:	rpmclean rpm_tarball 
	rpmbuild --define "_topdir $$PWD/rpm" -ba rpm/SPECS/rvi-$(VERSION).spec

install: deps compile
	./scripts/rvi_install.sh $(DESTDIR)/opt/rvi $(DESTDIR)/opt/rvi $(DESTDIR)/var/opt/rvi $(DESTDIR)/var/opt/log/rvi
	install --mode=0755 -d $(DESTDIR)/etc/opt/rvi/
	install --mode=0644 rvi_yocto.config $(DESTDIR)/etc/opt/rvi/rvi.config