aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-11-04 11:13:50 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-11-10 09:53:20 +0100
commit8c6b675aec6db6f12f81a10b5280c6068222d963 (patch)
tree0f9829d33dea764204630d2553deebe91c279e37
parentc3490e701eaadbea71762911b57295eb1caa28e9 (diff)
downloadsparse-dev-8c6b675aec6db6f12f81a10b5280c6068222d963.tar.gz
build: use '-objs' instead of '_EXTRA_DEPS'
Some programs are composed of several source files other than the main one. These files need then to be added at linking time. These extra file are currently specified using variables named "<program-name>_EXTRA_DEPS" but the way these variables are used make that they can only hold .o files (or .a ones) and are not some kind of generic dependencie. Make this explicit by using the suffix '-objs' instead. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--Makefile12
1 files changed, 6 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index bd8a08f1..fa86c09a 100644
--- a/Makefile
+++ b/Makefile
@@ -70,9 +70,9 @@ GTK_CFLAGS := $(shell $(PKG_CONFIG) --cflags gtk+-$(GTK_VERSION))
GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-$(GTK_VERSION))
PROGRAMS += test-inspect
INST_PROGRAMS += test-inspect
-test-inspect_EXTRA_DEPS := ast-model.o ast-view.o ast-inspect.o
-test-inspect_OBJS := test-inspect.o $(test-inspect_EXTRA_DEPS)
-$(test-inspect_OBJS) $(test-inspect_OBJS:.o=.sc): CFLAGS += $(GTK_CFLAGS)
+test-inspect-objs := test-inspect.o
+test-inspect-objs += ast-model.o ast-view.o ast-inspect.o
+$(test-inspect-objs) $(test-inspect-objs:.o=.sc): CFLAGS += $(GTK_CFLAGS)
test-inspect_EXTRA_OBJS := $(GTK_LIBS)
else
$(warning Your system does not have gtk3/gtk2, disabling test-inspect)
@@ -165,9 +165,9 @@ install: all-installable
$(foreach f,$(INST_MAN1),$(call INSTALL_FILE,$f,$(MAN1DIR)))
-compile_EXTRA_DEPS = compile-i386.o
+compile-objs:= compile-i386.o
-$(foreach p,$(PROGRAMS),$(eval $(p): $($(p)_EXTRA_DEPS) $(LIBS)))
+$(foreach p,$(PROGRAMS),$(eval $(p): $($(p)-objs) $(LIBS)))
$(PROGRAMS): % : %.o
$(QUIET_LINK)$(LD) $(LDFLAGS) -o $@ $^ $($@_EXTRA_OBJS)
@@ -193,7 +193,7 @@ pre-process.sc: CHECKER_FLAGS += -Wno-vla
%.sc: %.c sparse
$(QUIET_CHECK) $(CHECKER) $(CHECKER_FLAGS) $(CFLAGS) $(CPPFLAGS) -c $<
-ALL_OBJS := $(LIB_OBJS) $(foreach p,$(PROGRAMS),$(p).o $($(p)_EXTRA_DEPS))
+ALL_OBJS := $(LIB_OBJS) $(foreach p,$(PROGRAMS),$(p).o $($(p)-objs))
selfcheck: $(ALL_OBJS:.o=.sc)