#36876 - Mucca - Wed Mar 02, 2005 7:34 pm
Im banging my head off the desk trying to get my makefile work as Id like. For various reasons, my source files, makefiles, and vstudio project files are all in different locations. Thats obviously no problem. The problem I have is I cant get the source files to compile to object files in yet another directory.
I call make as such:
Then in the make file I have a list of source files listed like this:
and the correct object files derived like this:
Obviously theres a problem here as the o files have no path, therefore I wanted to move into a build directory and have the o files compile to there.
The problem is theres seems to be then no link between src/gfx/foo.cpp and bld/foo.o.
Ive tried many things - eg compiling the files into source directory, then moving them to build directory, however this destroys the usefullness of make, as every time I compile it has to compile every source file again. Also tried to get work-directory switching going but was faced problems (I also need to create the build directory if it does not exist).
The makefile that comes with devkit advance was similar to what I need, except it works on source directories and not individual source files. Plus it does one or two things that I dont really get and that irks me.
I guess what I need is a solution for redirecting the object files compiled from source files.
Any help welcome :)
I call make as such:
Code: |
make -C ../makefiles -f proj1.mak
|
Then in the make file I have a list of source files listed like this:
Code: |
SRCDIR = ../src
CPPFILES = $(SRCDIR)/gfx/foo.cpp\ etc. |
and the correct object files derived like this:
Code: |
OFILES := $(notdir $(CPPFILES:.cpp=.o)) |
Obviously theres a problem here as the o files have no path, therefore I wanted to move into a build directory and have the o files compile to there.
The problem is theres seems to be then no link between src/gfx/foo.cpp and bld/foo.o.
Ive tried many things - eg compiling the files into source directory, then moving them to build directory, however this destroys the usefullness of make, as every time I compile it has to compile every source file again. Also tried to get work-directory switching going but was faced problems (I also need to create the build directory if it does not exist).
The makefile that comes with devkit advance was similar to what I need, except it works on source directories and not individual source files. Plus it does one or two things that I dont really get and that irks me.
I guess what I need is a solution for redirecting the object files compiled from source files.
Any help welcome :)