0
votes

I have a project with the following directory structure

.
 Adder_PL
    bin
    main.cc
    Makefile
    obj
 SystemC
    my_models
       include
          add.h
       lib
          add.cpp
    Xilinx
        include
           amba.h
           debugdev.h
           demo-dma.h
           genattr.h
           iconnect.h
           memory.h
           remote-port-proto.h
           remote-port-sk.h
           remote-port-tlm.h
           remote-port-tlm-memory-master.h
           remote-port-tlm-memory-slave.h
           remote-port-tlm-wires.h
           safeio.h
           tlm2apb-bridge.h
           tlm2axi-bridge.h
           tlm2axilite-bridge.h
           trace.h
           xilinx-zynq.h
           xilinx-zynqmp.h
        lib
           debugdev.cc
           demo-dma.cc
           memory.cc
           remote-port-tlm.cc
           remote-port-tlm-memory-master.cc
           remote-port-tlm-memory-slave.cc
           remote-port-tlm-wires.cc
           trace.cc
           xilinx-zynq.cc
           xilinx-zynqmp.cc

Where the Makefile is situated in Adder_PL. I want to use the Xilinx SystemC models that I ported from their demo between a QEMU host and SystemC model. I am having trouble building it though.

[jfrye@cserh4 Adder_PL]$ make

make: Warning: File `Makefile' has modification time 10229 s in the future

make: *** No rule to make target /home/epi/jfrye_xilinx/Cosimulation/Adder_PL/obj/remote-port-tlm-memory-master.o', needed byadder_pl'. Stop.

Here is the Makefile

CXX=g++

EXEC=./bin/adder_pl

#directories
XILINX_DIR=/home/epi/jfrye_xilinx/Cosimulation/SystemC/Xilinx
MY_MODELS_DIR=/home/epi/jfrye_xilinx/Cosimulation/SystemC/my_models
SYSTEMC_DIR=/home/epi/jfrye_xilinx/SystemC/systemc-2.3.2
OBJ_DIR=/home/epi/jfrye_xilinx/Cosimulation/Adder_PL/obj/

#includes
XILINX_INC=$(XILINX_DIR)/include
MY_MODELS_INC=$(MY_MODELS_DIR)/include
SYSTEMC_INC=$(SYSTEMC_DIR)/include
INC=-I$(XILINX_INC) -I$(MY_MODELS_INC) -I$(SYSTEMC_INC)

#libs
LIB=-L/home/epi/jfrye_xilinx/SystemC/systemc-2.3.2/lib-linux64
LIBS=-lsystemc

#src and obj
XILINX_SRC_DIR=$(XILINX_DIR)/lib
MY_MODELS_SRC_DIR=$(MY_MODELS_DIR)/lib

XILINX_SRC=$(wildcard $(XILINX_SRC_DIR)/*.cc)
XILINX_OBJ=$(patsubst $(XILINX_SRC_DIR)/%.cc, $(OBJ_DIR)%.o, $(XILINX_SRC))
MY_MODELS_SRC=$(wildcard $(MY_MODELS_SRC_DIR)/*.cc)
MY_MODELS_OBJ=$(patsubst $(MY_MODELS_SRC_DIR)/%.cc, $(OBJ_DIR)/%.o, $(MY_MODELS_SRC))
MAIN_OBJ=$(OBJ_DIR)/main.o

#all objects
OBJS = $(XILINX_OBJ) $(MY_MODELS_OBJ) $(MAIN_OBJ)

#rules
adder_pl: $(OBJS)
    $(CXX) -o $(EXEC) $(OBJS) $(INC) $(LIB) $(LIBS)

$(XILINX_OBJ_DIR)/%.o: $(XILINX_SRC_DIR)/%.cc
    $(CXX) $(INC) $(LIB) $(LIBS) -c -o $@ $<

$(MY_MODELS_OBJ_DIR)/%.o: $(MY_MODELS_SRC_DIR)/%.cc
    $(CXX) $(INC) $(LIB) $(LIBS) -c -o $@ $<

$(MAIN_OBJ): main.cc
    $(CXX) $(INC) $(LIB) $(LIBS) -c main.cc -o $(MAIN_OBJ)

.PHONY: clean
clean:
    rm $(XILINX_OBJ_DIR)/*.o $(MY_MODELS_OBJ_DIR)/*.o $(EXEC)

Obviously, I am building the $(OBJS) correctly because it is trying to create /home/epi/jfrye_xilinx/Cosimulation/Adder_PL/obj/remote-port-tlm-memory-master.o but I do not understand why it is failing on the second rule, which I am assuming means it will also fail the third rule if it could get to it.

I ported this from another example. What do $@ and $< mean? Perhaps they are the root of the problem.

1
Check the make documentation for $@ and $< ( here ). These are not your problem. - HardcoreHenry

1 Answers

0
votes

your problem is that /home/epi/jfrye_xilinx/Cosimulation/Adder_PL/obj/remote-port-tlm-memory-master.o is required, but Make has no rule to build it. That means, that the target pattern:

$(XILINX_OBJ_DIR)/%.o: $(XILINX_SRC_DIR)/%.cc

did match both a target and a source. This is likely because XILINX_OBJ_DIR was never defined. Add the lines:

$(info XILINX_OBJ_DIR=$(XILINX_OBJ_DIR))
$(info XILINX_OBJ_DIR=$(XILINX_SRC_DIR))

right before your #rules line in the makefile, and rerun to see what these variables expand to.