Several things go wrong with this Makefile:
1) Using `test_srcs` to generate `test_objs`.
2) `test_objs` is an unused variable. So (1) is pointless.
3) `make clean` does not remove `ucontext-cp` binary.
I assume (1) and (2) were blindly copied from the test Makefile.
For 3, the `make clean` removes $(all_targets) and $(test_objs). But
`ucontext-cp` only exists in $(all_targets) if we have
`CONFIG_HAVE_UCONTEXT`. When the target goal is `clean`, we will not
have any of `CONFIG_*` variables. Thus, `ucontext-cp` is not removed.
Clean them up!
Signed-off-by: Ammar Faizi <ammar.faizi@students.amikom.ac.id>
Link: https://lore.kernel.org/r/20211030114858.320116-2-ammar.faizi@intel.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
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>
The header file `ucontext.h` is not available on musl based distros. The
example `ucontext-cp` is not built if `configure` fails to locate the
header.
Signed-off-by: Simon Zeni <simon@bl4ckb0ne.ca>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Split preprocessor flags into CPPFLAGS to be passed to rules involving
code compilation, instead of link-only rules. This also guarantees we
always use the user set CPPFLAGS which are expected to be honored by
most build systems. Move build system required C++ flags into an
override for CXXFLAGS to follow the same pattern as the other flags.
Signed-off-by: Guillem Jover <guillem@hadrons.org>
Coroutines are often used to simplify async programming,
and work great with liburing.
`ucontext` doesn't perform very good, but it's enough for an example.
It is not possible to install barrier.h and compat.h into the top-level
/usr/include directly since they are likely to conflict with other
software. io_uring.h could be confused with the system's kernel header
file.
Put liburing headers into <liburing/*.h> so there is no chance of
conflicts or confusion.
Existing applications continue to build successfully since the location
of <liburing.h> is unchanged. In-tree examples and tests require
modification because src/liburing.h is moved to src/include/liburing.h.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This patch makes the liburing build work as expected for e.g. the following
command:
make CFLAGS=-m32
and avoids that the build fails as follows for the above command:
make[1]: Entering directory 'liburing/test'
cc -m32 -o poll poll.c -luring
/usr/bin/ld: cannot find -luring
collect2: error: ld returned 1 exit status
Makefile:18: recipe for target 'poll' failed
make[1]: *** [poll] Error 1
make[1]: Leaving directory 'software/liburing/test'
Makefile:12: recipe for target 'all' failed
make: *** [all] Error 2
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Just a basic test case that does various forms of linked nops, and
a sample bare bones copy program using linked reads and writes.
Signed-off-by: Jens Axboe <axboe@kernel.dk>