From: Michael Stapelberg Date: Sun, 24 Jul 2011 22:31:35 +0000 (+0200) Subject: makefiles: build subdirs (Thanks Kacper) X-Git-Tag: 4.0~14^2~52 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6a07e083201fe2baaf7e6d76b469f9278ca119d2;p=i3%2Fi3 makefiles: build subdirs (Thanks Kacper) --- diff --git a/Makefile b/Makefile index ad7de02a..a29fe59e 100644 --- a/Makefile +++ b/Makefile @@ -18,14 +18,25 @@ else UNUSED:=$(shell $(MAKE) loglevels.h) endif +SUBDIRS=i3-msg i3-input i3-nagbar i3-config-wizard + # Depend on the specific file (.c for each .o) and on all headers src/%.o: src/%.c ${HEADERS} echo "CC $<" $(CC) $(CPPFLAGS) $(CFLAGS) -DLOGLEVEL="((uint64_t)1 << $(shell awk '/$(shell basename $< .c)/ { print NR; exit 0; }' loglevels.tmp))" -c -o $@ $< -all: src/cfgparse.y.o src/cfgparse.yy.o src/cmdparse.y.o src/cmdparse.yy.o ${FILES} +all: i3 subdirs + +i3: src/cfgparse.y.o src/cfgparse.yy.o src/cmdparse.y.o src/cmdparse.yy.o ${FILES} echo "LINK i3" - $(CC) $(LDFLAGS) -o i3 $^ $(LIBS) + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) + +subdirs: + for dir in $(SUBDIRS); do \ + echo ""; \ + echo "MAKE $$dir"; \ + $(MAKE) -C $$dir; \ + done loglevels.h: echo "LOGLEVELS" @@ -74,10 +85,9 @@ install: all $(INSTALL) -m 0644 i3.welcome $(DESTDIR)$(SYSCONFDIR)/i3/welcome $(INSTALL) -m 0644 i3.desktop $(DESTDIR)$(PREFIX)/share/xsessions/ $(INSTALL) -m 0644 include/i3/ipc.h $(DESTDIR)$(PREFIX)/include/i3/ - $(MAKE) TOPDIR=$(TOPDIR) -C i3-msg install - $(MAKE) TOPDIR=$(TOPDIR) -C i3-input install - $(MAKE) TOPDIR=$(TOPDIR) -C i3-nagbar install - $(MAKE) TOPDIR=$(TOPDIR) -C i3-config-wizard install + for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir install; \ + done dist: distclean [ ! -d i3-${VERSION} ] || rm -rf i3-${VERSION} diff --git a/i3-config-wizard/Makefile b/i3-config-wizard/Makefile index 688df11a..43c3a1ff 100644 --- a/i3-config-wizard/Makefile +++ b/i3-config-wizard/Makefile @@ -13,9 +13,11 @@ HEADERS:=$(wildcard *.h) echo "CC $<" $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< -all: cfgparse.y.o cfgparse.yy.o ${FILES} +all: i3-config-wizard + +i3-config-wizard: cfgparse.y.o cfgparse.yy.o ${FILES} echo "LINK i3-config-wizard" - $(CC) $(LDFLAGS) -o i3-config-wizard $^ $(LIBS) + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) cfgparse.yy.o: cfgparse.l cfgparse.y.o ${HEADERS} echo "LEX $<" diff --git a/i3-input/Makefile b/i3-input/Makefile index 498cfb50..45653dad 100644 --- a/i3-input/Makefile +++ b/i3-input/Makefile @@ -12,9 +12,11 @@ HEADERS=$(wildcard *.h) echo "CC $<" $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< -all: ${FILES} +all: i3-input + +i3-input: ${FILES} echo "LINK i3-input" - $(CC) $(LDFLAGS) -o i3-input ${FILES} $(LIBS) + $(CC) $(LDFLAGS) -o $@ ${FILES} $(LIBS) install: all echo "INSTALL" diff --git a/i3-msg/Makefile b/i3-msg/Makefile index 7ea19e60..1b7c1c04 100644 --- a/i3-msg/Makefile +++ b/i3-msg/Makefile @@ -14,7 +14,9 @@ HEADERS=$(wildcard *.h) echo "CC $<" $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< -all: ${FILES} +all: i3-msg + +i3-msg: ${FILES} echo "LINK i3-msg" $(CC) $(LDFLAGS) -o i3-msg ${FILES} $(LIBS) diff --git a/i3-nagbar/Makefile b/i3-nagbar/Makefile index c9eec446..933ae76c 100644 --- a/i3-nagbar/Makefile +++ b/i3-nagbar/Makefile @@ -12,9 +12,11 @@ HEADERS=$(wildcard *.h) echo "CC $<" $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< -all: ${FILES} +all: i3-nagbar + +i3-nagbar: ${FILES} echo "LINK i3-nagbar" - $(CC) $(LDFLAGS) -o i3-nagbar ${FILES} $(LIBS) + $(CC) $(LDFLAGS) -o $@ ${FILES} $(LIBS) install: all echo "INSTALL"