From 084e7ca9f9ecb76b91e143931d08195d45672ab7 Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Thu, 7 Apr 2016 12:17:47 -0700 Subject: Update Makefile to use sbt to determine sources; make build-scala the default build - #97 --- Makefile | 33 +++++++++++++-------------------- sourcesFromSbt.sh | 10 ++++++++++ 2 files changed, 23 insertions(+), 20 deletions(-) create mode 100755 sourcesFromSbt.sh diff --git a/Makefile b/Makefile index 827211fb..29534b83 100644 --- a/Makefile +++ b/Makefile @@ -4,12 +4,15 @@ regress_dir ?= $(root_dir)/regress firrtl_dir ?= $(root_dir)/src/main/stanza install_dir ?= $(root_dir)/utils/bin +sbt ?= sbt stanza ?= $(install_dir)/stanza stanza_bin ?= $(install_dir)/firrtl-stanza scala_jar ?= $(install_dir)/firrtl.jar -scala_src=$(shell ls src/main/scala/firrtl/*.scala) +# The following is slow but accurate. +# We use 'unmanaged' so we don't include source files generated by the +# build itself (otherwise, we'd need to include the rules to build them). +scala_src := $(shell $(sbt) "show compile:unmanaged-sources compile:unmanaged-resources" | ./sourcesFromSbt.sh ) stanza_src=$(shell ls src/main/stanza/*.stanza) -sbt ?= sbt all-noise: ${MAKE} all || ${MAKE} fail @@ -34,27 +37,18 @@ $(stanza): $(root_dir)/src/lib/stanza/stamp $(root_dir)/utils/stanza-wrapper $(stanza_bin): $(stanza) $(stanza_src) cd $(firrtl_dir) && $(stanza) -i firrtl-test-main.stanza -o $@ -build-deploy: $(stanza) - cd $(firrtl_dir) && $(stanza) -i firrtl-main.stanza -o $(install_dir)/firrtl - -build: $(stanza) - cd $(firrtl_dir) && $(stanza) -i firrtl-test-main.stanza -o $(install_dir)/firrtl - -build-fast: $(stanza) - cd $(firrtl_dir) && $(stanza) -i firrtl-test-main.stanza -o $(install_dir)/firrtl -flags OPTIMIZE - -build-deploy: - cd $(firrtl_dir) && $(stanza) -i firrtl-main.stanza -o $(install_dir)/firrtl-stanza - $(MAKE) set-stanza - -build: +build-stanza: $(stanza) cd $(firrtl_dir) && $(stanza) -i firrtl-test-main.stanza -o $(install_dir)/firrtl-stanza $(MAKE) set-stanza -build-fast: +build-fast: $(stanza) cd $(firrtl_dir) && $(stanza) -i firrtl-test-main.stanza -o $(install_dir)/firrtl-stanza -flags OPTIMIZE $(MAKE) set-stanza +build-deploy: $(stanza) + cd $(firrtl_dir) && $(stanza) -i firrtl-main.stanza -o $(install_dir)/firrtl-stanza + $(MAKE) set-stanza + check: cd $(test_dir) && lit -j 2 -v . --path=$(install_dir)/ @@ -73,9 +67,6 @@ jack: passes: cd $(test_dir)/passes && lit -v . --path=$(install_dir)/ -perf: - cd $(test_dir)/performance && lit -v . --path=$(install_dir)/ - errors: cd $(test_dir)/errors && lit -v . --path=$(install_dir)/ @@ -114,6 +105,8 @@ done: build-fast check regress fail: say "fail" +build: build-scala + # Scala Added Makefile commands build-scala: $(scala_jar) diff --git a/sourcesFromSbt.sh b/sourcesFromSbt.sh new file mode 100755 index 00000000..e2b6a170 --- /dev/null +++ b/sourcesFromSbt.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Parse the output of: +# sbt "show compile:sources compile:resources". +# +# Set the field delimiter to any of '(', ',', or ')' +# and split lines beginning with: +# [info] ArrayBuffer( +# [info] List( +# throwing away the initial 'field' up to and including the '('. +gawk -F '\\(|,|\\)' '/\[info\]\s+((ArrayBuffer)|(List))\(/ { $1 = ""; print $0 }' -- cgit v1.2.3