]> git.sur5r.net Git - i3/i3/blob - Makefile
Merge branch 'next' into testcases
[i3/i3] / Makefile
1 TOPDIR=$(shell pwd)
2
3 include $(TOPDIR)/common.mk
4
5 # Depend on the object files of all source-files in src/*.c and on all header files
6 FILES=$(patsubst %.c,%.o,$(wildcard src/*.c))
7 HEADERS=$(wildcard include/*.h)
8
9 # Depend on the specific file (.c for each .o) and on all headers
10 src/%.o: src/%.c ${HEADERS}
11         echo "CC $<"
12         $(CC) $(CFLAGS) -c -o $@ $<
13
14 all: ${FILES}
15         echo "LINK i3"
16         $(CC) -o i3 ${FILES} $(LDFLAGS)
17         echo ""
18         echo "SUBDIR i3-msg"
19         $(MAKE) TOPDIR=$(TOPDIR) -C i3-msg
20
21 install: all
22         echo "INSTALL"
23         $(INSTALL) -d -m 0755 $(DESTDIR)/usr/bin
24         $(INSTALL) -d -m 0755 $(DESTDIR)/etc/i3
25         $(INSTALL) -d -m 0755 $(DESTDIR)/usr/share/xsessions
26         $(INSTALL) -m 0755 i3 $(DESTDIR)/usr/bin/
27         test -e $(DESTDIR)/etc/i3/config || $(INSTALL) -m 0644 i3.config $(DESTDIR)/etc/i3/config
28         $(INSTALL) -m 0644 i3.desktop $(DESTDIR)/usr/share/xsessions/
29         $(MAKE) TOPDIR=$(TOPDIR) -C i3-msg install
30
31 dist: distclean
32         [ ! -d i3-${VERSION} ] || rm -rf i3-${VERSION}
33         [ ! -e i3-${VERSION}.tar.bz2 ] || rm i3-${VERSION}.tar.bz2
34         mkdir i3-${VERSION}
35         cp DEPENDS GOALS LICENSE PACKAGE-MAINTAINER TODO RELEASE-NOTES-${VERSION} i3.config i3.desktop pseudo-doc.doxygen Makefile i3-${VERSION}
36         cp -r src i3-msg include man i3-${VERSION}
37         # Only copy toplevel documentation (important stuff)
38         mkdir i3-${VERSION}/docs
39         find docs -maxdepth 1 -type f ! -name "*.xcf" -exec cp '{}' i3-${VERSION}/docs \;
40         sed -e 's/^GIT_VERSION=\(.*\)/GIT_VERSION=${GIT_VERSION}/g;s/^VERSION=\(.*\)/VERSION=${VERSION}/g' common.mk > i3-${VERSION}/common.mk
41         # Pre-generate a manpage to allow distributors to skip this step and save some dependencies
42         make -C man
43         cp man/i3.1 i3-${VERSION}/man/i3.1
44         tar cf i3-${VERSION}.tar i3-${VERSION}
45         bzip2 -9 i3-${VERSION}.tar
46         rm -rf i3-${VERSION}
47
48 clean:
49         rm -f src/*.o
50         $(MAKE) -C docs clean
51         $(MAKE) -C man clean
52         $(MAKE) TOPDIR=$(TOPDIR) -C i3-msg clean
53
54 distclean: clean
55         rm -f i3
56         $(MAKE) TOPDIR=$(TOPDIR) -C i3-msg distclean