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)
106 rm -f i3status man/i3status.1
112 install -m 755 -d $(DESTDIR)$(PREFIX)/bin
113 install -m 755 -d $(DESTDIR)$(SYSCONFDIR)
114 install -m 755 -d $(DESTDIR)$(MANPREFIX)/share/man/man1
115 install -m 755 i3status $(DESTDIR)$(PREFIX)/bin/i3status
116 # Allow network configuration for getting the link speed
117 (which setcap && setcap cap_net_admin=ep $(DESTDIR)$(PREFIX)/bin/i3status) || true
118 install -m 644 i3status.conf $(DESTDIR)$(SYSCONFDIR)/i3status.conf
119 install -m 644 man/i3status.1 $(DESTDIR)$(MANPREFIX)/share/man/man1
122 [ -f i3status-${VERSION} ] || rm -rf i3status-${VERSION}
123 mkdir i3status-${VERSION}
124 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} \;
125 mkdir i3status-${VERSION}/src
126 mkdir i3status-${VERSION}/man
127 find src -maxdepth 1 -type f \( -regex ".*\.\(c\|h\)" \) -exec cp '{}' i3status-${VERSION}/src \;
128 find man -maxdepth 1 -type f \( -regex ".*\.\(1\|man\|conf\)" -or -name "Makefile" \) -exec cp '{}' i3status-${VERSION}/man \;
129 cp -r include i3status-${VERSION}
130 cp -r yajl-fallback i3status-${VERSION}
131 cp -r contrib i3status-${VERSION}
132 echo ${I3STATUS_VERSION} > i3status-${VERSION}/I3STATUS_VERSION
133 tar cjf i3status-${VERSION}.tar.bz2 i3status-${VERSION}
134 rm -rf i3status-${VERSION}