On Sat, 2015-11-14 at 14:01 +0800, Bamvor Jian Zhang wrote:
> User need to provide cap-ng.h and libcap-ng.so for cross compiling
> which could be done by pass extra cflags to EXTRA_CLAGS. But other
> testcases pass CFLAGS instead.
>
> Change CLAGS ':=' to CLAGS '+=' to align with others. Delete useless
> EXTRA_CLAGS at the same time.
Actually I think you can clean this up even more. I don't see any reason it
can't use the implicit rule for compilation.
Also libraries should be in LDLIBS, not CFLAGS. And we can change the ordering
so that we don't need to define all multiple times.
Can you test this works for you?
cheers
diff --git a/tools/testing/selftests/capabilities/Makefile
b/tools/testing/selftests/capabilities/Makefile
index 8c8f0c1f0889..5f690c1ae894 100644
--- a/tools/testing/selftests/capabilities/Makefile
+++ b/tools/testing/selftests/capabilities/Makefile
@@ -1,18 +1,14 @@
-all:
-
-include ../lib.mk
-
-.PHONY: all clean
-
TARGETS := validate_cap test_execve
TEST_PROGS := test_execve
-CFLAGS := -O2 -g -std=gnu99 -Wall -lcap-ng
+CFLAGS += -O2 -g -std=gnu99 -Wall
+LDLIBS += -lcap-ng -lrt -ldl
all: $(TARGETS)
+include ../lib.mk
+
clean:
$(RM) $(TARGETS)
-$(TARGETS): %: %.c
- $(CC) -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl
+.PHONY: all clean
--
To unsubscribe from this list: send the line "unsubscribe linux-api" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html