summaryrefslogtreecommitdiffstats
path: root/makefile
blob: 3b1e40c90d6ec18a91839a83106430e303932abd (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
.PHONY: all
all: b32e b32d

.PHONY: test
test: b32e
	echo "hello!" | ./b32e
	@printf '\n'
	echo "hello!" | base32 -w0
	@printf '\n'

.PHONY: ftest
ftest: b32e b32d
	cat makefile | ./b32e > makefile.b32
	cat makefile | base32 -w 0 > makefile.check.b32
	diff makefile.b32 makefile.check.b32

	cat makefile.b32 | ./b32d > makefile.decoded
	@# cat makefile.check.b32 | base32 -d
	diff makefile makefile.decoded

.PHONY: perftest
perftest: b32e
	time cat doc/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf | ./b32e > 64-ia-32-intel2.pdf.b32
	time cat doc/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf | base32 -w 0 > 64-ia-32-intel2.pdf.b32

# encoder
b32e: b32e.o
	ld -o $@ $<

b32e.o: b32e.asm
	nasm -f elf64 -g -F dwarf -O0 -w+all -o $@ $<

# decoder
b32d: b32d.o
	ld -o $@ $<

b32d.o: b32d.asm
	nasm -f elf64 -g -F dwarf -O0 -w+all -o $@ $<

.PHONY: clean
clean:
	rm -f *.o b32e b32d *.b32 *.decoded