commit 3e30f7561a8b52dd0ae3f7b12392ea3b64cde6c5
parent 76fa3218bad5cf942da839291155cdbdaa19c4a3
Author: vaplv <vaplv@free.fr>
Date: Tue, 14 Mar 2023 15:19:22 +0100
Cleanup the POSIX Makefile
Added a clean_test target that uses the make.sh script to remove test
executables. Display a summary of the build line rather than the full
command line arguments
Diffstat:
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile
@@ -32,7 +32,8 @@ build_library: $(DEP) .config
$(OBJ): config.mk
libaw.so: $(OBJ)
- $(CC) $(CFLAGS) -o $@ $(OBJ) $(LDFLAGS)
+ @echo "LD $@"
+ @$(CC) $(CFLAGS) -o $@ $(OBJ) $(LDFLAGS)
.config: Makefile config.mk
@echo "Setup .config"
@@ -42,11 +43,11 @@ libaw.so: $(OBJ)
.SUFFIXES: .c .d .o
.c.d:
- @echo "Computing dependencies for $<"
@$(CC) $(CFLAGS) -MM -MT "$(@:.d=.o) $@" $< -MF $@
.c.o:
- $(CC) $(CFLAGS) -DAW_SHARED_BUILD -c $< -o $@
+ @echo "CC $@"
+ @$(CC) $(CFLAGS) -DAW_SHARED_BUILD -c $< -o $@
################################################################################
# Installation
@@ -99,21 +100,25 @@ test_run: test_bin
@$(SHELL) make.sh run_test src/test_aw_mtl.c src/test_aw_obj.c
$(TEST_OBJ): config.mk
- $(CC) $(CFLAGS) -c $(@:.o=.c) -o $@
+ @echo "CC $@"
+ @$(CC) $(CFLAGS) -c $(@:.o=.c) -o $@
test_aw test_aw_mtl test_aw_obj: libaw.so
- $(CC) $(CFLAGS) -o $@ -L$$(pwd) src/$@.o $$($(PKG_CONFIG) --libs rsys) -law -lrsys
+ @echo "LD $@"
+ @$(CC) $(CFLAGS) -o $@ -L$$(pwd) src/$@.o $$($(PKG_CONFIG) --libs rsys) -law -lrsys
+
+clean_test:
+ @rm -f test_cbox.obj test_obj_cube.obj test_obj_plane.obj test_obj_squares.obj
+ @rm -f mtl0.mtl test_mtl_common.mtl test_mtl_multi.mtl
+ @$(SHELL) make.sh clean_test $(TEST_SRC)
################################################################################
# Miscellaneous targets
################################################################################
all: build_library build_tests
-clean:
- @rm -f test_cbox.obj test_obj_cube.obj test_obj_plane.obj test_obj_squares.obj
- @rm -f mtl0.mtl test_mtl_common.mtl test_mtl_multi.mtl
+clean: clean_test
@rm -f $(OBJ) $(TEST_OBJ) libaw.so .test aw.pc .config
- @rm -f $$(for i in $(TEST_SRC); do echo $${i} | sed 's/src\/\(.\{1,\}\).c$$/\1/'; done)
distclean: clean
@rm -f $(DEP) $(TEST_DEP)