8 SYSCONFDIR=$(PREFIX)/etc
12 CFLAGS+=-Wall -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare
16 CPPFLAGS+=-DSYSCONFDIR=\"$(SYSCONFDIR)\"
17 CPPFLAGS+=-DVERSION=\"${GIT_VERSION}\"
22 VERSION:=$(shell git describe --tags --abbrev=0)
23 GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
25 ifeq ($(shell uname),Linux)
27 CPPFLAGS+=-D_GNU_SOURCE
32 ifeq ($(shell uname),GNU/kFreeBSD)
36 ifeq ($(shell uname),OpenBSD)
37 CFLAGS+=-I/usr/local/include/
38 LDFLAGS+=-L/usr/local/lib/
42 CFLAGS+=$(EXTRA_CFLAGS)
44 # Fallback for libyajl 1 which did not include yajl_version.h. We need
45 # YAJL_MAJOR from that file to decide which code path should be used.
46 CFLAGS += -idirafter yajl-fallback
48 OBJS:=$(wildcard src/*.c *.c)
52 @$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
56 @$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
62 @$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
69 rm -f i3status man/i3status.1
75 install -m 755 -d $(DESTDIR)$(PREFIX)/bin
76 install -m 755 -d $(DESTDIR)$(SYSCONFDIR)
77 install -m 755 -d $(DESTDIR)$(PREFIX)/share/man/man1
78 install -m 755 i3status $(DESTDIR)$(PREFIX)/bin/i3status
79 # Allow network configuration for getting the link speed
80 (which setcap && setcap cap_net_admin=ep $(DESTDIR)$(PREFIX)/bin/i3status) || true
81 install -m 644 i3status.conf $(DESTDIR)$(SYSCONFDIR)/i3status.conf
82 install -m 644 man/i3status.1 $(DESTDIR)$(PREFIX)/share/man/man1
85 [ -f i3status-${VERSION} ] || rm -rf i3status-${VERSION}
86 mkdir i3status-${VERSION}
87 find . -maxdepth 1 -type f \( -regex ".*\.\(c\|conf\|h\)" -or -name "Makefile" -or -name "LICENSE" -or -name "CHANGELOG" \) -exec cp '{}' i3status-${VERSION} \;
88 mkdir i3status-${VERSION}/src
89 mkdir i3status-${VERSION}/man
90 find src -maxdepth 1 -type f \( -regex ".*\.\(c\|h\)" \) -exec cp '{}' i3status-${VERSION}/src \;
91 find man -maxdepth 1 -type f \( -regex ".*\.\(1\|man\|conf\)" -or -name "Makefile" \) -exec cp '{}' i3status-${VERSION}/man \;
92 cp -r include i3status-${VERSION}
93 cp -r yajl-fallback i3status-${VERSION}
94 sed -e 's/^GIT_VERSION:=\(.*\)/GIT_VERSION=${GIT_VERSION}/g;s/^VERSION:=\(.*\)/VERSION=${VERSION}/g' Makefile > i3status-${VERSION}/Makefile
95 tar cjf i3status-${VERSION}.tar.bz2 i3status-${VERSION}
96 rm -rf i3status-${VERSION}