Updated kernel config
[dragora.git] / patches / libaio / 0011-build-Honour-user-build-flags.patch
blob33c370087f92a03aa095b817a21216e1e84aa9ea
1 From b8f802cee62430d4951990f578bcd27eba27476e Mon Sep 17 00:00:00 2001
2 From: Guillem Jover <guillem@hadrons.org>
3 Date: Sun, 12 Apr 2020 04:01:27 +0200
4 Subject: [PATCH libaio 11/11] build: Honour user build flags
6 CPPFLAGS, CFLAGS and LDFLAGS are user flags, which we need to preserve.
7 Any required flag that the build system needs, has to be set in some
8 other flag so that the build will succeed even if the user flags are
9 passed.
11 Signed-off-by: Guillem Jover <guillem@hadrons.org>
12 ---
13 harness/Makefile | 7 +++++--
14 src/Makefile | 18 +++++++++---------
15 2 files changed, 14 insertions(+), 11 deletions(-)
17 diff --git a/harness/Makefile b/harness/Makefile
18 index 84e03a6..42aa49a 100644
19 --- a/harness/Makefile
20 +++ b/harness/Makefile
21 @@ -6,8 +6,11 @@ PROGS:=$(PARTPROGS) $(EXTRAPROGS)
22 HARNESS_SRCS:=main.c
23 # io_queue.c
25 -CFLAGS+=-Wall -I../src -g -O2
26 +MK_CPPFLAGS := -I../src $(CPPFLAGS)
27 +CFLAGS = -Wall -g -O2
28 #-lpthread -lrt
29 +MK_CFLAGS = $(CFLAGS)
30 +MK_LDFLAGS = main.c $(LIBAIO) -lpthread $(LDFLAGS)
32 # Change this on the build line to run tests against the installed libraries:
33 # make LIBAIO=-laio partcheck
34 @@ -16,7 +19,7 @@ LIBAIO?=../src/libaio.a
35 all: $(PROGS)
37 $(PROGS): %.p: %.t $(HARNESS_SRCS)
38 - $(CC) $(CFLAGS) -DTEST_NAME=\"$<\" -o $@ main.c $(LIBAIO) -lpthread
39 + $(CC) $(MK_CPPFLAGS) $(MK_CFLAGS) -DTEST_NAME=\"$<\" -o $@ $(MK_LDFLAGS)
41 clean:
42 rm -f $(PROGS) *.o runtests.out rofile wofile rwfile
43 diff --git a/src/Makefile b/src/Makefile
44 index a53c43c..f6215f9 100644
45 --- a/src/Makefile
46 +++ b/src/Makefile
47 @@ -3,12 +3,12 @@ prefix=/usr
48 includedir=$(prefix)/include
49 libdir=$(prefix)/lib
51 -CFLAGS ?= -g -fomit-frame-pointer -O2
52 -CFLAGS += -Wall -I. -fPIC
53 -SO_CFLAGS=-shared $(CFLAGS)
54 -L_CFLAGS=$(CFLAGS)
55 -LINK_FLAGS=
56 -LINK_FLAGS+=$(LDFLAGS)
57 +MK_CPPFLAGS = -I.
58 +MK_CFLAGS = -fPIC $(CFLAGS)
59 +CFLAGS = -Wall -g -fomit-frame-pointer -O2
60 +SO_CFLAGS = -shared $(MK_CFLAGS)
61 +L_CFLAGS = $(MK_CFLAGS)
62 +MK_LDFLAGS = $(LDFLAGS)
63 ENABLE_SHARED ?= 1
65 soname=libaio.so.1
66 @@ -43,10 +43,10 @@ libaio_sobjs := $(patsubst %.c,%.os,$(libaio_srcs))
67 $(libaio_objs) $(libaio_sobjs): libaio.h vsys_def.h
69 %.os: %.c
70 - $(CC) $(SO_CFLAGS) -c -o $@ $<
71 + $(CC) $(MK_CPPFLAGS) $(SO_CFLAGS) -c -o $@ $<
73 %.ol: %.c
74 - $(CC) $(L_CFLAGS) -c -o $@ $<
75 + $(CC) $(MK_CPPFLAGS) $(L_CFLAGS) -c -o $@ $<
77 AR ?= ar
78 RANLIB ?= ranlib
79 @@ -56,7 +56,7 @@ libaio.a: $(libaio_objs)
80 $(RANLIB) libaio.a
82 $(libname): $(libaio_sobjs) libaio.map
83 - $(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map -Wl,-soname=$(soname) -o $@ $(libaio_sobjs) $(LINK_FLAGS)
84 + $(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map -Wl,-soname=$(soname) -o $@ $(libaio_sobjs) $(MK_LDFLAGS)
86 install: $(all_targets)
87 install -D -m 644 libaio.h $(DESTDIR)$(includedir)/libaio.h
88 --
89 2.26.0.292.g33ef6b2f38