-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
111 lines (91 loc) · 3.58 KB
/
Makefile
File metadata and controls
111 lines (91 loc) · 3.58 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
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
# HiAE Makefile
# High-Throughput Authenticated Encryption Algorithm
# Compiler and flags
CC = cc
# Detect architecture and set appropriate flags
ARCH := $(shell uname -m)
ifeq ($(ARCH),x86_64)
# x86-64 flags - enable AES-NI
CFLAGS = -O3 -march=native -maes -I code
else ifeq ($(ARCH),aarch64)
# ARM64 flags - enable crypto extensions
CFLAGS = -O3 -march=native+crypto -I code
else ifeq ($(ARCH),arm64)
# ARM64 flags (macOS naming) - enable crypto extensions
CFLAGS = -O3 -march=native+crypto -I code
else
$(error Unsupported architecture: $(ARCH). HiAE requires x86-64 with AES-NI or ARM64 with crypto extensions)
endif
LDFLAGS =
# Source files
SOURCES = code/HiAE.c
HEADERS = code/HiAE.h
# Output directory for binaries
BINDIR = bin
# Target executables
TARGETS = $(BINDIR)/perf_test $(BINDIR)/func_test $(BINDIR)/test_vectors $(BINDIR)/HiAE-MAC $(BINDIR)/HiAE-File-AEAD
# Default target
all: $(BINDIR) $(TARGETS)
# Create bin directory
$(BINDIR):
@mkdir -p $(BINDIR)
# Performance test
$(BINDIR)/perf_test: $(BINDIR) $(SOURCES) $(HEADERS) test/performance_test.c
@echo "Building performance test..."
$(CC) $(CFLAGS) $(SOURCES) test/performance_test.c -o $@ $(LDFLAGS)
# Functional test
$(BINDIR)/func_test: $(BINDIR) $(SOURCES) $(HEADERS) test/function_test.c
@echo "Building functional test..."
$(CC) $(CFLAGS) $(SOURCES) test/function_test.c -o $@ $(LDFLAGS)
# Test vectors validation
$(BINDIR)/test_vectors: $(BINDIR) $(SOURCES) $(HEADERS) test/test_vectors_ietf.c
@echo "Building test vectors validation..."
$(CC) $(CFLAGS) $(SOURCES) test/test_vectors_ietf.c -o $@ $(LDFLAGS)
# HiAE-MAC application
$(BINDIR)/HiAE-MAC: $(BINDIR) $(SOURCES) $(HEADERS) app/HiAE-MAC.c
@echo "Building HiAE-MAC application..."
$(CC) $(CFLAGS) $(SOURCES) app/HiAE-MAC.c -o $@ $(LDFLAGS)
# HiAE-File-AEAD application
$(BINDIR)/HiAE-File-AEAD: $(BINDIR) $(SOURCES) $(HEADERS) app/HiAE-File-AEAD.c
@echo "Building HiAE-File-AEAD application..."
$(CC) $(CFLAGS) $(SOURCES) app/HiAE-File-AEAD.c -o $@ $(LDFLAGS)
# Test targets
test: $(BINDIR)/func_test $(BINDIR)/test_vectors
@echo "Running functional tests..."
./$(BINDIR)/func_test
@echo ""
@echo "Running test vector validation..."
./$(BINDIR)/test_vectors
test-vectors: $(BINDIR)/test_vectors
@echo "Running test vector validation..."
./$(BINDIR)/test_vectors
benchmark: $(BINDIR)/perf_test
@echo "Running performance benchmark..."
./$(BINDIR)/perf_test
# Clean target
clean:
@echo "Cleaning build artifacts..."
@rm -rf $(BINDIR)
@rm -f perf_test func_test HiAE-MAC HiAE-File-AEAD
# Help target
help:
@echo "HiAE Makefile targets:"
@echo " make all - Build all targets (default)"
@echo " make test - Build and run all tests"
@echo " make test-vectors - Build and run test vector validation"
@echo " make benchmark - Build and run performance benchmark"
@echo " make perf_test - Build performance test only"
@echo " make func_test - Build functional test only"
@echo " make test_vectors - Build test vectors validation only"
@echo " make HiAE-MAC - Build HiAE-MAC application"
@echo " make HiAE-File-AEAD - Build file AEAD application"
@echo " make clean - Remove all build artifacts"
@echo " make help - Show this help message"
# Individual target shortcuts
perf_test: $(BINDIR)/perf_test
func_test: $(BINDIR)/func_test
test_vectors: $(BINDIR)/test_vectors
HiAE-MAC: $(BINDIR)/HiAE-MAC
HiAE-File-AEAD: $(BINDIR)/HiAE-File-AEAD
# Phony targets
.PHONY: all test test-vectors benchmark clean help perf_test func_test test_vectors HiAE-MAC HiAE-File-AEAD