13 SYSCONFDIR=$(PREFIX)/etc
17 CFLAGS+=-Wall -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare
21 CPPFLAGS+=-DSYSCONFDIR=\"$(SYSCONFDIR)\"
22 CPPFLAGS+=-DVERSION=\"${I3STATUS_VERSION}\"
30 ifeq ($(wildcard .git),)
31 # not in git repository
32 VERSION := $(shell [ -f $(TOPDIR)/I3STATUS_VERSION ] && cat $(TOPDIR)/I3STATUS_VERSION | cut -d '-' -f 1)
33 I3STATUS_VERSION := '$(shell [ -f $(TOPDIR)/I3STATUS_VERSION ] && cat $(TOPDIR)/I3STATUS_VERSION)'
35 VERSION:=$(shell git describe --tags --abbrev=0)
36 I3STATUS_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
42 CPPFLAGS+=-D_GNU_SOURCE
43 CFLAGS += $(shell pkg-config --cflags libnl-genl-3.0)
44 LIBS += $(shell pkg-config --libs libnl-genl-3.0)
48 ifeq ($(OS),GNU/kFreeBSD)
52 ifneq (, $(filter $(OS), DragonFly FreeBSD OpenBSD))
53 CFLAGS+=-I/usr/local/include/
54 LDFLAGS+=-L/usr/local/lib/
61 # This probably applies for any pkgsrc based system
62 ifneq (, $(filter $(OS), NetBSD DragonFly))
63 CFLAGS+=-I/usr/pkg/include/
64 LDFLAGS+=-L/usr/pkg/lib/
69 # Don’t print command lines which are run
73 CFLAGS+=$(EXTRA_CFLAGS)
75 # Fallback for libyajl 1 which did not include yajl_version.h. We need
76 # YAJL_MAJOR from that file to decide which code path should be used.
77 CFLAGS += -idirafter yajl-fallback
79 OBJS:=$(sort $(wildcard src/*.c *.c))
83 OBJS:=$(filter-out src/pulse.o, $(OBJS))
84 LIBS:=$(filter-out -lpulse, $(LIBS))
87 src/%.o: src/%.c include/i3status.h
88 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
92 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
98 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
105 rm -f i3status man/i3status.1
111 install -m 755 -d $(DESTDIR)$(PREFIX)/bin
112 install -m 755 -d $(DESTDIR)$(SYSCONFDIR)
113 install -m 755 -d $(DESTDIR)$(MANPREFIX)/share/man/man1
114 install -m 755 i3status $(DESTDIR)$(PREFIX)/bin/i3status
115 # Allow network configuration for getting the link speed
116 (which setcap && setcap cap_net_admin=ep $(DESTDIR)$(PREFIX)/bin/i3status) || true
117 install -m 644 i3status.conf $(DESTDIR)$(SYSCONFDIR)/i3status.conf
118 install -m 644 man/i3status.1 $(DESTDIR)$(MANPREFIX)/share/man/man1
121 [ -f i3status-${VERSION} ] || rm -rf i3status-${VERSION}
122 mkdir i3status-${VERSION}
123 find . -maxdepth 1 -type f \( -regex ".*\.\(c\|conf\|h\)" -or -name "README.md" -or -name "Makefile" -or -name "LICENSE" -or -name "CHANGELOG" \) -exec cp '{}' i3status-${VERSION} \;
124 mkdir i3status-${VERSION}/src
125 mkdir i3status-${VERSION}/man
126 find src -maxdepth 1 -type f \( -regex ".*\.\(c\|h\)" \) -exec cp '{}' i3status-${VERSION}/src \;
127 find man -maxdepth 1 -type f \( -regex ".*\.\(1\|man\|conf\)" -or -name "Makefile" \) -exec cp '{}' i3status-${VERSION}/man \;
128 cp -r include i3status-${VERSION}
129 cp -r yajl-fallback i3status-${VERSION}
130 cp -r contrib i3status-${VERSION}
131 echo ${I3STATUS_VERSION} > i3status-${VERSION}/I3STATUS_VERSION
132 tar cjf i3status-${VERSION}.tar.bz2 i3status-${VERSION}
133 rm -rf i3status-${VERSION}