2020-06-15 14:18:57 +00:00
|
|
|
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
|
|
|
|
#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘
|
|
|
|
|
|
|
|
PKGS += TOOL_NET
|
|
|
|
|
|
|
|
TOOL_NET_FILES := $(wildcard tool/net/*)
|
|
|
|
TOOL_NET_SRCS = $(filter %.c,$(TOOL_NET_FILES))
|
|
|
|
TOOL_NET_HDRS = $(filter %.h,$(TOOL_NET_FILES))
|
|
|
|
|
2020-10-06 06:11:49 +00:00
|
|
|
TOOL_NET_OBJS = \
|
2020-06-15 14:18:57 +00:00
|
|
|
$(TOOL_NET_SRCS:%.c=o/$(MODE)/%.o)
|
|
|
|
|
2020-10-06 06:11:49 +00:00
|
|
|
TOOL_NET_BINS = \
|
|
|
|
$(TOOL_NET_COMS) \
|
2020-06-15 14:18:57 +00:00
|
|
|
$(TOOL_NET_COMS:%=%.dbg)
|
|
|
|
|
2021-06-24 19:31:26 +00:00
|
|
|
TOOL_NET_COMS = \
|
2021-06-28 00:03:06 +00:00
|
|
|
o/$(MODE)/tool/net/dig.com \
|
|
|
|
o/$(MODE)/tool/net/echoserver.com \
|
2021-06-24 19:31:26 +00:00
|
|
|
o/$(MODE)/tool/net/redbean.com \
|
|
|
|
o/$(MODE)/tool/net/redbean-demo.com \
|
|
|
|
o/$(MODE)/tool/net/redbean-static.com \
|
|
|
|
o/$(MODE)/tool/net/redbean-unsecure.com \
|
|
|
|
o/$(MODE)/tool/net/redbean-original.com \
|
2021-07-19 21:55:20 +00:00
|
|
|
o/$(MODE)/tool/net/echoserver.com \
|
|
|
|
o/$(MODE)/tool/net/wb.com
|
2021-06-24 19:31:26 +00:00
|
|
|
|
2020-10-06 06:11:49 +00:00
|
|
|
TOOL_NET_DIRECTDEPS = \
|
|
|
|
LIBC_ALG \
|
|
|
|
LIBC_BITS \
|
|
|
|
LIBC_CALLS \
|
|
|
|
LIBC_DNS \
|
|
|
|
LIBC_FMT \
|
2021-01-16 20:05:41 +00:00
|
|
|
LIBC_INTRIN \
|
2020-10-06 06:11:49 +00:00
|
|
|
LIBC_LOG \
|
|
|
|
LIBC_MEM \
|
|
|
|
LIBC_NEXGEN32E \
|
2021-06-24 19:31:26 +00:00
|
|
|
LIBC_NT_IPHLPAPI \
|
|
|
|
LIBC_NT_KERNEL32 \
|
2020-12-09 23:04:54 +00:00
|
|
|
LIBC_RAND \
|
2020-10-06 06:11:49 +00:00
|
|
|
LIBC_RUNTIME \
|
|
|
|
LIBC_SOCK \
|
|
|
|
LIBC_STDIO \
|
|
|
|
LIBC_STR \
|
|
|
|
LIBC_STUBS \
|
|
|
|
LIBC_SYSV \
|
|
|
|
LIBC_SYSV_CALLS \
|
|
|
|
LIBC_TIME \
|
2021-03-29 09:39:20 +00:00
|
|
|
LIBC_TINYMATH \
|
2020-10-06 06:11:49 +00:00
|
|
|
LIBC_UNICODE \
|
|
|
|
LIBC_X \
|
2021-06-24 19:31:26 +00:00
|
|
|
LIBC_ZIPOS \
|
2020-10-06 06:11:49 +00:00
|
|
|
NET_HTTP \
|
2021-07-08 04:44:27 +00:00
|
|
|
NET_HTTPS \
|
2021-06-24 19:31:26 +00:00
|
|
|
THIRD_PARTY_GDTOA \
|
2020-10-06 06:11:49 +00:00
|
|
|
THIRD_PARTY_GETOPT \
|
2021-03-22 00:27:53 +00:00
|
|
|
THIRD_PARTY_LUA \
|
2021-06-24 19:31:26 +00:00
|
|
|
THIRD_PARTY_MBEDTLS \
|
2021-04-21 02:14:21 +00:00
|
|
|
THIRD_PARTY_REGEX \
|
2021-06-24 19:31:26 +00:00
|
|
|
THIRD_PARTY_SQLITE3 \
|
2020-10-06 06:11:49 +00:00
|
|
|
THIRD_PARTY_ZLIB \
|
2020-06-15 14:18:57 +00:00
|
|
|
TOOL_DECODE_LIB
|
|
|
|
|
2020-10-06 06:11:49 +00:00
|
|
|
TOOL_NET_DEPS := \
|
2020-06-15 14:18:57 +00:00
|
|
|
$(call uniq,$(foreach x,$(TOOL_NET_DIRECTDEPS),$($(x))))
|
|
|
|
|
2020-10-06 06:11:49 +00:00
|
|
|
o/$(MODE)/tool/net/net.pkg: \
|
|
|
|
$(TOOL_NET_OBJS) \
|
2020-06-15 14:18:57 +00:00
|
|
|
$(foreach x,$(TOOL_NET_DIRECTDEPS),$($(x)_A).pkg)
|
|
|
|
|
2020-10-06 06:11:49 +00:00
|
|
|
o/$(MODE)/tool/net/%.com.dbg: \
|
|
|
|
$(TOOL_NET_DEPS) \
|
|
|
|
o/$(MODE)/tool/net/%.o \
|
|
|
|
o/$(MODE)/tool/net/net.pkg \
|
|
|
|
$(CRT) \
|
|
|
|
$(APE)
|
|
|
|
@$(APELINK)
|
|
|
|
|
2021-06-24 19:31:26 +00:00
|
|
|
# REDBEAN.COM
|
|
|
|
#
|
|
|
|
# The little web server that could!
|
|
|
|
|
2020-10-06 06:11:49 +00:00
|
|
|
o/$(MODE)/tool/net/redbean.com.dbg: \
|
|
|
|
$(TOOL_NET_DEPS) \
|
|
|
|
o/$(MODE)/tool/net/redbean.o \
|
2021-06-06 00:33:04 +00:00
|
|
|
o/$(MODE)/tool/net/lsqlite3.o \
|
2020-11-28 20:01:51 +00:00
|
|
|
o/$(MODE)/tool/net/net.pkg \
|
|
|
|
$(CRT) \
|
|
|
|
$(APE)
|
|
|
|
@$(APELINK)
|
|
|
|
|
2021-04-18 18:34:59 +00:00
|
|
|
o/$(MODE)/tool/net/redbean.com: \
|
|
|
|
o/$(MODE)/tool/net/redbean.com.dbg \
|
2021-07-03 15:37:15 +00:00
|
|
|
o/$(MODE)/host/third_party/infozip/zip.com \
|
2021-04-23 17:45:19 +00:00
|
|
|
tool/net/net.mk \
|
2021-07-04 19:21:29 +00:00
|
|
|
tool/net/help.txt \
|
2021-04-18 18:34:59 +00:00
|
|
|
tool/net/.init.lua \
|
2021-04-25 00:09:01 +00:00
|
|
|
tool/net/favicon.ico \
|
|
|
|
tool/net/redbean.png
|
2021-04-18 18:34:59 +00:00
|
|
|
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
|
|
|
@$(COMPILE) -ADD -T$@ dd if=$@ of=o/$(MODE)/tool/net/.ape bs=64 count=11 conv=notrunc 2>/dev/null
|
2021-07-04 19:21:29 +00:00
|
|
|
@$(COMPILE) -AZIP -T$@ o/$(MODE)/host/third_party/infozip/zip.com -qj $@ o/$(MODE)/tool/net/.ape tool/net/help.txt tool/net/.init.lua tool/net/favicon.ico tool/net/redbean.png
|
2021-04-18 18:34:59 +00:00
|
|
|
|
2021-06-24 19:31:26 +00:00
|
|
|
# REDBEAN-DEMO.COM
|
|
|
|
#
|
|
|
|
# This redbean-demo.com program is the same as redbean.com except it
|
|
|
|
# bundles a bunch of example code and there's a live of it available
|
|
|
|
# online at http://redbean.justine.lol/
|
|
|
|
|
2021-04-24 20:58:34 +00:00
|
|
|
o/$(MODE)/tool/net/redbean-demo.com.dbg: \
|
|
|
|
o/$(MODE)/tool/net/redbean.com.dbg
|
|
|
|
@$(COMPILE) -ACP -T$@ cp $< $@
|
|
|
|
|
2021-04-18 18:34:59 +00:00
|
|
|
o/$(MODE)/tool/net/redbean-demo.com: \
|
2021-04-24 20:58:34 +00:00
|
|
|
o/$(MODE)/tool/net/redbean-demo.com.dbg \
|
2021-06-24 19:31:26 +00:00
|
|
|
o/$(MODE)/host/third_party/infozip/zip.com \
|
2021-04-21 02:14:21 +00:00
|
|
|
tool/net/net.mk \
|
2021-04-23 17:45:19 +00:00
|
|
|
tool/net/favicon.ico \
|
|
|
|
tool/net/redbean.png \
|
2021-07-04 19:21:29 +00:00
|
|
|
tool/net/help.txt \
|
2021-04-25 00:09:01 +00:00
|
|
|
tool/net/demo/.init.lua \
|
|
|
|
tool/net/demo/.reload.lua \
|
2021-05-17 02:05:35 +00:00
|
|
|
tool/net/demo/.lua/mymodule.lua \
|
Tune SQLite build for redbean (#97)
redbean lua handlers that perform sql queries can do 400k qps.
We now use a separate compile-time options for SQLite, when building the
SQLite shell versus building the production web serving code. It doesn't
seem appropriate for something like redbean to include backups, progress
callbacks, query completion, profiling, EXPLAIN, ALTER, ANALYZE, VACUUM,
etc. since those tasks are better left to the sqlite3.com shell program.
Lua SQLite pointer APIs have been removed since we're not using threads.
The Lua APIs for installing update / commit / rollback hooks are removed
due to a general sense of disagreement and an overall lack of comfort.
Full-Text Search and R*Tree are as large as the rest of SQLite combined.
Turning those off keeps redbean under 1mb when built for MODE=tiny which
is nice for marketing purposes.
If you need something that was removed, file an issue, and we'll add it.
2021-06-10 15:00:08 +00:00
|
|
|
tool/net/demo/sql.lua \
|
2021-04-25 00:09:01 +00:00
|
|
|
tool/net/demo/404.html \
|
|
|
|
tool/net/demo/hello.lua \
|
|
|
|
tool/net/demo/index.html \
|
|
|
|
tool/net/demo/redbean.css \
|
|
|
|
tool/net/demo/redbean.lua \
|
|
|
|
tool/net/demo/redbean-form.lua \
|
|
|
|
tool/net/demo/redbean-xhr.lua \
|
|
|
|
tool/net/demo/seekable.txt \
|
2021-04-25 02:49:49 +00:00
|
|
|
tool/net/demo/virtualbean.html \
|
2021-07-05 08:03:45 +00:00
|
|
|
tool/net/demo/printpayload.lua \
|
2021-07-08 04:44:27 +00:00
|
|
|
tool/net/demo/fetch.lua \
|
2021-04-21 02:14:21 +00:00
|
|
|
tool/net/redbean.c \
|
2021-06-28 00:03:06 +00:00
|
|
|
net/http/parsehttpmessage.c \
|
2021-04-21 02:14:21 +00:00
|
|
|
net/http/parseurl.c \
|
|
|
|
net/http/encodeurl.c \
|
2021-06-28 00:03:06 +00:00
|
|
|
test/net/http/parsehttpmessage_test.c \
|
2021-04-21 02:14:21 +00:00
|
|
|
test/net/http/parseurl_test.c
|
2021-04-23 17:45:19 +00:00
|
|
|
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
2021-04-25 00:09:01 +00:00
|
|
|
@$(COMPILE) -AMKDIR -T$@ mkdir -p o/$(MODE)/tool/net/.redbean-demo
|
|
|
|
@$(COMPILE) -ADD -T$@ dd if=$@ of=o/$(MODE)/tool/net/.redbean-demo/.ape bs=64 count=11 conv=notrunc 2>/dev/null
|
2021-07-04 19:21:29 +00:00
|
|
|
@$(COMPILE) -AZIP -T$@ o/$(MODE)/host/third_party/infozip/zip.com -qj $@ o/$(MODE)/tool/net/.redbean-demo/.ape tool/net/help.txt tool/net/demo/.init.lua tool/net/demo/.reload.lua
|
2021-05-17 02:05:35 +00:00
|
|
|
@$(COMPILE) -ARM -T$@ rm -rf o/$(MODE)/tool/net/.lua
|
|
|
|
@$(COMPILE) -ACP -T$@ cp -R tool/net/demo/.lua o/$(MODE)/tool/net/
|
2021-06-24 19:31:26 +00:00
|
|
|
@(cd o/$(MODE)/tool/net && ../../host/third_party/infozip/zip.com -qr redbean-demo.com .lua)
|
|
|
|
@$(COMPILE) -AZIP -T$@ o/$(MODE)/host/third_party/infozip/zip.com -qj $@ tool/net/demo/hello.lua tool/net/demo/sql.lua
|
|
|
|
@echo "<-- check out this lua server page" | $(COMPILE) -AZIP -T$@ o/$(MODE)/host/third_party/infozip/zip.com -cqj $@ tool/net/demo/redbean.lua
|
2021-07-08 04:44:27 +00:00
|
|
|
@$(COMPILE) -AZIP -T$@ o/$(MODE)/host/third_party/infozip/zip.com -qj $@ tool/net/demo/404.html tool/net/favicon.ico tool/net/redbean.png tool/net/demo/redbean-form.lua tool/net/demo/redbean-xhr.lua tool/net/demo/printpayload.lua tool/net/demo/fetch.lua
|
2021-06-24 19:31:26 +00:00
|
|
|
@echo Uncompressed for HTTP Range requests | $(COMPILE) -AZIP -T$@ o/$(MODE)/host/third_party/infozip/zip.com -cqj0 $@ tool/net/demo/seekable.txt
|
2021-06-28 00:03:06 +00:00
|
|
|
@$(COMPILE) -AZIP -T$@ o/$(MODE)/host/third_party/infozip/zip.com -q $@ tool/net/ tool/net/demo/ tool/net/demo/index.html tool/net/demo/redbean.css tool/net/redbean.c net/http/parsehttpmessage.c net/http/parseurl.c net/http/encodeurl.c test/net/http/parsehttpmessage_test.c test/net/http/parseurl_test.c
|
2021-04-25 02:49:49 +00:00
|
|
|
@$(COMPILE) -AMKDIR -T$@ mkdir -p o/$(MODE)/tool/net/virtualbean.justine.lol/
|
|
|
|
@$(COMPILE) -ACP -T$@ cp tool/net/redbean.png o/$(MODE)/tool/net/virtualbean.justine.lol/redbean.png
|
|
|
|
@$(COMPILE) -ACP -T$@ cp tool/net/demo/virtualbean.html o/$(MODE)/tool/net/virtualbean.justine.lol/index.html
|
2021-06-24 19:31:26 +00:00
|
|
|
@(cd o/$(MODE)/tool/net && ../../host/third_party/infozip/zip.com -q redbean-demo.com virtualbean.justine.lol/)
|
|
|
|
@(cd o/$(MODE)/tool/net && echo 'Go to <a href=http://virtualbean.justine.lol>http://virtualbean.justine.lol</a>' | ../../host/third_party/infozip/zip.com -cq redbean-demo.com virtualbean.justine.lol/index.html)
|
|
|
|
@(cd o/$(MODE)/tool/net && ../../host/third_party/infozip/zip.com -q redbean-demo.com virtualbean.justine.lol/redbean.png)
|
|
|
|
|
|
|
|
# REDBEAN-STATIC.COM
|
|
|
|
#
|
|
|
|
# Passing the -DSTATIC causes Lua and SQLite to be removed. This reduces
|
|
|
|
# the binary size from roughly 1500 kb to 500 kb. It still supports SSL.
|
2021-04-21 02:14:21 +00:00
|
|
|
|
|
|
|
o/$(MODE)/tool/net/redbean-static.com: \
|
|
|
|
o/$(MODE)/tool/net/redbean-static.com.dbg \
|
2021-07-03 15:37:15 +00:00
|
|
|
o/$(MODE)/host/third_party/infozip/zip.com \
|
2021-07-04 19:21:29 +00:00
|
|
|
tool/net/help.txt \
|
2021-04-21 02:14:21 +00:00
|
|
|
tool/net/favicon.ico \
|
|
|
|
tool/net/redbean.png
|
|
|
|
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
2021-04-25 00:09:01 +00:00
|
|
|
@$(COMPILE) -AMKDIR -T$@ mkdir -p o/$(MODE)/tool/net/.redbean-static
|
|
|
|
@$(COMPILE) -ADD -T$@ dd if=$@ of=o/$(MODE)/tool/net/.redbean-static/.ape bs=64 count=11 conv=notrunc 2>/dev/null
|
2021-07-04 19:21:29 +00:00
|
|
|
@$(COMPILE) -AZIP -T$@ o/$(MODE)/host/third_party/infozip/zip.com -qj $@ o/$(MODE)/tool/net/.redbean-static/.ape tool/net/help.txt tool/net/favicon.ico tool/net/redbean.png
|
2021-04-21 02:14:21 +00:00
|
|
|
|
|
|
|
o/$(MODE)/tool/net/redbean-static.com.dbg: \
|
|
|
|
$(TOOL_NET_DEPS) \
|
|
|
|
o/$(MODE)/tool/net/redbean-static.o \
|
|
|
|
o/$(MODE)/tool/net/net.pkg \
|
|
|
|
$(CRT) \
|
|
|
|
$(APE)
|
|
|
|
@$(APELINK)
|
|
|
|
|
|
|
|
o/$(MODE)/tool/net/redbean-static.o: tool/net/redbean.c
|
2021-06-24 19:31:26 +00:00
|
|
|
@$(COMPILE) -AOBJECTIFY.c $(OBJECTIFY.c) -DSTATIC -DREDBEAN=\"redbean-static\" $(OUTPUT_OPTION) $<
|
|
|
|
|
|
|
|
# REDBEAN-UNSECURE.COM
|
|
|
|
#
|
|
|
|
# Passing the -DUNSECURE will cause the TLS security code to be removed.
|
|
|
|
# That doesn't mean redbean becomes insecure. It just reduces complexity
|
|
|
|
# in situations where you'd rather have SSL be handled in an edge proxy.
|
|
|
|
|
|
|
|
o/$(MODE)/tool/net/redbean-unsecure.com: \
|
|
|
|
o/$(MODE)/tool/net/redbean-unsecure.com.dbg \
|
2021-07-03 15:37:15 +00:00
|
|
|
o/$(MODE)/host/third_party/infozip/zip.com \
|
2021-07-04 19:21:29 +00:00
|
|
|
tool/net/help.txt \
|
2021-06-24 19:31:26 +00:00
|
|
|
tool/net/favicon.ico \
|
|
|
|
tool/net/redbean.png
|
|
|
|
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
|
|
|
@$(COMPILE) -AMKDIR -T$@ mkdir -p o/$(MODE)/tool/net/.redbean-unsecure
|
|
|
|
@$(COMPILE) -ADD -T$@ dd if=$@ of=o/$(MODE)/tool/net/.redbean-unsecure/.ape bs=64 count=11 conv=notrunc 2>/dev/null
|
2021-07-04 19:21:29 +00:00
|
|
|
@$(COMPILE) -AZIP -T$@ o/$(MODE)/host/third_party/infozip/zip.com -qj $@ o/$(MODE)/tool/net/.redbean-unsecure/.ape tool/net/help.txt tool/net/favicon.ico tool/net/redbean.png
|
2021-06-24 19:31:26 +00:00
|
|
|
|
|
|
|
o/$(MODE)/tool/net/redbean-unsecure.com.dbg: \
|
|
|
|
$(TOOL_NET_DEPS) \
|
|
|
|
o/$(MODE)/tool/net/redbean-unsecure.o \
|
|
|
|
o/$(MODE)/tool/net/lsqlite3.o \
|
|
|
|
o/$(MODE)/tool/net/net.pkg \
|
|
|
|
$(CRT) \
|
|
|
|
$(APE)
|
|
|
|
@$(APELINK)
|
|
|
|
|
|
|
|
o/$(MODE)/tool/net/redbean-unsecure.o: tool/net/redbean.c
|
|
|
|
@$(COMPILE) -AOBJECTIFY.c $(OBJECTIFY.c) -DUNSECURE -DREDBEAN=\"redbean-unsecure\" $(OUTPUT_OPTION) $<
|
|
|
|
|
|
|
|
# REDBEAN-ORIGINAL.COM
|
|
|
|
#
|
|
|
|
# Passing the -DSTATIC and -DUNSECURE flags together w/ MODE=tiny will
|
|
|
|
# produce 200kb binary that's very similar to redbean as it existed on
|
|
|
|
# Hacker News the day it went viral.
|
|
|
|
|
|
|
|
o/$(MODE)/tool/net/redbean-original.com: \
|
|
|
|
o/$(MODE)/tool/net/redbean-original.com.dbg \
|
2021-07-03 15:37:15 +00:00
|
|
|
o/$(MODE)/host/third_party/infozip/zip.com \
|
2021-07-04 19:21:29 +00:00
|
|
|
tool/net/help.txt \
|
2021-06-24 19:31:26 +00:00
|
|
|
tool/net/favicon.ico \
|
|
|
|
tool/net/redbean.png
|
|
|
|
@$(COMPILE) -AOBJCOPY -T$@ $(OBJCOPY) -S -O binary $< $@
|
|
|
|
@$(COMPILE) -AMKDIR -T$@ mkdir -p o/$(MODE)/tool/net/.redbean-original
|
|
|
|
@$(COMPILE) -ADD -T$@ dd if=$@ of=o/$(MODE)/tool/net/.redbean-original/.ape bs=64 count=11 conv=notrunc 2>/dev/null
|
2021-07-04 19:21:29 +00:00
|
|
|
@$(COMPILE) -AZIP -T$@ o/$(MODE)/host/third_party/infozip/zip.com -qj $@ o/$(MODE)/tool/net/.redbean-original/.ape tool/net/help.txt tool/net/favicon.ico tool/net/redbean.png
|
2021-06-24 19:31:26 +00:00
|
|
|
|
|
|
|
o/$(MODE)/tool/net/redbean-original.com.dbg: \
|
|
|
|
$(TOOL_NET_DEPS) \
|
|
|
|
o/$(MODE)/tool/net/redbean-original.o \
|
|
|
|
o/$(MODE)/tool/net/lsqlite3.o \
|
|
|
|
o/$(MODE)/tool/net/net.pkg \
|
|
|
|
$(CRT) \
|
|
|
|
$(APE)
|
|
|
|
@$(APELINK)
|
|
|
|
|
|
|
|
o/$(MODE)/tool/net/redbean-original.o: tool/net/redbean.c
|
|
|
|
@$(COMPILE) -AOBJECTIFY.c $(OBJECTIFY.c) -DSTATIC -DUNSECURE -DREDBEAN=\"redbean-original\" $(OUTPUT_OPTION) $<
|
2021-04-18 18:34:59 +00:00
|
|
|
|
2020-06-15 14:18:57 +00:00
|
|
|
.PHONY: o/$(MODE)/tool/net
|
2020-10-06 06:11:49 +00:00
|
|
|
o/$(MODE)/tool/net: \
|
|
|
|
$(TOOL_NET_BINS) \
|
2020-09-07 04:39:00 +00:00
|
|
|
$(TOOL_NET_CHECKS)
|