79694832

Date: 2025-07-08 21:18:05
Score: 0.5
Natty:
Report link

Well, so far I have resolved by avoiding stripping the full source path and having a parallel path for the object:

BUILDDIR = ./build
EXT_SRC := $(wildcard ext/lib1/src/*.c) \
          $(wildcard ext/lib2/*.c) \
          $(wildcard ext/lib3/xyz/*.c)
EXT_OBJ := $(EXT_SRC:%.c=$(BUILDDIR)/%.o)

$(BUILDDIR)/ext/%.o: ext/%.c
    mkdir -p $(dir $@)
    $(CC) $(CFLAGS) -c $^ -o $@

.PHONY: clean
clean:
    rm -rf $(BUILDDIR)
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: user3758232