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 ""; \
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 \
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)
+++ /dev/null
-# 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
--- /dev/null
+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
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 $<"