summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorGuillem Jover <guillem@hadrons.org>2021-05-24 00:27:22 +0200
committerGuillem Jover <guillem@hadrons.org>2021-09-13 13:19:25 +0200
commitb7c779a90a987f7e65405c7985c52212fcf3cb53 (patch)
tree5a5b7e86664b15f3121a0d4f625ec3f20d0f03ad /examples
parent9c1401be8b07a93d88a243c57946f84a58890c3d (diff)
downloadliburing-b7c779a90a987f7e65405c7985c52212fcf3cb53.tar.gz
liburing-b7c779a90a987f7e65405c7985c52212fcf3cb53.tar.bz2
build: Fix build flags support
The usual convention is that the various *FLAGS are user controllable, and can be overridden, so anything that is essential for the build should be passed respecting that. The other usual convention is that CPPFLAGS only contain pre-processor options, CFLAGS and CXXFLAGS only contain compilation options and LDFLAGS only contain linker flags, where all of these are honored in all build rules. Switch to set optional flags conditionally into the *FLAGS variables if they are not set, and then unconditionally append any required flags. And pass the various *FLAGS to the rules as expected. Signed-off-by: Guillem Jover <guillem@hadrons.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/Makefile b/examples/Makefile
index a5d0b93..d3c5000 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -1,8 +1,8 @@
CPPFLAGS ?=
override CPPFLAGS += -D_GNU_SOURCE -I../src/include/
-CFLAGS ?= -g -O2
-XCFLAGS =
-override CFLAGS += -D_GNU_SOURCE -Wall -L../src/
+CFLAGS ?= -g -O2 -Wall
+LDFLAGS ?=
+override LDFLAGS += -L../src/ -luring
include ../Makefile.quiet
@@ -23,7 +23,7 @@ test_srcs := io_uring-test.c io_uring-cp.c link-cp.c
test_objs := $(patsubst %.c,%.ol,$(test_srcs))
%: %.c
- $(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< -luring $(XCFLAGS)
+ $(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS)
clean:
@rm -f $(all_targets) $(test_objs)