From ad27c973c1f55950b310d58832b16748541df450 Mon Sep 17 00:00:00 2001
From: Doug Torrance <dtorrance@monmouthcollege.edu>
Date: Sat, 3 Jan 2015 16:16:18 -0600
Subject: [PATCH] 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.
---
 wmtime/Makefile | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/wmtime/Makefile b/wmtime/Makefile
index 0b3ce5c..561c0f4 100755
--- a/wmtime/Makefile
+++ b/wmtime/Makefile
@@ -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)