File: Makefile

package info (click to toggle)
dumb-init 1.2.2-1.1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 280 kB
  • sloc: python: 653; ansic: 253; makefile: 92; sh: 50
file content (92 lines) | stat: -rw-r--r-- 2,475 bytes parent folder | download
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
SHELL=bash
CFLAGS=-std=gnu99 -s -Wall -Werror -O3

TEST_PACKAGE_DEPS := build-essential python python-pip procps python-dev python-setuptools

DOCKER_RUN_TEST := docker run -v $(PWD):/mnt:ro
VERSION = $(shell cat VERSION)

.PHONY: build
build: VERSION.h
	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o dumb-init dumb-init.c

VERSION.h: VERSION
	echo '// THIS FILE IS AUTOMATICALLY GENERATED' > VERSION.h
	echo '// Run `make VERSION.h` to update it after modifying VERSION.' >> VERSION.h
	xxd -i VERSION >> VERSION.h

.PHONY: clean
clean: clean-tox
	rm -rf dumb-init dist/ *.deb

.PHONY: clean-tox
clean-tox:
	rm -rf .tox

.PHONY: release
release: python-dists
	cd dist && \
		sha256sum --binary dumb-init_$(VERSION)_amd64.deb dumb-init_$(VERSION)_amd64 dumb-init_$(VERSION)_ppc64el.deb dumb-init_$(VERSION)_ppc64el \
		> sha256sums

.PHONY: python-dists
python-dists: VERSION.h
	python setup.py sdist
	docker run \
		--user $$(id -u):$$(id -g) \
		-v $(PWD)/dist:/dist:rw \
		quay.io/pypa/manylinux1_x86_64:latest \
		bash -exc ' \
			/opt/python/cp35-cp35m/bin/pip wheel --wheel-dir /tmp /dist/*.tar.gz && \
			auditwheel repair --wheel-dir /dist /tmp/*.whl --wheel-dir /dist \
		'

.PHONY: builddeb
builddeb:
	debuild --set-envvar=CC=musl-gcc -us -uc -b
	mkdir -p dist
	mv ../dumb-init_*.deb dist/
	# Extract the built binary from the Debian package
	dpkg-deb --fsys-tarfile dist/dumb-init_$(VERSION)_$(shell dpkg --print-architecture).deb | \
		tar -C dist --strip=3 -xvf - ./usr/bin/dumb-init
	mv dist/dumb-init dist/dumb-init_$(VERSION)_$(shell dpkg --print-architecture)

.PHONY: builddeb-docker
builddeb-docker: docker-image
	mkdir -p dist
	docker run -v $(PWD):/mnt dumb-init-build

.PHONY: docker-image
docker-image:
	docker build -t dumb-init-build .

.PHONY: test
test:
	tox
	tox -e pre-commit

.PHONY: install-hooks
install-hooks:
	tox -e pre-commit -- install -f --install-hooks

ITEST_TARGETS = itest_trusty itest_xenial itest_bionic itest_stretch

.PHONY: itest $(ITEST_TARGETS)
itest: $(ITEST_TARGETS)

itest_trusty: _itest-ubuntu-trusty
itest_xenial: _itest-ubuntu-xenial
itest_bionic: _itest-ubuntu-bionic
itest_stretch: _itest-debian-stretch

itest_tox:
	$(DOCKER_RUN_TEST) ubuntu:bionic /mnt/ci/docker-tox-test

_itest-%: _itest_deb-% _itest_python-%
	@true

_itest_python-%:
	$(DOCKER_RUN_TEST) $(shell sed 's/-/:/' <<< "$*") /mnt/ci/docker-python-test

_itest_deb-%: builddeb-docker
	$(DOCKER_RUN_TEST) $(shell sed 's/-/:/' <<< "$*") /mnt/ci/docker-deb-test