diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-23 04:25:30 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-23 04:25:48 +0100 |
commit | 0ac634a9bec04934398a431bfc1b9a7a27561f0c (patch) | |
tree | 25b729285ad0afb2fa6b17125aab75cce9b7b642 /Makefile | |
parent | ac57e32a0222a3f18e138f0a358d1d01921be3a0 (diff) | |
download | ovm-0ac634a9bec04934398a431bfc1b9a7a27561f0c.tar.gz ovm-0ac634a9bec04934398a431bfc1b9a7a27561f0c.tar.bz2 ovm-0ac634a9bec04934398a431bfc1b9a7a27561f0c.zip |
Reintroduced example fib.c via examples/ folder
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -23,19 +23,24 @@ VM_DIST=$(DIST)/vm VM_SRC=vm VM_CODE:=$(addprefix $(VM_SRC)/, inst.c runtime.c) VM_OBJECTS:=$(VM_CODE:$(VM_SRC)/%.c=$(VM_DIST)/%.o) -VM_DEPS:=$(VM_OBJECTS:%.o=%.d) $(VM_DIST)/fib.d $(VM_DIST)/main.d +VM_DEPS:=$(VM_OBJECTS:%.o=%.d) $(VM_DIST)/main.d VM_VERBOSE=0 VM_CFLAGS:=$(CFLAGS) -D VERBOSE=$(VM_VERBOSE) VM_OUT=$(DIST)/ovm.out +## EXAMPLES setup +EXAMPLES_DIST=$(DIST)/examples +EXAMPLES_SRC=examples +EXAMPLES_CFLAGS=$(CFLAGS) +EXAMPLES=$(DIST)/fib.out + # Things you want to build on `make` all: $(DIST) lib vm examples lib: $(LIB_DIST) $(LIB_OBJECTS) vm: $(VM_DIST) $(VM_OUT) -examples: vm-examples -vm-examples: $(VM_DIST) $(VM_DIST)/fib.out +examples: $(EXAMPLES_DIST) $(EXAMPLES) # Recipes ## LIB Recipes @@ -56,6 +61,15 @@ $(VM_DIST)/%.o: $(VM_SRC)/%.c @$(CC) $(VM_CFLAGS) -MMD -c $< -o $@ $(LIBS) @echo -e "$(TERM_GREEN)$@$(TERM_RESET)" +## EXAMPLES recipes +$(DIST)/fib.out: $(LIB_OBJECTS) $(VM_OBJECTS) $(ASM_OBJECTS) $(EXAMPLES_DIST)/fib.o + @$(CC) $(EXAMPLES_CFLAGS) $^ -o $@ $(LIBS) + @echo -e "$(TERM_GREEN)$@$(TERM_RESET)" + +$(EXAMPLES_DIST)/%.o: $(EXAMPLES_SRC)/%.c + @$(CC) $(EXAMPLES_CFLAGS) -MMD -c $< -o $@ $(LIBS) + @echo -e "$(TERM_GREEN)$@$(TERM_RESET)" + OUT= ARGS= .PHONY: run @@ -75,3 +89,6 @@ $(LIB_DIST): $(VM_DIST): mkdir -p $(VM_DIST) + +$(EXAMPLES_DIST): + mkdir -p $(EXAMPLES_DIST) |