Created
October 21, 2020 10:33
-
-
Save aliemo/7c76375e4c00c4a56e27eb459d96ac57 to your computer and use it in GitHub Desktop.
Generic Makefile for SystemC Projects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SYSTEMC_VERSION:=2.3.3 | |
GTKWAVE:= which gtkwave | |
TARGET := reference | |
CXX := g++ | |
LD := $(CXX) | |
C_FLAGS := -I/usr/local/systemc-${SYSTEMC_VERSION}/include -O0 -g3 -Wall -c | |
LD_OPTIONS = -L/usr/local/systemc-2.3.3/lib-linux64 -o $(TARGET) | |
LIBS := -lsystemc | |
C_SOURCES = $(shell ls *.cc) | |
C_OBJS := $(patsubst %.cc, %.o, $(C_SOURCES)) | |
%.o:%.cc | |
@echo 'Building file: $(@F)' | |
@echo '--------------------' | |
@echo 'Invoking: GNU CPP Compiler' | |
$(CXX) $(C_FLAGS) $< -o $@ | |
@echo 'Finished building: $(@F)' | |
@echo ' ' | |
all:$(TARGET) | |
$(TARGET): $(C_OBJS) | |
@echo 'building binary $(@F)' | |
$(LD) $(LD_OPTIONS) $(C_OBJS) $(LIBS) | |
prerequisites: | |
ifneq ('$(GTKWAVE)', "/usr/bin/gtkwave") | |
@echo $(GTKWAVE) | |
@echo 'installing gtkwave, please be patient' | |
# sudo apt install -y gtkwave | |
# sudo dnf install -y gtkwave | |
endif | |
test:$(TARGET) | |
./$(TARGET) | |
gtkwave -c 4 vcd_trace.vcd | |
clean: | |
rm -f $(TARGET) *.o vcd_trace.vcd | |
.PHONY: $(TARGET) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment