Helmut Giese
2007-11-23 13:37:28 UTC
Hello out there,
seems like I forgot some of the finer points on using a makefile.
I can create a list of .obj files from my source files
# Create list of .obj files from C files
COBJS = $(CSRCS:.c=.obj)
and I know about implicit rules like
# compile any C file
.c.obj:
$(CC) -c $(CCFLAGS) -o $@ $<
which make for compact and easy to maintain makefiles.
Everything works well as long as source and .obj files share the same
directory. However I would like to place my .obj files into a sub
directory (say OBJ) - and I fail miserably when trying to adapt the
above syntax to using different directories.
I am near to certain that (many) years ago I knew how to achieve this
and so I think that it is possible.
Any tips will be greatly appreciated.
Best regards
Helmut Giese
seems like I forgot some of the finer points on using a makefile.
I can create a list of .obj files from my source files
# Create list of .obj files from C files
COBJS = $(CSRCS:.c=.obj)
and I know about implicit rules like
# compile any C file
.c.obj:
$(CC) -c $(CCFLAGS) -o $@ $<
which make for compact and easy to maintain makefiles.
Everything works well as long as source and .obj files share the same
directory. However I would like to place my .obj files into a sub
directory (say OBJ) - and I fail miserably when trying to adapt the
above syntax to using different directories.
I am near to certain that (many) years ago I knew how to achieve this
and so I think that it is possible.
Any tips will be greatly appreciated.
Best regards
Helmut Giese