13 SYSCONFDIR=$(PREFIX)/etc
17 PKG_CONFIG ?= pkg-config
18 CFLAGS+=-Wall -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare
22 CPPFLAGS+=-DSYSCONFDIR=\"$(SYSCONFDIR)\"
23 CPPFLAGS+=-DVERSION=\"${I3STATUS_VERSION}\"
31 ifeq ($(wildcard .git),)
32 # not in git repository
33 VERSION := $(shell [ -f $(TOPDIR)/I3STATUS_VERSION ] && cat $(TOPDIR)/I3STATUS_VERSION | cut -d '-' -f 1)
34 I3STATUS_VERSION := '$(shell [ -f $(TOPDIR)/I3STATUS_VERSION ] && cat $(TOPDIR)/I3STATUS_VERSION)'
36 VERSION:=$(shell git describe --tags --abbrev=0)
37 I3STATUS_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
43 CPPFLAGS+=-D_GNU_SOURCE
44 CFLAGS += $(shell $(PKG_CONFIG) --cflags libnl-genl-3.0)
45 LIBS += $(shell $(PKG_CONFIG) --libs libnl-genl-3.0)
49 ifeq ($(OS),GNU/kFreeBSD)
53 ifneq (, $(filter $(OS), DragonFly FreeBSD OpenBSD))
54 CFLAGS+=-I/usr/local/include/
55 LDFLAGS+=-L/usr/local/lib/
62 # This probably applies for any pkgsrc based system
63 ifneq (, $(filter $(OS), NetBSD DragonFly))
64 CFLAGS+=-I/usr/pkg/include/
65 LDFLAGS+=-L/usr/pkg/lib/
70 # Don’t print command lines which are run
74 CFLAGS+=$(EXTRA_CFLAGS)
76 # Fallback for libyajl 1 which did not include yajl_version.h. We need
77 # YAJL_MAJOR from that file to decide which code path should be used.
78 CFLAGS += -idirafter yajl-fallback
80 OBJS:=$(sort $(wildcard src/*.c *.c))
84 OBJS:=$(filter-out src/pulse.o, $(OBJS))
85 LIBS:=$(filter-out -lpulse, $(LIBS))
88 src/%.o: src/%.c include/i3status.h
89 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
93 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
99 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
103 LC_ALL=C ./travis/run-tests.pl
109 rm -f i3status man/i3status.1
115 install -m 755 -d $(DESTDIR)$(PREFIX)/bin
116 install -m 755 -d $(DESTDIR)$(SYSCONFDIR)
117 install -m 755 -d $(DESTDIR)$(MANPREFIX)/share/man/man1
118 install -m 755 i3status $(DESTDIR)$(PREFIX)/bin/i3status
119 # Allow network configuration for getting the link speed
120 (which setcap && setcap cap_net_admin=ep $(DESTDIR)$(PREFIX)/bin/i3status) || true
121 install -m 644 i3status.conf $(DESTDIR)$(SYSCONFDIR)/i3status.conf
122 install -m 644 man/i3status.1 $(DESTDIR)$(MANPREFIX)/share/man/man1
125 [ -f i3status-${VERSION} ] || rm -rf i3status-${VERSION}
126 mkdir i3status-${VERSION}
127 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} \;
128 mkdir i3status-${VERSION}/src
129 mkdir i3status-${VERSION}/man
130 find src -maxdepth 1 -type f \( -regex ".*\.\(c\|h\)" \) -exec cp '{}' i3status-${VERSION}/src \;
131 find man -maxdepth 1 -type f \( -regex ".*\.\(1\|man\|conf\)" -or -name "Makefile" \) -exec cp '{}' i3status-${VERSION}/man \;
132 cp -r include i3status-${VERSION}
133 cp -r yajl-fallback i3status-${VERSION}
134 cp -r contrib i3status-${VERSION}
135 echo ${I3STATUS_VERSION} > i3status-${VERSION}/I3STATUS_VERSION
136 tar cjf i3status-${VERSION}.tar.bz2 i3status-${VERSION}
137 rm -rf i3status-${VERSION}