]> git.sur5r.net Git - i3/i3status/blob - Makefile
Bugfix: Correctly check for interface up/down-status (Thanks docsteel)
[i3/i3status] / Makefile
1 CFLAGS+=-Wall -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare
2 CFLAGS+=-g
3 CFLAGS+=-std=gnu99
4 CFLAGS+=-pedantic
5 CFLAGS+=-DPREFIX=\"\"
6 CFLAGS+=-Iinclude
7 LDFLAGS+=-lconfuse
8
9 VERSION=$(shell git describe --tags --abbrev=0)
10
11 ifeq ($(shell uname),Linux)
12 CFLAGS+=-DLINUX
13 CFLAGS+=-D_GNU_SOURCE
14 LDFLAGS+=-liw -lasound
15 endif
16
17 ifeq ($(shell uname),GNU/kFreeBSD)
18 CFLAGS+=-lbsd
19 endif
20
21 # Define this if you want i3status to spit out dzen2-compatible output on stdout
22 #CFLAGS+=-DDZEN
23 CFLAGS+=$(EXTRA_CFLAGS)
24
25 OBJS:=$(wildcard src/*.c *.c)
26 OBJS:=$(OBJS:.c=.o)
27
28 src/%.o: src/%.c
29         @$(CC) $(CFLAGS) -c -o $@ $<
30         @echo " CC $<"
31
32 %.o: %.c %.h
33         @$(CC) $(CFLAGS) -c -o $@ $<
34         @echo " CC $<"
35
36 all: i3status manpage
37
38 i3status: ${OBJS}
39         @$(CC) -o $@ src/*.o *.o $(LDFLAGS)
40         @echo " LD $@"
41
42 clean:
43         rm -f *.o src/*.o
44
45 distclean: clean
46         rm -f i3status
47
48 manpage:
49         make -C man
50
51 install:
52         install -m 755 -d $(DESTDIR)/usr/bin
53         install -m 755 -d $(DESTDIR)/etc
54         install -m 755 -d $(DESTDIR)/usr/share/man/man1
55         install -m 755 i3status $(DESTDIR)/usr/bin/i3status
56         # Allow network configuration for getting the link speed
57         (which setcap && setcap cap_net_admin=ep $(DESTDIR)/usr/bin/i3status) || true
58         install -m 644 i3status.conf $(DESTDIR)/etc/i3status.conf
59         install -m 644 man/i3status.1 $(DESTDIR)/usr/share/man/man1
60
61 release:
62         [ -f i3status-${VERSION} ] || rm -rf i3status-${VERSION}
63         mkdir i3status-${VERSION}
64         find . -maxdepth 1 -type f \( -regex ".*\.\(c\|conf\|h\)" -or -name "Makefile" -or -name "LICENSE" \) -exec cp '{}' i3status-${VERSION} \;
65         mkdir i3status-${VERSION}/src
66         mkdir i3status-${VERSION}/man
67         find src -maxdepth 1 -type f \( -regex ".*\.\(c\|h\)" \) -exec cp '{}' i3status-${VERSION}/src \;
68         find man -maxdepth 1 -type f \( -regex ".*\.\(1\|man\|conf\)" -or -name "Makefile" \) -exec cp '{}' i3status-${VERSION}/man \;
69         tar cjf i3status-${VERSION}.tar.bz2 i3status-${VERSION}
70         rm -rf i3status-${VERSION}