]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/beep/0005-Make-build-install-more-user-and-packaging-friendly.patch
reiserfsprogs: Update to 3.6.27
[ipfire-2.x.git] / src / patches / beep / 0005-Make-build-install-more-user-and-packaging-friendly.patch
CommitLineData
4217b4b6
MF
1From 947a7e332908dcba1c7e523fbdc927d39ee6adb1 Mon Sep 17 00:00:00 2001
2From: Hans Ulrich Niedermann <hun@n-dimensional.de>
3Date: Tue, 19 Nov 2013 23:40:50 +0100
4Subject: [PATCH] Make build/install more user and packaging friendly
5
6Make the build and install more user and packaging friendly
7by introducing the following features in the Makefile:
8
9 * Honor the $(CFLAGS) set when calling make.
10
11 * Prefix all install locations with $(DESTDIR) for
12 easy package building.
13
14 * Use GNU Makefile conventions for defining installation
15 directories. This means $(bindir) and $(man1dir)
16 instead of the former $(INSTALL_DIR) and $(MAN_DIR).
17
18 * Use install(1) for installing files and directories
19 so that permissions can be set properly.
20
21 * Stop "make clean" failing when it has nothing to do.
22
23 * Add 'uninstall' make target.
24
25 * Make 'install' target build executable if necessary.
26---
27 Makefile | 40 +++++++++++++++++++++++++++++-----------
28 1 file changed, 29 insertions(+), 11 deletions(-)
29
30diff --git a/Makefile b/Makefile
31index 0f4f810..942a7a5 100644
32--- a/Makefile
33+++ b/Makefile
34@@ -1,19 +1,37 @@
35 CC=gcc
36 FLAGS=-Wall -O2
37+
38+INSTALL=install
39+
40 EXEC_NAME=beep
41-INSTALL_DIR=/usr/bin
42 MAN_FILE=beep.1.gz
43-MAN_DIR=/usr/share/man/man1
44
45-default : beep
46+# Use GNU makefile conventions for directory names with one notable
47+# exception: prefix is not /usr/local in order to keep the default
48+# installation location for beep.
49+prefix=/usr
50+exec_prefix=$(prefix)
51+bindir=$(exec_prefix)/bin
52+datarootdir=$(prefix)/share
53+mandir=$(datarootdir)/man
54+man1dir=$(mandir)/man1
55+
56+.PHONY: all
57+all: $(EXEC_NAME)
58+
59+.PHONY: clean
60+clean:
61+ rm -f $(EXEC_NAME)
62
63-clean :
64- rm ${EXEC_NAME}
65+$(EXEC_NAME): beep.c
66+ $(CC) $(FLAGS) $(CFLAGS) -o $(EXEC_NAME) beep.c
67
68-beep : beep.c
69- ${CC} ${FLAGS} -o ${EXEC_NAME} beep.c
70+install: all
71+ $(INSTALL) -m 0755 -d $(DESTDIR)$(bindir)
72+ $(INSTALL) -m 0755 $(EXEC_NAME) $(DESTDIR)$(bindir)/
73+ $(INSTALL) -m 0755 -d $(DESTDIR)$(man1dir)
74+ $(INSTALL) -m 0644 $(MAN_FILE) $(DESTDIR)$(man1dir)/
75
76-install :
77- cp ${EXEC_NAME} ${INSTALL_DIR}
78- # rm -f /usr/man/man1/beep.1.bz2
79- cp ${MAN_FILE} ${MAN_DIR}
80+uninstall:
81+ rm -f $(DESTDIR)$(bindir)/$(EXEC_NAME)
82+ rm -f $(DESTDIR)$(man1dir)/$(MAN_FILE)
83--
842.7.5
85