]> Pileus Git - wmpus/commitdiff
Update makefiles
authorAndy Spencer <andy753421@gmail.com>
Sun, 3 Jun 2012 06:57:08 +0000 (06:57 +0000)
committerAndy Spencer <andy753421@gmail.com>
Sun, 3 Jun 2012 07:53:48 +0000 (07:53 +0000)
config.mk.example
makefile

index 914a19d59923d718d97843d916d59baf982ceb57..df79c8619ed09a0dc7cf43cf61af777ab2e58100 100644 (file)
@@ -1,4 +1,6 @@
-wm-wmii.o: CFLAGS += -DDEBUG -DMODKEY=ctrl
+# Set default install and compile flags
+#PREFIX = /usr
+#CFLAGS = -Os
 
-test: $(PROG)
-       DISPLAY=:2.0 ./wmpus
+# Build in debugging and use a different modifier key
+#wm-wmii.o: CFLAGS += -DDEBUG -DMODKEY=ctrl
index f9ad109ee7f1f5bc8d4379a3d49e958b80b57f13..fb14b4d31a614e8d32e1eb60f934ff2a3726c532 100644 (file)
--- a/makefile
+++ b/makefile
@@ -1,27 +1,51 @@
-WM     ?= wmii
-SYS    ?= x11
-CFLAGS ?= -g -Wall -Werror
+# wmpus - cross platofrm window manager
+# See LICENSE file for copyright and license details.
+
+undefine CC
+
+-include config.mk
+
+VERSION   ?= 0.1
+WM        ?= wmii
+SYS       ?= x11
+CFLAGS    ?= -g -Wall
+PREFIX    ?= /usr/local
+MANPREFIX ?= ${PREFIX}/share/man
 
 ifeq ($(SYS),x11)
-CC      = gcc
-LIBS   += -lX11 -lXinerama
-PROG    = wmpus
+CC        ?= gcc
+PROG      ?= wmpus
+LDFLAGS   += -lX11 -lXinerama
 endif
 
 ifeq ($(SYS),win32)
-CC      = i686-pc-mingw32-gcc
-CFLAGS += -D_MODE_T_
-LIBS   += -lgdi32
-PROG    = wmpus.exe
+CC        ?= i686-pc-mingw32-gcc
+PROG      ?= wmpus.exe
+CFLAGS    += -D_MODE_T_
+LDFLAGS   += -lgdi32
 endif
 
-include config.mk
+all: $(PROG)
+
+clean:
+       rm -f wmpus *.exe *.o
+
+dist:
+       tar -czf wmpus-$(VERSION).tar.gz --transform s::wmpus-$(VERSION)/: \
+               README LICENSE config.mk.example makefile *.1 *.c *.h
+
+install: all
+       install -m 755 -D $(PROG) $(DESTDIR)$(PREFIX)/bin/$(PROG)
+       install -m 644 -D wmpus.1 $(DESTDIR)$(MANPREFIX)/man1/wmpus.1
+
+uninstall:
+       rm -f $(DESTDIR)$(PREFIX)/bin/$(PROG)
+       rm -f $(DESTDIR)$(MANPREFIX)/man1/wmpus.1
 
 $(PROG): main.o conf.o util.o sys-$(SYS).o wm-$(WM).o
-       $(CC) $(CFLAGS) -o $@ $+ $(LIBS)
+       $(CC) $(CFLAGS) -o $@ $+ $(LDFLAGS)
 
 %.o: %.c $(wildcard *.h) makefile
-       $(CC) --std=gnu99 $(CFLAGS) -c -o $@ $<
+       $(CC) $(CFLAGS) --std=gnu99 -c -o $@ $<
 
-clean:
-       rm -f wmpus *.exe *.o
+.PHONY: all clean dist install uninstall