-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
119 lines (100 loc) · 3.78 KB
/
Makefile
File metadata and controls
119 lines (100 loc) · 3.78 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
112
113
114
115
116
117
118
119
CC := gcc
WCC := clang-19
CONTAINER_TOOL=podman
CFLAGS := \
-std=c23 -pthread \
-Wall -Wextra -Werror -Wpedantic -pedantic-errors \
-Wshadow -Wconversion -Wsign-conversion -Wcast-align -Wcast-qual \
-Wmissing-declarations -Wold-style-definition -Wmissing-prototypes \
-Wnull-dereference -Wpointer-arith -Wvla -Wwrite-strings \
-Wredundant-decls -Warray-bounds -Wnonnull -Wfloat-equal \
-Wduplicated-cond -Wduplicated-branches -Wlogical-op \
-Wuseless-cast -Wstringop-overflow
LIBS := -lssl -lcrypto -lz -lzstd -ldl
DEBUGFLAGS := \
-fsanitize=address,undefined,leak -fno-omit-frame-pointer \
-fstack-protector-strong -fno-common -DDEBUG=1
STDEBUGFLAGS := \
-static -fno-omit-frame-pointer \
-fstack-protector-strong -fno-common -DDEBUG=1
WCFLAGS := --target=wasm32 -nostdlib -Wl,--no-entry -Wl,--export-all
VERSION_PATCH=0
VERSION_UPDATE=0
VERSION_RELEASE=0
VERSION_TAG="\"-rc\""
Sources := \
src/femail.c src/comm.c src/master.c src/dns.c src/smtp.c \
src/http.c
WModules := \
dumby
TAGS_TARGET := \
$(shell find src -path 'src/modules' -prune -o -name '*.[ch]' -print) \
$(shell find wamr/core -name '*.[ch]' -print)
WTargets := $(addprefix bin/modules/,$(addsuffix .wasm,$(WModules)))
all: \
TAGS \
femail/debian/debfemail \
femail/scratch/debfemail-st \
bin/femail bin/femail-st \
$(WTargets)
up: femail/debian/debfemail femail/scratch/debfemail-st all
$(CONTAINER_TOOL) build -t femailbase .
$(CONTAINER_TOOL)-compose up -d --build
down:
$(CONTAINER_TOOL)-compose down -t 3
logs:
$(CONTAINER_TOOL)-compose logs --timestamp --names -f
femail/debian/debfemail: bin/debfemail
install $< $@
femail/scratch/debfemail-st: bin/debfemail-st
install $< $@
bin/femail: $(Sources)
$(CC) -DAPP_NAME="\"Femail Mail System\"" \
-DVERSION_PATCH=$(VERSION_PATCH) \
-DVERSION_UPDATE=$(VERSION_UPDATE) \
-DVERSION_RELEASE=$(VERSION_RELEASE) \
-DVERSION_TAG=$(VERSION_TAG) \
$(CFLAGS) -O2 $(Sources) $(LIBS) -o $@
bin/femail-st: $(Sources)
$(CC) -DAPP_NAME="\"Femail Mail System(Static)\"" \
-DVERSION_PATCH=$(VERSION_PATCH) \
-DVERSION_UPDATE=$(VERSION_UPDATE) \
-DVERSION_RELEASE=$(VERSION_RELEASE) \
-DVERSION_TAG=$(VERSION_TAG) \
$(CFLAGS) -O2 -static $(Sources) $(LIBS) -o $@
bin/debfemail: $(Sources)
$(CC) -DAPP_NAME="\"Femail Debug Mail System\"" \
-DVERSION_PATCH=$(VERSION_PATCH) \
-DVERSION_UPDATE=$(VERSION_UPDATE) \
-DVERSION_RELEASE=$(VERSION_RELEASE) \
-DVERSION_TAG=$(VERSION_TAG) \
$(CFLAGS) $(DEBUGFLAGS) -O1 $(Sources) $(LIBS) -o $@
bin/debfemail-st: $(Sources)
$(CC) -DAPP_NAME="\"Femail Debug Mail System(Static)\"" \
-DVERSION_PATCH=$(VERSION_PATCH) \
-DVERSION_UPDATE=$(VERSION_UPDATE) \
-DVERSION_RELEASE=$(VERSION_RELEASE) \
-DVERSION_TAG=$(VERSION_TAG) \
$(CFLAGS) $(STDEBUGFLAGS) -O1 $(Sources) $(LIBS) -o $@
bin/modules/%.wasm: src/modules/%.c
$(WCC) $(WCFLAGS) $< -o $@
TAGS: $(TAGS_TARGET)
etags --declarations --members --ignore-indentation -o TAGS $^
certs: femail/debian/mail.mailey.femail.crt femail/scratch/mail.failey.femail.crt
femail/debian/mail.mailey.femail.crt:
openssl req -x509 -newkey rsa:2048 -sha256 -days 365 -nodes \
-keyout ca/mail.mailey.femail.key \
-out ca/mail.mailey.femail.crt \
-subj "/CN=mail.mailey.femail" \
-addext "subjectAltName=DNS:mail.mailey.femail"
install -T ca/mail.mailey.femail.key femail/debian/mail.mailey.femail.key
install -T ca/mail.mailey.femail.crt femail/debian/mail.mailey.femail.crt
femail/scratch/mail.failey.femail.crt:
openssl req -x509 -newkey rsa:2048 -sha256 -days 365 -nodes \
-keyout ca/mail.failey.femail.key \
-out ca/mail.failey.femail.crt \
-subj "/CN=mail.failey.femail" \
-addext "subjectAltName=DNS:mail.failey.femail"
install -T ca/mail.failey.femail.key femail/scratch/mail.failey.femail.key
install -T ca/mail.failey.femail.crt femail/scratch/mail.failey.femail.crt
.PHONY: all up down logs certs