All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH liburing v3 0/4] Changes for Makefile
@ 2022-03-10 11:12 Alviro Iskandar Setiawan
  2022-03-10 11:12 ` [PATCH liburing v3 1/4] src/Makefile: Remove `-fomit-frame-pointer` from default build Alviro Iskandar Setiawan
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-03-10 11:12 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Alviro Iskandar Setiawan, Pavel Begunkov, Ammar Faizi,
	Alviro Iskandar Setiawan, io-uring, gwml

Hello sir,

This patchset (v3) changes Makefile. 4 patches here:

1. Remove -fomit-frame-pointer flag, because it's already covered
   by the -O2 optimization flag.

2. When the header files are modified, the compiled objects are
   not going to be recompiled because the header files are not
   marked as a dependency for the objects.

  - Instruct the compiler to generate dependency files.

  - Include those files from src/Makefile. Ensure if any changes are
    made, files that depend on the changes are recompiled.

3. The test binaries statically link liburing using liburing.a file.
   When liburing.a is recompiled, make sure the tests are also
   recompiled to ensure changes are applied to the test binary. It
   makes "make clean" command optional when making changes.

4. Same as no. 3, but for examples.

please review,
thx

link v2: https://lore.kernel.org/io-uring/20220310103224.1675123-1-alviro.iskandar@gnuweeb.org/
v2 -> v3: 
  - Add dependency files to .gitignore.
  - Remove dependency files when running "make clean".

link v1: https://lore.kernel.org/io-uring/20220308224002.3814225-1-alviro.iskandar@gnuweeb.org/
v1 -> v2:
  - Instruct the compiler to generate dependency files instead
    of hard code it in the Makefile.
  - Add liburing.a to dependency for test (patch 3).
  - Add liburing.a to dependency for examples (patch 4).

Signed-off-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>
---

Alviro Iskandar Setiawan (4):
  src/Makefile: Remove `-fomit-frame-pointer` from default build
  src/Makefile: Add header files as dependency
  test/Makefile: Add liburing.a as a dependency
  examples/Makefile: Add liburing.a as a dependency

 .gitignore        |  1 +
 examples/Makefile |  2 +-
 src/Makefile      | 15 +++++++--------
 test/Makefile     |  4 ++--
 4 files changed, 11 insertions(+), 11 deletions(-)


base-commit: 6231f56da7881bde6fb011e1b54d672f8fe5a224
-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH liburing v3 1/4] src/Makefile: Remove `-fomit-frame-pointer` from default build
  2022-03-10 11:12 [PATCH liburing v3 0/4] Changes for Makefile Alviro Iskandar Setiawan
@ 2022-03-10 11:12 ` Alviro Iskandar Setiawan
  2022-03-10 11:12 ` [PATCH liburing v3 2/4] src/Makefile: Add header files as dependency Alviro Iskandar Setiawan
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-03-10 11:12 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Alviro Iskandar Setiawan, Pavel Begunkov, Ammar Faizi,
	Alviro Iskandar Setiawan, io-uring, gwml

-fomit-frame-pointer is already turned on by -O1 optimization flag.

The liburing default compilation uses -O2 optimization, -O2 turns on
all optimization flags specified by -O1. Therefore, we don't need to
specify -fomit-frame-pointer here. Remove it.

Link: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
Signed-off-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>
---
 src/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Makefile b/src/Makefile
index 3e1192f..f19d45e 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -8,7 +8,7 @@ libdevdir ?= $(prefix)/lib
 CPPFLAGS ?=
 override CPPFLAGS += -D_GNU_SOURCE \
 	-Iinclude/ -include ../config-host.h
-CFLAGS ?= -g -fomit-frame-pointer -O2 -Wall -Wextra -fno-stack-protector
+CFLAGS ?= -g -O2 -Wall -Wextra -fno-stack-protector
 override CFLAGS += -Wno-unused-parameter -Wno-sign-compare -DLIBURING_INTERNAL
 SO_CFLAGS=-fPIC $(CFLAGS)
 L_CFLAGS=$(CFLAGS)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH liburing v3 2/4] src/Makefile: Add header files as dependency
  2022-03-10 11:12 [PATCH liburing v3 0/4] Changes for Makefile Alviro Iskandar Setiawan
  2022-03-10 11:12 ` [PATCH liburing v3 1/4] src/Makefile: Remove `-fomit-frame-pointer` from default build Alviro Iskandar Setiawan
@ 2022-03-10 11:12 ` Alviro Iskandar Setiawan
  2022-03-10 11:12 ` [PATCH liburing v3 3/4] test/Makefile: Add liburing.a as a dependency Alviro Iskandar Setiawan
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-03-10 11:12 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Alviro Iskandar Setiawan, Pavel Begunkov, Ammar Faizi,
	Alviro Iskandar Setiawan, io-uring, gwml

