-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmakefile
169 lines (135 loc) · 5.15 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# Need to export as ENV var
export TEMPLATE_DIR = templates
export QUIZ_DIR = templates
PTML_DIR = html_src
ADIR = ansible
SDIR = assembler
INTEL_DIR = $(SDIR)/Intel
MIPS_DIR = $(SDIR)/MIPS
RISCV_DIR = $(SDIR)/RISCV
WASM_DIR = $(SDIR)/WASM
EMUDIR = Emu86
REPO = emu86
ODIR = $(EMUDIR)/templates
MUDIR = myutils
MODELS_DIR = models
UDIR = utils
TDIR = tests
SRCS = $(INTEL_DIR)/arithmetic.py $(INTEL_DIR)/control_flow.py $(INTEL_DIR)/data_mov.py $(INTEL_DIR)/interrupts.py
MIPS_SRCS = $(MIPS_DIR)/arithmetic.py $(MIPS_DIR)/control_flow.py $(MIPS_DIR)/data_mov.py $(MIPS_DIR)/interrupts.py
INTER2 = $(ODIR)/help.ptml
OBJS = $(ODIR)/help.html
EXTR = $(UDIR)/extract_doc.awk
D2HTML = $(UDIR)/doc2html.awk
INCS = $(TEMPLATE_DIR)/head.txt $(TEMPLATE_DIR)/navbar.txt
DOCKER_DIR = docker
PYLINT = flake8
PYLINTFLAGS =
PYTHONFILES = $(shell find . -type f -name "*.py" -not -path "./utils/*" -not -path "./Emu86/migrations/*" -not -path "./mysite/*")
ESLINT = npx eslint
JSFILES = $(shell ls mysite/static/Emu86/*.js)
HTML_FILES = $(shell ls $(PTML_DIR)/*.ptml | sed -e 's/.ptml/.html/' | sed -e 's/html_src\///')
ASM_FILES = $(shell ls $(TDIR)/*/*.asm)
ASM_PTMLS = $(shell find ./$(TDIR)/tests_Intel -type f -name "*.asm" -not -path "./$(TDIR)/tests_Intel/fp*" -not -path "./$(TDIR)/tests_Intel/sieve*" | sed -e 's/.asm/.ptml/' | sed -e 's/tests\/tests_Intel\//html_src\//')
FORCE:
# update our submodules:
submods: FORCE
git submodule foreach --recursive git pull origin master
# this rule builds the menu for the static server:
navbar: submods
$(UDIR)/html_include.awk <$(TEMPLATE_DIR)/navbar.pre >$(TEMPLATE_DIR)/navbar.txt
python3 write_sample_programs.py
# rule for making html files from ptml files:
%.html: $(PTML_DIR)/%.ptml $(INCS)
python3 $(UDIR)/html_checker.py $<
$(UDIR)/html_include.awk <$< >$@
git add $@
local: $(HTML_FILES)
# build sample asm web pages for project web site:
$(PTML_DIR)/%.ptml: $(TDIR)/Intel/%.asm
$(MUDIR)/asm2ptml.awk $< >$@
samples: $(ASM_PTMLS) $(TDIR)
# build the static website describing the project:
website: $(INCS) $(HTML_FILES) help
-git commit -a
git pull --recurse-submodules origin master
git push origin master
# dev container has dev tools
dev_container: $(DOCKER_DIR)/Dockerfile $(DOCKER_DIR)/requirements-dev.txt
docker build -t gcallah/$(REPO)-dev docker
# prod container has only what's needed to run
prod_container: $(DOCKER_DIR)/Deployable $(DOCKER_DIR)/requirements.txt
docker system prune -f
docker build -t gcallah/$(REPO) docker --no-cache --build-arg repo=$(REPO) -f $(DOCKER_DIR)/Deployable
# deploy prod container
deploy_container:
docker push gcallah/$(REPO):latest
lint: $(patsubst %.py,%.pylint,$(PYTHONFILES)) $(patsubst %.js,%.eslint,$(JSFILES))
%.pylint:
$(PYLINT) $(PYLINTFLAGS) $*.py
%.eslint:
$(ESLINT) $*.js
help_mips: $(MIPS_SRCS)
$(EXTR) <$(MIPS_DIR)/arithmetic.py | $(D2HTML) >$(TEMPLATE_DIR)/mips_arithmetic.txt
$(EXTR) <$(MIPS_DIR)/control_flow.py | $(D2HTML) >$(TEMPLATE_DIR)/mips_control_flow.txt
$(EXTR) <$(MIPS_DIR)/data_mov.py | $(D2HTML) >$(TEMPLATE_DIR)/mips_data_mov.txt
$(EXTR) <$(MIPS_DIR)/interrupts.py | $(D2HTML) >$(TEMPLATE_DIR)/mips_interrupts.txt
# build instruction help material from python source:
help: $(SRCS) samples help_mips
python3 write_sample_programs.py
git add $(TEMPLATE_DIR)/sample_programs_*.txt -f
-git commit -m "Updating sample files"
$(EXTR) <$(SDIR)/parse.py | $(D2HTML) >$(TEMPLATE_DIR)/data.txt
$(EXTR) <$(INTEL_DIR)/arithmetic.py | $(D2HTML) >$(TEMPLATE_DIR)/arithmetic.txt
$(EXTR) <$(INTEL_DIR)/control_flow.py | $(D2HTML) >$(TEMPLATE_DIR)/control_flow.txt
$(EXTR) <$(INTEL_DIR)/data_mov.py | $(D2HTML) >$(TEMPLATE_DIR)/data_mov.txt
$(EXTR) <$(INTEL_DIR)/interrupts.py | $(D2HTML) >$(TEMPLATE_DIR)/interrupts.txt
$(UDIR)/html_include.awk <$(ODIR)/help.ptml >$(ODIR)/help.html
$(UDIR)/django2ptml.awk <$(ODIR)/help.html title="Language Description" >$(PTML_DIR)/help.ptml
-git commit $(ODIR)/help.html
git push origin master
jsfile:
python3 function_create_js.py
git add function_create_js.py
git add mysite/static/Emu86/sample_functions*.js
git commit -m "Updating js sample files"
git push origin master
zip:
-git rm Haldun.zip
-git commit -m 'Removing old zip file'
git push origin master
git archive --format zip --output Haldun.zip master
git add Haldun.zip
git commit -m 'Updating zip file'
git push origin master
db:
python3 manage.py makemigrations
python3 manage.py migrate
git add $(EMUDIR)/migrations/*.py
-git commit $(EMUDIR)/migrations/*.py
git push origin master
jupyter_kernel:
pip3 install --upgrade emu86
intel_kernel:
python3 -m kernels.intel.install
att_kernel:
python3 -m kernels.att.install
mips_asm_kernel:
python3 -m kernels.mips_asm.install
mips_mml_kernel:
python3 -m kernels.mips_mml.install
riscv_kernel:
python3 -m kernels.riscv.install
all_tests: tests test_docker
tests: FORCE
./all_tests.sh
test_docker:
docker build -t gcallah/$(REPO) docker/
dev: $(SRCS) $(MIPS_SRCS) $(OBJS) tests
-git commit -a
git push origin master
ssh [email protected] 'cd /home/emu86/Emu86; /home/emu86/Emu86/myutils/dev.sh'
prod: $(SRCS) $(OBJ) navbar tests
git pull --recurse-submodules origin master
-git commit -a
git push origin master