-
-
Notifications
You must be signed in to change notification settings - Fork 50
/
Makefile
56 lines (40 loc) · 1.1 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
#
# Simple Makefile for the simple virtual machine.
#
#
# Common definitions.
#
CC=gcc
LINKER=$(CC) -o
CFLAGS+=-O2 -W -Wall -Wextra -pedantic -std=gnu99
#
# The default targets
#
all: simple-vm embedded
#
# The sample driver.
#
simple-vm: src/main.o src/simple-vm.o src/simple-vm-opcodes.o
$(LINKER) $@ $(OBJECTS) $(CFLAGS) src/main.o src/simple-vm.o src/simple-vm-opcodes.o
#
# A program that contains an embedded virtual machine and allows
# that machine to call into the application via a custom opcode 0xCD.
#
embedded: src/embedded.o src/simple-vm.o src/simple-vm-opcodes.o
$(LINKER) $@ $(OBJECTS) $(CFLAGS) src/simple-vm.o src/embedded.o src/simple-vm-opcodes.o
#
# Remove our compiled machine, and the sample programs.
#
clean:
@rm simple-vm embedded *.raw src/*.o || true
#
# Compile all the examples.
#
compile:
for i in examples/*.in; do ./compiler $$i >/dev/null ; done
#
# Format our source-code.
#
indent:
find . \( -name '*.c' -o -name '*.h' \) -exec indent --braces-after-if-line --no-tabs --k-and-r-style --line-length 90 --indent-level 4 -bli0 \{\} \;
perltidy compiler decompiler