dumb-init/Makefile

74 lines
2.1 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
VERSION = $(shell cat VERSION)
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
release: python-dists
2016-03-19 00:12:58 +03:00
cd dist && \
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-12-19 06:28:36 +03:00
.PHONY: python-dists
2021-10-11 23:22:01 +03:00
python-dists: python-dists-x86_64 python-dists-aarch64 python-dists-ppc64le python-dists-s390x
2021-10-08 14:47:06 +03:00
2021-10-11 23:22:01 +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) \
2021-10-08 14:47:06 +03:00
-v `pwd`/dist:/dist:rw \
2021-10-11 23:22:01 +03:00
quay.io/pypa/manylinux2014_$*:latest \
2021-10-08 14:47:06 +03:00
bash -exc ' \
/opt/python/cp38-cp38/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/
# 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 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
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