From 0c81ee06d19d1d7f67dab3c2c9da268b0c55e3c0 Mon Sep 17 00:00:00 2001 From: Jacob McDonnell Date: Sat, 14 Mar 2026 18:44:18 -0400 Subject: feat: Initial parsing of instructions Initial ability to parse basic instructions. Currently hex numbers are broken and immediates with labels (movl $str, %ecx) are broken. --- Makefile | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c10ffc6 --- /dev/null +++ b/Makefile @@ -0,0 +1,36 @@ +CC = gcc-15 +SRC_DIR = src +SRCS = $(SRC_DIR)/lex.yy.c \ + $(SRC_DIR)/parser.tab.c +PROG = jas +OBJS = $(patsubst %.c, %.o, \ + $(patsubst %.cpp, %.o, \ + $(patsubst %.cxx, %.o, \ + $(patsubst %.cc, %.o, $(SRCS))))) + +$(PROG): $(OBJS) + $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) + +$(SRC_DIR)/parser.tab.c: $(SRC_DIR)/parser.y + bison $(BISONFLAGS) -d $< -o $@ + +$(SRC_DIR)/lex.yy.c: $(SRC_DIR)/lexer.l $(SRC_DIR)/parser.tab.c + flex $(FLEXFLAGS) -o $@ -l $< + +%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +%.o: %.cpp + $(CXX) $(CXXFLAGS) -c $< -o $@ + +%.o: %.cxx + $(CXX) $(CXXFLAGS) -c $< -o $@ + +%.o: %.cc + $(CXX) $(CXXFLAGS) -c $< -o $@ + +clean: + rm -rf $(PROG) $(OBJS) $(SRC_DIR)/lex.yy.c $(SRC_DIR)/parser.tab.c $(SRC_DIR)/parser.tab.h + +.PHONY: all clean + -- cgit v1.2.3