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 && \
|
2020-12-03 04:24:58 +03:00
|
|
|
sha256sum --binary dumb-init_$(VERSION)_amd64.deb dumb-init_$(VERSION)_x86_64 dumb-init_$(VERSION)_ppc64el.deb dumb-init_$(VERSION)_ppc64le dumb-init_$(VERSION)_s390x.deb dumb-init_$(VERSION)_s390x dumb-init_$(VERSION)_arm64.deb dumb-init_$(VERSION)_aarch64 \
|
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
|
2019-12-09 22:17:51 +03:00
|
|
|
mv dist/dumb-init dist/dumb-init_$(VERSION)_$(shell uname -m)
|
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
|
2021-10-07 21:19:38 +03:00
|
|
|
docker run --init --user $$(id -u):$$(id -g) -v $(PWD):/tmp/mnt dumb-init-build make builddeb
|
2015-08-05 03:15:08 +03:00
|
|
|
|
2015-08-05 20:56:55 +03:00
|
|
|
.PHONY: docker-image
|
2015-08-05 03:15:08 +03:00
|
|
|
docker-image:
|
2021-10-07 21:19:38 +03:00
|
|
|
docker build $(if $(BASE_IMAGE),--build-arg BASE_IMAGE=$(BASE_IMAGE)) -t dumb-init-build .
|
2015-08-05 03:15:08 +03:00
|
|
|
|
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
|