[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dmidecode --json
From: |
Jean Delvare |
Subject: |
Re: dmidecode --json |
Date: |
Thu, 19 Dec 2024 11:01:11 +0100 |
User-agent: |
Evolution 3.50.3 |
On Fri, 2024-12-13 at 17:31 +0100, Jean Delvare wrote:
> On Mon, 2024-12-02 at 16:25 +0100, Jiri Hnidek wrote:
>
> > Open questions:
> > 1) Should be support for output to JSON format (requiting json-c) enabled
> > or disabled by default?
>
> If this can be implemented easily in the Makefile, I would enable JSON
> output by default, as I think most distributions will want to include
> it, and probably most users as well. Something like the following may
> work, although I'm not sure how portable it is:
Turns out this isn't portable, as bmake (BSD make) uses a different
syntax for conditionals. That being said, the time may have come to
give up on bmake compatibility. It was nice to have when it was cheap,
but it should not prevent us from keeping the dmidecode package
convenient to build. I don't even know if non-Linux users actually rely
on bmake compatibility. I suppose they can switch to GNU make if
needed.
As a side note, it's a shame that there's no standard makefile
format...
> --- a/Makefile
> +++ b/Makefile
> @@ -21,17 +21,23 @@ CFLAGS ?= -O2
> CFLAGS += -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
> -Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef
>
> +# By default we include support for JSON output, can be overridden on
> +# the command line
> +WITH_JSON ?= 1
> +
> # Let lseek and mmap support 64-bit wide offsets
> CFLAGS += -D_FILE_OFFSET_BITS=64
>
> #CFLAGS += -DBIGENDIAN
> #CFLAGS += -DALIGNMENT_WORKAROUND
> -#CFLAGS += -DWITH_JSON_C
>
> # Pass linker flags here (can be set from environment too)
> LDFLAGS ?=
>
> -#LDFLAGS += -ljson-c
> +ifeq ($(WITH_JSON),1)
> +CFLAGS += -DWITH_JSON_C
> +LDFLAGS += -ljson-c
> +endif
>
> DESTDIR =
> prefix = /usr/local
>
> With this, just "make" will include JSON output, while "make
> WITH_JSON=0" will not.
--
Jean Delvare
SUSE L3 Support