]> git.sur5r.net Git - i3/i3status/blob - Makefile
document the path option in sample config
[i3/i3status] / Makefile
1 ifndef PREFIX
2   PREFIX=/usr
3 endif
4 ifndef SYSCONFDIR
5   ifeq ($(PREFIX),/usr)
6     SYSCONFDIR=/etc
7   else
8     SYSCONFDIR=$(PREFIX)/etc
9   endif
10 endif
11
12 CFLAGS+=-Wall -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare
13 CFLAGS+=-g
14 CFLAGS+=-std=gnu99
15 CFLAGS+=-pedantic
16 CFLAGS+=-DSYSCONFDIR=\"$(SYSCONFDIR)\"
17 CFLAGS+=-DVERSION=\"${GIT_VERSION}\"
18 CFLAGS+=-Iinclude
19 LDFLAGS+=-lconfuse
20
21 VERSION:=$(shell git describe --tags --abbrev=0)
22 GIT_VERSION:="$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1))"
23
24 ifeq ($(shell uname),Linux)
25 CFLAGS+=-DLINUX
26 CFLAGS+=-D_GNU_SOURCE
27 LDFLAGS+=-liw -lasound
28 endif
29
30 ifeq ($(shell uname),GNU/kFreeBSD)
31 CFLAGS+=-lbsd
32 endif
33
34 CFLAGS+=$(EXTRA_CFLAGS)
35
36 OBJS:=$(wildcard src/*.c *.c)
37 OBJS:=$(OBJS:.c=.o)
38
39 src/%.o: src/%.c
40         @$(CC) $(CFLAGS) -c -o $@ $<
41         @echo " CC $<"
42
43 %.o: %.c %.h
44         @$(CC) $(CFLAGS) -c -o $@ $<
45         @echo " CC $<"
46
47 all: i3status manpage
48
49 i3status: ${OBJS}
50         @$(CC) -o $@ src/*.o *.o $(LDFLAGS)
51         @echo " LD $@"
52
53 clean:
54         rm -f *.o src/*.o
55
56 distclean: clean
57         rm -f i3status
58
59 manpage:
60         make -C man
61
62 install:
63         install -m 755 -d $(DESTDIR)/usr/bin
64         install -m 755 -d $(DESTDIR)/etc
65         install -m 755 -d $(DESTDIR)/usr/share/man/man1
66         install -m 755 i3status $(DESTDIR)/usr/bin/i3status
67         # Allow network configuration for getting the link speed
68         (which setcap && setcap cap_net_admin=ep $(DESTDIR)/usr/bin/i3status) || true
69         install -m 644 i3status.conf $(DESTDIR)/etc/i3status.conf
70         install -m 644 man/i3status.1 $(DESTDIR)/usr/share/man/man1
71
72 release:
73         [ -f i3status-${VERSION} ] || rm -rf i3status-${VERSION}
74         mkdir i3status-${VERSION}
75         find . -maxdepth 1 -type f \( -regex ".*\.\(c\|conf\|h\)" -or -name "Makefile" -or -name "LICENSE" \) -exec cp '{}' i3status-${VERSION} \;
76         mkdir i3status-${VERSION}/src
77         mkdir i3status-${VERSION}/man
78         find src -maxdepth 1 -type f \( -regex ".*\.\(c\|h\)" \) -exec cp '{}' i3status-${VERSION}/src \;
79         find man -maxdepth 1 -type f \( -regex ".*\.\(1\|man\|conf\)" -or -name "Makefile" \) -exec cp '{}' i3status-${VERSION}/man \;
80         cp -r include i3status-${VERSION}
81         sed -e 's/^GIT_VERSION:=\(.*\)/GIT_VERSION=${GIT_VERSION}/g;s/^VERSION:=\(.*\)/VERSION=${VERSION}/g' Makefile > i3status-${VERSION}/Makefile
82         tar cjf i3status-${VERSION}.tar.bz2 i3status-${VERSION}
83         rm -rf i3status-${VERSION}