2 INSTALL_TARGETS += install-i3
3 CLEAN_TARGETS += clean-i3
5 i3_SOURCES_GENERATED = src/cfgparse.tab.c src/cfgparse.yy.c
6 i3_SOURCES := $(filter-out $(i3_SOURCES_GENERATED),$(wildcard src/*.c))
7 i3_HEADERS_CMDPARSER := $(wildcard include/GENERATED_*.h)
8 i3_HEADERS := $(filter-out $(i3_HEADERS_CMDPARSER),$(wildcard include/*.h))
12 i3_OBJECTS := $(i3_SOURCES_GENERATED:.c=.o) $(i3_SOURCES:.c=.o)
14 src/%.o: src/%.c $(i3_HEADERS)
16 $(CC) $(CPPFLAGS) $(i3_CFLAGS) $(CFLAGS) -c -o $@ $<
18 src/cfgparse.yy.c: src/cfgparse.l src/cfgparse.tab.o $(i3_HEADERS)
22 src/cfgparse.tab.c: src/cfgparse.y $(i3_HEADERS)
24 $(BISON) --debug --verbose -b $(basename $< .y) -d $<
26 # This target compiles the command parser twice:
27 # Once with -DTEST_PARSER, creating a stand-alone executable used for tests,
28 # and once as an object file for i3.
29 src/commands_parser.o: src/commands_parser.c $(i3_HEADERS) i3-command-parser.stamp
31 $(CC) $(CPPFLAGS) $(i3_CFLAGS) $(CFLAGS) $(LDFLAGS) -DTEST_PARSER -o test.commands_parser $< $(i3_LIBS) $(LIBS)
32 $(CC) $(CPPFLAGS) $(i3_CFLAGS) $(CFLAGS) -c -o $@ $<
34 i3-command-parser.stamp: generate-command-parser.pl parser-specs/commands.spec
35 echo "[i3] Generating command parser"
36 (cd include; ../generate-command-parser.pl)
39 i3: libi3.a $(i3_OBJECTS)
41 $(CC) $(LDFLAGS) -o $@ $(filter-out libi3.a,$^) $(i3_LIBS) $(LIBS)
45 $(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/bin
46 $(INSTALL) -d -m 0755 $(DESTDIR)$(SYSCONFDIR)/i3
47 $(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/include/i3
48 $(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/share/xsessions
49 $(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/share/applications
50 $(INSTALL) -m 0755 i3 $(DESTDIR)$(PREFIX)/bin/
51 $(INSTALL) -m 0755 i3-migrate-config-to-v4 $(DESTDIR)$(PREFIX)/bin/
52 $(INSTALL) -m 0755 i3-sensible-editor $(DESTDIR)$(PREFIX)/bin/
53 $(INSTALL) -m 0755 i3-sensible-pager $(DESTDIR)$(PREFIX)/bin/
54 $(INSTALL) -m 0755 i3-sensible-terminal $(DESTDIR)$(PREFIX)/bin/
55 test -e $(DESTDIR)$(SYSCONFDIR)/i3/config || $(INSTALL) -m 0644 i3.config $(DESTDIR)$(SYSCONFDIR)/i3/config
56 test -e $(DESTDIR)$(SYSCONFDIR)/i3/config.keycodes || $(INSTALL) -m 0644 i3.config.keycodes $(DESTDIR)$(SYSCONFDIR)/i3/config.keycodes
57 $(INSTALL) -m 0644 i3.xsession.desktop $(DESTDIR)$(PREFIX)/share/xsessions/i3.desktop
58 $(INSTALL) -m 0644 i3.applications.desktop $(DESTDIR)$(PREFIX)/share/applications/i3.desktop
59 $(INSTALL) -m 0644 include/i3/ipc.h $(DESTDIR)$(PREFIX)/include/i3/
63 rm -f $(i3_OBJECTS) $(i3_SOURCES_GENERATED) $(i3_HEADERS_CMDPARSER) i3-command-parser.stamp i3 src/*.gcno src/cfgparse.{output,dot}