]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
src/Makefile: fix ccan config.h
authorKlaus Jensen <k.jensen@samsung.com>
Tue, 19 Oct 2021 19:34:38 +0000 (21:34 +0200)
committerKlaus Jensen <k.jensen@samsung.com>
Tue, 19 Oct 2021 19:51:44 +0000 (21:51 +0200)
The ccan/ccan-config.h generated by the ccan configurator is never read
by the ccan sources which expect config.h. Instead, because of -I.. in
src/Makefile, the ccan sources picks up the base config.h (as generated
by configure). All kinds of wrong since config.h should actually have
been config-host.h.

Fix the compiler args to not include the base directory and generate the
ccan config file as ccan/config.h. Rename ./config.h to ./config-host.h.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
configure
src/Makefile

index b21a09823af28415bfc7ad2cbd7d13e68389e4b9..592e0abfd379657d6f4f4d21038e48b9153cc3fd 100755 (executable)
--- a/configure
+++ b/configure
@@ -73,16 +73,16 @@ exit 0
 fi
 
 config_host_mak="config-host.mak"
-config_h="config.h"
+config_host_h="config-host.h"
 
 rm -rf $config_host_mak
-rm -rf $config_h
+rm -rf $config_host_h
 
 fatal() {
   echo $@
   echo "Configure failed, check config.log and/or the above output"
   rm -rf $config_host_mak
-  rm -rf $config_h
+  rm -rf $config_host_h
   exit 1
 }
 
@@ -96,8 +96,8 @@ CFLAGS="-D_GNU_SOURCE -include config.h"
 BUILD_CFLAGS=""
 
 cmdstr=$(printf " '%s'" "$0" "$@")
-# Print configure header at the top of $config_h
-cat > $config_h <<EOF
+# Print configure header at the top of $config_host_h
+cat > $config_host_h <<EOF
 /*
  * Automatically generated by configure - do not modify
  * Configured with:
@@ -169,7 +169,7 @@ output_mak() {
 
 output_sym() {
   output_mak "$1" "y"
-  echo "#define $1" >> $config_h
+  echo "#define $1" >> $config_host_h
 }
 
 print_and_output_mak() {
index 9c54141d6ec44014b4c973c371237b0b77061a85..2f269e434337cc29a8b2707d3a76afd8898ab8b9 100644 (file)
@@ -12,7 +12,7 @@ libdir ?= $(prefix)/lib
 
 CCANDIR=../ccan/
 
-CFLAGS ?= -g -fomit-frame-pointer -O2 -I/usr/include -Invme/ -I$(CCANDIR) -I.. -include ../config.h -D_GNU_SOURCE
+CFLAGS ?= -g -fomit-frame-pointer -O2 -I/usr/include -Invme/ -I$(CCANDIR) -include ../config-host.h -D_GNU_SOURCE
 override CFLAGS += -Wall -fPIC
 SO_CFLAGS=-shared $(CFLAGS)
 L_CFLAGS=$(CFLAGS)
@@ -36,7 +36,7 @@ include ../Makefile.quiet
 
 all: $(all_targets)
 
-$(CCANDIR)ccan-config.h: $(CCANDIR)tools/configurator/configurator
+$(CCANDIR)config.h: $(CCANDIR)tools/configurator/configurator
        $< > $@
 $(CCANDIR)tools/configurator/configurator: CFLAGS = -D_GNU_SOURCE
 
@@ -45,7 +45,7 @@ libccan_srcs := $(wildcard $(CCANDIR)ccan/*/*.c)
 libccan_objs := $(patsubst %.c,%.ol,$(libccan_srcs))
 libccan_sobjs := $(patsubst %.c,%.os,$(libccan_srcs))
 
-$(libccan_objs) $(libccan_sobjs): $(libccan_headers) $(CCANDIR)ccan-config.h
+$(libccan_objs) $(libccan_sobjs): $(libccan_headers) $(CCANDIR)config.h
 
 libnvme_priv := nvme/private.h
 libnvme_api := libnvme.h nvme/types.h nvme/ioctl.h nvme/filters.h nvme/tree.h nvme/util.h nvme/fabrics.h nvme/log.h
@@ -87,10 +87,10 @@ ifeq ($(ENABLE_SHARED),1)
 endif
 
 $(libnvme_objs): $(libnvme_api) $(libnvme_private)
-$(libccan_objs): $(libccan_headers) $(CCANDIR)ccan-config.h
+$(libccan_objs): $(libccan_headers) $(CCANDIR)config.h
 
 clean:
        rm -f $(all_targets) $(libnvme_objs) $(libnvme_sobjs) $(libccan_objs) $(libccan_sobjs) $(soname).new
-       rm -f $(CCANDIR)ccan-config.h
+       rm -f $(CCANDIR)config.h
        rm -f $(CCANDIR)tools/configurator/configurator
        rm -f *.so* *.a *.o