-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·70 lines (51 loc) · 1.95 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
59
60
61
62
63
64
65
66
67
68
69
70
### --- Path variables --- ###
OBJPATH='objfiles'
VMPATH='LC3VM'
RESOURCESPATH='resources'
MEMDIR = src/memory
OSDIR = src/os
INSTRDIR = src/instructionset
COMPDIR = src/compiler
EDITORDIR = src/editor
PROGDIR = src/runprogram
GUIDIR = src/gui
FILEXCG = src/clientserver
BINARIESDIR = bin
SHELL := /bin/bash
### --- Install script order --- ###
install_core = install_compiler install_vm
shared = instructionset.o
exec_files = run_program os lc3compiler texor gui
install_post = install_file_sender move_obj_files complete_install
all: $(install_core) $(shared) $(exec_files) $(install_post)
### --- Object files --- ###
os: $(OSDIR)/os.c $(OSDIR)/ui.c $(OSDIR)/fsystem.c memory.o
cc -w $^ -o $@ -lpthread -lrt
run_program: $(PROGDIR)/run_program.c $(OSDIR)/os.h instructionset.o
cc -w $^ -o $@ -lpthread -lrt
lc3compiler: $(COMPDIR)/lc3parser.tab.c instructionset.o
cc -w $^ -o $@ -ly -lfl
instructionset.o: memory.o opcodes.o
cc -w -r $^ -o $@
opcodes.o: $(INSTRDIR)/opcodes.c
cc -w -c $^
memory.o: $(MEMDIR)/memory.c $(MEMDIR)/condflags.h
cc -w -c $^
texor: $(EDITORDIR)/texor.c
cc -w $< -o $@
gui: $(GUIDIR)/gui.c
cc -w $< -o $@ `pkg-config --cflags --libs gtk+-3.0 vte-2.91`
### --- Install procedures --- ###
install_compiler:
{ set -e ; cd src/compiler ; echo "Installing the LC3-COMPILER..." ; flex lc3.l ; bison -d lc3parser.y ; echo "Compiler successfully installed!" ; cd - ; }
install_vm:
{ set -e ; echo "Creating the VM folder" ; if [ ! -d "~/LC3VM" ]; then mkdir LC3VM ; fi ; printf "The VM will be placed in %s/%s\n" $$(pwd) ${VMPATH} ; }
install_file_sender:
{ set -e ; cp ./${FILEXCG}/filesender.sh ./${VMPATH}/filesender.sh ;echo "File sender successfully installed!" ; }
move_obj_files:
{ set -e ; mkdir ${OBJPATH} ; for f in *.o; do mv $$f ${OBJPATH} ; done ; mv $(exec_files) LC3VM; }
complete_install:
echo "Program successfully installed! Go to LC3VM folder to use it!"
### --- Uninstall --- ###
clean:
rm -r ${VMPATH} ${OBJPATH}