made a few tweaks and regenerated the Makefile to get it to link but it still won't
This commit is contained in:
56
Makefile
56
Makefile
@@ -1,42 +1,40 @@
|
|||||||
#Makefile for yab2cpp
|
CC := clang++
|
||||||
#by Samuel D. Crow
|
CFLAGS := -Wall
|
||||||
|
CFLAGS += -std=c++11
|
||||||
|
CFLAGS += -O0
|
||||||
|
LFLAGS :=
|
||||||
|
|
||||||
#presently architecture-neutral
|
ODIR := build
|
||||||
|
|
||||||
CC=g++
|
YABCODESTRUCTURES_SOURCE_DEPS := yabCodeStructures.cpp yab2cpp.h yab2cpp.cpp
|
||||||
LD=g++
|
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
|
all: binaries
|
||||||
#FLAGS=-c -Os -std=c++11
|
|
||||||
#LDFLAGS=LDFLAGS=-std=c++11
|
|
||||||
|
|
||||||
#debug build
|
$(ODIR):
|
||||||
FLAGS=-c -g -Og -std=c++11
|
@mkdir $(ODIR)
|
||||||
LDFLAGS=-std=c++11
|
|
||||||
|
|
||||||
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
|
bin_yab2cpp: $(ODIR) $(YAB2CPP_OBJECT_DEPS)
|
||||||
$(CC) $(FLAGS) -o yabDataStructures.o yabDataStructures.cpp
|
clang++ -v -o yab2cpp $(ODIR)/yabCodeStructures.o $(ODIR)/yabFunctions.o $(ODIR)/yabDataStructures.o $(ODIR)/yab2cpp.o
|
||||||
|
|
||||||
yabCodeStructures.o: yabCodeStructures.cpp yab2cpp.h
|
$(ODIR)/yabCodeStructures.o: $(ODIR) $(YABCODESTRUCTURES_SOURCE_DEPS)
|
||||||
$(CC) $(FLAGS) -o yabCodeStructures.o yabCodeStructures.cpp
|
$(CC) -c $(CFLAGS) yabCodeStructures.cpp -o $(ODIR)/yabCodeStructures.o
|
||||||
|
|
||||||
yabFunctions.o: yabFunctions.cpp yab2cpp.h
|
$(ODIR)/yab2cpp.o: $(ODIR) $(YAB2CPP_SOURCE_DEPS)
|
||||||
$(CC) $(FLAGS) -o yabFunctions.o yabFunctions.cpp
|
$(CC) -c $(CFLAGS) yab2cpp.cpp -o $(ODIR)/yab2cpp.o
|
||||||
|
|
||||||
yab2cpp.o: yab2cpp.cpp yab2cpp.h
|
$(ODIR)/yabDataStructures.o: $(ODIR) $(YABDATASTRUCTURES_SOURCE_DEPS)
|
||||||
$(CC) $(FLAGS) -o yab2cpp.o yab2cpp.cpp
|
$(CC) -c $(CFLAGS) yabDataStructures.cpp -o $(ODIR)/yabDataStructures.o
|
||||||
|
|
||||||
#BASIC_framework.a: yabDataStructures.o yabCodeStructures.o yabFunctions.o
|
$(ODIR)/yabFunctions.o: $(ODIR) $(YABFUNCTIONS_SOURCE_DEPS)
|
||||||
# $(AR) BASIC_framework.a yabDataStructures.o yabCodeStructures.o yabFunctions.o
|
$(CC) -c $(CFLAGS) yabFunctions.cpp -o $(ODIR)/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
|
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o yab2cpp BASIC_framework.a
|
rm -rf build/* yab2cpp
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ ofstream logfile;
|
|||||||
ofstream varNames;
|
ofstream varNames;
|
||||||
|
|
||||||
/* private prototypes */
|
/* private prototypes */
|
||||||
void helpText(string);
|
void helpText(const string);
|
||||||
void setup();
|
void setup();
|
||||||
void compile();
|
void compile();
|
||||||
void shutDown();
|
void shutDown();
|
||||||
@@ -135,7 +135,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* print the help text to stdout */
|
/* 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" <<
|
cout << commandname << "[-d|D|V|v|G] < filename.mb\n" <<
|
||||||
"Compiles filename.mb by default unless a flag is specified.\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;
|
errorLevel=e;
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ enum OPERATORS
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* global prototype */
|
/* global prototype */
|
||||||
void error(enum COMPILE_ERRORS err);
|
[[noreturn]] void error(enum COMPILE_ERRORS err);
|
||||||
void logger(string s);
|
void logger(string s);
|
||||||
|
|
||||||
/* internal states used by the parser */
|
/* internal states used by the parser */
|
||||||
|
|||||||
@@ -50,11 +50,7 @@ void label::generateJumpTo()
|
|||||||
/* pass this as second parameter to generateOnNTo or generateOnNSub */
|
/* pass this as second parameter to generateOnNTo or generateOnNSub */
|
||||||
unsigned int label::generateOnNSkip(list<shared_ptr<label> >&dest)
|
unsigned int label::generateOnNSkip(list<shared_ptr<label> >&dest)
|
||||||
{
|
{
|
||||||
if (dest.size()<2)
|
if (dest.size()<2)error(E_BAD_SYNTAX);
|
||||||
{
|
|
||||||
errorLevel=E_BAD_SYNTAX;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
auto iter=dest.begin();
|
auto iter=dest.begin();
|
||||||
consts_h << "j" << this->getID() << "[]={" << *iter;
|
consts_h << "j" << this->getID() << "[]={" << *iter;
|
||||||
++iter;
|
++iter;
|
||||||
@@ -129,13 +125,9 @@ void ifStatement::alternative(shared_ptr<expression>e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ifStatement::close()
|
void ifStatement::close()
|
||||||
{
|
|
||||||
if(this->chain)
|
|
||||||
{
|
{
|
||||||
/* elsif ended without else in between */
|
/* elsif ended without else in between */
|
||||||
errorLevel=E_BAD_SYNTAX;
|
if(this->chain)error(E_BAD_SYNTAX);
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
this->done->generate();
|
this->done->generate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -125,8 +125,7 @@ void fn::generateReturn()
|
|||||||
fn::callStack.pop_back();
|
fn::callStack.pop_back();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
errorLevel=E_TYPE_MISMATCH;
|
error(E_TYPE_MISMATCH);
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user