summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJacob McDonnell <jacob@jacobmcdonnell.com>2026-03-14 18:44:18 -0400
committerJacob McDonnell <jacob@jacobmcdonnell.com>2026-03-14 18:44:18 -0400
commit0c81ee06d19d1d7f67dab3c2c9da268b0c55e3c0 (patch)
tree9a10aae3c5de847ca1235c048d886c5b64929d80 /Makefile
parentecffc124bbc5d6c9c089eb6d914565119d254a4d (diff)
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.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile36
1 files changed, 36 insertions, 0 deletions
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
+