This repository has been archived on 2025-11-10. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
ovm/Makefile
Aryadev Chavali cf23a62008 Made a debug and release configuration via flags
Also split out the check for whether $(DIST) exists by making it its
own recipe.  Removes the repeated checks in each object compilation.
2023-10-22 18:07:41 +01:00

40 lines
656 B
Makefile

CC=gcc
GENERAL-FLAGS=-Wall -Wextra -Werror -Wswitch-enum -std=c11
DEBUG-FLAGS=-ggdb -fsanitize=address
RELEASE-FLAGS=-O3
CFLAGS=$(GENERAL-FLAGS) $(DEBUG-FLAGS)
LIBS=
ARGS=
OUT=ovm.out
SRC=src
DIST=build
CODE=$(addprefix $(SRC)/, darr.c inst.c runtime.c main.c)
OBJECTS=$(CODE:$(SRC)/%.c=$(DIST)/%.o)
DEPS=$(OBJECTS:%.o=%.d)
.PHONY: all
all: $(OUT) $(DIST)
$(DIST):
mkdir -p $(DIST)
$(OUT): $(DIST)/$(OUT)
$(DIST)/$(OUT): $(DIST) $(OBJECTS)
$(CC) $(CFLAGS) $(OBJECTS) -o $@ $(LIBS)
-include $(DEPS)
$(DIST)/%.o: $(SRC)/%.c
$(CC) $(CFLAGS) -MMD -c $< -o $@ $(LIBS)
.PHONY: run
run: $(DIST)/$(OUT)
./$^ $(ARGS)
.PHONY:
clean:
rm -rfv $(DIST)/*