mirror of
https://gitlab.os-k.eu/os-k-team/kvisc.git
synced 2023-08-25 14:05:46 +02:00
Some enhancements for a conditional makefile
This commit is contained in:
parent
037f0b34c0
commit
df77629e85
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,6 +2,7 @@
|
||||
*.out
|
||||
*.bin
|
||||
*.o
|
||||
*.d
|
||||
arch_i.h
|
||||
*.dis
|
||||
instrs.lst
|
||||
@ -9,4 +10,3 @@ instrs.lst
|
||||
stdout.txt
|
||||
stderr.txt
|
||||
stdin.txt
|
||||
|
||||
|
2
Makefile
2
Makefile
@ -5,7 +5,7 @@ all: kas
|
||||
|
||||
kpc:
|
||||
@rm -f vm/a.out
|
||||
@cd vm && make --no-print-directory
|
||||
@cd vm && make --no-print-directory verbose=no
|
||||
|
||||
kas: kpc as/k-as.py as/regs.lst
|
||||
@cp vm/in/instrs.lst as
|
||||
|
47
vm/Makefile
47
vm/Makefile
@ -1,36 +1,59 @@
|
||||
# The OS/K Team licenses this file to you under the MIT license.
|
||||
# See the LICENSE file in the project root for more information.
|
||||
|
||||
all: k.exe
|
||||
|
||||
.PHONY: clean
|
||||
.INTERMEDIATE: %.o
|
||||
|
||||
verbose ?= yes
|
||||
OBJDIR = ob
|
||||
FLAGS=-O2 -g -Wall -fno-builtin-log -I.
|
||||
|
||||
dv_src = $(shell ls dv/*.c)
|
||||
in_src = $(shell ls in/*.c)
|
||||
pc_src = $(shell ls pc/*.c)
|
||||
|
||||
#obj = pc/disd.o
|
||||
obj = $(patsubst %.c,%.o,$(dv_src))
|
||||
obj += $(patsubst %.c,%.o,$(in_src))
|
||||
obj += $(patsubst %.c,%.o,$(pc_src))
|
||||
obj = $(patsubst %.c,$(OBJDIR)/%.o,$(dv_src))
|
||||
obj += $(patsubst %.c,$(OBJDIR)/%.o,$(in_src))
|
||||
obj += $(patsubst %.c,$(OBJDIR)/%.o,$(pc_src))
|
||||
|
||||
FLAGS=-O2 -g -Wall -fno-builtin-log -I.
|
||||
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
|
||||
|
||||
#pc/disd.o: in/i_arch.h */*.h pc/decd.c
|
||||
# @cc $(FLAGS) -D_NEED_DISASM -c pc/decd.c -o $@
|
||||
|
||||
%.o: %.c in/i_arch.h */*.h $(src)
|
||||
-include $(dep)
|
||||
|
||||
$(OBJDIR)/%.o: %.c
|
||||
@mkdir -p $(shell dirname $@)
|
||||
@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
|
||||
|
||||
in/i_arch.h: in/INSTRS in/arch_i.py
|
||||
@cd in && python3 arch_i.py
|
||||
|
||||
clean:
|
||||
@rm -f */*.o in/arch_i.h
|
||||
@rm -f $(OBJDIR)/*/*.o in/arch_i.h
|
||||
@rm -f $(OBJDIR)/*/*.d
|
||||
|
||||
k.exe: in/i_arch.h $(obj)
|
||||
@gcc -O2 -Wall $(obj) -o k.exe
|
||||
@rm in/arch_i.h
|
||||
@rm -f */*.o
|
||||
|
||||
@echo ${CL2}[$@] ${CL}made successfully.${CL3}
|
||||
|
Loading…
Reference in New Issue
Block a user