-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
55 lines (42 loc) · 880 Bytes
/
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
# SPDX-License-Identifier: MIT
CFLAGS := -Wall -std=c11 -g -O0 -Iinclude
HDRS := \
include/ebcvm.h \
include/efi.h \
include/pe.h \
OBJS := \
src/debug.o \
src/decode.o \
src/disas.o \
src/efi.o \
src/exec.o \
src/load.o \
src/mem.o \
src/util.o \
src/vm.o \
TOOLS := \
tools/ebcvm \
tools/disas \
tools/fnv1 \
TEST_OBJS := $(patsubst %.c,%.o,$(wildcard test/*.c))
TESTS := $(TEST_OBJS:.o=.exe)
all: $(TOOLS)
@cp tools/ebcvm ebcvm
$(TOOLS): libebcvm.a
$(TESTS): test/%.exe: test/%.o libebcvm.a
$(CC) $(CFLAGS) -o $@ $^
libebcvm.a: $(OBJS)
$(AR) -rc $@ $^
$(OBJS): $(HDRS)
test: $(TESTS)
@for test in $(TESTS) ; do \
./$${test} ; \
out=$$? ; \
if [ "$${out}" != 0 ]; then \
echo "$${test}: NG" ; \
exit $${out} ; \
fi \
done
clean:
@rm -f ebcvm libebcvm.a $(TOOLS) $(TESTS) $(OBJS) $(TEST_OBJS)
.PHONY: test clean