Linking error linking static library in Makefile for extern

189 views Asked by At

I am attempting to write a makefile for the Cell Broadband Engine (PS3), which will link an external library.

The Makefile is as follows:

PROJ=apple_sort_ppu
PCC=ppu-g++
CFLAGS=-Wall
LIBS= -lX11 -lspe2 -lpthread

objects = apple_sort_ppu.o lodepng.o ThreadPool.o SPUTask.o
#Imports is for linking the extern spu program library to SPUTask.o.     Currently not linking correctly
IMPORTS := spu/lib_process_spu_a.a  $(LIBS)
all: $(PROJ) 

apple_sort_ppu: $(objects)
    $(PCC) $(objects) -o $(LIBS)

apple_sort_ppu.o: apple_sort_ppu.cpp
    $(PCC) $(CFLAGS) -c apple_sort_ppu.cpp $(LIBS)

lodepng.o: lodepng.cpp lodepng.h
    $(PCC) $(CFLAGS) -c lodepng.cpp

SPUTask.o: SPUTask.cpp SPUTask.h $(IMPORTS) ThreadPool.o
    $(PCC) $(CFLAGS)  -c SPUTask.cpp

ThreadPool.o: ThreadPool.cpp ThreadPool.h
    $(PCC) $(CFLAGS) -c ThreadPool.cpp $(LIBS)

clean:
    rm $(objects) *.d

include $(CELL_TOP)/buildutils/make.footer

When I run make on this file, I get :

No rule to make spu/lib_process_spu_a.a, needed by SPUTask.o. STOP

I have confirmed that the library exists in the correct directory. My experience of Makefiles is extremely limited, so I don't really understand what is going on here.

The file causing the problem in the makefile is SPUTask.h, with the header code:

#pragma once
#include "ThreadPool.h"
#include <libspe2.h>

extern spe_program_handle_t process_spu_a;//Program handle

class SPUTask : public Task
{
public:
    SPUTask(int i_id = 0);
    virtual ~SPUTask(){;}   
    virtual void execute();
    virtual bool hasReturnData(){return false;}
    virtual int getTaskID(){return m_id;}
    void setData(unsigned char* pData, int pSize);
    void setContext(spe_context_ptr_t pContext){mContext = pContext;}
private:
    unsigned char* mData __attribute__((aligned(128)));
    int m_id;
    int mDataSize;
    spe_context_ptr_t mContext;
};

process_spu_a has already been compiled into lib_process_spu_a.a in the /spu subdirectory.

Any help would be greatly appreciated.

0

There are 0 answers