3 include $(TOPDIR)/common.mk
5 # Depend on the object files of all source-files in src/*.c and on all header files
6 AUTOGENERATED:=src/cfgparse.tab.c src/cfgparse.yy.c
7 FILES:=$(filter-out $(AUTOGENERATED),$(wildcard src/*.c))
9 HEADERS=$(wildcard include/*.h)
11 # Depend on the specific file (.c for each .o) and on all headers
12 src/%.o: src/%.c ${HEADERS}
14 $(CC) $(CFLAGS) -c -o $@ $<
16 all: src/cfgparse.y.o src/cfgparse.yy.o ${FILES}
18 $(CC) -o i3 ${FILES} src/cfgparse.y.o src/cfgparse.yy.o $(LDFLAGS)
21 $(MAKE) TOPDIR=$(TOPDIR) -C i3-msg
22 echo "SUBDIR i3-input"
23 $(MAKE) TOPDIR=$(TOPDIR) -C i3-input
25 src/cfgparse.yy.o: src/cfgparse.l
27 flex -i -o$(@:.o=.c) $<
28 $(CC) $(CFLAGS) -c -o $@ $(@:.o=.c)
30 src/cfgparse.y.o: src/cfgparse.y
32 bison --debug --verbose -b $(basename $< .y) -d $<
33 $(CC) $(CFLAGS) -c -o $@ $(<:.y=.tab.c)
37 $(INSTALL) -d -m 0755 $(DESTDIR)/usr/bin
38 $(INSTALL) -d -m 0755 $(DESTDIR)/etc/i3
39 $(INSTALL) -d -m 0755 $(DESTDIR)/usr/share/xsessions
40 $(INSTALL) -m 0755 i3 $(DESTDIR)/usr/bin/
41 test -e $(DESTDIR)/etc/i3/config || $(INSTALL) -m 0644 i3.config $(DESTDIR)/etc/i3/config
42 $(INSTALL) -m 0644 i3.welcome $(DESTDIR)/etc/i3/welcome
43 $(INSTALL) -m 0644 i3.desktop $(DESTDIR)/usr/share/xsessions/
44 $(MAKE) TOPDIR=$(TOPDIR) -C i3-msg install
45 $(MAKE) TOPDIR=$(TOPDIR) -C i3-input install
48 [ ! -d i3-${VERSION} ] || rm -rf i3-${VERSION}
49 [ ! -e i3-${VERSION}.tar.bz2 ] || rm i3-${VERSION}.tar.bz2
51 cp DEPENDS GOALS LICENSE PACKAGE-MAINTAINER TODO RELEASE-NOTES-${VERSION} i3.config i3.desktop i3.welcome pseudo-doc.doxygen Makefile i3-${VERSION}
52 cp -r src i3-msg include man i3-${VERSION}
53 # Only copy toplevel documentation (important stuff)
54 mkdir i3-${VERSION}/docs
55 find docs -maxdepth 1 -type f ! -name "*.xcf" -exec cp '{}' i3-${VERSION}/docs \;
56 # Only copy source code from i3-input
57 mkdir i3-${VERSION}/i3-input
58 find i3-input -maxdepth 1 -type f \( -name "*.c" -or -name "*.h" -or -name "Makefile" \) -exec cp '{}' i3-${VERSION}/i3-input \;
59 sed -e 's/^GIT_VERSION=\(.*\)/GIT_VERSION=${GIT_VERSION}/g;s/^VERSION=\(.*\)/VERSION=${VERSION}/g' common.mk > i3-${VERSION}/common.mk
60 # Pre-generate a manpage to allow distributors to skip this step and save some dependencies
62 cp man/*.1 i3-${VERSION}/man/
63 tar cfj i3-${VERSION}.tar.bz2 i3-${VERSION}
67 rm -f src/*.o src/cfgparse.tab.{c,h} src/cfgparse.yy.c
70 $(MAKE) TOPDIR=$(TOPDIR) -C i3-msg clean
71 $(MAKE) TOPDIR=$(TOPDIR) -C i3-input clean
75 $(MAKE) TOPDIR=$(TOPDIR) -C i3-msg distclean
76 $(MAKE) TOPDIR=$(TOPDIR) -C i3-input distclean