I'm trying to create a Makefile that has a target per src/
subfolder so that it creates a static lib.
I am currently trying this:
%.o: %.cpp
$(CXX) $(CXXFLAGS) $(INCLUDE) -c -o $@ $<
lib%.a: $(patsubst %.cpp, %.o, $(wildcard src/%/*.cpp))
$(AR) rcs $@ $^
But this doesn't work, the target matching works, but the dependency tracking doesn't.
If I just leave alone src/%/*.cpp
that completes properly to the .cpp
files in the proper dir, but the moment I try to use it inside string functions to convert the .cpp
to .o
the %
does not work anymore.