0

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.

Ian Young
  • 1,712
  • 1
  • 16
  • 33
  • Please show the source and header files’ name and content. May be I can help you. – Dániel Sándor Nov 29 '15 at 07:09
  • I would say that is is a matter of path resolution: you give a relative path `spu/lib_process_spu_a.a` but you are probably in a directory that cannot resolve this path. Can you try 'hardcoding' the full path of you lib; ei: `IMPORTS := /your/path/to/this/lib/spu/lib_process_spu_a.a $(LIBS)` – OznOg Nov 29 '15 at 14:27
  • No change when I change to the full path – Ian Young Nov 29 '15 at 14:40

0 Answers0