-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
151 lines (129 loc) · 4.79 KB
/
Makefile
File metadata and controls
151 lines (129 loc) · 4.79 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
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 := $(wildcard src/*.c)
Headers := $(wildcard src/*.h)
WModules := $(notdir $(wildcard src/modules/*))
Deps := \
bin/wamr/libiwasm.a
WTargets := $(addprefix bin/modules/,$(addsuffix .wasm,$(WModules)))
WAMR_SOURCE := $(shell find wamr/core -name '*.[ch]' -print)
TAGS_TARGET := \
$(shell find src -path 'src/modules' -prune -o -name '*.[ch]' -print) \
$(WAMR_SOURCE)
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) $(Deps) $(Headers)
$(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) $(Deps) $(LIBS) -o $@
bin/femail-st: $(Sources) $(Deps) $(Headers)
$(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) $(Deps) $(LIBS) -o $@
bin/debfemail: $(Sources) $(Deps) $(Headers)
$(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) $(Deps) $(LIBS) -o $@
bin/debfemail-st: $(Sources) $(Deps) $(Headers)
$(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) $(Deps) $(LIBS) -o $@
deps: bin/wamr/libiwasm.a
bin/wamr/libiwasm.a: bin/wamr/Makefile
make -C bin/wamr -j$(shell nproc)
bin/wamr/Makefile: $(WAMR_SOURCE)
mkdir -p bin/wamr
cmake -Swamr -Bbin/wamr \
-DWAMR_BUILD_PLATFORM=linux \
-DWAMR_BUILD_INTERP=1 \
-DWAMR_BUILD_FAST_INTERP=1 \
-DWAMR_BUILD_AOT=0 \
-DWAMR_BUILD_JIT=0 \
-DWAMR_BUILD_FAST_JIT=0 \
-DWAMR_BUILD_LIBC_BUILTIN=0 \
-DWAMR_BUILD_LIBC_WASI=0 \
-DWAMR_BUILD_MULTI_MODULE=0 \
-DWAMR_BUILD_SHARED_MEMORY=0 \
-DWAMR_BUILD_THREAD_MGR=0 \
-DWAMR_BUILD_LIB_PTHREAD=0 \
-DWAMR_BUILD_GC=0 \
-DWAMR_BUILD_SIMD=1 \
-DWAMR_BUILD_REF_TYPES=1 \
-DWAMR_BUILD_TAIL_CALL=1 \
-DWAMR_BUILD_CUSTOM_NAME_SECTION=1 \
-DWAMR_BUILD_DUMP_CALL_STACK=1 \
-DWAMR_DISABLE_HW_BOUND_CHECK=1 \
-DWAMR_DISABLE_STACK_HW_BOUND_CHECK=1 \
-DWAMR_BUILD_SHRUNK_MEMORY=1 \
-DWAMR_BUILD_MEMORY64=0;
bin/modules/%.wasm: src/modules/%/mod.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 deps