-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·56 lines (47 loc) · 1.59 KB
/
Copy pathMakefile
File metadata and controls
executable file
·56 lines (47 loc) · 1.59 KB
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
ifeq ($(OS),Windows_NT)
LOGISIM_BINARY := /usr/local/bin/logisim.exe
PATH := $(wildcard /c/Program\ Files/Java/jdk*/bin):$(PATH)
else
LOGISIM_BINARY := $(HOME)/bin/logisim
endif
.PHONY: compare
compare: alutest_reference.txt alutest.txt
#diff $^
git diff --color-words $^
alutest.txt: alutest_reference.txt alutest_student.txt
cut -f1-4 "$(word 1,$^)" | paste - "$(word 2,$^)" >"$@"
alutest_student.txt: alutest.circ $(LOGISIM_BINARY) alu.circ
rm -f "$@"
logisim -tty table "$<" >"$@"
@while [ ! -e "$@" ]; do :; done
@while [ "`wc -l $@ | cut -d\ -f1`" -ne "256" ]; do :; done
alutest_reference.txt: AluTest.class
java -cp . "$(basename $<)" >"$@"
alu.circ:
@echo
@echo ERROR: No ALU implementation found!
@echo Please copy your Logisim project into this folder and rename it to 'alu.circ'
@echo Then open the 'alutest.circ' project, ensure everything is connected correctly, and save.
@echo
@false
/usr/local/bin/logisim.exe $(HOME)/bin/logisim.jar:
mkdir -p "$(dir $@)"
wget -O "$@" sf.net/projects/circuit/files/latest
$(HOME)/bin/logisim: $(HOME)/bin/logisim.jar
echo "#!/bin/sh" >"$@"
echo 'java -jar $< "$$@"' >>"$@"
chmod +x "$@"
java.check:
@which javac >/dev/null || (\
echo ;\
echo ERROR: No Java installation found! ;\
echo Please download the JDK from http://www.oracle.com/technetwork/java/javase/downloads ;\
echo Then run the installer to completion, keeping the default installation path. ;\
echo ;\
false )
touch java.check
.PHONY: clean
clean:
rm -f *.check *.class *.txt
%.class: %.java java.check
javac "$<"