Makefile 1.47 KB
Newer Older
Max Beckett's avatar
Max Beckett committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#
# Copyright 2017-2018 Amazon.com, Inc. and its affiliates. All Rights Reserved.
#
# Licensed under the MIT License. See the LICENSE accompanying this file
# for the specific language governing permissions and limitations under
# the License.
#

PACKAGE_NAME = amazon-efs-utils
SOURCE_TARBALL = $(PACKAGE_NAME).tar.gz
SPECFILE = $(PACKAGE_NAME).spec
BUILD_DIR = build/rpmbuild
export PYTHONPATH := $(shell pwd)/src

Ian Patel's avatar
Ian Patel committed
15
.PHONY: clean
Max Beckett's avatar
Max Beckett committed
16
17
clean:
	rm -rf $(BUILD_DIR)
Ian Patel's avatar
Ian Patel committed
18
	rm -rf $(PACKAGE_NAME)
Max Beckett's avatar
Max Beckett committed
19
20
	rm -f $(SOURCE_TARBALL)

Ian Patel's avatar
Ian Patel committed
21
.PHONY: tarball
Max Beckett's avatar
Max Beckett committed
22
23
tarball: clean
	mkdir -p $(PACKAGE_NAME)
Ian Patel's avatar
Ian Patel committed
24
25
26
27
28
29
30
31
32
33
34

	mkdir -p $(PACKAGE_NAME)/dist
	cp -p dist/amazon-efs-mount-watchdog.conf $(PACKAGE_NAME)/dist
	cp -p dist/amazon-efs-mount-watchdog.service $(PACKAGE_NAME)/dist
	cp -p dist/efs-utils.conf $(PACKAGE_NAME)/dist
	cp -p dist/efs-utils.crt $(PACKAGE_NAME)/dist

	mkdir -p $(PACKAGE_NAME)/src
	cp -rp src/mount_efs $(PACKAGE_NAME)/src
	cp -rp src/watchdog $(PACKAGE_NAME)/src

35
36
37
	mkdir -p ${PACKAGE_NAME}/man
	cp -rp man/mount.efs.8 ${PACKAGE_NAME}/man

Max Beckett's avatar
Max Beckett committed
38
39
	tar -czf $(SOURCE_TARBALL) $(PACKAGE_NAME)/*

40
41
42
.PHONY: sources
sources: tarball

Ian Patel's avatar
Ian Patel committed
43
.PHONY: rpm-only
Max Beckett's avatar
Max Beckett committed
44
45
46
47
48
49
50
rpm-only:
	mkdir -p $(BUILD_DIR)/{SPECS,COORD_SOURCES,DATA_SOURCES,BUILD,RPMS,SOURCES,SRPMS}
	cp $(SPECFILE) $(BUILD_DIR)/SPECS
	cp $(SOURCE_TARBALL) $(BUILD_DIR)/SOURCES
	rpmbuild -ba --define "_topdir `pwd`/$(BUILD_DIR)" $(BUILD_DIR)/SPECS/$(SPECFILE)
	cp $(BUILD_DIR)/RPMS/*/*rpm build

Ian Patel's avatar
Ian Patel committed
51
.PHONY: rpm
52
rpm: sources rpm-only
Max Beckett's avatar
Max Beckett committed
53

Ian Patel's avatar
Ian Patel committed
54
55
56
57
.PHONY: deb
deb:
	./build-deb.sh

Max Beckett's avatar
Max Beckett committed
58
59
60
.PHONY: test
test:
	pytest
61
	flake8