diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-11-05 15:52:13 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-11-10 10:26:35 +0100 |
| commit | 8fe0934ad9513cd43e07bb368d5a0e6dd7a1d917 (patch) | |
| tree | b742cfc2d055242e3265a438465e908e9cdc1e1e /Makefile | |
| parent | 081679882c3f8bd06a26bb1f4d8b37b8b3ae06fe (diff) | |
| download | sparse-dev-8fe0934ad9513cd43e07bb368d5a0e6dd7a1d917.tar.gz | |
build: avoid foreach
(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@gmail.com>
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -85,6 +85,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 && \ @@ -113,13 +116,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 @@ -161,13 +166,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 $@ @@ -176,7 +178,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) |
