Hi

My project looks like:

├── build
│   |── makefile
|
└── src
    ├── subsys1
    │   ├── includes
    │   └── src_1.cpp
    └── subsys2
        ├── includes
        └── src_2.cpp

I want the object files and executable to be stored in the build directory.

My makefile has:

OBJDIR = _gnuRelease

CPP_FILES = ../src/subsys1/src_1.cpp ../src/subsys1/src_2.cpp

OBJ_FILES_TMP = $(patsubst %.cpp,%.o,$(CPP_FILES))
OBJ_FILES = $(addprefix $(OBJDIR)/,$(notdir $(OBJ_FILES_TMP)))

$(APP) : $(OBJ_FILES)
        $(LINKER) $(CXXFLAGS) $^ -o $@ 

%.o: %.cpp
        $(CXX) $(CXXFLAGS) $(INC_SWITCHES) -c $< -o $@

Best regards

David


_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to