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
|
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
|
2016-05-02 21:41:45 +03:00
|
|
|
release: sdist builddeb-docker
|
2016-03-19 00:12:58 +03:00
|
|
|
$(eval VERSION := $(shell cat VERSION))
|
2016-01-07 21:59:44 +03:00
|
|
|
# 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 | \
|
2016-01-07 21:59:44 +03:00
|
|
|
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 && \
|
2016-04-05 18:05:48 +03:00
|
|
|
sha256sum --binary dumb-init_$(VERSION)_amd64.deb dumb-init_$(VERSION)_amd64 \
|
2016-03-19 00:12:58 +03:00
|
|
|
> sha256sums
|
2016-01-07 21:59:44 +03:00
|
|
|
|
|
|
|
.PHONY: sdist
|
|
|
|
sdist: VERSION.h
|
|
|
|
python setup.py sdist
|
|
|
|
|
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/
|
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
|
|
|
|
|
|
|
|
.PHONY: install-hooks
|
|
|
|
install-hooks:
|
|
|
|
tox -e pre-commit -- install -f --install-hooks
|
|
|
|
|
2016-04-26 00:58:48 +03:00
|
|
|
ITEST_TARGETS = itest_lucid itest_precise itest_trusty itest_xenial itest_wheezy itest_jessie itest_stretch
|
|
|
|
|
|
|
|
.PHONY: itest $(ITEST_TARGETS)
|
|
|
|
itest: $(ITEST_TARGETS)
|
2015-08-05 20:56:55 +03:00
|
|
|
|
2015-08-11 23:46:03 +03:00
|
|
|
itest_lucid: _itest-ubuntu-lucid
|
2015-08-08 03:17:12 +03:00
|
|
|
itest_precise: _itest-ubuntu-precise
|
|
|
|
itest_trusty: _itest-ubuntu-trusty
|
2016-04-26 00:58:48 +03:00
|
|
|
itest_xenial: _itest-ubuntu-xenial
|
2015-08-08 03:17:12 +03:00
|
|
|
itest_wheezy: _itest-debian-wheezy
|
|
|
|
itest_jessie: _itest-debian-jessie
|
|
|
|
itest_stretch: _itest-debian-stretch
|
2015-08-05 20:56:55 +03:00
|
|
|
|
2015-09-18 20:14:49 +03:00
|
|
|
itest_tox:
|
2016-07-02 21:36:30 +03:00
|
|
|
$(DOCKER_RUN_TEST) ubuntu:xenial /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
|