(g)make foreach can be quite handy but it also make Makefiles much less declarative and thus harder to read. Avoid them by adding the few needed assignments & dependencies. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- Makefile | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 7f1b9508f..82ca2fe06 100644 --- a/Makefile +++ b/Makefile @@ -84,6 +84,9 @@ cflags += -DGCC_BASE=\"$(GCC_BASE)\" MULTIARCH_TRIPLET := $(shell $(CC) -print-multiarch 2>/dev/null) cflags += -DMULTIARCH_TRIPLET=\"$(MULTIARCH_TRIPLET)\" +compile: compile-i386.o +EXTRA_OBJS += compile-i386.o + # Can we use GCC's generated dependencies? HAVE_GCC_DEP:=$(shell touch .gcc-test.c && \ $(CC) -c -Wp,-MD,.gcc-test.d .gcc-test.c 2>/dev/null && \ @@ -112,13 +115,15 @@ HAVE_GTK:=$(shell $(PKG_CONFIG) --exists gtk+-$(GTK_VERSION) 2>/dev/null && echo endif ifeq ($(HAVE_GTK),yes) GTK_CFLAGS := $(shell $(PKG_CONFIG) --cflags gtk+-$(GTK_VERSION)) -GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-$(GTK_VERSION)) +ast-view_CFLAGS := $(GTK_CFLAGS) +ast-model_CFLAGS := $(GTK_CFLAGS) +ast-inspect_CFLAGS := $(GTK_CFLAGS) +test-inspect_CFLAGS := $(GTK_CFLAGS) +test-inspect_LDLIBS := $(shell $(PKG_CONFIG) --libs gtk+-$(GTK_VERSION)) +test-inspect: ast-model.o ast-view.o ast-inspect.o +EXTRA_OBJS += ast-model.o ast-view.o ast-inspect.o PROGRAMS += test-inspect INST_PROGRAMS += test-inspect -test-inspect_OBJS := test-inspect.o -test-inspect_OBJS += ast-model.o ast-view.o ast-inspect.o -$(foreach p,$(test-inspect_OBJS:.o=),$(eval $(p)_CFLAGS := $(GTK_CFLAGS))) -test-inspect_LDLIBS := $(GTK_LIBS) else $(warning Your system does not have gtk3/gtk2, disabling test-inspect) endif @@ -160,13 +165,10 @@ V = @ Q = $(V:1=) -compile_OBJS := compile-i386.o - all: $(PROGRAMS) ldflags += $($(@)_LDFLAGS) $(LDFLAGS) ldlibs += $($(@)_LDLIBS) $(LDLIBS) -$(foreach p,$(PROGRAMS),$(eval $(p): $($(p)_OBJS))) $(PROGRAMS): % : %.o $(LIBS) @echo " LD $@" $(Q)$(LD) $(ldflags) $^ $(ldlibs) -o $@ @@ -175,7 +177,7 @@ libsparse.a: $(LIB_OBJS) @echo " AR $@" $(Q)$(AR) rcs $@ $^ -OBJS := $(LIB_OBJS) $(PROGRAMS:%=%.o) $(foreach p,$(PROGRAMS),$($(p)_OBJS)) +OBJS := $(LIB_OBJS) $(EXTRA_OBJS) $(PROGRAMS:%=%.o) DEPS := $(OBJS:%.o=.%.o.d) -include $(DEPS) -- 2.14.0 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html