Script dir set in Makefile. Rename exec to `pl`

Changed install dir.
General cleanup of Makefile.
Added `make uninstall` to Makefile.
Tests still require that lib scripts already be installed to pass.
This commit is contained in:
Sage Vaillancourt 2020-11-07 00:05:52 -05:00
parent 0962601976
commit 18b1e28185
3 changed files with 22 additions and 13 deletions

View File

@ -1,23 +1,32 @@
files = pebblisp.c tokens.c object.c env.c 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: all:
gcc -g -O0 -Wall -o $(exe) -D STANDALONE $(files) && ./tests.sh $(GCC_COM) $(files) && ./tests.sh
notest: notest:
gcc -g -O0 -Wall -o $(exe) -D STANDALONE $(files) $(GCC_COM) $(files)
val: val:
gcc -g -O0 -Wall -o $(exe) -D STANDALONE $(files) && ./tests.sh -val $(GCC_COM) $(files) && ./tests.sh -val
debug: debug:
gcc -g -O0 -Wall -o $(exe) -D STANDALONE -D DEBUG $(files) $(GCC_COM) -D DEBUG $(files)
run: run:
./$(exe) ./$(exe)
install: install:
cp ./$(exe) /usr/bin/pl cp -pf ./$(exe) $(BINPREFIX)
mkdir -p /usr/share/pebblisp/ mkdir -p $(SCRIPTDIR)
rm /usr/share/pebblisp/* cp ./examples/* $(SCRIPTDIR)
cp ./examples/* /usr/share/pebblisp/
uninstall:
rm $(BINPREFIX)/$(exe)
rm -r $(SCRIPTDIR)

View File

@ -773,13 +773,13 @@ int readFile(const char *filename, struct Environment *env) {
void repl(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[]) int main(int argc, const char* argv[])
{ {
struct Environment env = defaultEnv(); struct Environment env = defaultEnv();
readFile("/usr/share/pebblisp/lib.pbl", &env); readFile(SCRIPTDIR "/lib.pbl", &env);
if(argc >= 2) { if(argc >= 2) {
if(readFile(argv[1], &env) != 0) { if(readFile(argv[1], &env) != 0) {
Object r = numberObject(0); Object r = numberObject(0);

View File

@ -42,9 +42,9 @@ fail() {
check() { check() {
local output local output
if (($VALGRIND == 1)); then if (($VALGRIND == 1)); then
local output=$($VALCOM ./pebblisp "$2") local output=$($VALCOM ./pl "$2")
else else
local output=$(./pebblisp "$2") local output=$(./pl "$2")
fi fi
if [ "$output" == "$3" ]; then if [ "$output" == "$3" ]; then