11 SYSCONFDIR=$(PREFIX)/etc
15 CFLAGS+=-Wall -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare
19 CPPFLAGS+=-DSYSCONFDIR=\"$(SYSCONFDIR)\"
20 CPPFLAGS+=-DVERSION=\"${GIT_VERSION}\"
27 VERSION:=$(shell git describe --tags --abbrev=0)
28 GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
33 CPPFLAGS+=-D_GNU_SOURCE
34 CFLAGS += $(shell pkg-config --cflags libnl-genl-3.0)
35 LIBS += $(shell pkg-config --libs libnl-genl-3.0)
39 ifeq ($(OS),GNU/kFreeBSD)
43 ifneq (, $(filter $(OS), DragonFly FreeBSD OpenBSD))
44 CFLAGS+=-I/usr/local/include/
45 LDFLAGS+=-L/usr/local/lib/
52 # This probably applies for any pkgsrc based system
53 ifneq (, $(filter $(OS), NetBSD DragonFly))
54 CFLAGS+=-I/usr/pkg/include/
55 LDFLAGS+=-L/usr/pkg/lib/
60 # Don’t print command lines which are run
64 CFLAGS+=$(EXTRA_CFLAGS)
66 # Fallback for libyajl 1 which did not include yajl_version.h. We need
67 # YAJL_MAJOR from that file to decide which code path should be used.
68 CFLAGS += -idirafter yajl-fallback
70 OBJS:=$(wildcard src/*.c *.c)
74 OBJS:=$(filter-out src/pulse.o, $(OBJS))
75 LIBS:=$(filter-out -lpulse, $(LIBS)) -lpthread
78 src/%.o: src/%.c include/i3status.h
79 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
83 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
89 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
96 rm -f i3status man/i3status.1
102 install -m 755 -d $(DESTDIR)$(PREFIX)/bin
103 install -m 755 -d $(DESTDIR)$(SYSCONFDIR)
104 install -m 755 -d $(DESTDIR)$(MANPREFIX)/share/man/man1
105 install -m 755 i3status $(DESTDIR)$(PREFIX)/bin/i3status
106 # Allow network configuration for getting the link speed
107 (which setcap && setcap cap_net_admin=ep $(DESTDIR)$(PREFIX)/bin/i3status) || true
108 install -m 644 i3status.conf $(DESTDIR)$(SYSCONFDIR)/i3status.conf
109 install -m 644 man/i3status.1 $(DESTDIR)$(MANPREFIX)/share/man/man1
112 [ -f i3status-${VERSION} ] || rm -rf i3status-${VERSION}
113 mkdir i3status-${VERSION}
114 find . -maxdepth 1 -type f \( -regex ".*\.\(c\|conf\|h\)" -or -name "README" -or -name "Makefile" -or -name "LICENSE" -or -name "CHANGELOG" \) -exec cp '{}' i3status-${VERSION} \;
115 mkdir i3status-${VERSION}/src
116 mkdir i3status-${VERSION}/man
117 find src -maxdepth 1 -type f \( -regex ".*\.\(c\|h\)" \) -exec cp '{}' i3status-${VERSION}/src \;
118 find man -maxdepth 1 -type f \( -regex ".*\.\(1\|man\|conf\)" -or -name "Makefile" \) -exec cp '{}' i3status-${VERSION}/man \;
119 cp -r include i3status-${VERSION}
120 cp -r yajl-fallback i3status-${VERSION}
121 cp -r contrib i3status-${VERSION}
122 sed -e 's/^GIT_VERSION:=\(.*\)/GIT_VERSION=${GIT_VERSION}/g;s/^VERSION:=\(.*\)/VERSION=${VERSION}/g' Makefile > i3status-${VERSION}/Makefile
123 tar cjf i3status-${VERSION}.tar.bz2 i3status-${VERSION}
124 rm -rf i3status-${VERSION}