risc-v-tlm/Makefile

49 lines
1.1 KiB
Makefile
Raw Normal View History

2018-09-11 00:44:54 +08:00
TARGET = RISCV_TLM
SYSTEMC ?=../systemc-2.3.2
2018-09-11 00:44:54 +08:00
TARGET_ARCH=linux64
CC = g++
# compiling flags here
2018-09-27 20:58:39 +08:00
CFLAGS = -Wall -I. -O3 -std=c++11
2018-09-11 00:44:54 +08:00
LINKER = g++
# linking flags here
2018-09-27 20:58:39 +08:00
LFLAGS = -Wall -I. -lm
2018-09-11 00:44:54 +08:00
LIBS = -lsystemc -lm $(EXTRA_LIBS)
# change these to proper directories where each file should be
SRCDIR = src
OBJDIR = obj
BINDIR = ./
INCDIR = -I. -I./inc -I$(SYSTEMC)/include -Ibasic_protocol -I$(SYSTEMC)/include/tlm_core/tlm_2
LIBDIR = -L. -L$(SYSTEMC)/lib-$(TARGET_ARCH)
SOURCES := $(wildcard $(SRCDIR)/*.cpp)
INCLUDES := $(wildcard $(INCDIR)/*.h)
OBJECTS := $(SOURCES:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o)
rm = rm -f
$(BINDIR)/$(TARGET): $(OBJECTS)
@$(LINKER) $(OBJECTS) $(LFLAGS) $(LIBS) $(LIBDIR) -o $@
@echo "Linking complete!"
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.cpp
# @$(CC) $(CFLAGS) $(INCDIR) -c $< -o $@
@echo "Compiling "$<" ..."
@$(CC) $(CFLAGS) $(INCDIR) -c $< -o $@
@echo "Done!"
.PHONY: clean
clean:
@$(rm) $(OBJECTS)
@echo "Cleanup complete!"
.PHONY: remove
remove: clean
@$(rm) $(BINDIR)/$(TARGET)
@echo "Executable removed!"