From 928a6181403648aa8ebf6fd8a18594d8ab20b67d Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Wed, 17 Jul 2024 13:26:14 +0200 Subject: [PATCH] makfile --- src/cutils | 2 +- src/tests-cutils/makefile.d | 34 ++++++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/cutils b/src/cutils index 8cf0ab8..d6fa07c 160000 --- a/src/cutils +++ b/src/cutils @@ -1 +1 @@ -Subproject commit 8cf0ab8f25623889760fef03414c476c1cc19613 +Subproject commit d6fa07c12023662e16ace68bba78047e0244a9f7 diff --git a/src/tests-cutils/makefile.d b/src/tests-cutils/makefile.d index 3633bc1..03e4ae6 100644 --- a/src/tests-cutils/makefile.d +++ b/src/tests-cutils/makefile.d @@ -1,10 +1,10 @@ # # Makefile for C test projets -# > NAME : the name of the main program (if programs, make a single .d file -# per program, link them up in Makfile and use a $ssrcdir) -# > srcdir : the source directory -# > ssrcdir: the sub-sources directory (defaults to $srcdir) -# > dstdir: the destination directory (defaults to $srcdir/bin) +# > NAME : the name of the main program (if programs, make a single .d file +# per program, link them up in Makfile and use a $ssrcdir) +# > srcdir : the source directory +# > ssrcdir : the sub-sources directory (defaults to $srcdir) +# > dstdir : the destination directory (defaults to $srcdir/bin) # # Environment variables: # > PREFIX: where to (un)install (defaults to /usr/local) @@ -21,10 +21,16 @@ CXXFLAGS += -Wall -pedantic -I./ PREFIX = /usr/local # Required libraries if any: -LDFLAGS += -lcheck -lcutils-check +LDFLAGS += -lcutils-check +LDFLAGS += -lcheck $(shell pkg-config --libs --clfags check) # Required *locally compiled* libraries if any: -LIBS = cutils +LIBS = cutils + +# Code to test +# CODE = $(NAME) +# CODEO = $(NAME)/xxx.o \ +# $(NAME)/yyy.o ################################################################################ @@ -49,13 +55,17 @@ endif deps: $(foreach lib,$(LIBS),$(MAKE) --no-print-directory \ -C $(lib)/ dstdir=$(dstdir)) +$(CODEO): + $(foreach cod,$(CODE),$(MAKE) --no-print-directory \ + -C $(cod)/ dstdir=$(dstdir)) .PHONY: build rebuild install uninstall clean mrpropre mrpropre \ $(NAME) test run run-test run-test-more -SOURCES=$(wildcard $(ssrcdir)/*.c) -OBJECTS=$(SOURCES:%.c=%.o) -DEPENDS =$(SOURCES:%.c=%.d) +SOURCES = $(wildcard $(ssrcdir)/*.c) +OBJECTS = $(SOURCES:%.c=%.o) +OBJECTS += $(CODEO) +DEPENDS = $(SOURCES:%.c=%.d) # Autogenerate dependencies from code -include $(DEPENDS) @@ -90,6 +100,8 @@ $(dstdir)/$(NAME): $(OBJECTS) clean: $(foreach lib,$(LIBS),$(MAKE) --no-print-directory \ -C $(lib)/ $@ dstdir=$(dstdir)) + $(foreach cod,$(CODE),$(MAKE) --no-print-directory \ + -C $(cod)/ $@ dstdir=$(dstdir)) rm -f $(OBJECTS) rm -f $(DEPENDS) @@ -97,6 +109,8 @@ mrproper: mrpropre mrpropre: clean $(foreach lib,$(LIBS),$(MAKE) --no-print-directory \ -C $(lib)/ $@ dstdir=$(dstdir)) + $(foreach cod,$(CODE),$(MAKE) --no-print-directory \ + -C $(cod)/ $@ dstdir=$(dstdir)) rm -f $(dstdir)/$(NAME) rmdir $(dstdir) 2>/dev/null || true -- 2.27.0