wmbutton: Makefile install rewritten

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

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

This patch solves these problems.
This commit is contained in:
Rodolfo García Peñas (kix) 2012-08-22 19:33:45 +02:00 committed by Carlos R. Mafra
parent 79857511c5
commit caae33b0f0

View file

@ -4,23 +4,21 @@ LIBS = -lX11 -lXpm -lXext
TARGET = wmbutton TARGET = wmbutton
OBJECTS = wmbutton.o wmb_libs.o OBJECTS = wmbutton.o wmb_libs.o
DESTDIR = DESTDIR = /usr/local
PREFIX = /usr/local PREFIX = /usr
BINDIR = ${PREFIX}/bin BINDIR = /bin
MANDIR = ${PREFIX}/share/man
CONF = /etc CONF = /etc
CONFFL = ${CONF}/wmbutton.conf CONFFL = ${CONF}/wmbutton.conf
INSTALL = /usr/bin/install 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 CFLAGS += -Wall -O2
LDFLAGS +=
.c.o: .c.o:
gcc -c ${CFLAGS} ${INCLUDES} $< -o $*.o gcc -c ${CFLAGS} ${INCLUDES} $< -o $*.o
${TARGET}: ${OBJECTS} ${TARGET}: ${OBJECTS}
gcc -o ${TARGET} ${OBJECTS} ${LIBINC} ${LIBS} gcc -o ${TARGET} ${OBJECTS} ${LDFLAGS} ${LIBINC} ${LIBS}
clean:: clean::
for i in ${OBJECTS}; do if [ -e $$i ] ; then rm $$i; fi; done 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 if [ -e core ]; then rm core; fi
install:: install::
${INSTALL_PROGRAM} wmbutton ${DESTDIR}${BINDIR} $(INSTALL) -d -m 0755 ${DESTDIR}${PREFIX}${BINDIR} ${DESTDIR}${CONF}
${INSTALL_FILE} sample.wmbutton ${DESTDIR}${CONFFL} $(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 wmbutton.o: wmbutton.c wmbutton.h Makefile