I have a project with multiple subfolders under my include
folder. For instance:
include/
|-- foo/
|-- foo_header1.h
\-- foo_header2.h
|-- bar/
|-- bar_header1.h
\-- bar_header2.h
|-- root_header1.h
\-- root_header2.h
src/
|-- foo/
|-- foo_source1.cpp
\-- foo_source2.cpp
|-- bar/
|-- bar_source1.cpp
\-- bar_source2.cpp
|-- root_source1.cpp
|-- root_source2.cpp
\-- main.cpp
Curently my Makefile
is:
all:
g++ -Iinclude/ -Iinclude/foo -Iinclude/bar -o main src/*.cpp src/foo/*.cpp src/bar/*.cpp
I want a way to make that command "smarter", so I don't hardcode all the folders in my source and include directories (potentially my project will have many folders). I just want some way to specify the root header directory and make g++ find the files recursively.
Does anyone know if I can do that? Maybe using the makefile or some special flag of g++
...