[clinfo] 36/55: Provide a `make install` target

Andreas Beckmann anbe at moszumanska.debian.org
Sat Jan 13 14:40:02 UTC 2018


This is an automated email from the git hooks/post-receive script.

anbe pushed a commit to branch master
in repository clinfo.

commit d0620be802425e5d577450d8ad1d0b09876de9a9
Author: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
Date:   Sun Aug 20 22:44:52 2017 +0200

    Provide a `make install` target
---
 Makefile | 41 ++++++++++++++++++++++++++++++++++++-----
 1 file changed, 36 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 0ba0c72..1e33c47 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,8 @@
 # Headers
 
+PROG = clinfo
+MAN = man1/$(PROG).1
+
 HDR =	src/error.h \
 	src/ext.h \
 	src/fmtmacros.h \
@@ -17,6 +20,13 @@ SPARSEFLAGS=-Wsparse-all -Wno-decl
 # BSD make does not define RM
 RM ?= rm -f
 
+# Installation paths and modes
+PREFIX ?= /usr/local
+BINDIR ?= $(PREFIX)/bin
+BINMODE ?= 555
+MANDIR ?= $(PREFIX)/man
+MANMODE ?= 444
+
 # Common library includes
 LDLIBS = -lOpenCL -ldl
 
@@ -29,14 +39,35 @@ LDLIBS += $(LDLIBS_${OS})
 # Remove -lOpenCL if OS is Darwin
 LDLIBS := $(LDLIBS:$(LDLIBS_${OS}_exclude)=)
 
-clinfo: clinfo.o
 
-clinfo.o: clinfo.c $(HDR)
+#
+# Standard targets
+#
+
+$(PROG): $(PROG).o
+
+$(PROG).o: $(PROG).c $(HDR)
 
 clean:
-	$(RM) clinfo.o clinfo
+	$(RM) $(PROG).o $(PROG)
+
+$(BINDIR):
+	install -d $@
+
+$(MANDIR)/man1:
+	install -d $@
 
-sparse: clinfo.c
+$(BINDIR)/$(PROG): $(PROG) $(BINDIR)
+	install -p -m $(BINMODE) $(PROG) $@
+
+$(MANDIR)/$(MAN): $(MAN) $(MANDIR)/man1
+	install -p -m $(MANMODE) $(MAN) $@
+
+install: $(BINDIR)/$(PROG) $(MANDIR)/$(MAN)
+
+
+sparse: $(PROG).c
 	$(SPARSE) $(CPPFLAGS) $(CFLAGS) $(SPARSEFLAGS) $^
 
-.PHONY: clean sparse
+
+.PHONY: clean sparse install

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/clinfo.git



More information about the Pkg-opencl-commits mailing list