diff --git a/src/Makefile b/src/Makefile index d6ceea7..518d5c5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,23 +1,32 @@ files = pebblisp.c tokens.c object.c env.c -exe = pebblisp +exe = pl + +PREFIX ?= /usr/local +BINPREFIX ?= $(PREFIX)/bin +SCRIPTDIR ?= /usr/local/share/pebblisp + +GCC_COM ?= gcc -g -O0 -Wall -o $(exe) -D STANDALONE -DSCRIPTDIR=\"$(SCRIPTDIR)\" all: - gcc -g -O0 -Wall -o $(exe) -D STANDALONE $(files) && ./tests.sh + $(GCC_COM) $(files) && ./tests.sh notest: - gcc -g -O0 -Wall -o $(exe) -D STANDALONE $(files) + $(GCC_COM) $(files) val: - gcc -g -O0 -Wall -o $(exe) -D STANDALONE $(files) && ./tests.sh -val + $(GCC_COM) $(files) && ./tests.sh -val debug: - gcc -g -O0 -Wall -o $(exe) -D STANDALONE -D DEBUG $(files) + $(GCC_COM) -D DEBUG $(files) run: ./$(exe) install: - cp ./$(exe) /usr/bin/pl - mkdir -p /usr/share/pebblisp/ - rm /usr/share/pebblisp/* - cp ./examples/* /usr/share/pebblisp/ + cp -pf ./$(exe) $(BINPREFIX) + mkdir -p $(SCRIPTDIR) + cp ./examples/* $(SCRIPTDIR) + +uninstall: + rm $(BINPREFIX)/$(exe) + rm -r $(SCRIPTDIR) diff --git a/src/pebblisp.c b/src/pebblisp.c index 52b8350..cfe91ed 100644 --- a/src/pebblisp.c +++ b/src/pebblisp.c @@ -773,13 +773,13 @@ int readFile(const char *filename, struct Environment *env) { void repl(struct Environment *env) { - readFile("/usr/share/pebblisp/repl.pbl", env); + readFile(SCRIPTDIR "/repl.pbl", env); } int main(int argc, const char* argv[]) { struct Environment env = defaultEnv(); - readFile("/usr/share/pebblisp/lib.pbl", &env); + readFile(SCRIPTDIR "/lib.pbl", &env); if(argc >= 2) { if(readFile(argv[1], &env) != 0) { Object r = numberObject(0); diff --git a/src/tests.sh b/src/tests.sh index d6ba1f8..b763eb5 100755 --- a/src/tests.sh +++ b/src/tests.sh @@ -42,9 +42,9 @@ fail() { check() { local output if (($VALGRIND == 1)); then - local output=$($VALCOM ./pebblisp "$2") + local output=$($VALCOM ./pl "$2") else - local output=$(./pebblisp "$2") + local output=$(./pl "$2") fi if [ "$output" == "$3" ]; then