ifeq ($(OS),Windows_NT)
    SEP := ;
else
    SEP := :
endif

SOURCES := $(wildcard library/*.java libraryManagement/*.java)

# Files you should upload to Gradescope: everything except Library.java,
# LibraryItem.java, and LibraryItems.java, which we provide and you do not modify.
SUBMISSION_FILES := \
    library/LibraryImpl.java \
    library/LibrarySpecTest.java \
    library/LibraryImplTest.java \
    libraryManagement/LibraryManagementApp.java \
    static/index.html \
    static/index.js \
    static/index.css

.PHONY: compile run test clean submission

compile:
	javac -d . -cp "lib/*$(SEP)." $(SOURCES)

run: compile
	java -cp "lib/*$(SEP)." libraryManagement.LibraryManagementApp

test: compile
	java -cp "lib/*$(SEP)." org.junit.platform.console.ConsoleLauncher execute --scan-classpath --classpath .

clean:
	rm -rf library/*.class libraryManagement/*.class submission.zip

# Bundle the files listed above into submission.zip for upload to Gradescope.
submission:
	rm -f submission.zip
	zip submission.zip $(SUBMISSION_FILES)