diff --git a/.gitignore b/.gitignore index 9277185..e7f7918 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ **/*.o -**/*.a \ No newline at end of file +**/*.a +test/1010test diff --git a/Makefile b/Makefile index 97e0d15..65bf89d 100644 --- a/Makefile +++ b/Makefile @@ -2,10 +2,25 @@ CC=clang AR=ar CFLAGS=-c @compile_flags.txt -Iinclude LIB=lib/libcs1010.a +INCLUDE=include/cs1010.h +DESTDIR?=/usr/local $(LIB): src/cs1010.o mkdir -p lib $(AR) r $(LIB) src/cs1010.o +install: $(LIB) $(INCLUDE) + install -d $(DESTDIR)/lib/ + install -m 644 $(LIB) $(DESTDIR)/lib/ + install -d $(DESTDIR)/include/ + install -m 644 $(INCLUDE) $(DESTDIR)/include/ + +clean: + rm -f $(LIB) src/cs1010.o + test: - $(CC) -o 1010test src/test.c -Iinclude -Llib -lcs1010 + $(CC) -o test/1010test src/test.c -Iinclude -Llib -lcs1010 + ! { test/1010test < test/input 2>&1 | grep "test failed"; } || { echo "One or more test(s) failed"; false; } + +.PHONY: install clean test + # vim:set noexpandtab