From c223d276ce40a25f7c0e0b5ae305ad60cf7043d1 Mon Sep 17 00:00:00 2001 From: Darshit Shah Date: Fri, 21 Nov 2014 16:51:16 +0530 Subject: [PATCH 1/2] Declare externs for generated strings in version.c --- src/ChangeLog | 6 ++++++ src/Makefile.am | 18 ++++++++++++++---- src/main.c | 6 +----- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 120e82e..e9a8160 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2014-11-21 Darshit Shah + + * Makefile.am: Generate version.h containing extern declarations for strings + in version.c + * main.c: Include version.h and remove local extern declarations + 2014-11-21 Daniel Stenberg * iri.c (remote_to_utf8): Fix compiler warning diff --git a/src/Makefile.am b/src/Makefile.am index a5db9fd..03f4dfe 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -54,7 +54,7 @@ wget_SOURCES = cmpt.c connect.c convert.c cookies.c ftp.c \ options.h progress.h ptimer.h recur.h res.h retr.h \ spider.h ssl.h sysdep.h url.h warc.h utils.h wget.h iri.h \ exits.h gettext.h -nodist_wget_SOURCES = version.c +nodist_wget_SOURCES = version.h version.c EXTRA_wget_SOURCES = iri.c LDADD = $(LIBOBJS) ../lib/libgnu.a AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib @@ -70,10 +70,20 @@ build_info.c: $(srcdir)/Makefile.am $(srcdir)/build_info.c.in if test -n "$(VPATH)"; then rm -f build_info.c.in; fi ESCAPEQUOTE = sed -e 's/[\\"]/\\&/g' -e 's/\\"/"/' -e 's/\\";$$/";/' -version.c: $(wget_SOURCES) ../lib/libgnu.a + +version.h: $(wget_SOURCES) + echo '/* version.h */' > $@ + echo '/* Autogenerated by Makefile - DO NOT EDIT */' >> $@ + echo '' >> $@ + echo 'extern const char *version_string;' >> $@ + echo 'extern const char *compilation_string;' >> $@ + echo 'extern const char *link_string;' >> $@ + +version.c: $(wget_SOURCES) ../lib/libgnu.a version.h echo '/* version.c */' > $@ echo '/* Autogenerated by Makefile - DO NOT EDIT */' >> $@ echo '' >> $@ + echo '#include "version.h"' >> $@ echo 'const char *version_string = "@VERSION@";' >> $@ echo 'const char *compilation_string = "'$(COMPILE)'";' \ | $(ESCAPEQUOTE) >> $@ @@ -93,8 +103,8 @@ distclean-local: check_LIBRARIES = libunittest.a libunittest_a_SOURCES = $(wget_SOURCES) test.c build_info.c test.h -nodist_libunittest_a_SOURCES = version.c +nodist_libunittest_a_SOURCES = version.h version.c libunittest_a_CPPFLAGS = -DTESTING "-I$(top_builddir)/lib" "-I$(top_srcdir)/lib" libunittest_a_LIBADD = $(LIBOBJS) -CLEANFILES = *~ *.bak core core.[0-9]* build_info.c version.c +CLEANFILES = *~ *.bak core core.[0-9]* build_info.c version.c version.h diff --git a/src/main.c b/src/main.c index 28c832c..a2eac76 100644 --- a/src/main.c +++ b/src/main.c @@ -55,6 +55,7 @@ as that of the covered work. */ #include "ptimer.h" #include "warc.h" #include "c-strcase.h" +#include "version.h" #include #include #include @@ -78,11 +79,6 @@ struct iri dummy_iri; struct options opt; -/* defined in version.c */ -extern char *version_string; -extern char *compilation_string; -extern char *system_getrc; -extern char *link_string; /* defined in build_info.c */ extern const char *compiled_features[]; /* Used for --version output in print_version */ -- 2.1.3