tags:

views:

80

answers:

2

Hi,

Using the command "make apps", I wanna generate two executables: main_test.exe and main_app2.exe. For some reason, the command to generate main_test.exe is more is less completley ignored when I run the makefile. Finally, I end up with a main_app.exe and main_app2.exe file but there is no main_test.exe file produced. Anyone an idea why objcopy command is ignored in my makefile?

# make apps to generate executables

main_app.exe: main.c lib3tests.a
 $(XCC) $(XCFLAGS) main.c $(XLDFLAGS) -o main_app.exe

main_test.exe: main_app.exe
  $/bin/sparc-elf-objcopy --add-section .myelfsection=file.txt --change-section-address .myelfsection=0xcd000000 --set-section-flags .myelfsection=alloc,contents,load,data main_app.exe

main_app2.exe: main.c lib3tests.a
 $(XCC) $(XCFLAGS) main.c $(XLDFLAGS) -o main_app2.exe

apps: main_app2.exe main_test.exe

Many thanks

+1  A: 

Make sure you have a TAB character (not spaces) before sparc-elf-objcopy in this line:

main_test.exe: main_app.exe
    $/bin/sparc-elf-objcopy --add-section .myelfsection=file.txt --change-section-address .myelfsection=0xcd000000 --set-section-flags .myelfsection=alloc,contents,load,data main_app.exe
Pablo Santa Cruz
Thanks, I tried this but the result remains the same. Despite a TAB there, the sparc-elf-objcopy line is still ignored.
Robert
What happens if you issue a `make main_app2.exe` command?
Pablo Santa Cruz
Then I get the error message: make: *** No rule to make target `main_app2.exe'. Stop.
Robert
What about `make main_test.exe`??
Pablo Santa Cruz
the same error. That makes sense as my target is named "apps".
Robert
You **also** have a target named `main_test.exe`. It's weird. Can you put your `Makefile` somewhere to download it?
Pablo Santa Cruz
Sure, it can be downloaded from here, thanks for your help: http://www.4shared.com/file/0vyXl92m/Makefile-share.html
Robert
+1  A: 

Your sparc-elf-objcopy command seems to lack an output filename.

Have you tried reducing your makefile to triviality, with no inline variables or other expansions occurring? I.e. Reduce it until make only calls your one line.

apps: main_app.exe
        sparc-elf-objcopy ... main_app.exe main_test.exe
Eric Towers
should be main_app.exe at the end of the line. The thing is, this objcopy line works fine when entered directly in the shell, but is ignored for some reason in the Makefile
Robert
To be perhaps more explicit. What is telling /bin/sparc-elf-objcopy to output to a file named main_test.exe ?
Eric Towers