#------------------------------------------------------------------------------ # Top-level Makefile to Install RISC V 0.6.3 #------------------------------------------------------------------------------ # # 01/18/21 RD updated for release 0.6.3 # 09/07/20 VG added "gets" patch to SystemC headers # 05/22/20 RD updated for release 0.6.2 # 10/04/19 RD updated for release 0.6.1 # 07/25/19 RD updated for release 0.6.0 # 05/17/19 RD updated for release 0.5.3 # 04/18/19 RD updated for release 0.5.2 # 10/02/18 RD updated for release 0.5.1 # 09/28/18 RD updated for release 0.5.0 # 06/22/18 RD updated for release 0.4.3 # 06/20/18 RD no more RISC variable, use RISC_HOME only # 05/21/18 RD use new Boost version 1.61, new Rose version 0.9.10.25 # 05/18/18 RD updated for release 0.4.2 # 08/02/17 RD updated for release 0.4.1 # 07/08/17 RD updated for release 0.4.0 # 07/08/17 RD turn on compiler optimization by default (RISC_OPTS) # 10/05/16 RD reduced boost installation to the needed libraries only # 10/05/16 RD added developer targets clean_boost, uninstall_boost # 10/05/16 RD added developer targets clean_sysc, uninstall_sysc # 10/05/16 RD added developer target clean_demo # 10/04/16 RD initial adjustments for release 0.3.1 # 09/30/16 RD added header-line to generated source_me scripts # 09/29/16 RD added SYSTEMC_MIC_HOME for optional SystemC-MIC library # 09/19/16 RD initial adjustments for release 0.3.0 # 03/13/16 RD added developer targets clean_rose, uninstall_rose # 03/13/16 RD added developer targets clean_risc, uninstall_risc # 03/13/16 RD added developer options ROSE_OPTS and RISC_OPTS # 02/29/16 RD initial adjustments for release 0.2.2: # use 'tar' instead of 'gtar' # 10/28/15 RD final adjustments for release 0.2.1 # 10/28/15 RD added 'demo' target # 10/16/15 RD SYSTEMC_HOME points to ACCELLERA installation(s) (i.e. _pt), # SYSTEMC_LW_HOME points to RISC LWSC installation, # SYSTEMC_OOP_HOME points to RISC OOPSC installation # 10/13/15 RD v0.2.1: separated download, build, install directories # 10/12/15 RD improvements, named the targets same as packages # 10/08/15 RD initial version based on INSTALLv020 # # Requirements: # - host platform: Linux, CentOS 6.10 or 7.x, x86_64 (or similar) # - GNU C++ compiler tool chain (4.4.7 and 4.8.5 work, others may also) # - GNU flex (v2.5.35) and bison (v2.4.1) # # Prerequisites: (will be installed as needed) # - Boost library (version 1.61.0) # - ROSE compiler source installation # - Accellera SystemC 2.3.1 source installation # # Installation steps: (major targets) # - Prep1: 'dirs': prepare a directory tree # - Prereq1: 'boost': install Boost library # - Prereq2: 'rose': install ROSE compiler # - Prereq3: 'sysc': install Accellera SystemC # - Step1: 'risc': install RISC compiler and simulator # - Step2: 'demo': run the RISC demo examples # PATHS: (adjust these to fit your environment!) TOP = /local/lecs/lecs/risc_v0.6.3/top #TOP = /opt/pkg RISC_HOME = $(TOP)/risc_v0.6.3 RISC_TARGET = $(RISC_HOME)/bin/risc RISC_PKG = $(RISC_HOME)/pkg SOURCES = /local/lecs/lecs/risc_v0.6.3/sources #SOURCES = /home/pkg/risc/risc_v0.6.3 RISC_DOWNLOAD = $(SOURCES)/download RISC_BUILD = $(SOURCES)/build # 3RD PARTY PACKAGES: (adjust if you already have these installed) BOOST_HOME = $(RISC_PKG)/boost_1_61_0 BOOST_TARGET = $(BOOST_HOME)/include/boost/version.hpp ROSE_HOME = $(RISC_PKG)/edg4x-rose ROSE_TARGET = $(ROSE_HOME)/lib/librose.so SYSTEMC_HOME = $(RISC_PKG)/systemc-2.3.1_pt SYSTEMC_TARGET = $(SYSTEMC_HOME)/include/systemc.h # RISC PACKAGES: (customized software packages for RISC) SYSTEMC_LW_HOME = $(RISC_PKG)/systemc-2.3.1_lw SYSTEMC_OOP_HOME= $(RISC_PKG)/systemc-2.3.1_oop SYSTEMC_MIC_HOME= $(RISC_PKG)/systemc-2.3.1_mic # DEVELOPER OPTIONS: (for developers only) ROSE_OPTS = --with-C_OPTIMIZE=-O2 --with-CXX_OPTIMIZE=-O2 \ --with-C_DEBUG=-DNDEBUG --with-CXX_DEBUG=-DNDEBUG #ROSE_OPTS = --with-C_OPTIMIZE=-O0 --with-CXX_OPTIMIZE=-O0 \ # --with-C_DEBUG=-g --with-CXX_DEBUG=-g #ROSE_OPTS += CC=gcc-4.4 CXX=g++-4.4 #RISC_OPTS = RISC_OPTS = "DEBUG=-O2 -DNDEBUG" #RISC_OPTS = DEBUG=-g # COMMANDS: (adjust only if you have an unusual Linux) ECHO = echo CAT = cat CD = cd CP = cp -f MKDIR = mkdir -p MV = mv -f RM = rm -f RMDIR = rmdir --ignore-fail-on-non-empty TAR = tar GIT = git WGET = wget -nv #WGET = wget -nv --no-check-certificate SLEEP = sleep SED = sed -i #----------------------------------------------------------------------------- # Convenience targets: #----------------------------------------------------------------------------- all: $(MAKE) dirs $(MAKE) boost $(MAKE) rose $(MAKE) sysc $(MAKE) risc $(MAKE) demo test: $(MAKE) demo clean: @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC: Deleting $(RISC_BUILD), demodir..." @$(ECHO) "***********************************************************" @$(ECHO) "Waiting 10 seconds, type CTRL-C if you want to abort!" $(SLEEP) 10 $(RM) -r $(RISC_BUILD) $(RM) -r demodir -$(RMDIR) $(SOURCES) @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC: Build tree removed." @$(ECHO) "***********************************************************" clean_downloads: @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC: Deleting $(RISC_DOWNLOAD)..." @$(ECHO) "***********************************************************" @$(ECHO) "Waiting 10 seconds, type CTRL-C if you want to abort!" $(SLEEP) 10 $(RM) -r $(RISC_DOWNLOAD) -$(RMDIR) $(SOURCES) @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC: Download tree removed." @$(ECHO) "***********************************************************" uninstall: @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC: Uninstalling, deleting $(RISC_HOME)..." @$(ECHO) "***********************************************************" @$(ECHO) "Waiting 10 seconds, type CTRL-C if you want to abort!" $(SLEEP) 10 $(RM) -r $(RISC_HOME) -$(RMDIR) $(TOP) @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC: Uninstalled." @$(ECHO) "***********************************************************" downloads: dirs $(MAKE) $(RISC_DOWNLOAD)/boost_1_61_0.tar.gz $(MAKE) $(RISC_DOWNLOAD)/edg4x-rose $(MAKE) $(RISC_DOWNLOAD)/systemc-2.3.1.tgz $(MAKE) $(RISC_DOWNLOAD)/risc_v0.6.3.tar.gz # --- developer targets clean_boost: $(RM) -r $(RISC_BUILD)/boost_1_61_0 -$(RMDIR) $(RISC_BUILD) uninstall_boost: $(RM) -r $(RISC_PKG)/boost_1_61_0 -$(RMDIR) $(RISC_PKG) -$(RMDIR) $(RISC_HOME) clean_rose: $(RM) -r $(RISC_BUILD)/edg4x-rose -$(RMDIR) $(RISC_BUILD) uninstall_rose: $(RM) -r $(RISC_PKG)/edg4x-rose -$(RMDIR) $(RISC_PKG) -$(RMDIR) $(RISC_HOME) clean_sysc: $(RM) -r $(RISC_BUILD)/systemc-2.3.1 -$(RMDIR) $(RISC_BUILD) uninstall_sysc: $(RM) -r $(RISC_PKG)/systemc-2.3.1 $(RM) -r $(RISC_PKG)/systemc-2.3.1_pt -$(RMDIR) $(RISC_PKG) -$(RMDIR) $(RISC_HOME) clean_risc: $(RM) -r $(RISC_BUILD)/risc_v0.6.3 $(RM) -r $(RISC_BUILD)/systemc-2.3.1_lw $(RM) -r $(RISC_BUILD)/systemc-2.3.1_oop $(RM) -r $(RISC_BUILD)/systemc-2.3.1_mic -$(RMDIR) $(RISC_BUILD) uninstall_risc: $(RM) $(RISC_HOME)/COPYRIGHT $(RM) $(RISC_HOME)/HISTORY $(RM) $(RISC_HOME)/LICENSE $(RM) -r $(RISC_HOME)/bin $(RM) -r $(RISC_HOME)/docs $(RM) -r $(RISC_HOME)/examples $(RM) -r $(RISC_HOME)/include $(RM) -r $(RISC_HOME)/lib $(RM) -r $(RISC_HOME)/man $(RM) -r $(RISC_PKG)/systemc-2.3.1_lw $(RM) -r $(RISC_PKG)/systemc-2.3.1_oop $(RM) -r $(RISC_PKG)/systemc-2.3.1_mic -$(RMDIR) $(RISC_PKG) -$(RMDIR) $(RISC_HOME) clean_demo: $(RM) -r demodir #----------------------------------------------------------------------------- # RISC dirs: Prepare a top directory to assemble all packages #----------------------------------------------------------------------------- dirs: $(RISC_DOWNLOAD) $(RISC_BUILD) $(RISC_HOME) $(RISC_PKG) $(RISC_DOWNLOAD) $(RISC_BUILD) $(RISC_HOME) $(RISC_PKG): @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC dirs: Preparing directory tree..." @$(ECHO) "***********************************************************" $(MKDIR) $(RISC_DOWNLOAD) $(MKDIR) $(RISC_BUILD) $(MKDIR) $(RISC_HOME) $(MKDIR) $(RISC_PKG) @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC dirs: Directory tree prepared." @$(ECHO) "***********************************************************" #----------------------------------------------------------------------------- # RISC boost: Install BOOST library #----------------------------------------------------------------------------- # Reference: # https://www.boost.org/users/history/version_1_61_0.html # http://rosecompiler.org/ROSE_HTML_Reference/group__installing__boost.html boost: dirs $(BOOST_TARGET) $(RISC_DOWNLOAD)/boost_1_61_0.tar.gz: @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC boost: Downloading BOOST library..." @$(ECHO) "***********************************************************" $(CD) $(RISC_DOWNLOAD) && \ $(RM) boost_1_61_0.tar.gz && \ $(WGET) http://downloads.sourceforge.net/project/boost/boost/1.61.0/boost_1_61_0.tar.gz $(BOOST_TARGET): $(MAKE) $(RISC_DOWNLOAD)/boost_1_61_0.tar.gz @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC boost: Building/installing BOOST library..." @$(ECHO) "***********************************************************" $(CD) $(RISC_BUILD) && \ $(TAR) xvzf ../download/boost_1_61_0.tar.gz $(CD) $(RISC_BUILD)/boost_1_61_0 && \ ./bootstrap.sh --prefix=$(BOOST_HOME) \ --with-libraries=chrono,date_time,filesystem,iostreams,program_options,random,regex,signals,system,thread,wave $(CD) $(RISC_BUILD)/boost_1_61_0 && \ ./b2 --prefix=$(BOOST_HOME) -sNO_BZIP2=1 install @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC boost: BOOST library installed." @$(ECHO) "***********************************************************" #----------------------------------------------------------------------------- # RISC rose: Install ROSE compiler #----------------------------------------------------------------------------- # Reference: # http://rosecompiler.org/ROSE_HTML_Reference/group__installation.html # https://en.wikibooks.org/wiki/ROSE_Compiler_Framework/Installation # # Notes: # ROSE requires many developer packages, including the following: # CentOS: libtool libtool-ltdl libtool-ltdl-devel autoconf automake # Ubuntu: libtool libltdl7 libltdl-dev autoconf automake autotools-dev rose: dirs boost $(ROSE_TARGET) $(RISC_DOWNLOAD)/edg4x-rose: @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC rose: Downloading ROSE compiler..." @$(ECHO) "***********************************************************" $(CD) $(RISC_DOWNLOAD) && \ $(GIT) clone https://github.com/rose-compiler/rose.git edg4x-rose @$(ECHO) "Using ROSE version 0.9.10.25 (2018-05-16)" $(CD) $(RISC_DOWNLOAD)/edg4x-rose && \ $(GIT) checkout 88e95f3ef8891e4d43f395f866a54182f771531e @$(ECHO) "Checked out edge4x-rose/ROSE_VERSION:" \ `$(CAT) $(RISC_DOWNLOAD)/edg4x-rose/ROSE_VERSION` $(ROSE_TARGET): $(MAKE) $(RISC_DOWNLOAD)/edg4x-rose @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC rose: Building/installing ROSE compiler..." @$(ECHO) "***********************************************************" $(CD) $(RISC_DOWNLOAD)/edg4x-rose && \ ./build $(MKDIR) $(RISC_BUILD)/edg4x-rose $(CD) $(RISC_BUILD)/edg4x-rose && \ LD_LIBRARY_PATH=$(BOOST_HOME)/lib$${LD_LIBRARY_PATH:+:}$${LD_LIBRARY_PATH} \ $(RISC_DOWNLOAD)/edg4x-rose/configure \ --prefix=$(ROSE_HOME) --with-boost=$(BOOST_HOME) \ --without-java --enable-languages=c,c++ \ $(ROSE_OPTS) $(CD) $(RISC_BUILD)/edg4x-rose && \ LD_LIBRARY_PATH=$(BOOST_HOME)/lib$${LD_LIBRARY_PATH:+:}$${LD_LIBRARY_PATH} \ $(MAKE) -j4 install-rose-library @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC rose: ROSE compiler installed." @$(ECHO) "***********************************************************" #----------------------------------------------------------------------------- # RISC sysc: Install Accellera SystemC #----------------------------------------------------------------------------- # Reference: # http://www.accellera.org/downloads/standards/systemc/files sysc: dirs $(SYSTEMC_TARGET) $(RISC_DOWNLOAD)/systemc-2.3.1.tgz: @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC sysc: Downloading Accellera SystemC..." @$(ECHO) "***********************************************************" $(CD) $(RISC_DOWNLOAD) && \ $(RM) systemc-2.3.1.tgz && \ $(WGET) http://www.accellera.org/images/downloads/standards/systemc/systemc-2.3.1.tgz $(SYSTEMC_TARGET): $(MAKE) $(RISC_DOWNLOAD)/systemc-2.3.1.tgz @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC sysc: Building/installing Accellera SystemC..." @$(ECHO) "***********************************************************" $(CD) $(RISC_BUILD) && \ $(TAR) xvzf $(RISC_DOWNLOAD)/systemc-2.3.1.tgz $(MKDIR) $(RISC_BUILD)/systemc-2.3.1/objdir $(CD) $(RISC_BUILD)/systemc-2.3.1/src && \ $(SED) 's/using std::gets;/\/\/using std::gets;/g' systemc.h $(CD) $(RISC_BUILD)/systemc-2.3.1/objdir && \ CXX=g++ ../configure --prefix=$(RISC_PKG)/systemc-2.3.1 $(MAKE) -C $(RISC_BUILD)/systemc-2.3.1/objdir all $(MAKE) -C $(RISC_BUILD)/systemc-2.3.1/objdir install $(MAKE) -C $(RISC_BUILD)/systemc-2.3.1/objdir check $(MKDIR) $(RISC_BUILD)/systemc-2.3.1/objdir_pt $(CD) $(RISC_BUILD)/systemc-2.3.1/objdir_pt && \ CXX=g++ ../configure --prefix=$(SYSTEMC_HOME) --enable-pthreads $(MAKE) -C $(RISC_BUILD)/systemc-2.3.1/objdir_pt all $(MAKE) -C $(RISC_BUILD)/systemc-2.3.1/objdir_pt install $(MAKE) -C $(RISC_BUILD)/systemc-2.3.1/objdir_pt check @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC sysc: Accellera SystemC installed." @$(ECHO) "***********************************************************" #----------------------------------------------------------------------------- # RISC risc: Install RISC compiler and simulator #----------------------------------------------------------------------------- # Reference: # http://www.cecs.uci.edu/~doemer/risc/v063/INSTALL risc: dirs boost rose sysc ${RISC_TARGET} $(RISC_DOWNLOAD)/risc_v0.6.3.tar.gz: @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC risc: Downloading RISC compiler and simulator..." @$(ECHO) "***********************************************************" $(CD) $(RISC_DOWNLOAD) && \ $(RM) risc_v0.6.3.tar.gz && \ $(WGET) http://www.cecs.uci.edu/~doemer/risc/v063/risc_v0.6.3.tar.gz $(RISC_TARGET): $(MAKE) $(RISC_DOWNLOAD)/risc_v0.6.3.tar.gz @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC risc: Building/installing RISC comp. and sim. ..." @$(ECHO) "***********************************************************" $(CD) $(RISC_BUILD) && \ $(TAR) xvzf $(RISC_DOWNLOAD)/risc_v0.6.3.tar.gz $(CD) $(RISC_BUILD)/risc_v0.6.3 && \ $(MV) source_me.csh source_me.csh.bak && \ $(ECHO) > source_me.csh '# source_me.csh: generated by RISC top-level Makefile' && \ $(ECHO) >>source_me.csh 'setenv RISC_HOME ${RISC_HOME}' && \ $(ECHO) >>source_me.csh 'setenv RISC_BUILD ${RISC_BUILD}' && \ $(ECHO) >>source_me.csh 'setenv RISC_DOWNLOAD ${RISC_DOWNLOAD}' && \ $(ECHO) >>source_me.csh 'setenv ROSE_HOME ${ROSE_HOME}' && \ $(ECHO) >>source_me.csh 'setenv BOOST_HOME ${BOOST_HOME}' && \ $(ECHO) >>source_me.csh 'setenv SYSTEMC_HOME ${SYSTEMC_HOME}' && \ $(ECHO) >>source_me.csh 'setenv SYSTEMC_LW_HOME ${SYSTEMC_LW_HOME}' && \ $(ECHO) >>source_me.csh 'setenv SYSTEMC_OOP_HOME ${SYSTEMC_OOP_HOME}' && \ $(ECHO) >>source_me.csh 'setenv SYSTEMC_MIC_HOME ${SYSTEMC_MIC_HOME}' && \ $(ECHO) >>source_me.csh 'if ( $$?LD_LIBRARY_PATH ) then' && \ $(ECHO) >>source_me.csh ' setenv LD_LIBRARY_PATH $${RISC_HOME}/lib:$${ROSE_HOME}/lib:$${BOOST_HOME}/lib:$${SYSTEMC_HOME}/lib-linux64:$${LD_LIBRARY_PATH}' && \ $(ECHO) >>source_me.csh 'else' && \ $(ECHO) >>source_me.csh ' setenv LD_LIBRARY_PATH $${RISC_HOME}/lib:$${ROSE_HOME}/lib:$${BOOST_HOME}/lib:$${SYSTEMC_HOME}/lib-linux64' && \ $(ECHO) >>source_me.csh 'endif' $(CD) $(RISC_BUILD)/risc_v0.6.3 && \ $(MV) source_me.sh source_me.sh.bak && \ $(ECHO) > source_me.sh '# source_me.sh: generated by RISC top-level Makefile' && \ $(ECHO) >>source_me.sh 'export RISC_HOME=${RISC_HOME}' && \ $(ECHO) >>source_me.sh 'export RISC_BUILD=${RISC_BUILD}' && \ $(ECHO) >>source_me.sh 'export RISC_DOWNLOAD=${RISC_DOWNLOAD}' && \ $(ECHO) >>source_me.sh 'export ROSE_HOME=${ROSE_HOME}' && \ $(ECHO) >>source_me.sh 'export BOOST_HOME=${BOOST_HOME}' && \ $(ECHO) >>source_me.sh 'export SYSTEMC_HOME=${SYSTEMC_HOME}' && \ $(ECHO) >>source_me.sh 'export SYSTEMC_LW_HOME=${SYSTEMC_LW_HOME}' && \ $(ECHO) >>source_me.sh 'export SYSTEMC_OOP_HOME=${SYSTEMC_OOP_HOME}' && \ $(ECHO) >>source_me.sh 'export SYSTEMC_MIC_HOME=${SYSTEMC_MIC_HOME}' && \ $(ECHO) >>source_me.sh 'export LD_LIBRARY_PATH=$${RISC_HOME}/lib:$${ROSE_HOME}/lib:$${BOOST_HOME}/lib:$${SYSTEMC_HOME}/lib-linux64$${LD_LIBRARY_PATH:+:}$${LD_LIBRARY_PATH}' . $(RISC_BUILD)/risc_v0.6.3/source_me.sh && \ $(MAKE) $(RISC_OPTS) -C $(RISC_BUILD)/risc_v0.6.3 clean . $(RISC_BUILD)/risc_v0.6.3/source_me.sh && \ $(MAKE) $(RISC_OPTS) -C $(RISC_BUILD)/risc_v0.6.3 build . $(RISC_BUILD)/risc_v0.6.3/source_me.sh && \ $(MAKE) $(RISC_OPTS) -C $(RISC_BUILD)/risc_v0.6.3 install . $(RISC_BUILD)/risc_v0.6.3/source_me.sh && \ $(MAKE) $(RISC_OPTS) -C $(RISC_BUILD)/risc_v0.6.3 test @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC risc: RISC compiler and simulator installed." @$(ECHO) "***********************************************************" #----------------------------------------------------------------------------- # RISC demo: Run the RISC demo examples #----------------------------------------------------------------------------- demo: @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC: Compiling and running the demo examples..." @$(ECHO) "***********************************************************" $(MKDIR) demodir $(CP) $(RISC_HOME)/examples/demo/* demodir . $(RISC_HOME)/bin/setup.sh && \ $(MAKE) -C demodir clean . $(RISC_HOME)/bin/setup.sh && \ $(MAKE) -C demodir play_demo . $(RISC_HOME)/bin/setup.sh && \ $(MAKE) -C demodir mandelbrot_demo @$(ECHO) "***********************************************************" @$(ECHO) "*** RISC: Demo successful." @$(ECHO) "***********************************************************" #------------------------------------------------------------------------------ # EOF Makefile (The RISC Team, August 2021) #------------------------------------------------------------------------------