summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAiden Gall <aiden@aidengall.xyz>2023-12-11 18:41:43 +0000
committerAiden Gall <aiden@aidengall.xyz>2023-12-11 18:41:43 +0000
commitac18fcd10eff325973211b894ba4236cc1c3818c (patch)
tree5c49b9977fee854d258d257cec2462bb126743d6 /Makefile
initial commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile53
1 files changed, 53 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..5130c30
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,53 @@
+# 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 <http://www.gnu.org/licenses/>.
+
+.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