]> Pileus Git - wmpus/blob - makefile
Support multiple windows
[wmpus] / makefile
1 # wmpus - cross platofrm window manager
2 # See LICENSE file for copyright and license details.
3
4 -include config.mk
5
6 # Common configuration
7 VERSION   ?= 0.1-rc1
8 WM        ?= wmii
9 SYS       ?= x11
10 CFLAGS    ?= -g -Wall
11 PREFIX    ?= /usr/local
12 MANPREFIX ?= ${PREFIX}/share/man
13
14 # System specific configuration
15 ifeq ($(SYS),xwl)
16 GCC       ?= gcc
17 PROG      ?= wmpus
18 LDFLAGS   += -lwayland-client -lwayland-server
19
20 PROTOCOL  ?= gtk-shell xdg-shell
21 HEADERS   += $(addsuffix -client-protocol.h,$(PROTOCOL))
22 HEADERS   += $(addsuffix -server-protocol.h,$(PROTOCOL))
23 OBJECTS   += $(addsuffix -protocol.o,$(PROTOCOL))
24
25 sys-xwl.o: CFLAGS  += $(shell pkg-config --cflags gtk+-3.0)
26 wmpus:     LDFLAGS += $(shell pkg-config --libs   gtk+-3.0)
27 endif
28
29 ifeq ($(SYS),wl)
30 GCC       ?= gcc
31 PROG      ?= wmpus
32 LDFLAGS   += -lwayland-client -lwayland-server
33 endif
34
35 ifeq ($(SYS),swc)
36 GCC       ?= gcc
37 PROG      ?= wmpus
38 LDFLAGS   += -lswc -lwayland-client -lwayland-server
39 endif
40
41 ifeq ($(SYS),x11)
42 GCC       ?= gcc
43 PROG      ?= wmpus
44 LDFLAGS   += -lX11 -lXinerama
45 endif
46
47 ifeq ($(SYS),win32)
48 GCC       ?= i486-mingw32-gcc
49 PROG      ?= wmpus.exe
50 LDFLAGS   += -lgdi32
51 endif
52
53 # Targets
54 all: $(HEADERS) $(PROG)
55
56 clean:
57         rm -f wmpus *.exe *.o *-protocol.[ch]
58
59 dist:
60         tar -czf wmpus-$(VERSION).tar.gz --transform s::wmpus-$(VERSION)/: \
61                 README LICENSE config.mk.example makefile *.1 *.c *.h
62
63 install: all
64         sed -i 's:/usr.*:$(PREFIX)/bin/wmpus:' wmpus.session
65         install -m 755 -D $(PROG) $(DESTDIR)$(PREFIX)/bin/$(PROG)
66         install -m 644 -D wmpus.1 $(DESTDIR)$(MANPREFIX)/man1/wmpus.1
67         install -m 755 -D wmpus.session $(DESTDIR)/etc/X11/Sessions/wmpus
68         install -m 644 -D wmpus.desktop $(DESTDIR)$(PREFIX)/share/xsessions/wmpus.desktop
69
70 uninstall:
71         rm -f $(DESTDIR)$(PREFIX)/bin/$(PROG)
72         rm -f $(DESTDIR)$(MANPREFIX)/man1/wmpus.1
73
74 # Common Rules
75 $(PROG): main.o conf.o util.o sys-$(SYS).o wm-$(WM).o $(OBJECTS)
76         $(GCC) $(CFLAGS) -o $@ $+ $(LDFLAGS)
77
78 %.o: %.c $(wildcard *.h) makefile
79         $(GCC) $(CFLAGS) --std=gnu99 -c -o $@ $<
80
81 # Wayland Rules
82 %-protocol.c: %.xml
83         wayland-scanner code < $+ > $@
84
85 %-server-protocol.h: %.xml
86         wayland-scanner server-header < $+ > $@
87
88 %-client-protocol.h: %.xml
89         wayland-scanner client-header < $+ > $@
90
91 .PHONY: all clean dist install uninstall