Move libi3 to the new Makefile layout

This commit is contained in:
Quentin Glidic 2012-05-16 16:22:57 +02:00
parent 8853334bbe
commit e3b9ffe381
5 changed files with 22 additions and 32 deletions

View File

@ -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 \

View File

@ -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)

View File

@ -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

19
libi3/libi3.mk Normal file
View File

@ -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

View File

@ -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 $<"