1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00
kvisc/vm/Makefile
julianb0 633577e99c
vm
2019-09-09 14:29:28 +02:00

60 lines
1.4 KiB
Makefile

# The OS/K Team licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
.PHONY: clean
verbose ?= yes
OBJDIR = ob
FLAGS=-O2 -Wall -fno-builtin-log -I. -Werror=implicit-function-declaration -Werror
dv_src = $(shell ls dv/*.c)
in_src = $(shell ls in/*.c)
pc_src = $(shell ls pc/*.c)
obj = $(patsubst %.c,$(OBJDIR)/%.o,$(pc_src))
obj += $(patsubst %.c,$(OBJDIR)/%.o,$(dv_src))
obj += $(patsubst %.c,$(OBJDIR)/%.o,$(in_src))
dep = $(patsubst %.c,$(OBJDIR)/%.d,$(pc_src))
dep += $(patsubst %.c,$(OBJDIR)/%.d,$(dv_src))
dep += $(patsubst %.c,$(OBJDIR)/%.d,$(in_src))
# Color codes
CL='\033[0;32m'
CL2='\033[1;36m'
CL3='\033[0m'
NC='\033[1;37m'
KEXE=../fs/kvisc.exe
all: $(KEXE)
-include $(dep)
$(OBJDIR)/%.o: %.c
@mkdir -p $(shell dirname $@)
@cc $(FLAGS) -c $< -o $@
@if [ $(verbose) = "yes" ]; then \
echo ${CL2}[$@] ${CL}object file generated.${CL3};\
fi
$(OBJDIR)/%.d: %.c
@mkdir -p $(shell dirname $@)
@cc -I. -MM -MT $(@:%.d=%.o) -MF $@ $<
# @if [ $(verbose) = "yes" ]; then \
# echo ${CL2}[$@] ${CL}dependencies generated.${CL3};\
# fi
ob/instrs.lst: in/arch_i.py
@cd in && python3 arch_i.py
clean:
@rm -f ob/*/*.o ob/arch_i.h ob/instrs.lst
@rm -f ob/*/*.d ob/*.k ob/*.sym
$(KEXE): ob/instrs.lst $(obj)
@gcc -O2 -lSDL2 -lSDL2_ttf -Wall $(obj) -o $(KEXE)
@echo ${CL2}[$@] ${CL}made successfully.${CL3}