]> git.sur5r.net Git - i3/i3/commitdiff
Move libi3 to the new Makefile layout
authorQuentin Glidic <sardemff7+git@sardemff7.net>
Wed, 16 May 2012 14:22:57 +0000 (16:22 +0200)
committerQuentin Glidic <sardemff7+git@sardemff7.net>
Sun, 22 Jul 2012 17:57:21 +0000 (19:57 +0200)
Makefile
common.mk
libi3/Makefile [deleted file]
libi3/libi3.mk [new file with mode: 0644]
src/i3.mk

index c121bbdf6116fae412ac077be98e52fc8b0d2239..2ffdffcc5bf282c9bdb25a75c4b5d31a08535c95 100644 (file)
--- 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 \
index 241576fc9e7a887892d5b37fdbd0dd351062ace9..25e812009b72c19e97144ef0841087c73557b5f8 100644 (file)
--- 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 (file)
index e9efcf7..0000000
+++ /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 (file)
index 0000000..9c9f3c9
--- /dev/null
@@ -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
index f3c0193e494556d36cd961742bce28c32c873cb2..026bf4a0c82023ddf51b52085db3783ef7b0f60f 100644 (file)
--- 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 $<"