diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-04-14 02:45:48 +0630 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-04-14 02:45:48 +0630 |
commit | 0ebbf3ca751e638a90cf886625992bb028f9b587 (patch) | |
tree | 626e1cbddb50f0ec7d5fb8e93c4a3adfa9943349 /Makefile | |
parent | b7a40f4ab0fc5c0f6b68f24437f479a29e72c9af (diff) | |
download | ovm-0ebbf3ca751e638a90cf886625992bb028f9b587.tar.gz ovm-0ebbf3ca751e638a90cf886625992bb028f9b587.tar.bz2 ovm-0ebbf3ca751e638a90cf886625992bb028f9b587.zip |
Start writing assembler in C++
Best language to use as it's already compatible with the headers I'm
using and can pretty neatly enter the build system while also using
the functions I've built for converting to and from bytecode!
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -1,9 +1,13 @@ CC=gcc +CPP=g++ + VERBOSE=0 -GENERAL-FLAGS=-Wall -Wextra -Werror -Wswitch-enum -std=c11 -I. +GENERAL-FLAGS=-Wall -Wextra -Werror -Wswitch-enum -I. DEBUG-FLAGS=-ggdb -fsanitize=address RELEASE-FLAGS=-O3 -CFLAGS:=$(GENERAL-FLAGS) $(DEBUG-FLAGS) -D VERBOSE=$(VERBOSE) +CFLAGS:=$(GENERAL-FLAGS) -std=c11 $(DEBUG-FLAGS) -D VERBOSE=$(VERBOSE) +CPPFLAGS:=$(GENERAL_FLAGS) $(DEBUG-FLAGS) -D VERBOSE=$(VERBOSE) + LIBS=-lm DIST=build TERM_YELLOW:=$(shell echo -e "\e[0;33m") @@ -31,10 +35,10 @@ VM_OUT=$(DIST)/ovm.out ## ASSEMBLY setup ASM_DIST=$(DIST)/asm ASM_SRC=asm -ASM_CODE:=$(addprefix $(ASM_SRC)/, lexer.c parser.c) -ASM_OBJECTS:=$(ASM_CODE:$(ASM_SRC)/%.c=$(ASM_DIST)/%.o) +ASM_CODE:=$(addprefix $(ASM_SRC)/, ) +ASM_OBJECTS:=$(ASM_CODE:$(ASM_SRC)/%.cpp=$(ASM_DIST)/%.o) ASM_DEPS:=$(ASM_OBJECTS:%.o=%.d) $(ASM_DIST)/main.d -ASM_CFLAGS=$(CFLAGS) +ASM_CFLAGS=$(CPPFLAGS) ASM_OUT=$(DIST)/asm.out ## EXAMPLES setup @@ -71,13 +75,13 @@ $(VM_DIST)/%.o: $(VM_SRC)/%.c ## ASSEMBLY Recipes $(ASM_OUT): $(LIB_OBJECTS) $(ASM_OBJECTS) $(ASM_DIST)/main.o - @$(CC) $(ASM_CFLAGS) $^ -o $@ $(LIBS) + @$(CPP) $(ASM_CFLAGS) $^ -o $@ $(LIBS) @echo "$(TERM_GREEN)$@$(TERM_RESET): $^" -include $(ASM_DEPS) -$(ASM_DIST)/%.o: $(ASM_SRC)/%.c - @$(CC) $(ASM_CFLAGS) -MMD -c $< -o $@ $(LIBS) +$(ASM_DIST)/%.o: $(ASM_SRC)/%.cpp + @$(CPP) $(ASM_CFLAGS) -MMD -c $< -o $@ $(LIBS) @echo "$(TERM_YELLOW)$@$(TERM_RESET): $<" ## EXAMPLES recipes |