# Copyright (C) 2023 Aiden Gall # # 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 3 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 . .POSIX: .PHONY: all clean dist install VERSION = 0.1 PREFIX = /usr/local MANPREFIX = $(PREFIX)/share/man CC = gcc CFLAGS = -std=c89 -pedantic -Wall -Wextra -D_POSIX_C_SOURCE=200809L SRC = simplebl.c OBJ = ${SRC:.c=.o} all: simplebl simplebl: ${OBJ} ${CC} -o $@ $^ ${LDFLAGS} %.o: %.c ${CC} -c ${CFLAGS} $< -o $@ clean: rm -f simplebl ${OBJ} dist: clean mkdir -p simplebl-${VERSION} cp -R LICENSE Makefile ${SRC} simplebl-${VERSION} tar -cf - simplebl-${VERSION} | gzip > simplebl-${VERSION}.tar.gz rm -rf simplebl-${VERSION} install: all mkdir -p ${DESTDIR}${PREFIX}/bin mkdir -p $(DESTDIR)$(MANPREFIX)/man8 sed "s/VERSION/$(VERSION)/g" < simplebl.8 > $(DESTDIR)$(MANPREFIX)/man8/simplebl.8 chmod 644 $(DESTDIR)$(MANPREFIX)/man8/simplebl.8 install -Dm755 simplebl ${DESTDIR}${PREFIX}/bin/simplebl chmod u+s ${DESTDIR}${PREFIX}/bin/simplebl