forked from mandrookin/yaforth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
72 lines (55 loc) · 1.5 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#
#
#
ifeq ($(OS),Windows_NT)
PLUGINS :=
else
PLUGINS :=
found := $(shell /sbin/ldconfig -p | grep readline)
READLINE_LIB := $(if $(found),-lreadline,)
READLINE_DEF := $(if $(found),-DUSE_READLINE,)
endif
SRC := yaforth.cpp middleware.cpp codegen.cpp _main.cpp
ROOTOBJ := obj
OBJDIR := $(ROOTOBJ)
OBJECTS := $(SRC:%.cpp=$(OBJDIR)/%.o)
INCLUDES := include/
#SRC := $(wildcard $(SRC_DIR)/*.cc)
#DEBUG := -g
CXX := g++
#CXXFLAGS := -g
CXXFLAGS := -O3
#INCLUDES :=
ifeq ($(OS),Windows_NT)
all: $(OBJECTS)
$(CXX) $^ -o yaforth
# $(CXX) $^ -l$(LIBS) -o yaforth
else
all: $(OBJECTS)
$(CXX) $^ $(DEBUG) $(READLINE_LIB) -o yaforth
endif
TESTS:=$(shell find tests -name *.frt)
check:
TERM=ansi
@echo "Iterate overt test files in ./test dicrectory"
@for forth_file in $(TESTS); do \
printf '############## $(bold)%s$(sgr0) ###############\n' $$forth_file; \
#echo "############## $$forth_file ###############"; \
./yaforth -no-stdin $$forth_file; \
done
bold := $(shell tput -Tansi bold)
sgr0 := $(shell tput -Tansi sgr0)
clean:
rm -f $(OBJECTS) yaforth
# echo "Delete binary executable objects"
# find . -name "*.xod" -type f -delete
# echo "Delete MIF and listings"
# find ./ -type f \( -iname \*.mif -o -iname \*.mif_dbg \) -delete
find ./tests -type f \( -iname \*.asm -o -iname \*.mif_dbg -o -name \*.mif \) -delete
rm -f yaforth
rm -rf $(ROOTOBJ)
$(OBJDIR)/%.o: %.cpp | $(OBJDIR)
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(DEBUG) $(READLINE_DEF) -I$(INCLUDES) -c $< -o $@
$(OBJDIR):
mkdir $@