diff options
| author | dacctal <donotcontactmevia@email.invalid> | 2026-06-28 03:24:10 +0000 |
|---|---|---|
| committer | dacctal <donotcontactmevia@email.invalid> | 2026-06-28 03:24:10 +0000 |
| commit | ce574919bc809ace81837fdd87d130651a7c7a50 (patch) | |
| tree | 151e80443fcabe49fabb0bf806fd53c3cb476105 | |
| parent | b27634a7c7626b3536428d313e192f96a83a1538 (diff) | |
aintea <aintea@protonmail.com> added pretty printing to makefile
| -rw-r--r-- | Makefile | 73 | ||||
| -rw-r--r-- | makefile-license | 16 |
2 files changed, 52 insertions, 37 deletions
@@ -1,19 +1,3 @@ -# pkgit - package it! - -# Copyright (C) 2026 dacctal -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <https://www.gnu.org/licenses/>. - .PHONY: default debug install defconfig clean CC ?= clang @@ -24,42 +8,57 @@ SRCS = $(wildcard src/*.c) OBJS = $(SRCS:src/%.c=$(OBJDIR)/%.o) CFLAGS += $(shell pkg-config --cflags luajit) -I./include -Wno-format-truncation -std=c99 -D_XOPEN_SOURCE=700 -Wall -Wextra +# pretty print for compilation. To enable verbose (show commands), run with +# `make V=1` +ifeq ($(strip $(V)),) + E = @echo + Q = @ +else + E = @\# + Q = +endif + default: pkgit pkgit: $(OBJS) - ${CC} -o $@ $^ $(shell pkg-config --libs luajit) + $(E) " LINK " $@ + $(Q) ${CC} -o $@ $^ $(shell pkg-config --libs luajit) $(OBJDIR): @mkdir -p $(OBJDIR) $(OBJDIR)/%.o: src/%.c | $(OBJDIR) - ${CC} $(CFLAGS) -c -o $@ $< + $(E) " CC " $@ + $(Q) ${CC} $(CFLAGS) -c -o $@ $< debug: CFLAGS += -g -O0 debug: pkgit install: pkgit - install -d ${DESTDIR}${PREFIX}/bin - install -m 755 pkgit ${DESTDIR}${PREFIX}/bin/pkgit - install -d ${DESTDIR}${PREFIX}/share/man/man1 - install -m 644 docs/pkgit.1 ${DESTDIR}${PREFIX}/share/man/man1/pkgit.1 + $(E) " INSTALL" ${DESTDIR}${PREFIX} + $(Q) install -d ${DESTDIR}${PREFIX}/bin + $(Q) install -m 755 pkgit ${DESTDIR}${PREFIX}/bin/pkgit + $(Q) install -d ${DESTDIR}${PREFIX}/share/man/man1 + $(Q) install -m 644 docs/pkgit.1 ${DESTDIR}${PREFIX}/share/man/man1/pkgit.1 uninstall: ${DESTDIR}${PREFIX}/bin/pkgit - ${RM} ${DESTDIR}${PREFIX}/bin/pkgit - ${RM} ${DESTDIR}${PREFIX}/share/man/man1/pkgit.1 - + $(E) " UNINSTALL" ${DESTDIR}${PREFIX} + $(Q) ${RM} ${DESTDIR}${PREFIX}/bin/pkgit + $(Q) ${RM} ${DESTDIR}${PREFIX}/share/man/man1/pkgit.1 + defconfig: - @if [ "$$(id -u)" -eq 0 ]; then dir=/etc/pkgit; else dir=~/.config/pkgit; fi; \ - echo "installing default config to $$dir ..."; \ - mkdir -p $$dir; \ - cp -r ./config/* $$dir/; \ - echo "default config installed" - + $(Q) @if [ "$$(id -u)" -eq 0 ]; then dir=/etc/pkgit; else dir=~/.config/pkgit; fi; \ + $(Q) echo "installing default config to $$dir ..."; \ + $(Q) mkdir -p $$dir; \ + $(Q) cp -r ./config/* $$dir/; \ + $(Q) echo "default config installed" + rmconfig: - @if [ "$$(id -u)" -eq 0 ]; then dir=/etc/pkgit; else dir=~/.config/pkgit; fi; \ - echo "removing config from $$dir ..."; \ - rm -rf $$dir; \ - echo "config successfully removed" - + $(Q) @if [ "$$(id -u)" -eq 0 ]; then dir=/etc/pkgit; else dir=~/.config/pkgit; fi; \ + $(Q) echo "removing config from $$dir ..."; \ + $(Q) rm -rf $$dir; \ + $(Q) echo "config successfully removed" + clean: - ${RM} -r $(OBJDIR) pkgit + $(E) " CLEAN" + $(Q) ${RM} -r $(OBJDIR) pkgit diff --git a/makefile-license b/makefile-license new file mode 100644 index 0000000..9e5d9da --- /dev/null +++ b/makefile-license @@ -0,0 +1,16 @@ +# pkgit - package it! + +# Copyright (C) 2026 dacctal +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + |
