Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am building a program on a TS-7800(SBC), and when I run make (show below), it appears to go through all of the steps normally, but in the end i do not get a binary file. Why is this, and how can I get my file.

makefile

CC= /home/eclipse/ReidTest/cc/cross-toolchains/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc 

# compiler options

#CFLAGS= -O2
CFLAGS= -mcpu=arm9 
#CFLAGS= -pg -Wall

# linker

LN= $(CC)

# linker options

LNFLAGS= 
#LNFLAGS= -pg

# extra libraries used in linking (use -l command)

LDLIBS= -lpthread

# source files

SOURCES= HMITelem.c Cpacket.c GPS.c ADC.c Wireless.c Receivers.c CSVReader.c RPM.c RS485.c

# include files

INCLUDES= Cpacket.h HMITelem.h CSVReader.h RS485.h

# object files

OBJECTS= HMITelem.o Cpacket.o GPS.o ADC.o Wireless.o Receivers.o CSVReader.o RPM.o RS485.o

HMITelem: $(OBJECTS)
    $(LN) $(LNFLAGS) -o $@ $(OBJECTS) $(LDLIBS)

.c.o:   $*.c
    $(CC) $(CFLAGS) -c $*.c

RUN : ./HMITelem

#clean:
#   rm -f *.o
#   rm -f *~

Output

root@ts7800:ReidTest# make
/home/eclipse/ReidTest/cc/cross-toolchains/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc  -mcpu=arm9  -c HMITelem.c
/home/eclipse/ReidTest/cc/cross-toolchains/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc  -mcpu=arm9  -c Cpacket.c
/home/eclipse/ReidTest/cc/cross-toolchains/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc  -mcpu=arm9  -c GPS.c
/home/eclipse/ReidTest/cc/cross-toolchains/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc  -mcpu=arm9  -c ADC.c
/home/eclipse/ReidTest/cc/cross-toolchains/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc  -mcpu=arm9  -c Wireless.c
/home/eclipse/ReidTest/cc/cross-toolchains/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc  -mcpu=arm9  -c Receivers.c
/home/eclipse/ReidTest/cc/cross-toolchains/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc  -mcpu=arm9  -c CSVReader.c
/home/eclipse/ReidTest/cc/cross-toolchains/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc  -mcpu=arm9  -c RPM.c
/home/eclipse/ReidTest/cc/cross-toolchains/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc  -mcpu=arm9  -c RS485.c
/home/eclipse/ReidTest/cc/cross-toolchains/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc   -o HMITelem HMITelem.o Cpacket.o GPS.o ADC.o Wireless.o Receivers.o CSVReader.o RPM.o RS485.o -lpthread

Thank you.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

The implicit make rule for compiling a source into an object file seems broken. There's no output specification "-o x.o" to go with the "cc -c x.c". Are there any object files after running the make?

.c.o:   $*.c

Also, the above target specification, ".c.o", looks strange to me; perhaps make does not recognize this either, and that would explain why the implicit rule for making an object file is not being applied.

This might be a better target specification and prerequisites for the objects rule (straight from the GNU 'make' manual):

$(OBJECTS): %.o: %.c
        $(CC) -c $(CFLAGS) $< -o $@
share|improve this answer
    
Note that you shouldn't use > for quoting code, instead indent with 4 spaces. –  Dan D. Mar 21 '12 at 10:02
    
@Dan D. - Thanks for the tip. –  sawdust Mar 21 '12 at 19:19
    
That worked!!!! –  Reid Mar 22 '12 at 2:36

.c.o is only special (a suffix rule) if it has no prerequisites, in which case each .c file is an implicit prerequisite of the corresponding .o file. If it has a prerequisite, make tries to build a file named .c.o! See http://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.