0

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.

0

2 Answers 2

0

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 $@
2
  • Note that you shouldn't use > for quoting code, instead indent with 4 spaces.
    – Dan D.
    Mar 21, 2012 at 10:02
  • That worked!!!!
    – Reid
    Mar 22, 2012 at 2:36
0

.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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .