-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile
60 lines (44 loc) · 2.21 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
LOTS_O_WARNINGS = -pedantic -Werror -Wall -Wextra -Wwrite-strings -Winit-self -Wcast-align -Wcast-qual -Wpointer-arith -Wstrict-aliasing -Wformat=2 -Wmissing-declarations -Wmissing-include-dirs -Wno-unused-parameter -Wuninitialized -Wold-style-definition -Wstrict-prototypes -Wmissing-prototypes
PREFIX=/usr/bin
.PHONY: all
all: passgen
passgen: passgen.o libs/ct32.o libs/ct_string.o libs/memset_s.o
gcc -std=c99 $(EXTRA_GCC_FLAGS) $(LOTS_O_WARNINGS) libs/ct32.o libs/memset_s.o libs/ct_string.o passgen.o -o passgen
@echo '!!!'
@echo '!!! --> Run `make test` and `make stat_test` to test the binary you just built!'
@echo '!!!'
passgen.o: passgen.c libs/wordlist.h
gcc -std=c99 $(EXTRA_GCC_FLAGS) $(LOTS_O_WARNINGS) -c passgen.c -o passgen.o
libs/ct32.o: libs/ct32.c libs/ct32.h
gcc -std=c99 $(EXTRA_GCC_FLAGS) $(LOTS_O_WARNINGS) -c libs/ct32.c -o libs/ct32.o
libs/ct_string.o: libs/ct_string.c libs/ct_string.h
gcc -std=c99 $(EXTRA_GCC_FLAGS) $(LOTS_O_WARNINGS) -c libs/ct_string.c -o libs/ct_string.o
libs/memset_s.o: libs/memset_s.c libs/memset_s.h
gcc -std=c99 $(EXTRA_GCC_FLAGS) $(LOTS_O_WARNINGS) -c libs/memset_s.c -o libs/memset_s.o
libs/wordlist.h: tools/generate_wordlist.rb libs/wordlist.txt
ruby tools/generate_wordlist.rb libs/wordlist.txt > libs/wordlist.h
# Rebuild the wordlist from the original source.
.PHONY: wordlist
wordlist:
# There are spurious UTF-8 BOM's in the file. The tr -cd removes them.
wget https://raw.githubusercontent.com/zooko/pyutil/master/pyutil/data/wordlist.txt -O - | tr -cd '\x11\12\15\40-\176' | sort -u > libs/wordlist.txt
# NOTE: The `sort -u` serves a security purpose here:
# Without it, if a network attacker injected duplicate words into the downloaded
# list, passgen would over-report the size of the word set to the user.
# The $$ instead of $ in the egrep command is a Make-escaped $.
.PHONY: test
test:
ruby tools/test.rb
.PHONY: stat_test
stat_test:
ruby tools/statistical_test.rb
.PHONY: stat_test_fast
stat_test_fast:
ruby tools/statistical_test.rb fast
.PHONY: install
install: passgen
install -m 755 -D passgen $(PREFIX)/passgen
.PHONY: clean
clean:
rm -f passgen passgen.o libs/ct32.o libs/ct_string.o libs/memset_s.o
find . -name '*.gcda' -o -name '*.gcno' -delete