hi,
I have 2 directories (../src/dir_a and ../src/dir_b) each with its own .cpp files.
I have written the below foreach function, but the problem is that it is reading the .cpp files from both directories, dir_a and dir_b, to create libdir.a. Is there a way I can rewrite dirs (without hard-coding the directory names) so I can create 2 separate libraries for source files from each directory.
dirs := $(shell echo ../src/*)
find_files = $(wildcard $(dir)/*.cpp)
cppsources :=$(foreach dir, $(dirs),$(find_files))
cppobjects :=$(cppsources:.cpp=.o)
cppobjects: $(cppsources)
echo "this is the objects line"
libdir.a: cppobjects
ar rcs $@ $(cppobjects)
ranlib $@
thanks!