wmtime: Update Makefile.

In particular,
- Remove reference to deprecated X11R6 directory.
- Honor PREFIX and INSTALL variables.
- Change definition of CFLAGS from += to =; perhaps users don't want to
  append -O2. Also move -Wall to CFLAGS.
- Use C*FLAGS only when compiling and LDFLAGS only when linking.
- Create directories if needed during install.
- Install manpage.
This commit is contained in:
Doug Torrance 2015-01-03 16:16:18 -06:00 committed by Carlos R. Mafra
parent 937d1d280a
commit ad27c973c1

View file

@ -1,19 +1,22 @@
LIBDIR = -L/usr/X11R6/lib
LIBS = -lXpm -lXext -lX11 -lm
OBJS = wmtime.o \
wmgeneral/wmgeneral.o \
wmgeneral/misc.o \
wmgeneral/list.o
XPMS = wmtime-master.xpm wmtime-mask.xbm
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man/man1
INSTALL = install
CC = gcc
CFLAGS += -O2
CFLAGS = -O2 -Wall
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -c -Wall $< -o $*.o
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $*.o
wmtime: $(OBJS) $(XPMS)
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o wmtime $(OBJS) $(LIBDIR) $(LIBS)
$(CC) $(LDFLAGS) -o wmtime $(OBJS) $(LIBS)
clean::
for i in $(OBJS) ; do \
@ -22,4 +25,7 @@ clean::
rm -f wmtime
install:: wmtime
install -m 755 wmtime $(DESTDIR)/usr/bin
$(INSTALL) -d $(DESTDIR)$(BINDIR)
$(INSTALL) wmtime $(DESTDIR)$(BINDIR)
$(INSTALL) -d $(DESTDIR)$(MANDIR)
$(INSTALL) -m 644 wmtime.1 $(DESTDIR)$(MANDIR)