summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmmar Faizi <ammar.faizi@students.amikom.ac.id>2021-10-30 22:55:53 +0700
committerJens Axboe <axboe@kernel.dk>2021-10-31 16:30:00 -0600
commitd543ff1a23d0a9ad7a2628f60194896f9033f27e (patch)
tree2a32063187df4c4a3c0b934b393284a9edfe13ad
parentdd317a1938c00ba71d29aa7903fc1f78273c6009 (diff)
downloadliburing-d543ff1a23d0a9ad7a2628f60194896f9033f27e.tar.gz
liburing-d543ff1a23d0a9ad7a2628f60194896f9033f27e.tar.bz2
examples/Makefile: Fix missing clean up
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>
-rw-r--r--examples/Makefile21
1 files changed, 15 insertions, 6 deletions
diff --git a/examples/Makefile b/examples/Makefile
index d3c5000..f966f94 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -10,20 +10,29 @@ ifneq ($(MAKECMDGOALS),clean)
include ../config-host.mak
endif
-all_targets += io_uring-test io_uring-cp link-cp
+example_srcs := \
+ io_uring-cp.c \
+ io_uring-test.c \
+ link-cp.c
+
+all_targets :=
+
ifdef CONFIG_HAVE_UCONTEXT
-all_targets += ucontext-cp
+ example_srcs += ucontext-cp.c
endif
+all_targets += ucontext-cp
-all: $(all_targets)
+example_targets := $(patsubst %.c,%,$(patsubst %.cc,%,$(example_srcs)))
+all_targets += $(example_targets)
-test_srcs := io_uring-test.c io_uring-cp.c link-cp.c
-test_objs := $(patsubst %.c,%.ol,$(test_srcs))
+all: $(example_targets)
%: %.c
$(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS)
clean:
- @rm -f $(all_targets) $(test_objs)
+ @rm -f $(all_targets)
+
+.PHONY: all clean