Can't open source from build window with external makefile

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have 2 avr studio projects: 1 using the generated makefile and one using an external makefile. I can always open a source file from the build window with the generated makefile project, but not with the external makefile.

I noticed that the generated makefile must change to the "default" output directory when runnign GCC so compile errors are reported as "../sourcefile.c:119 ..." But my custom makefile builds in the same directory as the .c and .aps files. So errors just look like "sourcefile:119".

Has anyone else seen this? Do custom makefiles need to report GCC errors relative to the output directory?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just read the output from either makefile. Obviously the Studio "internal" makefile is the sort of output that you need.

Studio is compiling from a Makefile in the "default" subdirectory of your project. So it is looking for file.c in the "default"'s parent directory.

Either set a specific rule for each of your objects like Studio does. (with its absolute path)

Or add an absolute path to the .c.o: builtin rules

Edit: This is probably the easiest to do, in your Makefile alter the builtin rule and add your absolute path:

# place your absolute directory path here
SRCPATH = /src/lockcard/

# Compile: create object files from C source files.
.c.o:
	$(CC) -c $(ALL_CFLAGS) $(SRCPATH)$< -o $@ 

If you have no macro for $(SRCPATH) then this will behave in the regular fashion. Obviously test the operation with "make -n".

David.