I am trying to compile my project which has the following structure
Project:
- MakeFile
- Executable
- Source1
- .cxx
- .h
- Source2
- .cxx
- .h
- Build
- *.o
And I'm having difficulty writting a Makefile to compile. I currently have commands like:
Src1 = $(wildcard $(SRCDIR1)/*.cxx)
Obj1 = $(patsubst $(SRCDIR1)/%.cxx, $(OBJDIR)/%.o, $(Src1))
But then I have difficulty making the compile rules for the object files a) Because I can no longer do:
$(Obj1): %.cxx
$(CXX) $(CFLAGS) -c $(@:.o=.cxx) -o $@
Because the '$@' command now includes the path of the build directory and b) because the prerequisites now include the build path and I should have a source path. I have read large bits of the make manual to try and find a solution but no luck. Any help towards a solution appreciated! Jack