dumb-init/Makefile

93 lines
2.3 KiB
Makefile
Raw Normal View History

2016-04-28 02:22:56 +03:00
SHELL=bash
CFLAGS=-std=gnu99 -static -s -Wall -Werror -O3
2015-08-26 19:05:54 +03:00
TEST_PACKAGE_DEPS := build-essential python python-pip procps python-dev python-setuptools
DOCKER_RUN_TEST := docker run -v $(PWD):/mnt:ro
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
.PHONY: release
2016-12-19 06:28:36 +03:00
release: python-dists builddeb-docker
2016-03-19 00:12:58 +03:00
$(eval VERSION := $(shell cat VERSION))
# extract the built binary from the Debian package
2016-03-19 00:12:58 +03:00
dpkg-deb --fsys-tarfile dist/dumb-init_$(VERSION)_amd64.deb | \
tar -C dist --strip=3 -xvf - ./usr/bin/dumb-init
2016-03-19 00:12:58 +03:00
mv dist/dumb-init dist/dumb-init_$(VERSION)_amd64
cd dist && \
sha256sum --binary dumb-init_$(VERSION)_amd64.deb dumb-init_$(VERSION)_amd64 \
2016-03-19 00:12:58 +03:00
> sha256sums
2016-12-19 06:28:36 +03:00
.PHONY: python-dists
python-dists: VERSION.h
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 \
'
2015-08-05 20:56:55 +03:00
.PHONY: builddeb
2015-08-05 03:15:08 +03:00
builddeb:
debuild --set-envvar=CC=musl-gcc -us -uc -b
mkdir -p dist
2015-08-05 20:56:55 +03:00
mv ../dumb-init_*.deb dist/
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
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
ITEST_TARGETS = itest_trusty itest_xenial itest_jessie itest_stretch
.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
itest_xenial: _itest-ubuntu-xenial
2015-08-08 03:17:12 +03:00
itest_jessie: _itest-debian-jessie
itest_stretch: _itest-debian-stretch
2015-08-05 20:56:55 +03:00
itest_tox:
2016-07-02 21:36:30 +03:00
$(DOCKER_RUN_TEST) ubuntu:xenial /mnt/ci/docker-tox-test
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