-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
45 lines (35 loc) · 1.2 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
# Basic compilation macros
CC = gcc # GCC Compiler
CFLAGS = -ansi -Wall -pedantic # Flags
GLOBAL_DEPS = globals.h # Dependencies for everything
EXE_DEPS = assembler.o code.o fpass.o spass.o instructions.o table.o utils.o writefiles.o # Deps for exe
## Executable
assembler: $(EXE_DEPS) $(GLOBAL_DEPS)
$(CC) -g $(EXE_DEPS) $(CFLAGS) -o $@
## Main:
assembler.o: assembler.c $(GLOBAL_DEPS)
$(CC) -c assembler.c $(CFLAGS) -o $@
## Code helper functions:
code.o: code.c code.h $(GLOBAL_DEPS)
$(CC) -c code.c $(CFLAGS) -o $@
## First Pass:
fpass.o: first_pass.c first_pass.h $(GLOBAL_DEPS)
$(CC) -c first_pass.c $(CFLAGS) -o $@
## Second Pass:
spass.o: second_pass.c second_pass.h $(GLOBAL_DEPS)
$(CC) -c second_pass.c $(CFLAGS) -o $@
## Instructions helper functions:
instructions.o: instructions.c instructions.h $(GLOBAL_DEPS)
$(CC) -c instructions.c $(CFLAGS) -o $@
## Table:
table.o: table.c table.h $(GLOBAL_DEPS)
$(CC) -c table.c $(CFLAGS) -o $@
## Useful functions:
utils.o: utils.c instructions.h $(GLOBAL_DEPS)
$(CC) -c utils.c $(CFLAGS) -o $@
## Output Files:
writefiles.o: writefiles.c writefiles.h $(GLOBAL_DEPS)
$(CC) -c writefiles.c $(CFLAGS) -o $@
# Clean Target (remove leftovers)
clean:
rm -rf *.o