Updated the project structure, and modified the Makefile to hopefully be future proof so I can freely make sub-folders in the src/ folder and not have to worry about breaking the Makefile.

This commit is contained in:
2022-03-16 18:07:37 +00:00
parent 6daaaae7c2
commit b3693f17df
13 changed files with 21 additions and 29 deletions
+1
View File
@@ -1,3 +1,4 @@
clox
*.lox
obj/
bin/
+16 -7
View File
@@ -1,17 +1,26 @@
CC = gcc
SOURCEFILES := $(wildcard *.c)
CFLAGS=-Wall
SRC=src
OBJ=obj
SRCS=$(wildcard $(SRC)/*.c)
OBJS=$(patsubst $(SRC)/%.c, $(OBJ)/%.o, $(SRCS))
SOURCE := $(wildcard *.c)
BINDIR=bin
BIN=$(BINDIR)/clox
$(SOURCE:.c=.o): $(SOURCE)
@mkdir -p obj
$(CC) $^ -o obj/clox
all:$(BIN)
$(BIN): $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o $@
$(OBJ)/%.o: $(SRC)/%.c
$(CC) $(CFLAGS) -c $< -o $@
.PHONY: clean
.PHONY: test
clean:
rm -r obj
rm -r $(BINDIR)/* $(OBJ)/*
test:
./obj/clox test.lox
$(BIN) test.lox
-18
View File
@@ -1,18 +0,0 @@
#include "expr.h"
char* Parenthesize(char*, int, ...);
void VisitBinary(struct binary expr) {
}
void VisitGrouping(struct grouping);
void VisitLiteral(Token);
void VisitUnary(struct unary);
char* Parenthesize(char* operator, int count, ...) {
va_list list;
va_start(list, count);
va_arg(list, Expr);
}
+4 -4
View File
@@ -40,9 +40,9 @@ struct Expr {
} expression;
};
void VisitBinary(struct binary);
void VisitGrouping(struct grouping);
void VisitLiteral(Token);
void VisitUnary(struct unary);
// void VisitBinary(struct binary);
// void VisitGrouping(struct grouping);
// void VisitLiteral(Token);
// void VisitUnary(struct unary);
#endif
View File
View File
View File
View File
View File
View File
View File
View File
View File