Files
third_party_liburing/examples/Makefile
T
Guillem Jover 130e82b9f2 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>
2021-09-13 13:19:25 +02:00

30 lines
574 B
Makefile

CPPFLAGS ?=
override CPPFLAGS += -D_GNU_SOURCE -I../src/include/
CFLAGS ?= -g -O2 -Wall
LDFLAGS ?=
override LDFLAGS += -L../src/ -luring
include ../Makefile.quiet
ifneq ($(MAKECMDGOALS),clean)
include ../config-host.mak
endif
all_targets += io_uring-test io_uring-cp link-cp
ifdef CONFIG_HAVE_UCONTEXT
all_targets += ucontext-cp
endif
all: $(all_targets)
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 $@ $< $(LDFLAGS)
clean:
@rm -f $(all_targets) $(test_objs)