summaryrefslogtreecommitdiff
path: root/Makefile
blob: e3cb8e5b171ed51850c0cfa80d549a8a72a2dfcc (plain)
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
EXECUTABLES = assembler disassembler emulator asmcat bincat

ASM_OBJECTS = assembler.o lex.o parse.o output/output_bin.o util.o
DISASM_OBJECTS = disassembler.o input/input_bin.o output/output_asm.o parse.o util.o
EMUL_OBJECTS = input/input_bin.o util.o
ASMCAT_OBJECTS = asmcat.o lex.o parse.o output/output_asm.o util.o
BINCAT_OBJECTS = bincat.o input/input_bin.o output/output_bin.o util.o

INCLUDE += -I.

CFLAGS += $(INCLUDE) -Wall -Wextra -Wpedantic

all: $(EXECUTABLES)

# Main executables
assembler: $(ASM_OBJECTS)

disassembler: $(DISASM_OBJECTS)

emulator: $(EMUL_OBJECTS)

asmcat: $(ASMCAT_OBJECTS)

bincat: $(BINCAT_OBJECTS)

# Utils: FIXME lex and parse should be input?
lex.o: lex.h

parse.o: lex.h parse.h instruction.h util.h

util.o: lex.h instruction.h

# Output modules
output/output_bin.o: output/output_bin.h parse.h

output/output_asm.o: output/output_asm.h parse.h util.h

# Intput modules
input/input_bin.o: input/input_bin.h parse.h

.PHONY: clean test
clean:
	- rm -f $(EXECUTABLES) $(ASM_OBJECTS) $(DISASM_OBJECTS) $(ASMCAT_OBJECTS) $(BINCAT_OBJECTS)

test: all
	make -C test test