diff --git a/Makefile b/Makefile index 4ab8816..f765bf8 100644 --- a/Makefile +++ b/Makefile @@ -2,15 +2,15 @@ include nemu/Makefile.git default: @echo "Please run 'make' under any subprojects to compile." - + clean: - -$(MAKE) -C nemu clean - -$(MAKE) -C nexus-am clean - -$(MAKE) -C nanos-lite clean - -$(MAKE) -C navy-apps clean + -$(MAKE) -s -C nemu clean + -$(MAKE) -s -C abstract-machine clean-all + -$(MAKE) -s -C nanos-lite clean + -$(MAKE) -s -C navy-apps clean submit: clean git gc - STUID=$(STUID) STUNAME=$(STUNAME) bash -c "$$(curl -s http://ics.nju.edu.cn/people/yanyanjiang/teach/submit.sh)" + STUID=$(STUID) STUNAME=$(STUNAME) bash -c "$$(curl -s http://jyywiki.cn/static/submit.sh)" .PHONY: default clean submit diff --git a/README.md b/README.md index dc49605..9e1b853 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,19 @@ -# ICS2019 Programming Assignment +# ICS2020 Programming Assignment -This project is the programming assignment of the class ICS(Introduction to Computer System) in Department of Computer Science and Technology, Nanjing University. +This project is the programming assignment of the class ICS(Introduction to Computer System) +in Department of Computer Science and Technology, Nanjing University. For the guide of this programming assignment, -refer to http://nju-ics.gitbooks.io/ics2019-programming-assignment/content/ +refer to http://nju-ics.gitbooks.io/ics2020-programming-assignment/content/ To initialize, run ```bash -bash init.sh +bash init.sh subproject-name ``` +See `init.sh` for more details. The following subprojects/components are included. Some of them are not fully implemented. * [NEMU](https://github.com/NJU-ProjectN/nemu) -* [Nexus-am](https://github.com/NJU-ProjectN/nexus-am) +* [Abstract-Machine](https://github.com/NJU-ProjectN/abstract-machine) * [Nanos-lite](https://github.com/NJU-ProjectN/nanos-lite) * [Navy-apps](https://github.com/NJU-ProjectN/navy-apps) diff --git a/init.sh b/init.sh index ebd62c3..6931eba 100644 --- a/init.sh +++ b/init.sh @@ -1,48 +1,69 @@ #!/bin/bash -version=ics2019 - -log="" +version=ics2020 function init() { if [ -d $1 ]; then - echo "$1 is already initialized, exiting..." + echo "$1 is already initialized, skipping..." return fi while [ ! -d $1 ]; do git clone -b $version https://github.com/NJU-ProjectN/$1.git done - log="$log$1 `cd $1 && git log --oneline --no-abbrev-commit -n1`"$'\n' + log="$1 `cd $1 && git log --oneline --no-abbrev-commit -n1`"$'\n' rm -rf $1/.git + git add -A $1 + git commit -am "$1 $version initialized"$'\n\n'"$log" + if [ $2 ] ; then sed -i -e "/^export $2=.*/d" ~/.bashrc echo "export $2=`readlink -e $1`" >> ~/.bashrc - fi -} -read -r -p "Are you sure to initialize everything? [y/n] " input -case $input in - [yY]) - init nemu NEMU_HOME - init nexus-am AM_HOME - init nanos-lite - init navy-apps NAVY_HOME - - git add -A - git commit -am "$version initialized"$'\n\n'"$log" - - echo "Initialization finishes!" echo "By default this script will add environment variables into ~/.bashrc." echo "After that, please run 'source ~/.bashrc' to let these variables take effect." echo "If you use shell other than bash, please add these environment variables manually." - ;; + fi +} - [nN]) - ;; +function init_no_git() { + if [ -d $1 ]; then + echo "$1 is already initialized, skipping..." + return + fi + while [ ! -d $1 ]; do + git clone -b $version https://github.com/NJU-ProjectN/$1.git + done + log="$1 `cd $1 && git log --oneline --no-abbrev-commit -n1`"$'\n' + + sed -i -e "/^\/$1/d" .gitignore + echo "/$1" >> .gitignore + + git add -A .gitignore + git commit --no-verify --allow-empty -am "$1 $version initialized without tracing"$'\n\n'"$log" +} + +case $1 in + nemu) + init nemu NEMU_HOME + ;; + abstract-machine) + init abstract-machine AM_HOME + init_no_git fceux-am + ;; + am-kernels) + init_no_git am-kernels + ;; + nanos-lite) + init nanos-lite + ;; + navy-apps) + init navy-apps NAVY_HOME + ;; *) echo "Invalid input..." + exit ;; esac