-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
58 lines (42 loc) · 1.33 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
# ---------------------------------------------------------------------------
#
# Dwarf, an educational stack virtual machine
#
#
# See README.md for additional information.
#
# (c) Igor Zhirkov, igorjirkov [at] gmail.com
# ---------------------------------------------------------------------------
CC = gcc
BUILDDIR = build
OBJDIR = obj
SRCDIR = src
TESTDIR = tests
INCLUDEDIR = include
CFLAGS = -c -std=c99 -I$(INCLUDEDIR) -ggdb -Wno-attributes
LDFLAGS =
#SOURCES = bc_reloc.c bc_visitor.c code_printer.c const_pool.c debug.c function.c interpreter.c launcher.c linker.c loader.c util.c vm.c
SOURCES = $(wildcard $(SRCDIR)/*.c)
OBJECTS = $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
TESTS = $(wildcard $(TESTDIR)/*.dw)
TESTTARGETS = $(TESTS:%.dw=%.dwc)
TARGET = vm
ASM = nasm
ASMFLAGS = -fbin -I$(TESTDIR)/
all: $(BUILDDIR) $(OBJDIR) $(BUILDDIR)/$(TARGET) $(OBJECTS) $(TESTS) $(TESTTARGETS)
$(BUILDDIR)/$(TARGET): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
$(OBJECTS): $(OBJDIR)/%.o:$(SRCDIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR):
mkdir -p $@
$(OBJDIR):
mkdir -p $@
$(TESTTARGETS): $(TESTS)
$(ASM) $(ASMFLAGS) -o $@ $(@:%.dwc=%.dw)
docs:
doxygen Doxyfile
clean:
rm -rf $(BUILDDIR) $(OBJDIR)
rm -f $(TESTTARGETS)
.PHONY: dirs clean docs