More makefile changes

This commit is contained in:
Bobby Lucero 2023-05-26 21:14:13 -04:00
parent 00cbc056c8
commit f8853d022b
3 changed files with 7 additions and 4 deletions

View File

@ -4,7 +4,7 @@
CC = g++
# Compiler flags
CFLAGS = -Wall -Wextra -std=c++11
CFLAGS = -Wall -Wextra -std=c++17 -Wno-unused-variable -Wno-unused-parameter
# Source directory
SRC_DIR = ./source
@ -22,7 +22,7 @@ OBJ_FILES := $(patsubst $(SRC_DIR)/%.cpp,$(BUILD_DIR)/%.o,$(CPP_FILES))
$(shell mkdir -p $(dir $(OBJ_FILES)))
# Default target
all: $(BUILD_DIR)/bob
all: clean $(BUILD_DIR)/bob
# Rule to create necessary directories
$(DIRS):
@ -36,6 +36,9 @@ $(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
$(BUILD_DIR)/bob: $(OBJ_FILES)
$(CC) $(CFLAGS) $^ -o $@
./$(BUILD_DIR)/bob
# Clean build directory
clean:
rm -rf $(BUILD_DIR)/*

View File

@ -22,7 +22,7 @@ struct BinaryExpr : Expr<T>
const Token oper;
const std::shared_ptr<Expr<T>> right;
BinaryExpr(std::shared_ptr<Expr<T>> left, Token oper, std::shared_ptr<Expr<T> > right) : left(left), oper(oper), right(right)
BinaryExpr(std::shared_ptr<Expr<T>> left, Token oper, std::shared_ptr<Expr<T>> right) : left(left), oper(oper), right(right)
{
}
T accept(Visitor<T>* visitor) override{

View File

@ -21,7 +21,7 @@ int main(){
Token{MINUS, "-", 1},
std::make_shared<LiteralExpr<std::string>>("123", true)
),
Token{STAR, "*", 1},
Token{MINUS, "-", 1},
std::make_shared<GroupingExpr<std::string>>(
std::make_shared<LiteralExpr<std::string>>("45.67", true)
)