diff --git a/Makefile b/Makefile index ee32337..d3f7a28 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ export CXXFLAGS := -Wall -O2 LDFLAGS := -lfl -SUBDIRS := main parser +SUBDIRS := main parser nodes all: $(TARGET) diff --git a/main/jtlc.cc b/main/jtlc.cc index 933afc6..523dd65 100644 --- a/main/jtlc.cc +++ b/main/jtlc.cc @@ -1,8 +1,10 @@ #include /* tmpfile() */ #include /* exit() */ -#include "parser/parser.h" #include +#include "util/refptr.h" +#include "parser/parser.h" +#include "nodes/Node.h" using namespace std; int usage(); @@ -41,6 +43,7 @@ int main(int argc, char * argv[]) void compile(const char * filename) { FILE * out = tmpfile(); - parse(filename); + refptr tree = parse(filename); +// tree->process(out); fclose(out); } diff --git a/nodes/Makefile b/nodes/Makefile new file mode 100644 index 0000000..a210eec --- /dev/null +++ b/nodes/Makefile @@ -0,0 +1,23 @@ + +OBJS := $(patsubst %.cc,%.o,$(wildcard *.cc)) +DEPS := $(OBJS:.o=.dep) + +all: $(DEPS) $(OBJS) + +%.o: %.cc + $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $< + +# Make dependency files +%.dep: %.cc + @set -e; rm -f $@; \ + $(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \ + sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ + rm -f $@.$$$$ + +clean: + -$(RM) -f *.o *.dep + +# Include dependency files +ifndef CLEAN +-include $(DEPS) +endif diff --git a/parser/Node.cc b/nodes/Node.cc similarity index 100% rename from parser/Node.cc rename to nodes/Node.cc diff --git a/parser/Node.h b/nodes/Node.h similarity index 100% rename from parser/Node.h rename to nodes/Node.h diff --git a/parser/parser.h b/parser/parser.h index d8ecb9c..75b5ceb 100644 --- a/parser/parser.h +++ b/parser/parser.h @@ -3,7 +3,7 @@ #define PARSER_H #include "util/refptr.h" -#include "parser/Node.h" +#include "nodes/Node.h" #define YYSTYPE refptr