Description: Rework the Makefile for better configurability.
 - separate warning, debugging, optimization, and strip flags;
 - implement PREFIX and X11BASE properly;
 - turn on lots and lots of warnings;
 - do not build a useless tags file;
 - honor DESTDIR.
 .
 This patch has been forwarded to Meik Tessmer via private e-mail;
 he responded that he will probably integrate it into a new release.
Forwarded: yes
Author: Peter Pentchev <roam@ringlet.net>
Last-Update: 2009-09-08

diff -urNad wmanager-0.2.1~/Makefile wmanager-0.2.1/Makefile
--- wmanager-0.2.1~/Makefile	2008-07-02 17:21:39.000000000 +0300
+++ wmanager-0.2.1/Makefile	2008-07-02 17:22:08.000000000 +0300
@@ -28,39 +28,39 @@
 # make settings
 SHELL     = /bin/sh
 MAKEFLAGS = --print-directory
+PREFIX    ?= /usr
+X11BASE   ?= /usr
 
+# base settings
+bindir	= $(PREFIX)/bin
+incdir	= ./inc
+srcdir	= ./src
+fltkinc	= $(X11BASE)/include
+x11lib	= $(X11BASE)/lib
 
 # compiler settings
-CXX       = g++ 
-CXXFLAGS  = -I$(incdir) -O2 -Wall -pedantic #-DDEBUG=1 -g3
-
+CXX		?= g++
+CXXFLAGS_WARN	?= -Wall -W
+CXXFLAGS_OPT	?= -O2 -fno-strict-aliasing -pipe
+#CXXFLAGS_DBG	?= -g -DDEBUG
+CXXFLAGS_DBG	?=
+CXXFLAGS	?= ${CXXFLAGS_DBG} ${CXXFLAGS_OPT}
+CXXFLAGS	+= ${CXXFLAGS_WARN} -I${fltkinc} -I${incdir}
 
 # linker settings
-LD        = g++
-LDFLAGS   = -lfltk -lXext -lX11 -lm
-LDDIRS    = -L/usr/X11R6/lib -L/usr/lib -L/usr/local/lib
-
+LD        = $(CXX)
+LDFLAGS   ?= -lGL -lfltk -lXext -lX11 -lm 
+LDDIRS    = -L$(x11lib)
 
 # install settings
-INSTALL       = /usr/bin/install
-INSTALL_FLAGS = --strip
+INSTALL       ?= install
+STRIP         ?= -s
 
 
 # documentation tool
 DOCTOOL      = perceps
 DOCTOOL_FLAGS = -a -b -f -h -m -r
 
-# base locations
-prefix      = /usr/local
-exec_prefix = $(prefix)
-bindir      = $(exec_prefix)/bin
-
-
-# include files and sources
-incdir      = ./inc
-srcdir      = ./src
-
-
 # documentational files for developer
 docdir    = ./doc
 templates = $(docdir)/templates
@@ -82,8 +82,7 @@
 # project version
 VERSION = 0.1.1
 
-
-all: wmanager TAGS
+all: wmanager
 
 wmanager: $(OBJ)
 	$(LD) -o $@ $^ $(LDDIRS) $(LDFLAGS) 
@@ -92,7 +91,7 @@
 	$(LD) -o wmanager $^ $(LDDIRS) $(LDFLAGS) -static
 
 install: wmanager
-	$(INSTALL) $< $(bindir)/$<
+	$(INSTALL) $(STRIP) $< ${DESTDIR}$(bindir)/$<
 
 clean:
 	@rm -f $(OBJ) wmanager
