5 GIT_VERSION=$(shell git describe --tags --always)
6 VERSION=$(shell git describe --tags --abbrev=0)
13 CFLAGS += -I/usr/local/include
14 CFLAGS += -DI3_VERSION=\"${GIT_VERSION}\"
18 LDFLAGS += -lxcb-keysyms
19 LDFLAGS += -lxcb-xinerama
21 LDFLAGS += -L/usr/local/lib -L/usr/pkg/lib
23 ifeq ($(UNAME),NetBSD)
24 # We need -idirafter instead of -I to prefer the system’s iconv over GNU libiconv
25 CFLAGS += -idirafter /usr/pkg/include
26 LDFLAGS += -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/pkg/lib
29 ifeq ($(UNAME),FreeBSD)
34 CFLAGS += -D_GNU_SOURCE
38 # Extended debugging flags, macros shall be available in gcc
45 # Don’t print command lines which are run
48 # Always remake the following targets
49 .PHONY: install clean dist distclean
51 # Depend on the object files of all source-files in src/*.c and on all header files
52 FILES=$(patsubst %.c,%.o,$(wildcard src/*.c))
53 HEADERS=$(wildcard include/*.h)
55 # Depend on the specific file (.c for each .o) and on all headers
56 src/%.o: src/%.c ${HEADERS}
58 $(CC) $(CFLAGS) -c -o $@ $<
62 $(CC) -o i3 ${FILES} $(LDFLAGS)
66 $(INSTALL) -d -m 0755 $(DESTDIR)/usr/bin
67 $(INSTALL) -d -m 0755 $(DESTDIR)/etc/i3
68 $(INSTALL) -m 0755 i3 $(DESTDIR)/usr/bin/
69 test -e $(DESTDIR)/etc/i3/config || $(INSTALL) -m 0644 i3.config $(DESTDIR)/etc/i3/config
72 [ ! -f i3-${VERSION} ] || rm -rf i3-${VERSION}
73 [ ! -e i3-${VERSION}.tar.bz2 ] || rm i3-${VERSION}.tar.bz2
75 cp DEPENDS GOALS LICENSE PACKAGE-MAINTAINER TODO i3.config i3-${VERSION}
76 cp -r src include docs man i3-${VERSION}
77 sed -e 's/^GIT_VERSION=\(.*\)/GIT_VERSION=${GIT_VERSION}/g;s/^VERSION=\(.*\)/VERSION=${VERSION}/g' Makefile > i3-${VERSION}/Makefile
78 tar cf i3-${VERSION}.tar i3-${VERSION}
79 bzip2 -9 i3-${VERSION}.tar