build: move build logic in the Makefile.

This commit is contained in:
Alexandre Pujol 2022-10-15 23:11:31 +01:00
parent 62f2163875
commit a470063f0f
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
4 changed files with 28 additions and 49 deletions

View file

@ -1,14 +1,35 @@
#!/usr/bin/make -f
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2022 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
DESTDIR ?= /
BUILD := .build
PKGNAME := apparmor.d
.PHONY: install lint archlinux debian ubuntu whonix clean
.PHONY: all install lint archlinux debian ubuntu whonix clean
all:
@echo "Nothing to do."
@go build -o ${BUILD}/ ./cmd/aa-log
ROOT = $(shell find "${BUILD}/root" -type f -printf "%P\n")
PROFILES = $(shell find "${BUILD}/apparmor.d" -type f -printf "%P\n")
install:
@echo "Nothing to do."
@install -Dm755 ${BUILD}/aa-log ${DESTDIR}/usr/bin/aa-log
@for file in ${ROOT}; do \
install -Dm0644 "${BUILD}/root/$${file}" "${DESTDIR}/$${file}"; \
done;
@for file in ${PROFILES}; do \
install -Dm0644 "${BUILD}/apparmor.d/$${file}" "${DESTDIR}/etc/apparmor.d/$${file}"; \
done;
@for file in systemd/system/*; do \
service="$$(basename "$$file")"; \
install -Dm0644 "$${file}" "${DESTDIR}/usr/lib/systemd/system/$${service}.d/apparmor.conf"; \
done;
@for file in systemd/user/*; do \
service="$$(basename "$$file")"; \
install -Dm0644 "$${file}" "${DESTDIR}/usr/lib/systemd/user/$${service}.d/apparmor.conf"; \
done
lint:
@shellcheck --shell=bash \
@ -31,4 +52,4 @@ clean:
@rm -rf \
debian/.debhelper debian/debhelper* debian/*.debhelper \
${PKGNAME}-*.pkg.tar.zst.sig ${PKGNAME}-*.pkg.tar.zst \
${PKGNAME}_*.* .build
${PKGNAME}_*.* ${BUILD}