>From 5e7e3d196d90b2587e29cee57b904f915e1135e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <k...@kix.es>
Date: Wed, 22 Aug 2012 19:33:45 +0200
Subject: [PATCH 1/2] wmbutton: Makefile install rewrited

The current Makefile script don't work properly, because the path
for /etc don't uses DESTDIR and the installation path for $(DESTDIR)/usr/bin
is not created before install the binary file in the folder.

LDFLAGS are needed in some distros to build the package, for example Debian.

This patch solves these problems.
---
 wmbutton/Makefile |   17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/wmbutton/Makefile b/wmbutton/Makefile
index 8dbd22d..1ac7298 100644
--- a/wmbutton/Makefile
+++ b/wmbutton/Makefile
@@ -4,23 +4,21 @@ LIBS = -lX11 -lXpm -lXext
 
 TARGET = wmbutton
 OBJECTS = wmbutton.o wmb_libs.o
-DESTDIR =
-PREFIX = /usr/local
-BINDIR = ${PREFIX}/bin
-MANDIR = ${PREFIX}/share/man
+DESTDIR = /usr/local
+PREFIX = /usr
+BINDIR = /bin
 CONF   = /etc
 CONFFL = ${CONF}/wmbutton.conf
 INSTALL = /usr/bin/install
-INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755
-INSTALL_FILE    = $(INSTALL) -p -o root -g root -m 644
 
 CFLAGS += -Wall -O2
+LDFLAGS +=
 
 .c.o:
        gcc -c ${CFLAGS} ${INCLUDES} $< -o $*.o
 
 ${TARGET}: ${OBJECTS}
-       gcc -o ${TARGET} ${OBJECTS} ${LIBINC} ${LIBS}
+       gcc -o ${TARGET} ${OBJECTS}  ${LDFLAGS} ${LIBINC} ${LIBS}
 
 clean::
        for i in ${OBJECTS}; do if [ -e $$i ] ; then rm $$i; fi; done 
@@ -29,8 +27,9 @@ clean::
        if [ -e core ]; then rm core; fi
 
 install::
-       ${INSTALL_PROGRAM} wmbutton ${DESTDIR}${BINDIR}
-       ${INSTALL_FILE} sample.wmbutton ${DESTDIR}${CONFFL}
+       $(INSTALL) -d -m 0755 ${DESTDIR}${PREFIX}${BINDIR} ${DESTDIR}${CONF}
+       $(INSTALL) -p -o root -g root -m 755 wmbutton 
${DESTDIR}${PREFIX}${BINDIR}
+       $(INSTALL) -p -o root -g root -m 644 sample.wmbutton ${DESTDIR}${CONFFL}
 
 wmbutton.o: wmbutton.c wmbutton.h Makefile
 
-- 
1.7.10.4

-- 
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/
>From 5e7e3d196d90b2587e29cee57b904f915e1135e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <k...@kix.es>
Date: Wed, 22 Aug 2012 19:33:45 +0200
Subject: [PATCH 1/2] wmbutton: Makefile install rewrited

The current Makefile script don't work properly, because the path
for /etc don't uses DESTDIR and the installation path for $(DESTDIR)/usr/bin
is not created before install the binary file in the folder.

LDFLAGS are needed in some distros to build the package, for example Debian.

This patch solves these problems.
---
 wmbutton/Makefile |   17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/wmbutton/Makefile b/wmbutton/Makefile
index 8dbd22d..1ac7298 100644
--- a/wmbutton/Makefile
+++ b/wmbutton/Makefile
@@ -4,23 +4,21 @@ LIBS = -lX11 -lXpm -lXext
 
 TARGET = wmbutton
 OBJECTS = wmbutton.o wmb_libs.o
-DESTDIR =
-PREFIX = /usr/local
-BINDIR = ${PREFIX}/bin
-MANDIR = ${PREFIX}/share/man
+DESTDIR = /usr/local
+PREFIX = /usr
+BINDIR = /bin
 CONF   = /etc
 CONFFL = ${CONF}/wmbutton.conf
 INSTALL = /usr/bin/install
-INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755
-INSTALL_FILE    = $(INSTALL) -p -o root -g root -m 644
 
 CFLAGS += -Wall -O2
+LDFLAGS +=
 
 .c.o:
 	gcc -c ${CFLAGS} ${INCLUDES} $< -o $*.o
 
 ${TARGET}: ${OBJECTS}
-	gcc -o ${TARGET} ${OBJECTS} ${LIBINC} ${LIBS}
+	gcc -o ${TARGET} ${OBJECTS}  ${LDFLAGS} ${LIBINC} ${LIBS}
 
 clean::
 	for i in ${OBJECTS}; do if [ -e $$i ] ; then rm $$i; fi; done 
@@ -29,8 +27,9 @@ clean::
 	if [ -e core ]; then rm core; fi
 
 install::
-	${INSTALL_PROGRAM} wmbutton ${DESTDIR}${BINDIR}
-	${INSTALL_FILE} sample.wmbutton ${DESTDIR}${CONFFL}
+	$(INSTALL) -d -m 0755 ${DESTDIR}${PREFIX}${BINDIR} ${DESTDIR}${CONF}
+	$(INSTALL) -p -o root -g root -m 755 wmbutton ${DESTDIR}${PREFIX}${BINDIR}
+	$(INSTALL) -p -o root -g root -m 644 sample.wmbutton ${DESTDIR}${CONFFL}
 
 wmbutton.o: wmbutton.c wmbutton.h Makefile
 
-- 
1.7.10.4

Reply via email to