aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates
diff options
context:
space:
mode:
authorGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2015-04-29 08:56:01 +0200
committerGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2015-04-29 09:05:25 +0200
commitadaa100e3ea04454f03b347171c057de7d58afb5 (patch)
tree814510b1ae238a006de9f9a76595945e16aa8c4a /templates
parent5b8c2558843ac6f10b3e16165b07e92002207f56 (diff)
Trimming down useless variables in the Makefile.
A bunch of autogenerated variables are currently useless, because of tests actually having no source code attached to them. Let's avoid emitting useless code in that case.
Diffstat (limited to 'templates')
-rw-r--r--templates/Makefile.template35
1 files changed, 27 insertions, 8 deletions
diff --git a/templates/Makefile.template b/templates/Makefile.template
index e51af39348..fe455d1c20 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -1215,7 +1215,8 @@ $(OBJDIR)/$(CONFIG)/${os.path.splitext(src)[0]}.o: ${' '.join(proto_to_cc(src2)
% endfor
</%def>
-<%def name="maketarget(tgt)">
+<%def name="maketarget(tgt)"><% has_no_sources = not tgt.src %>
+% if not has_no_sources:
${tgt.name.upper()}_SRC = \\
% for src in tgt.src:
@@ -1224,7 +1225,7 @@ ${tgt.name.upper()}_SRC = \\
% endfor
${tgt.name.upper()}_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(${tgt.name.upper()}_SRC))))
-
+% endif
% if tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check':
ifeq ($(NO_SECURE),true)
@@ -1254,9 +1255,15 @@ $(BINDIR)/$(CONFIG)/${tgt.name}: protobuf_dep_error
else
-$(BINDIR)/$(CONFIG)/${tgt.name}: $(PROTOBUF_DEP) $(${tgt.name.upper()}_OBJS)\
+$(BINDIR)/$(CONFIG)/${tgt.name}: \
+% if not has_no_sources:
+$(PROTOBUF_DEP) $(${tgt.name.upper()}_OBJS)\
+% endif
% else:
-$(BINDIR)/$(CONFIG)/${tgt.name}: $(${tgt.name.upper()}_OBJS)\
+$(BINDIR)/$(CONFIG)/${tgt.name}: \
+% if not has_no_sources:
+$(${tgt.name.upper()}_OBJS)\
+% endif
% endif
% for dep in tgt.deps:
$(LIBDIR)/$(CONFIG)/lib${dep}.a\
@@ -1267,17 +1274,26 @@ $(BINDIR)/$(CONFIG)/${tgt.name}: $(${tgt.name.upper()}_OBJS)\
% if tgt.build == 'protoc':
$(E) "[HOSTLD] Linking $@"
$(Q) mkdir -p `dirname $@`
- $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(${tgt.name.upper()}_OBJS)\
+ $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) \
+% if not has_no_sources:
+$(${tgt.name.upper()}_OBJS)\
+% endif
% else:
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
- $(Q) $(LDXX) $(LDFLAGS) $(${tgt.name.upper()}_OBJS)\
+ $(Q) $(LDXX) $(LDFLAGS) \
+% if not has_no_sources:
+$(${tgt.name.upper()}_OBJS)\
+% endif
% endif
% else:
## C-only targets specificities.
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
- $(Q) $(LD) $(LDFLAGS) $(${tgt.name.upper()}_OBJS)\
+ $(Q) $(LD) $(LDFLAGS) \
+% if not has_no_sources:
+$(${tgt.name.upper()}_OBJS)\
+% endif
% endif
% for dep in tgt.deps:
$(LIBDIR)/$(CONFIG)/lib${dep}.a\
@@ -1319,9 +1335,11 @@ $(OBJDIR)/$(CONFIG)/${os.path.splitext(src)[0]}.o: \
% endfor
% endfor
-
+% if not has_no_sources:
deps_${tgt.name}: $(${tgt.name.upper()}_OBJS:.o=.dep)
+% endif
+% if not has_no_sources:
% if tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check':
ifneq ($(NO_SECURE),true)
% endif
@@ -1331,6 +1349,7 @@ endif
% if tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check':
endif
% endif
+% endif
</%def>
ifneq ($(OPENSSL_DEP),)