Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

uClinux makefile

Does anyone know how to create a makefile for a uClinux project consisting several .c and .h files. I am having trouble linking any function to "main"which are not in the same .c file(but in the same application project folder).

For example I am getting an error:

*******************************

mpeg2enc.bin(.text+0xf0): In function `main':

/cygdrive/c/Anika/uc/strx1/sw/mpg/mpeg2enc.c:70: undefined reference to `putseq'

******************************

putseq is another .c file which is in the same application project but not in the same file(mpeg2enc.c-> main).

Right now my makefile looks like this:

**********************************# # configurable options# - set DEBUG = 1 to turn on debugging support#

DEBUG = 1

PROJ_NAME = mpg

INSTALL_DIR = ./build

PROGS := mpeg2enc.exe

OBJ = mpeg2enc.o conform.o putseq.o putpic.o puthdr.o putmpg.o putvlc.o putbits.o motion.o predict.o readpic.o writepic.o transfrm.o fdctref.o idct.o quantize.o ratectl.o stats.o

LIBCDIR := C:\Altera5\kits\bin\eclipse\plugins\com.microtronix.nios2linux.uClibc_1.4.0

UTILSDIR := C:\Altera5\kits\bin\eclipse\plugins\com.microtronix.nios2linux.application_1.4.0

CFLAGS +=

# # You should not need to modify anything beyond this point#

TOPDIR = ./

include Rules.mak

ifeq '$(DEBUG)' '1'

PROGS += $(PROGS:.exe=.gdb)

endif

all: $(PROGS)

clean:

rm -f *.o *% core mpeg2encode

mpeg2enc.exe: mpeg2encode

coff2exe mpeg2enc

mpeg2encode: $(OBJ)

$(CFLAGS) -o mpeg2encode $(OBJ) -lm

conform.o : conform.c config.h global.h mpeg2enc.h

fdctref.o : fdctref.c config.h

idct.o : idct.c config.h

motion.o : motion.c config.h global.h mpeg2enc.h

mpeg2enc.o : mpeg2enc.c config.h global.h mpeg2enc.h

predict.o : predict.c config.h global.h mpeg2enc.h

putbits.o : putbits.c config.h

puthdr.o : puthdr.c config.h global.h mpeg2enc.h

putmpg.o : putmpg.c config.h global.h mpeg2enc.h

putpic.o : putpic.c config.h global.h mpeg2enc.h

putseq.o : putseq.c config.h global.h mpeg2enc.h

putvlc.o : putvlc.c config.h global.h mpeg2enc.h vlc.h

quantize.o : quantize.c config.h global.h mpeg2enc.h

ratectl.o : ratectl.c config.h global.h mpeg2enc.h

readpic.o : readpic.c config.h global.h mpeg2enc.h

stats.o : stats.c config.h global.h mpeg2enc.h

transfrm.o : transfrm.c config.h global.h mpeg2enc.h

writepic.o : writepic.c config.h global.h mpeg2enc.h

***********************************************

I'll really appreciate if someone could help me in this regard.

Anika http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/unsure.gif

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by hippo@Feb 4 2007, 08:44 PM

    you&#39;d better move to linux pc and follow the nios wiki.

    http://nioswiki.jot.com/%c2%b5clinux (http://nioswiki.jot.com/%c2%b5clinux)

    it will be easier to port apps.

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=21228)

    --- quote end ---

    --- Quote End ---

    Thanks for the suggestion. Unfortunately, at this moment it is not possible to have uClinux on linux PC&#39;s at Ryerson. My code is working perfect just on Nios II IDE(without uClinux) though, because I think Nios II IDE uses it&#39;s own makefile, where as for uClinux I need to create a makefile.

    So any other suggestion how to create the makefile for my app project(consists of several .c and .h files) in uClinux?