Skip to content

Instantly share code, notes, and snippets.

@TuxCoding
Last active October 25, 2017 15:17
Show Gist options
  • Select an option

  • Save TuxCoding/df9562edea66560ed6c9426c6a2f461a to your computer and use it in GitHub Desktop.

Select an option

Save TuxCoding/df9562edea66560ed6c9426c6a2f461a to your computer and use it in GitHub Desktop.
Simple Makefile for build bluespec projects. It will compile and link it by default. You could run `make compile link sim` to test it at the same moment.
TOPFILE = Testbench.bsv
TOPMODULE = mkTestbench
BUILD_PATH = build
BSIM_EXE = $(BUILD_PATH)/outputFile
BSCFLAGS = -u
BUILD_DIR_FLAGS = -simdir $(BUILD_PATH) -bdir $(BUILD_PATH) -info-dir $(BUILD_PATH)
default: compile link
build:
mkdir -p $(BUILD_PATH)
.PHONY: compile
compile: build
@echo Compiling for Bluesim ...
bsc $(BUILD_DIR_FLAGS) -sim -g $(TOPMODULE) $(BSCFLAGS) $(TOPFILE)
@echo Compilation finished
.PHONY: link
link:
@echo Linking Bluesim...
bsc $(BUILD_DIR_FLAGS) -e $(TOPMODULE) -sim -o ./$(BSIM_EXE)
@echo Bluesim linking finished
.PHONY: simulate
sim:
@echo Simulating...
./$(BSIM_EXE)
@echo Bluesim simulation finished
.PHONY: clean
clean:
rm -rf build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment