From: Quentin Glidic Date: Wed, 16 May 2012 14:22:57 +0000 (+0200) Subject: Move libi3 to the new Makefile layout X-Git-Tag: 4.3~187 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e3b9ffe3813cca5bc762cbb8a2179cfd03dbedf9;p=i3%2Fi3 Move libi3 to the new Makefile layout --- diff --git a/Makefile b/Makefile index c121bbdf..2ffdffcc 100644 --- a/Makefile +++ b/Makefile @@ -11,13 +11,11 @@ DISTCLEAN_TARGETS = all: real-all +include libi3/libi3.mk include src/i3.mk real-all: $(ALL_TARGETS) subdirs -libi3/%.a: libi3/*.c - $(MAKE) -C libi3 - subdirs: for dir in $(SUBDIRS); do \ echo ""; \ @@ -57,7 +55,6 @@ dist: distclean clean: $(CLEAN_TARGETS) (which lcov >/dev/null 2>&1 && lcov -d . --zerocounters) || true - $(MAKE) -C libi3 clean $(MAKE) -C docs clean $(MAKE) -C man clean for dir in $(SUBDIRS); do \ diff --git a/common.mk b/common.mk index 241576fc..25e81200 100644 --- a/common.mk +++ b/common.mk @@ -72,7 +72,7 @@ LIBS += -lm ifneq ($(UNAME),Darwin) LIBS += -lrt endif -LIBS += -L $(TOPDIR)/libi3 -li3 +LIBS += -L $(TOPDIR) -li3 LIBS += $(call ldflags_for_lib, xcb-event,xcb-event) LIBS += $(call ldflags_for_lib, xcb-keysyms,xcb-keysyms) ifeq ($(shell pkg-config --exists xcb-util 2>/dev/null || echo 1),1) diff --git a/libi3/Makefile b/libi3/Makefile deleted file mode 100644 index e9efcf7b..00000000 --- a/libi3/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# Default value so one can compile i3-msg standalone -TOPDIR=.. - -include $(TOPDIR)/common.mk - -CFLAGS += -I$(TOPDIR)/include - -# Depend on the object files of all source-files in src/*.c and on all header files -FILES=$(patsubst %.c,%.o,$(wildcard *.c)) -HEADERS=$(wildcard *.h) - -# Depend on the specific file (.c for each .o) and on all headers -%.o: %.c ${HEADERS} - echo "[libi3] CC $<" - $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< - -all: libi3.a - -libi3.a: ${FILES} - echo "[libi3] AR libi3.a" - ar rcs libi3.a ${FILES} - -clean: - rm -f *.o libi3.a - -distclean: clean diff --git a/libi3/libi3.mk b/libi3/libi3.mk new file mode 100644 index 00000000..9c9f3c91 --- /dev/null +++ b/libi3/libi3.mk @@ -0,0 +1,19 @@ +CLEAN_TARGETS += clean-libi3 + +libi3_SOURCES := $(wildcard libi3/*.c) +libi3_HEADERS := $(wildcard libi3/*.h) + +libi3_OBJECTS := $(libi3_SOURCES:.c=.o) + + +libi3/%.o: libi3/%.c $(libi3_HEADERS) + echo "[libi3] CC $<" + $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< + +libi3.a: $(libi3_OBJECTS) + echo "[libi3] AR libi3.a" + ar rcs $@ $^ + +clean-libi3: + echo "[libi3] Clean" + rm -f $(libi3_OBJECTS) libi3.a diff --git a/src/i3.mk b/src/i3.mk index f3c0193e..026bf4a0 100644 --- a/src/i3.mk +++ b/src/i3.mk @@ -7,7 +7,7 @@ i3_SOURCES := $(filter-out $(i3_SOURCES_GENERATED),$(wildcard src/*.c)) i3_HEADERS_CMDPARSER := $(wildcard include/GENERATED_*.h) i3_HEADERS := $(filter-out $(i3_HEADERS_CMDPARSER),$(wildcard include/*.h)) -i3_OBJECTS = $(i3_SOURCES_GENERATED:.c=.o) $(i3_SOURCES:.c=.o) +i3_OBJECTS := $(i3_SOURCES_GENERATED:.c=.o) $(i3_SOURCES:.c=.o) src/%.o: src/%.c $(i3_HEADERS) echo "[i3] CC $<"