[1/2] Fix Makefile to delete objects from the library on make clean
diff mbox series

Message ID 20200515205649.1670512-2-Jes.Sorensen@gmail.com
State Superseded
Headers show
Series
  • fsverity-utils Makefile fixes
Related show

Commit Message

Jes Sorensen May 15, 2020, 8:56 p.m. UTC
From: Jes Sorensen <jsorensen@fb.com>

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

Comments

Eric Biggers May 20, 2020, 2:42 a.m. UTC | #1
On Fri, May 15, 2020 at 04:56:48PM -0400, Jes Sorensen wrote:
> From: Jes Sorensen <jsorensen@fb.com>
> 
> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
> ---
>  Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Makefile b/Makefile
> index 1a7be53..c5f46f4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -81,6 +81,7 @@ LIB_SRC         := $(wildcard lib/*.c)
>  LIB_HEADERS     := $(wildcard lib/*.h) $(COMMON_HEADERS)
>  STATIC_LIB_OBJ  := $(LIB_SRC:.c=.o)
>  SHARED_LIB_OBJ  := $(LIB_SRC:.c=.shlib.o)
> +LIB_OBJS        := $(SHARED_LIB_OBJ) $(STATIC_LIB_OBJ)
>  
>  # Compile static library object files
>  $(STATIC_LIB_OBJ): %.o: %.c $(LIB_HEADERS) .build-config
> -- 

Thanks for pointing this out.  I think it would be a bit easier to just use a
wildcard in the clean target, though.

diff --git a/Makefile b/Makefile
index 1a7be53..e7fb5cf 100644
--- a/Makefile
+++ b/Makefile
@@ -180,8 +180,8 @@ help:
 	done
 
 clean:
-	rm -f $(DEFAULT_TARGETS) $(TEST_PROGRAMS) $(LIB_OBJS) $(ALL_PROG_OBJ) \
-		.build-config
+	rm -f $(DEFAULT_TARGETS) $(TEST_PROGRAMS) \
+		lib/*.o programs/*.o .build-config
 
 FORCE:

Patch
diff mbox series

diff --git a/Makefile b/Makefile
index 1a7be53..c5f46f4 100644
--- a/Makefile
+++ b/Makefile
@@ -81,6 +81,7 @@  LIB_SRC         := $(wildcard lib/*.c)
 LIB_HEADERS     := $(wildcard lib/*.h) $(COMMON_HEADERS)
 STATIC_LIB_OBJ  := $(LIB_SRC:.c=.o)
 SHARED_LIB_OBJ  := $(LIB_SRC:.c=.shlib.o)
+LIB_OBJS        := $(SHARED_LIB_OBJ) $(STATIC_LIB_OBJ)
 
 # Compile static library object files
 $(STATIC_LIB_OBJ): %.o: %.c $(LIB_HEADERS) .build-config