Update Makefile to be more like AVM Makefile
Less colours more information, easier to decode.
This commit is contained in:
22
Makefile
22
Makefile
@@ -1,16 +1,19 @@
|
|||||||
CPP=g++
|
CPP=g++
|
||||||
|
|
||||||
VERBOSE=0
|
VERBOSE=0
|
||||||
|
RELEASE=1
|
||||||
|
|
||||||
GENERAL-FLAGS=-Wall -Wextra -Werror -Wswitch-enum -std=c++17 -I$(shell pwd) -I$(shell pwd)/avm
|
GENERAL-FLAGS=-Wall -Wextra -Werror -Wswitch-enum -std=c++17 -I$(shell pwd) -I$(shell pwd)/avm
|
||||||
DEBUG-FLAGS=-ggdb -fsanitize=address
|
DEBUG-FLAGS=-ggdb -fsanitize=address
|
||||||
RELEASE-FLAGS=-O3
|
RELEASE-FLAGS=-O3
|
||||||
CPPFLAGS:=$(GENERAL-FLAGS) -std=c++17 $(DEBUG-FLAGS) -D VERBOSE=$(VERBOSE)
|
|
||||||
|
ifeq ($(RELEASE),1)
|
||||||
|
CPPFLAGS:=$(GENERAL-FLAGS) -pedantic $(RELEASE-FLAGS) -DVERBOSE=$(VERBOSE)
|
||||||
|
else
|
||||||
|
CPPFLAGS:=$(GENERAL-FLAGS) -pedantic $(DEBUG-FLAGS) -DVERBOSE=$(VERBOSE)
|
||||||
|
endif
|
||||||
|
|
||||||
LIBS=-lm
|
LIBS=-lm
|
||||||
DIST=build
|
DIST=build
|
||||||
TERM_YELLOW:=$(shell echo -e "\e[0;33m")
|
|
||||||
TERM_GREEN:=$(shell echo -e "\e[0;32m")
|
|
||||||
TERM_RESET:=$(shell echo -e "\e[0;0m")
|
|
||||||
|
|
||||||
# Setup variables for source code, output, etc
|
# Setup variables for source code, output, etc
|
||||||
## ASSEMBLY setup
|
## ASSEMBLY setup
|
||||||
@@ -46,17 +49,14 @@ examples: $(EXAMPLES)
|
|||||||
# Recipes
|
# Recipes
|
||||||
## ASSEMBLY Recipes
|
## ASSEMBLY Recipes
|
||||||
$(OUT): $(AVM_OBJECTS) $(OBJECTS) $(DIST)/main.o
|
$(OUT): $(AVM_OBJECTS) $(OBJECTS) $(DIST)/main.o
|
||||||
@$(CPP) $(CPPFLAGS) $^ -o $@ $(LIBS)
|
$(CPP) $(CPPFLAGS) $^ -o $@ $(LIBS)
|
||||||
@echo "$(TERM_GREEN)$@$(TERM_RESET): $^"
|
|
||||||
|
|
||||||
$(DIST)/%.o: $(SRC)/%.cpp | $(DIST) $(DEPDIR)/asm
|
$(DIST)/%.o: $(SRC)/%.cpp | $(DIST) $(DEPDIR)/asm
|
||||||
@$(CPP) $(CPPFLAGS) $(DEPFLAGS) $(DEPDIR)/asm/$*.d -c $< -o $@ $(LIBS)
|
$(CPP) $(CPPFLAGS) $(DEPFLAGS) $(DEPDIR)/asm/$*.d -c $< -o $@ $(LIBS)
|
||||||
@echo "$(TERM_YELLOW)$@$(TERM_RESET): $<"
|
|
||||||
|
|
||||||
## EXAMPLES recipes
|
## EXAMPLES recipes
|
||||||
$(EXAMPLES_DIST)/%.out: $(EXAMPLES_SRC)/%.asm $(OUT) | $(EXAMPLES_DIST)
|
$(EXAMPLES_DIST)/%.out: $(EXAMPLES_SRC)/%.asm $(OUT) | $(EXAMPLES_DIST)
|
||||||
@$(OUT) $< $@
|
$(OUT) $< $@
|
||||||
@echo "$(TERM_GREEN)$@$(TERM_RESET): $<"
|
|
||||||
|
|
||||||
.PHONY: run-examples
|
.PHONY: run-examples
|
||||||
run-examples: $(EXAMPLES)
|
run-examples: $(EXAMPLES)
|
||||||
|
|||||||
Reference in New Issue
Block a user