From: Guillem Jover Date: Tue, 26 Feb 2019 04:26:21 +0000 (+0000) Subject: Honour user build flags X-Git-Tag: archive/raspbian/0.3.112-13+rpi1~1^2^2^2~22 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1370e32dc1250d53c9bb95878a83e3e686f58095;p=libaio.git Honour user build flags Origin: vendor Forwarded: no Last-Update: 2014-10-09 CPPFLAGS, CFLAGS and LDFLAGS are user flags, which we need to preserve, any required flag that the build system needs, has to be set in some other flag so that the build will succeed even of the user flags are passed. Gbp-Pq: Name 05_build-flags.patch --- diff --git a/harness/Makefile b/harness/Makefile index efd255a..9e2f95f 100644 --- a/harness/Makefile +++ b/harness/Makefile @@ -6,13 +6,16 @@ PROGS:=$(PARTPROGS) $(EXTRAPROGS) HARNESS_SRCS:=main.c # io_queue.c -CFLAGS+=-Wall -I../src -g -O2 -DPAGE_SIZE=$(shell getconf PAGESIZE) +MK_CPPFLAGS := -I../src -DPAGE_SIZE=$(shell getconf PAGESIZE) $(CPPFLAGS) +CFLAGS = -Wall -g -O2 #-lpthread -lrt +MK_CFLAGS = $(CFLAGS) +MK_LDFLAGS = main.c ../src/libaio.a -lpthread $(LDFLAGS) all: $(PROGS) $(PROGS): %.p: %.t $(HARNESS_SRCS) - $(CC) $(CFLAGS) -DTEST_NAME=\"$<\" -o $@ main.c ../src/libaio.a -lpthread + $(CC) $(MK_CPPFLAGS) $(MK_CFLAGS) -DTEST_NAME=\"$<\" -o $@ $(MK_LDFLAGS) clean: rm -f $(PROGS) *.o runtests.out rofile wofile rwfile diff --git a/src/Makefile b/src/Makefile index 5b393ce..e9b9b36 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,12 +4,12 @@ includedir=$(prefix)/include libdir=$(prefix)/lib libdevdir=$(libdir) -CFLAGS ?= -g -fomit-frame-pointer -O2 -CFLAGS += -Wall -I. -fPIC -SO_CFLAGS=-shared $(CFLAGS) -L_CFLAGS=$(CFLAGS) -LINK_FLAGS= -LINK_FLAGS+=$(LDFLAGS) +MK_CPPFLAGS = -I. +MK_CFLAGS = -fPIC $(CFLAGS) +CFLAGS = -Wall -g -fomit-frame-pointer -O2 +SO_CFLAGS = -shared $(MK_CFLAGS) +L_CFLAGS = $(MK_CFLAGS) +MK_LDFLAGS = $(LDFLAGS) ENABLE_SHARED ?= 1 soname=libaio.so.1 @@ -44,10 +44,10 @@ libaio_sobjs := $(patsubst %.c,%.os,$(libaio_srcs)) $(libaio_objs) $(libaio_sobjs): libaio.h vsys_def.h %.os: %.c - $(CC) $(SO_CFLAGS) -c -o $@ $< + $(CC) $(MK_CPPFLAGS) $(SO_CFLAGS) -c -o $@ $< %.ol: %.c - $(CC) $(L_CFLAGS) -c -o $@ $< + $(CC) $(MK_CPPFLAGS) $(L_CFLAGS) -c -o $@ $< AR ?= ar RANLIB ?= ranlib @@ -57,7 +57,7 @@ libaio.a: $(libaio_objs) $(RANLIB) libaio.a $(libname): $(libaio_sobjs) libaio.map - $(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map -Wl,-soname=$(soname) -o $@ $(libaio_sobjs) $(LINK_FLAGS) + $(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map -Wl,-soname=$(soname) -o $@ $(libaio_sobjs) $(MK_LDFLAGS) install: $(all_targets) install -D -m 644 libaio.h $(DESTDIR)$(includedir)/libaio.h