@@ -4,4 +4,5 @@ build-etc/Release
build-etc/ipch
build-etc/*sdf
build-etc/*suo
-build-etc/*vcxproj.*
+build-etc/*vcxproj.*
+src/*.o
@@ -0,0 +1,20 @@
+PROJDIRS := src
+SRCFILES := $(shell find $(PROJDIRS) -type f -name "*.cpp")
+OBJFILES := $(patsubst %.cpp,%.o,$(SRCFILES))
+DEPFILES := $(patsubst %.cpp,%.d,$(SRCFILES))
+
+.PHONY: all clean
+CXXFLAGS := -g -Wall -pedantic -Werror
+CXX := g++
+all: tibasic
+tibasic: $(OBJFILES)
+ g++ -o tibasic $?
+-include $(DEPFILES)
+%.o: %.c
+ @$(CXX) $(CFLAGS) -MMD -MP -c $< -o $@
@@ -23,6 +23,8 @@
#include <iostream>
#include <string>
+#include <string.h>
#include "tibasic.h"
#ifdef _WIN32
@@ -20,6 +20,7 @@
#include <stdio.h>
@@ -44,7 +45,7 @@ size_t Compiler::sumBytes(const char *data, size_t len)
bool Compiler::compile(string inFile, string outFile)
{
- ifstream f(inFile);
+ ifstream f(inFile.c_str(), ifstream::in);
string tmpLine;
@@ -17,6 +17,8 @@
#include <map>
using namespace std;
@@ -79,7 +81,7 @@ void initialiseTokens()
}
// Now iterate the two-byte tokens.
- for(size_t i = 0; i < (sizeof CalcVars / sizeof Token); i++)
+ for(size_t i = 0; i < (sizeof(CalcVars) / sizeof(Token)); i++)
token_t value;
value.token = CalcVars[i].data;