commit 6953562c3fce572433811b5b8a11a1c809d3229b
parent 6dc729cc16f9263e76a04c9c366139d4cb44db1f
Author: parazyd <parazyd@dyne.org>
Date: Wed, 27 Jan 2021 15:08:15 +0100
Simplify Makefile and use system flags if there are any.
Diffstat:
4 files changed, 16 insertions(+), 22 deletions(-)
diff --git a/LICENSE b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2018-2019 Ivan J. <parazyd@dyne.org>
+Copyright (c) 2018-2021 Ivan J. <parazyd@dyne.org>
2009-2011 pancake <nopcode.org>
GNU GENERAL PUBLIC LICENSE
diff --git a/Makefile b/Makefile
@@ -2,7 +2,14 @@
# See LICENSE file for copyright and license details.
.POSIX:
-include config.mk
+# paths
+PREFIX = /usr/local
+MANPREFIX = ${PREFIX}/share/man
+
+# use system flags
+SUP_CFLAGS = ${CFLAGS} -Wall -Werror -pedantic -std=c99
+SUP_CPPFLAGS = ${CPPFLAGS}
+SUP_LDFLAGS = ${LDFLAGS} -static
BIN = sup
MAN = $(BIN).1
@@ -10,11 +17,14 @@ OBJ = $(BIN:=.o) sha256.o
all: $(BIN)
-$(OBJ): config.h config.mk
+$(OBJ): config.h
config.h:
cp config.def.h config.h
+.c.o:
+ $(CC) -c $(SUP_CFLAGS) $(SUP_CPPFLAGS) $<
+
$(BIN): $(OBJ)
$(CC) $(OBJ) $(LDFLAGS) -o $@
@@ -23,14 +33,11 @@ clean:
install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin
- mkdir -p $(DESTDIR)$(MANDIR)
+ mkdir -p $(DESTDIR)$(MANPREFIX)/man1
cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
- cp -f $(MAN) $(DESTDIR)$(MANDIR)
+ cp -f $(MAN) $(DESTDIR)$(MANPREFIX)/man1
chmod 4711 $(DESTDIR)$(PREFIX)/bin/$(BIN)
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
- rm -f $(DESTDIR)$(MANDIR)/$(MAN)
-
-.c.o:
- $(CC) $(CFLAGS) -c $<
+ rm -f $(DESTDIR)$(MANPREFIX)/man1/$(MAN)
diff --git a/README b/README
@@ -8,9 +8,3 @@ Configuration
-------------
Use the config.h file to apply authorizations that you want to allow in
sup. After editing, make sure to recompile and reinstall.
-
-
-Installation
-------------
-Edit config.mk to match your local setup and execute `make install` as
-root. By default, sup will be installed into the /usr/local namespace.
diff --git a/config.mk b/config.mk
@@ -1,7 +0,0 @@
-# Install paths
-PREFIX = /usr/local
-MANDIR = $(PREFIX)/share/man/man1
-
-# Stock FLAGS
-CFLAGS = -Os -Wall -Werror -pedantic -std=c99
-LDFLAGS = -static -s