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))"
28 CPPFLAGS+=-D_GNU_SOURCE
33 ifeq ($(OS),GNU/kFreeBSD)
38 CFLAGS+=-I/usr/local/include/
39 LDFLAGS+=-L/usr/local/lib/
44 # This probably applies for any pkgsrc based system
45 ifneq (, $(filter $(OS), NetBSD DragonFly))
46 CFLAGS+=-I/usr/pkg/include/
47 LDFLAGS+=-L/usr/pkg/lib/
52 # Don’t print command lines which are run
56 CFLAGS+=$(EXTRA_CFLAGS)
58 # Fallback for libyajl 1 which did not include yajl_version.h. We need
59 # YAJL_MAJOR from that file to decide which code path should be used.
60 CFLAGS += -idirafter yajl-fallback
62 OBJS:=$(wildcard src/*.c *.c)
65 src/%.o: src/%.c include/i3status.h
66 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
70 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
76 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
83 rm -f i3status man/i3status.1
89 install -m 755 -d $(DESTDIR)$(PREFIX)/bin
90 install -m 755 -d $(DESTDIR)$(SYSCONFDIR)
91 install -m 755 -d $(DESTDIR)$(PREFIX)/share/man/man1
92 install -m 755 i3status $(DESTDIR)$(PREFIX)/bin/i3status
93 # Allow network configuration for getting the link speed
94 (which setcap && setcap cap_net_admin=ep $(DESTDIR)$(PREFIX)/bin/i3status) || true
95 install -m 644 i3status.conf $(DESTDIR)$(SYSCONFDIR)/i3status.conf
96 install -m 644 man/i3status.1 $(DESTDIR)$(PREFIX)/share/man/man1
99 [ -f i3status-${VERSION} ] || rm -rf i3status-${VERSION}
100 mkdir i3status-${VERSION}
101 find . -maxdepth 1 -type f \( -regex ".*\.\(c\|conf\|h\)" -or -name "Makefile" -or -name "LICENSE" -or -name "CHANGELOG" \) -exec cp '{}' i3status-${VERSION} \;
102 mkdir i3status-${VERSION}/src
103 mkdir i3status-${VERSION}/man
104 find src -maxdepth 1 -type f \( -regex ".*\.\(c\|h\)" \) -exec cp '{}' i3status-${VERSION}/src \;
105 find man -maxdepth 1 -type f \( -regex ".*\.\(1\|man\|conf\)" -or -name "Makefile" \) -exec cp '{}' i3status-${VERSION}/man \;
106 cp -r include i3status-${VERSION}
107 cp -r yajl-fallback i3status-${VERSION}
108 cp -r contrib i3status-${VERSION}
109 sed -e 's/^GIT_VERSION:=\(.*\)/GIT_VERSION=${GIT_VERSION}/g;s/^VERSION:=\(.*\)/VERSION=${VERSION}/g' Makefile > i3status-${VERSION}/Makefile
110 tar cjf i3status-${VERSION}.tar.bz2 i3status-${VERSION}
111 rm -rf i3status-${VERSION}