CS3700-project2/Makefile

52 lines
1.4 KiB
Makefile

.PHONY: all test clean upload submit stage-test ccis-test ccis-clean
SOURCES=Makefile router README.md $(shell find . -path ./build -prune -o -iname '*.rkt' -print)
TESTS_DIR=build
CONTAINER_DIR=$(TESTS_DIR)/container
TEST_SIM_PKG=https://course.ccs.neu.edu/cs3700sp20/archive/bgp-sim.tar.gz
CCIS_TEAM_NAME=hash-lang-uwu
CCIS_PROJECT_NAME=project2
CCIS_SERVER=login.ccs.neu.edu
CCIS_PATH=CS3700/$(CCIS_PROJECT_NAME)/
CCIS_FMT_CHECK=/course/cs3700sp20/code/project2/project2_format_check.py
CCIS_TURNIN=/course/cs3700sp20/bin/turnin
all:
@echo "This recipe intentionally left blank"
clean:
sudo $(RM) -r $(TESTS_DIR)
$(TESTS_DIR):
mkdir -p $(TESTS_DIR)
cd $(TESTS_DIR) && wget -O bgp-sim.tar.gz $(TEST_SIM_PKG)
cd $(TESTS_DIR) && tar xf bgp-sim.tar.gz
$(CONTAINER_DIR):
mkdir -p $(TESTS_DIR)
sudo ./scripts/nspawn-support.sh create $(CONTAINER_DIR)
test: $(TESTS_DIR) $(CONTAINER_DIR)
sudo ./scripts/nspawn-support.sh boot $(CONTAINER_DIR)
upload: $(SOURCES)
@rsync -avzzR --progress $^ $(CCIS_SERVER):$(CCIS_PATH)
@ssh $(CCIS_SERVER) -t -- "tput bold; $(CCIS_FMT_CHECK) $(CCIS_PATH); tput sgr0"
stage-test: upload
ssh $(CCIS_SERVER) -t -- "cd $(CCIS_PATH); make ccis-test && make ccis-clean"
submit: upload
ssh $(CCIS_SERVER) -t -- "cd $(CCIS_PATH); make ccis-clean; $(CCIS_TURNIN) $(CCIS_PROJECT_NAME) ."
ccis-test: $(TESTS_DIR)
cd $(TESTS_DIR) && ./sim --router ../router all
ccis-clean:
$(RM) -r $(TESTS_DIR)