diff options
| author | Jim Lawson | 2015-07-24 17:17:01 -0700 |
|---|---|---|
| committer | Jim Lawson | 2015-07-24 17:17:01 -0700 |
| commit | e73450165c59d68b524689a7169e03140a41a1c5 (patch) | |
| tree | b7236f80d9abf60775ecbcefe6f7ca25557dce73 /Makefile | |
| parent | 94893bad972ded686a2c68dd334aa40b92e3b85d (diff) | |
| parent | 3976145bb8c7595ad0f0a7fbb4ccbbd3030d8873 (diff) | |
Merge pull request #1 from ucb-bar/packagedir
Packagedir
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..fa607649 --- /dev/null +++ b/Makefile @@ -0,0 +1,83 @@ +# Retain all intermediate files. +.SECONDARY: + +SBT ?= sbt +SBT_FLAGS ?= -Dsbt.log.noformat=true + +CHISEL_VERSION = $(shell "$(SBT)" $(SBT_FLAGS) "show version" | tail -n 1 | cut -d ' ' -f 2) + +SRC_DIR ?= . +CHISEL_BIN ?= $(abspath $(SRC_DIR)/bin) +export CHISEL_BIN + +#$(info Build Chisel $(CHISEL_VERSION)) + +# The targetDir will be rm -rf'ed when "make clean" +targetDir ?= ./generated +# The TEST_OUTPUT_DIR will be rm -rf'ed when "make clean" +TEST_OUTPUT_DIR ?= ./test-outputs +RM_DIRS := $(TEST_OUTPUT_DIR) test-reports $(targetDir) +#CLEAN_DIRS := doc + +test_src_dir := src/test/scala/ChiselTests +test_results := $(filter-out main DirChange Pads SIntOps,$(notdir $(basename $(wildcard $(test_src_dir)/*.scala)))) +c_resources_dir := src/main/resources + +test_outs := $(addprefix $(targetDir)/, $(addsuffix .out, $(test_results))) + +.PHONY: smoke publish-local check clean jenkins-build coverage scaladoc test + +default: publish-local + +smoke: + $(SBT) $(SBT_FLAGS) compile + +publish-local: + $(SBT) $(SBT_FLAGS) +publish-local + +test: + $(SBT) $(SBT_FLAGS) test + +check: test $(test_outs) + +coverage: + $(SBT) $(SBT_FLAGS) coverage test + $(SBT) $(SBT_FLAGS) coverageReport + +clean: + $(SBT) $(SBT_FLAGS) +clean +ifneq (,$(CLEAN_DIRS)) + for dir in $(CLEAN_DIRS); do $(MAKE) -C $$dir clean; done +endif +ifneq (,$(RM_DIRS)) + $(RM) -r $(RM_DIRS) +endif + +scaladoc: + $(SBT) $(SBT_FLAGS) doc test:doc + +# Start off clean, then run tests for all supported configurations, and publish those versions of the code. +# Then run coverage and style tests (for developer's use). +# Don't publish the coverage test code since it contains hooks/references to the coverage test package +# and we don't want code with those dependencies published. +# We need to run the coverage tests last, since Jenkins will fail the build if it can't find their results. +jenkins-build: clean + $(SBT) $(SBT_FLAGS) +test + $(SBT) $(SBT_FLAGS) +clean +publish-local + $(SBT) $(SBT_FLAGS) scalastyle coverage test + $(SBT) $(SBT_FLAGS) coverageReport + +$(targetDir)/%.fir: $(test_src_dir)/%.scala + $(SBT) $(SBT_FLAGS) "test:runMain ChiselTests.MiniChisel $(notdir $(basename $<)) $(CHISEL_FLAGS)" + +$(targetDir)/%.flo: $(targetDir)/%.fir + $(CHISEL_BIN)/fir2flo.sh $(targetDir)/$* + +$(targetDir)/%: $(targetDir)/%.flo $(targetDir)/emulator.h $(targetDir)/emulator_mod.h $(targetDir)/emulator_api.h + (cd $(targetDir); $(CHISEL_BIN)/flo2app.sh $*) + +$(targetDir)/%.h: $(c_resources_dir)/%.h + cp $< $@ + +$(targetDir)/%.out: $(targetDir)/% + $(SBT) $(SBT_FLAGS) "test:runMain ChiselTests.MiniChisel $(notdir $(basename $<)) $(CHISEL_FLAGS) --test --targetDir $(targetDir)" |
