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

60 lines
1.4 KiB
Makefile
Raw Normal View History

2019-06-05 12:53:09 +02:00
# 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 -g -Wall -fno-builtin-log -I.
2019-06-05 12:53:09 +02:00
2019-06-05 19:31:48 +02:00
dv_src = $(shell ls dv/*.c)
2019-06-05 12:53:09 +02:00
in_src = $(shell ls in/*.c)
pc_src = $(shell ls pc/*.c)
2019-06-07 22:23:38 +02:00
#obj = pc/disd.o
obj = $(patsubst %.c,$(OBJDIR)/%.o,$(dv_src))
obj += $(patsubst %.c,$(OBJDIR)/%.o,$(in_src))
obj += $(patsubst %.c,$(OBJDIR)/%.o,$(pc_src))
2019-06-05 12:53:09 +02:00
dep = $(patsubst %.c,$(OBJDIR)/%.d,$(dv_src))
dep += $(patsubst %.c,$(OBJDIR)/%.d,$(in_src))
dep += $(patsubst %.c,$(OBJDIR)/%.d,$(pc_src))
# Color codes
CL='\033[0;32m'
CL2='\033[1;36m'
CL3='\033[0m'
NC='\033[1;37m'
all: k.exe
2019-06-05 12:53:09 +02:00
2019-06-07 22:23:38 +02:00
#pc/disd.o: in/i_arch.h */*.h pc/decd.c
# @cc $(FLAGS) -D_NEED_DISASM -c pc/decd.c -o $@
2019-06-05 12:53:09 +02:00
-include $(dep)
$(OBJDIR)/%.o: %.c
@mkdir -p $(shell dirname $@)
2019-06-05 12:53:09 +02:00
@cc $(FLAGS) -c $< -o $@
@if [ $(verbose) = "yes" ]; then \
echo ${CL2}[$@] ${CL}dependencies 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
2019-06-05 12:53:09 +02:00
2019-06-05 19:31:48 +02:00
in/i_arch.h: in/INSTRS in/arch_i.py
2019-06-05 12:53:09 +02:00
@cd in && python3 arch_i.py
clean:
@rm -f $(OBJDIR)/*/*.o in/arch_i.h
@rm -f $(OBJDIR)/*/*.d
2019-06-05 12:53:09 +02:00
2019-06-05 19:31:48 +02:00
k.exe: in/i_arch.h $(obj)
2019-06-05 12:53:09 +02:00
@gcc -O2 -Wall $(obj) -o k.exe
@echo ${CL2}[$@] ${CL}made successfully.${CL3}