From e220d1084f4a377bbbbb3565252b780f945517c1 Mon Sep 17 00:00:00 2001 From: Kevin Orr Date: Thu, 29 Aug 2019 00:43:26 -0400 Subject: [PATCH 1/4] Use implicit rules No need to manually specify such rules, so long as the right variables (CC, CFLAGS, LDFLAGS, etc) are set --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d638b5a..a164a7f 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,15 @@ # Copyright 2017 - 2019, Udi Fuchs # SPDX-License-Identifier: MIT +CFLAGS := -Wall ${CFLAGS} +LDFLAGS := -l lcms2 ${LDFLAGS} + BIN_PATH=/usr/local/bin/ AUTO_START_PATH=/usr/share/gnome/autostart/ all: icc-brightness-gen icc-brightness-gen: icc-brightness-gen.c - $(CC) -W -Wall $(CFLAGS) $^ -l lcms2 $(LDFLAGS) -o $@ clean: rm -f icc-brightness-gen From bf4e14dbd008cea95e308760659cdd508c4c0f1a Mon Sep 17 00:00:00 2001 From: Kevin Orr Date: Thu, 29 Aug 2019 00:55:01 -0400 Subject: [PATCH 2/4] Use PREFIX and BINDIR This allows the user to specify an alternative root directory to install to. For example, they may wish to install only for their local user, so they can set PREFIX="$HOME"/.local make install --- Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index a164a7f..daa9402 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,8 @@ CFLAGS := -Wall ${CFLAGS} LDFLAGS := -l lcms2 ${LDFLAGS} -BIN_PATH=/usr/local/bin/ +PREFIX ?= /usr/local +BINDIR ?= ${PREFIX}/bin AUTO_START_PATH=/usr/share/gnome/autostart/ all: icc-brightness-gen @@ -15,8 +16,8 @@ clean: rm -f icc-brightness-gen install: all - mkdir -p $(DESTDIR)$(BIN_PATH) - install -m 755 icc-brightness-gen $(DESTDIR)$(BIN_PATH) - install -m 755 icc-brightness $(DESTDIR)$(BIN_PATH) + mkdir -p $(DESTDIR)$(BINDIR) + install -m 755 icc-brightness-gen $(DESTDIR)$(BINDIR) + install -m 755 icc-brightness $(DESTDIR)$(BINDIR) mkdir -p $(DESTDIR)$(AUTO_START_PATH) install -m 644 icc-brightness.desktop $(DESTDIR)$(AUTO_START_PATH) From bd7b838e5cc5e5af5db8349da92adb81808e7b0e Mon Sep 17 00:00:00 2001 From: Kevin Orr Date: Thu, 29 Aug 2019 00:59:10 -0400 Subject: [PATCH 3/4] Use the XDG config dir, instead of GNOME-specific one This is compatible with more WMs --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index daa9402..b5a25fe 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ LDFLAGS := -l lcms2 ${LDFLAGS} PREFIX ?= /usr/local BINDIR ?= ${PREFIX}/bin -AUTO_START_PATH=/usr/share/gnome/autostart/ +AUTO_START_DIR=/etc/xdg/autostart all: icc-brightness-gen From 038a16067a39a6e3275666fa097ee1b46da83a45 Mon Sep 17 00:00:00 2001 From: Kevin Orr Date: Thu, 29 Aug 2019 01:04:09 -0400 Subject: [PATCH 4/4] Use `install` to create directories automatically --- Makefile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index b5a25fe..b77b919 100644 --- a/Makefile +++ b/Makefile @@ -16,8 +16,5 @@ clean: rm -f icc-brightness-gen install: all - mkdir -p $(DESTDIR)$(BINDIR) - install -m 755 icc-brightness-gen $(DESTDIR)$(BINDIR) - install -m 755 icc-brightness $(DESTDIR)$(BINDIR) - mkdir -p $(DESTDIR)$(AUTO_START_PATH) - install -m 644 icc-brightness.desktop $(DESTDIR)$(AUTO_START_PATH) + install -Dm755 -t $(DESTDIR)$(BINDIR) icc-brightness icc-brightness-gen + install -Dm644 -t $(DESTDIR)$(AUTO_START_DIR) icc-brightness.desktop