2016-04-28 02:22:56 +03:00
|
|
|
SHELL=bash
|
2016-01-07 21:42:50 +03:00
|
|
|
CFLAGS=-std=gnu99 -static -s -Wall -Werror -O3
|
2015-08-26 19:05:54 +03:00
|
|
|
|
2016-04-26 00:58:48 +03:00
|
|
|
TEST_PACKAGE_DEPS := build-essential python python-pip procps python-dev python-setuptools
|
2015-09-10 05:04:28 +03:00
|
|
|
|
2015-10-23 02:43:50 +03:00
|
|
|
DOCKER_RUN_TEST := docker run -v $(PWD):/mnt:ro
|
2018-06-05 05:19:57 +03:00
|
|
|
VERSION = $(shell cat VERSION)
|
2015-09-18 20:14:49 +03:00
|
|
|
|
2015-08-05 20:56:55 +03:00
|
|
|
.PHONY: build
|
2015-10-02 23:31:35 +03:00
|
|
|
build: VERSION.h
|
2015-08-26 19:05:54 +03:00
|
|
|
$(CC) $(CFLAGS) -o dumb-init dumb-init.c
|
2015-07-30 02:03:55 +03:00
|
|
|
|
2015-10-02 23:31:35 +03:00
|
|
|
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
|
|
|
|
|
2015-08-05 20:56:55 +03:00
|
|
|
.PHONY: clean
|
2015-08-08 03:17:12 +03:00
|
|
|
clean: clean-tox
|
2015-08-05 20:56:55 +03:00
|
|
|
rm -rf dumb-init dist/ *.deb
|
2015-08-05 03:15:08 +03:00
|
|
|
|
2015-08-08 03:17:12 +03:00
|
|
|
.PHONY: clean-tox
|
|
|
|
clean-tox:
|
|
|
|
rm -rf .tox
|
|
|
|
|
2016-01-07 21:59:44 +03:00
|
|
|
.PHONY: release
|
2018-06-07 20:37:45 +03:00
|
|
|
release: python-dists
|
2016-03-19 00:12:58 +03:00
|
|
|
cd dist && \
|
2018-06-07 20:37:45 +03:00
|
|
|
sha256sum --binary dumb-init_$(VERSION)_amd64.deb dumb-init_$(VERSION)_amd64 dumb-init_$(VERSION)_ppc64el.deb dumb-init_$(VERSION)_ppc64el \
|
2016-03-19 00:12:58 +03:00
|
|
|
> sha256sums
|
2016-01-07 21:59:44 +03:00
|
|
|
|
2016-12-19 06:28:36 +03:00
|
|
|
.PHONY: python-dists
|
|
|
|
python-dists: VERSION.h
|
2016-01-07 21:59:44 +03:00
|
|
|
python setup.py sdist
|
2016-12-19 06:28:36 +03:00
|
|
|
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 \
|
|
|
|
'
|
2016-01-07 21:59:44 +03:00
|
|
|
|
2015-08-05 20:56:55 +03:00
|
|
|
.PHONY: builddeb
|
2015-08-05 03:15:08 +03:00
|
|
|
builddeb:
|
2016-01-07 21:47:36 +03:00
|
|
|
debuild --set-envvar=CC=musl-gcc -us -uc -b
|
2016-01-07 21:59:44 +03:00
|
|
|
mkdir -p dist
|
2015-08-05 20:56:55 +03:00
|
|
|
mv ../dumb-init_*.deb dist/
|
2018-06-05 05:19:57 +03:00
|
|
|
# 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)
|
2015-08-05 03:15:08 +03:00
|
|
|
|
2015-08-05 20:56:55 +03:00
|
|
|
.PHONY: builddeb-docker
|
2015-08-05 03:15:08 +03:00
|
|
|
builddeb-docker: docker-image
|
2016-01-07 21:59:44 +03:00
|
|
|
mkdir -p dist
|
2015-08-05 03:15:08 +03:00
|
|
|
docker run -v $(PWD):/mnt dumb-init-build
|
|
|
|
|
2015-08-05 20:56:55 +03:00
|
|
|
.PHONY: docker-image
|
2015-08-05 03:15:08 +03:00
|
|
|
docker-image:
|
|
|
|
docker build -t dumb-init-build .
|
|
|
|
|
2015-08-08 01:40:26 +03:00
|
|
|
.PHONY: test
|
|
|
|
test:
|
|
|
|
tox
|
2016-09-13 18:53:13 +03:00
|
|
|
tox -e pre-commit
|
2015-08-08 01:40:26 +03:00
|
|
|
|
|
|
|
.PHONY: install-hooks
|
|
|
|
install-hooks:
|
|
|
|
tox -e pre-commit -- install -f --install-hooks
|
|
|
|
|
2018-06-04 22:42:29 +03:00
|
|
|
ITEST_TARGETS = itest_trusty itest_xenial itest_bionic itest_stretch
|
2016-04-26 00:58:48 +03:00
|
|
|
|
|
|
|
.PHONY: itest $(ITEST_TARGETS)
|
|
|
|
itest: $(ITEST_TARGETS)
|
2015-08-05 20:56:55 +03:00
|
|
|
|
2015-08-08 03:17:12 +03:00
|
|
|
itest_trusty: _itest-ubuntu-trusty
|
2016-04-26 00:58:48 +03:00
|
|
|
itest_xenial: _itest-ubuntu-xenial
|
2018-05-16 19:23:33 +03:00
|
|
|
itest_bionic: _itest-ubuntu-bionic
|
2015-08-08 03:17:12 +03:00
|
|
|
itest_stretch: _itest-debian-stretch
|
2015-08-05 20:56:55 +03:00
|
|
|
|
2015-09-18 20:14:49 +03:00
|
|
|
itest_tox:
|
2018-05-16 19:23:33 +03:00
|
|
|
$(DOCKER_RUN_TEST) ubuntu:bionic /mnt/ci/docker-tox-test
|
2015-09-18 20:14:49 +03:00
|
|
|
|
2015-08-08 03:17:12 +03:00
|
|
|
_itest-%: _itest_deb-% _itest_python-%
|
|
|
|
@true
|
2015-08-05 03:15:08 +03:00
|
|
|
|
2015-08-08 03:17:12 +03:00
|
|
|
_itest_python-%:
|
2016-07-02 21:36:30 +03:00
|
|
|
$(DOCKER_RUN_TEST) $(shell sed 's/-/:/' <<< "$*") /mnt/ci/docker-python-test
|
2015-08-05 03:15:08 +03:00
|
|
|
|
2015-08-12 22:03:04 +03:00
|
|
|
_itest_deb-%: builddeb-docker
|
2016-07-02 21:36:30 +03:00
|
|
|
$(DOCKER_RUN_TEST) $(shell sed 's/-/:/' <<< "$*") /mnt/ci/docker-deb-test
|