When the header files are modified, the compiled objects are not going
to be recompiled because the header files are not marked as a dependency
for the objects.

  - Instruct the compiler to generate dependency files.

  - Include those files from src/Makefile. Ensure if any changes are
    made, files that depend on the changes are recompiled.

Suggested-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Signed-off-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>
---

v2 -> v3: 
  - Add dependency files to .gitignore.
  - Remove dependency files when running "make clean".

 .gitignore   |  1 +
 src/Makefile | 13 ++++++-------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/.gitignore b/.gitignore
index c9dc77f..9b74880 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
 *~
 /*.patch
 
+*.d
 *.o
 *.o[ls]
 
diff --git a/src/Makefile b/src/Makefile
index f19d45e..0e04986 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -43,19 +43,20 @@ else
 	liburing_srcs += syscall.c
 endif
 
+override CPPFLAGS += -MT "$@" -MMD -MP -MF "$@.d"
 liburing_objs := $(patsubst %.c,%.ol,$(liburing_srcs))
 liburing_sobjs := $(patsubst %.c,%.os,$(liburing_srcs))
 
-$(liburing_srcs): syscall.h lib.h
-
-$(liburing_objs) $(liburing_sobjs): include/liburing/io_uring.h
-
 %.os: %.c
 	$(QUIET_CC)$(CC) $(CPPFLAGS) $(SO_CFLAGS) -c -o $@ $<
 
 %.ol: %.c
 	$(QUIET_CC)$(CC) $(CPPFLAGS) $(L_CFLAGS) -c -o $@ $<
 
+# Include compiler generated dependency files.
+-include $(liburing_objs:%=%.d)
+-include $(liburing_sobjs:%=%.d)
+
 AR ?= ar
 RANLIB ?= ranlib
 liburing.a: $(liburing_objs)
@@ -78,11 +79,9 @@ ifeq ($(ENABLE_SHARED),1)
 	ln -sf $(relativelibdir)$(libname) $(libdevdir)/liburing.so
 endif
 
-$(liburing_objs): include/liburing.h
-
 clean:
 	@rm -f $(all_targets) $(liburing_objs) $(liburing_sobjs) $(soname).new
-	@rm -f *.so* *.a *.o
+	@rm -f *.so* *.a *.o *.d
 	@rm -f include/liburing/compat.h
 
 	@# When cleaning, we don't include ../config-host.mak,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH liburing v3 3/4] test/Makefile: Add liburing.a as a dependency
  2022-03-10 11:12 [PATCH liburing v3 0/4] Changes for Makefile Alviro Iskandar Setiawan
  2022-03-10 11:12 ` [PATCH liburing v3 1/4] src/Makefile: Remove `-fomit-frame-pointer` from default build Alviro Iskandar Setiawan
  2022-03-10 11:12 ` [PATCH liburing v3 2/4] src/Makefile: Add header files as dependency Alviro Iskandar Setiawan
@ 2022-03-10 11:12 ` Alviro Iskandar Setiawan
  2022-03-10 11:12 ` [PATCH liburing v3 4/4] examples/Makefile: " Alviro Iskandar Setiawan
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-03-10 11:12 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Alviro Iskandar Setiawan, Pavel Begunkov, Ammar Faizi,
	Alviro Iskandar Setiawan, io-uring, gwml

The test binaries statically link liburing using liburing.a file. When
liburing.a is recompiled, make sure the tests are also recompiled to
ensure changes are applied to the test binary. It makes "make clean"
command optional when making changes.

Signed-off-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>
---
 test/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/Makefile b/test/Makefile
index f421f53..9dae002 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -196,10 +196,10 @@ all: $(test_targets)
 helpers.o: helpers.c
 	$(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
 
-%: %.c $(helpers) helpers.h
+%: %.c $(helpers) helpers.h ../src/liburing.a
 	$(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(helpers) $(LDFLAGS)
 
-%: %.cc $(helpers) helpers.h
+%: %.cc $(helpers) helpers.h ../src/liburing.a
 	$(QUIET_CXX)$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $< $(helpers) $(LDFLAGS)
 
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH liburing v3 4/4] examples/Makefile: Add liburing.a as a dependency
  2022-03-10 11:12 [PATCH liburing v3 0/4] Changes for Makefile Alviro Iskandar Setiawan
                   ` (2 preceding siblings ...)
  2022-03-10 11:12 ` [PATCH liburing v3 3/4] test/Makefile: Add liburing.a as a dependency Alviro Iskandar Setiawan
@ 2022-03-10 11:12 ` Alviro Iskandar Setiawan
  2022-03-10 11:40 ` [PATCH liburing v3 0/4] Changes for Makefile Ammar Faizi
  2022-03-10 12:14 ` Jens Axboe
  5 siblings, 0 replies; 7+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-03-10 11:12 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Alviro Iskandar Setiawan, Pavel Begunkov, Ammar Faizi,
	Alviro Iskandar Setiawan, io-uring, gwml

The example binaries statically link liburing using liburing.a file.
When liburing.a is recompiled, make sure the example binaries are also
recompiled to ensure changes are applied to the binaries. It makes
"make clean" command optional when making changes.

Signed-off-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>
---
 examples/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/Makefile b/examples/Makefile
index f966f94..95a45f9 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -29,7 +29,7 @@ all_targets += $(example_targets)
 
 all: $(example_targets)
 
-%: %.c
+%: %.c ../src/liburing.a
 	$(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS)
 
 clean:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH liburing v3 0/4] Changes for Makefile
  2022-03-10 11:12 [PATCH liburing v3 0/4] Changes for Makefile Alviro Iskandar Setiawan
                   ` (3 preceding siblings ...)
  2022-03-10 11:12 ` [PATCH liburing v3 4/4] examples/Makefile: " Alviro Iskandar Setiawan
@ 2022-03-10 11:40 ` Ammar Faizi
  2022-03-10 12:14 ` Jens Axboe
  5 siblings, 0 replies; 7+ messages in thread
From: Ammar Faizi @ 2022-03-10 11:40 UTC (permalink / raw)
  To: Alviro Iskandar Setiawan, Jens Axboe
  Cc: Pavel Begunkov, Alviro Iskandar Setiawan, io-uring, gwml

On 3/10/22 6:12 PM, Alviro Iskandar Setiawan wrote:
> Hello sir,
> 
> This patchset (v3) changes Makefile. 4 patches here:
> 
> 1. Remove -fomit-frame-pointer flag, because it's already covered
>     by the -O2 optimization flag.
> 
> 2. When the header files are modified, the compiled objects are
>     not going to be recompiled because the header files are not
>     marked as a dependency for the objects.
> 
>    - Instruct the compiler to generate dependency files.
> 
>    - Include those files from src/Makefile. Ensure if any changes are
>      made, files that depend on the changes are recompiled.
> 
> 3. The test binaries statically link liburing using liburing.a file.
>     When liburing.a is recompiled, make sure the tests are also
>     recompiled to ensure changes are applied to the test binary. It
>     makes "make clean" command optional when making changes.
> 
> 4. Same as no. 3, but for examples.
> 
> please review,
> thx

I think this series looks good.

-- 
Ammar Faizi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH liburing v3 0/4] Changes for Makefile
  2022-03-10 11:12 [PATCH liburing v3 0/4] Changes for Makefile Alviro Iskandar Setiawan
                   ` (4 preceding siblings ...)
  2022-03-10 11:40 ` [PATCH liburing v3 0/4] Changes for Makefile Ammar Faizi
@ 2022-03-10 12:14 ` Jens Axboe
  5 siblings, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2022-03-10 12:14 UTC (permalink / raw)
  To: Alviro Iskandar Setiawan
  Cc: Ammar Faizi, Alviro Iskandar Setiawan, io-uring, Pavel Begunkov, gwml

On Thu, 10 Mar 2022 11:12:27 +0000, Alviro Iskandar Setiawan wrote:
> This patchset (v3) changes Makefile. 4 patches here:
> 
> 1. Remove -fomit-frame-pointer flag, because it's already covered
>    by the -O2 optimization flag.
> 
> 2. When the header files are modified, the compiled objects are
>    not going to be recompiled because the header files are not
>    marked as a dependency for the objects.
> 
> [...]

Applied, thanks!

[1/4] src/Makefile: Remove `-fomit-frame-pointer` from default build
      commit: de214792d38700ba470a560cf3729a9bd62acb35
[2/4] src/Makefile: Add header files as dependency
      commit: 9ea9df11bbdbbf3bceae38679dd175b092950142
[3/4] test/Makefile: Add liburing.a as a dependency
      commit: b48d6af787c00fd4a8f3614f8c1a0443a3054eef
[4/4] examples/Makefile: Add liburing.a as a dependency
      commit: 115cca320dd4df9293440d8e410bebb064822265

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-03-10 12:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-10 11:12 [PATCH liburing v3 0/4] Changes for Makefile Alviro Iskandar Setiawan
2022-03-10 11:12 ` [PATCH liburing v3 1/4] src/Makefile: Remove `-fomit-frame-pointer` from default build Alviro Iskandar Setiawan
2022-03-10 11:12 ` [PATCH liburing v3 2/4] src/Makefile: Add header files as dependency Alviro Iskandar Setiawan
2022-03-10 11:12 ` [PATCH liburing v3 3/4] test/Makefile: Add liburing.a as a dependency Alviro Iskandar Setiawan
2022-03-10 11:12 ` [PATCH liburing v3 4/4] examples/Makefile: " Alviro Iskandar Setiawan
2022-03-10 11:40 ` [PATCH liburing v3 0/4] Changes for Makefile Ammar Faizi
2022-03-10 12:14 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.