made a few tweaks and regenerated the Makefile to get it to link but it still won't

This commit is contained in:
Samuel D. Crow
2021-03-18 16:18:54 -05:00
parent b6e8984e62
commit 68c4806a3d
5 changed files with 35 additions and 46 deletions

View File

@@ -1,42 +1,40 @@
#Makefile for yab2cpp
#by Samuel D. Crow
CC := clang++
CFLAGS := -Wall
CFLAGS += -std=c++11
CFLAGS += -O0
LFLAGS :=
#presently architecture-neutral
ODIR := build
CC=g++
LD=g++
YABCODESTRUCTURES_SOURCE_DEPS := yabCodeStructures.cpp yab2cpp.h yab2cpp.cpp
YAB2CPP_SOURCE_DEPS := yab2cpp.cpp yab2cpp.h
YABDATASTRUCTURES_SOURCE_DEPS := yabDataStructures.cpp yab2cpp.h yab2cpp.cpp
YABFUNCTIONS_SOURCE_DEPS := yabFunctions.cpp yab2cpp.h yab2cpp.cpp
#release build
#FLAGS=-c -Os -std=c++11
#LDFLAGS=LDFLAGS=-std=c++11
all: binaries
#debug build
FLAGS=-c -g -Og -std=c++11
LDFLAGS=-std=c++11
$(ODIR):
@mkdir $(ODIR)
AR=ar r
binaries: bin_yab2cpp
default: yab2cpp
YAB2CPP_OBJECT_DEPS := $(ODIR)/yab2cpp.o $(ODIR)/yabCodeStructures.o $(ODIR)/yabDataStructures.o $(ODIR)/yabFunctions.o
yabDataStructures.o: yabDataStructures.cpp yab2cpp.h
$(CC) $(FLAGS) -o yabDataStructures.o yabDataStructures.cpp
bin_yab2cpp: $(ODIR) $(YAB2CPP_OBJECT_DEPS)
clang++ -v -o yab2cpp $(ODIR)/yabCodeStructures.o $(ODIR)/yabFunctions.o $(ODIR)/yabDataStructures.o $(ODIR)/yab2cpp.o
yabCodeStructures.o: yabCodeStructures.cpp yab2cpp.h
$(CC) $(FLAGS) -o yabCodeStructures.o yabCodeStructures.cpp
$(ODIR)/yabCodeStructures.o: $(ODIR) $(YABCODESTRUCTURES_SOURCE_DEPS)
$(CC) -c $(CFLAGS) yabCodeStructures.cpp -o $(ODIR)/yabCodeStructures.o
yabFunctions.o: yabFunctions.cpp yab2cpp.h
$(CC) $(FLAGS) -o yabFunctions.o yabFunctions.cpp
$(ODIR)/yab2cpp.o: $(ODIR) $(YAB2CPP_SOURCE_DEPS)
$(CC) -c $(CFLAGS) yab2cpp.cpp -o $(ODIR)/yab2cpp.o
yab2cpp.o: yab2cpp.cpp yab2cpp.h
$(CC) $(FLAGS) -o yab2cpp.o yab2cpp.cpp
$(ODIR)/yabDataStructures.o: $(ODIR) $(YABDATASTRUCTURES_SOURCE_DEPS)
$(CC) -c $(CFLAGS) yabDataStructures.cpp -o $(ODIR)/yabDataStructures.o
#BASIC_framework.a: yabDataStructures.o yabCodeStructures.o yabFunctions.o
# $(AR) BASIC_framework.a yabDataStructures.o yabCodeStructures.o yabFunctions.o
#yab2cpp: BASIC_framework.a yab2cpp.o
yab2cpp: yab2cpp.o yabCodeStructures.o yabDataStructures.o yabFunctions.o
$(LD) $(LDFLAGS) -o yab2cpp yab2cpp.o yabCodeStructures.o yabDataStructures.o yabFunctions.o
#BASIC_framework.a
$(ODIR)/yabFunctions.o: $(ODIR) $(YABFUNCTIONS_SOURCE_DEPS)
$(CC) -c $(CFLAGS) yabFunctions.cpp -o $(ODIR)/yabFunctions.o
.PHONY: clean
clean:
rm -f *.o yab2cpp BASIC_framework.a
rm -rf build/* yab2cpp

View File

@@ -76,7 +76,7 @@ ofstream logfile;
ofstream varNames;
/* private prototypes */
void helpText(string);
void helpText(const string);
void setup();
void compile();
void shutDown();
@@ -135,7 +135,7 @@ int main(int argc, char *argv[])
}
/* print the help text to stdout */
void helpText(string &commandname)
void helpText(const string commandname)
{
cout << commandname << "[-d|D|V|v|G] < filename.mb\n" <<
"Compiles filename.mb by default unless a flag is specified.\n" <<
@@ -174,7 +174,7 @@ void setUp()
}
}
void error(enum COMPILE_ERRORS e)
[[noreturn]] void error(enum COMPILE_ERRORS e)
{
errorLevel=e;
exit(1);

View File

@@ -149,7 +149,7 @@ enum OPERATORS
};
/* global prototype */
void error(enum COMPILE_ERRORS err);
[[noreturn]] void error(enum COMPILE_ERRORS err);
void logger(string s);
/* internal states used by the parser */

View File

@@ -50,11 +50,7 @@ void label::generateJumpTo()
/* pass this as second parameter to generateOnNTo or generateOnNSub */
unsigned int label::generateOnNSkip(list<shared_ptr<label> >&dest)
{
if (dest.size()<2)
{
errorLevel=E_BAD_SYNTAX;
exit(1);
}
if (dest.size()<2)error(E_BAD_SYNTAX);
auto iter=dest.begin();
consts_h << "j" << this->getID() << "[]={" << *iter;
++iter;
@@ -130,12 +126,8 @@ void ifStatement::alternative(shared_ptr<expression>e)
void ifStatement::close()
{
if(this->chain)
{
/* elsif ended without else in between */
errorLevel=E_BAD_SYNTAX;
exit(1);
}
/* elsif ended without else in between */
if(this->chain)error(E_BAD_SYNTAX);
this->done->generate();
}

View File

@@ -125,8 +125,7 @@ void fn::generateReturn()
fn::callStack.pop_back();
break;
default:
errorLevel=E_TYPE_MISMATCH;
exit(1);
error(E_TYPE_MISMATCH);
}
}