nmake makefile to compile from a different directory

Hi,

I am trying to write a makefile(stored in Makefile directory) which will compile source files from Source directory, and place the object files and executables in Objects directory. There is just a single C file for now, i intend to use this setup as i go along doing (hopefully) more serious stuff.

So the directory structure is MyPrj which contains Makefile, Source and Objects.

this is the makefile i am trying to get to work with , but it isn't :(

1
2
3
4
5
6
7
8
CC=cl
link=link
SOURCE_DIR=..\Source
OUTPUT_DIR=..\Objects
.c.obj:
   $(CC) $(SOURCE_DIR)\$*.c /Fo$(OUTPUT_DIR)\$*.obj
MyTest: $(OUTPUT_DIR)\$*.obj
   $(link) $(OUTPUT_DIR)\$*.obj -out:test.exe


This gives me the following error:
1
2
NMAKE : fatal error U1073: don't know how to make 'test.obj'
Stop. 


Help!!!
Topic archived. No new replies allowed.