From 98fcd6fa6ca11aeedcb714182ccde2fdfd817fa3 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Fri, 1 Aug 2008 21:37:42 +0000 Subject: reduce the amount of recompiling necessary when the version string changes git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@4646 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- Makefile | 10 ++++++---- build_tools/make_version_h | 4 ++-- dahdi_cfg.c | 4 ++-- version.h | 22 ++++++++++++++++++++++ 4 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 version.h diff --git a/Makefile b/Makefile index 4016703..c6b06c6 100644 --- a/Makefile +++ b/Makefile @@ -83,9 +83,9 @@ endif endif LTZ_A:=libtonezone.a -LTZ_A_OBJS:=zonedata.o tonezone.o +LTZ_A_OBJS:=zonedata.o tonezone.o version.o LTZ_SO:=libtonezone.so -LTZ_SO_OBJS:=zonedata.lo tonezone.lo +LTZ_SO_OBJS:=zonedata.lo tonezone.lo version.o LTZ_SO_MAJOR_VER:=1 LTZ_SO_MINOR_VER:=0 @@ -130,7 +130,7 @@ programs: libs utils utils: $(BINS) utils-subdirs -version.h: FORCE +version.c: FORCE @TOOLSVERSION="${TOOLSVERSION}" build_tools/make_version_h > $@.tmp @if cmp -s $@.tmp $@ ; then :; else \ mv $@.tmp $@ ; \ @@ -141,6 +141,8 @@ tests: patgen pattest patlooptest hdlcstress hdlctest hdlcgen hdlcverify timerte $(UTILS): %: %.o +$(UTILS): version.o + %.o: %.c $(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $< @@ -150,7 +152,7 @@ $(UTILS): %: %.o %: %.o $(CC) $(LDFLAGS) -o $@ $^ -prereq: config.status version.h +prereq: config.status dahdi_tool: CFLAGS+=$(NEWT_INCLUDE) dahdi_tool: LDFLAGS+=$(NEWT_LIB) diff --git a/build_tools/make_version_h b/build_tools/make_version_h index f65fdd0..7382f3f 100755 --- a/build_tools/make_version_h +++ b/build_tools/make_version_h @@ -1,10 +1,10 @@ #!/bin/sh cat << END /* - * version.h + * version.c * Automatically generated */ -static const char tools_version[] = "DAHDI Tools Version - ${TOOLSVERSION}"; +const char dahdi_tools_version[] = "DAHDI Tools Version - ${TOOLSVERSION}"; END diff --git a/dahdi_cfg.c b/dahdi_cfg.c index e6f3d93..fcfdeaf 100644 --- a/dahdi_cfg.c +++ b/dahdi_cfg.c @@ -1338,7 +1338,7 @@ static void usage(char *argv0, int exitcode) c = argv0; else c++; - fprintf(stderr, "%s\n", tools_version); + fprintf(stderr, "%s\n", dahdi_tools_version); fprintf(stderr, "Usage: %s [options]\n" " Valid options are:\n" @@ -1393,7 +1393,7 @@ int main(int argc, char *argv[]) } if (verbose) { - fprintf(stderr, "%s\n", tools_version); + fprintf(stderr, "%s\n", dahdi_tools_version); } if (fd == -1) fd = open(MASTER_DEVICE, O_RDWR); diff --git a/version.h b/version.h new file mode 100644 index 0000000..897de90 --- /dev/null +++ b/version.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2008 Digium, Inc. + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under thet erms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +extern const char *dahdi_tools_version; -- cgit v1.2.3