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
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)

View File

@ -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);

View File

@ -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