Message ID | 1457526636-3634-5-git-send-email-clg@fr.ibm.com |
---|---|
State | Accepted |
Headers | show |
On 03/09/2016 06:00 PM, Cédric Le Goater wrote: > Let's version like skiboot and other external tools do. There is no > need to generate a version.c file. Defining VERSION on the compile > commande line is enough. Cedric, > > Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> > --- > external/xscom-utils/Makefile | 4 ++-- > external/xscom-utils/getscom.c | 6 +----- > external/xscom-utils/getsram.c | 6 +----- > external/xscom-utils/putscom.c | 6 +----- > skiboot.spec | 2 +- > 5 files changed, 6 insertions(+), 18 deletions(-) > > diff --git a/external/xscom-utils/Makefile b/external/xscom-utils/Makefile > index b5d0d1cd9003..ca9e37897b7e 100644 > --- a/external/xscom-utils/Makefile > +++ b/external/xscom-utils/Makefile > @@ -1,7 +1,7 @@ > all: getscom putscom getsram > > -VERSION=0.1 > -CFLAGS=-O2 -g -Wall -m64 -DVERSION=$(VERSION) > +XSCOM_VERSION ?= $(shell ../../make_version.sh xscom-utils) > +CFLAGS=-O2 -g -Wall -m64 -DVERSION=\"$(XSCOM_VERSION)\" This won't work if we do something like "make CFLAGS=<flags>". You may want to introduce version.c (something similar to opal-prd). -Vasant
On 03/10/2016 11:43 AM, Vasant Hegde wrote: > On 03/09/2016 06:00 PM, Cédric Le Goater wrote: >> Let's version like skiboot and other external tools do. There is >> no need to generate a version.c file. Defining VERSION on the >> compile commande line is enough. > > > Cedric, > >> >> Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> --- >> external/xscom-utils/Makefile | 4 ++-- >> external/xscom-utils/getscom.c | 6 +----- >> external/xscom-utils/getsram.c | 6 +----- >> external/xscom-utils/putscom.c | 6 +----- skiboot.spec >> | 2 +- 5 files changed, 6 insertions(+), 18 deletions(-) >> >> diff --git a/external/xscom-utils/Makefile >> b/external/xscom-utils/Makefile index b5d0d1cd9003..ca9e37897b7e >> 100644 --- a/external/xscom-utils/Makefile +++ >> b/external/xscom-utils/Makefile @@ -1,7 +1,7 @@ all: getscom >> putscom getsram >> >> -VERSION=0.1 -CFLAGS=-O2 -g -Wall -m64 -DVERSION=$(VERSION) >> +XSCOM_VERSION ?= $(shell ../../make_version.sh xscom-utils) >> +CFLAGS=-O2 -g -Wall -m64 -DVERSION=\"$(XSCOM_VERSION)\" > > This won't work if we do something like "make CFLAGS=<flags>". > > You may want to introduce version.c (something similar to opal-prd). Ah yes. I thought it was a little overkill to generate a file but I didn't think of that possibility. I will send a fix. Thanks, C.
diff --git a/external/xscom-utils/Makefile b/external/xscom-utils/Makefile index b5d0d1cd9003..ca9e37897b7e 100644 --- a/external/xscom-utils/Makefile +++ b/external/xscom-utils/Makefile @@ -1,7 +1,7 @@ all: getscom putscom getsram -VERSION=0.1 -CFLAGS=-O2 -g -Wall -m64 -DVERSION=$(VERSION) +XSCOM_VERSION ?= $(shell ../../make_version.sh xscom-utils) +CFLAGS=-O2 -g -Wall -m64 -DVERSION=\"$(XSCOM_VERSION)\" getscom: getscom.c xscom.c $(CC) $(CFLAGS) -o $@ $^ diff --git a/external/xscom-utils/getscom.c b/external/xscom-utils/getscom.c index 96dcace433cd..81893dfad177 100644 --- a/external/xscom-utils/getscom.c +++ b/external/xscom-utils/getscom.c @@ -74,10 +74,6 @@ static void print_chip_info(uint32_t chip_id) } -#define VERSION_STR _str(VERSION) -#define _str(s) __str(s) -#define __str(s) #s - int main(int argc, char *argv[]) { uint64_t val, addr = -1ull; @@ -112,7 +108,7 @@ int main(int argc, char *argv[]) list_chips = true; break; case 'v': - printf("xscom utils version %s\n", VERSION_STR); + printf("xscom utils version %s\n", VERSION); exit(1); default: exit(1); diff --git a/external/xscom-utils/getsram.c b/external/xscom-utils/getsram.c index ea3d38badf8d..5dbd81bb7248 100644 --- a/external/xscom-utils/getsram.c +++ b/external/xscom-utils/getsram.c @@ -32,10 +32,6 @@ static void print_usage(void) exit(1); } -#define VERSION_STR _str(VERSION) -#define _str(s) __str(s) -#define __str(s) #s - int main(int argc, char *argv[]) { uint64_t val, addr = -1ull; @@ -73,7 +69,7 @@ int main(int argc, char *argv[]) print_usage(); break; case 'v': - printf("xscom utils version %s\n", VERSION_STR); + printf("xscom utils version %s\n", VERSION); exit(1); default: exit(1); diff --git a/external/xscom-utils/putscom.c b/external/xscom-utils/putscom.c index be7b696186cb..0c4d5cdf0753 100644 --- a/external/xscom-utils/putscom.c +++ b/external/xscom-utils/putscom.c @@ -30,10 +30,6 @@ static void print_usage(void) exit(1); } -#define VERSION_STR _str(VERSION) -#define _str(s) __str(s) -#define __str(s) #s - int main(int argc, char *argv[]) { uint64_t val = -1ull, addr = -1ull; @@ -66,7 +62,7 @@ int main(int argc, char *argv[]) chip_id = strtoul(optarg, NULL, 0); break; case 'v': - printf("xscom utils version %s\n", VERSION_STR); + printf("xscom utils version %s\n", VERSION); exit(1); case 'h': print_usage(); diff --git a/skiboot.spec b/skiboot.spec index b1bbcc6e60a6..1d7046741254 100644 --- a/skiboot.spec +++ b/skiboot.spec @@ -53,7 +53,7 @@ SKIBOOT_VERSION=%version CROSS= make V=1 %{?_smp_mflags} OPAL_PRD_VERSION=%version make V=1 -C external/opal-prd GARD_VERSION=%version make V=1 -C external/gard PFLASH_VERSION=%version make V=1 -C external/pflash -make V=1 -C external/xscom-utils +XSCOM_VERSION=%version make V=1 -C external/xscom-utils %install make -C external/opal-prd install DESTDIR=%{buildroot} prefix=/usr
Let's version like skiboot and other external tools do. There is no need to generate a version.c file. Defining VERSION on the compile commande line is enough. Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> --- external/xscom-utils/Makefile | 4 ++-- external/xscom-utils/getscom.c | 6 +----- external/xscom-utils/getsram.c | 6 +----- external/xscom-utils/putscom.c | 6 +----- skiboot.spec | 2 +- 5 files changed, 6 insertions(+), 18 deletions(-)