Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown on demand #829

Merged
merged 6 commits into from
Apr 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ obj
/src/syscall
/deps/*.vsn
/src/programs.inc
.images
Binary file removed src/.images/Architecture.png
Binary file not shown.
Binary file removed src/.images/Network.png
Binary file not shown.
27 changes: 13 additions & 14 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CSRC = $(shell find . -regex '[^\#]*\.c' -not -regex './arch/.*' -printf '%P '
CHDR = $(shell find . -regex '[^\#]*\.h' -printf '%P ')
ASM = $(shell find . -regex '[^\#]*\.dasl' -printf '%P ')
ARCHSRC= $(shell find . -regex '^./arch/[^\#]*\.c' -printf '%P ')
RMSRC = $(shell find . -name README.src.md -printf '%P ')
RMSRC = $(shell find . -name '*.md' -not -regex './obj.*' -printf '%P ')
# regexp is to include program/foo but not program/foo/bar
PROGRAM = $(shell find program -regex '^[^/]+/[^/]+' -type d -printf '%P ')
# sort to eliminate potential duplicate of programs.inc
Expand All @@ -30,7 +30,7 @@ ARCHOBJ:= $(patsubst %.c,obj/%_c.o, $(ARCHSRC))
ASMOBJ := $(patsubst %.dasl,obj/%_dasl.o, $(ASM))
JITOBJS:= $(patsubst %,obj/jit_%.o,$(JITSRC))
EXTRAOBJS := obj/jit_tprof.o obj/jit_vmprof.o obj/strict.o
RMOBJS := $(patsubst %.src.md,%.md,$(RMSRC))
RMOBJS := $(patsubst %,obj/%,$(RMSRC))
INCOBJ := $(patsubst %.inc,obj/%_inc.o, $(INCSRC))
EXE := bin/snabb $(patsubst %,bin/%,$(PROGRAM))

Expand Down Expand Up @@ -110,7 +110,7 @@ $(TESTSCRIPTS): testlog snabb
) \
)

$(OBJDIR) bin testlog:
$(OBJDIR) bin testlog $(OBJDIR/doc):
$(E) "DIR $@"
$(Q) mkdir -p $@

Expand Down Expand Up @@ -151,10 +151,9 @@ $(JITOBJS): obj/jit_%.o: ../lib/luajit/src/jit/%.lua $(OBJDIR)
$(E) "LUA $@"
$(Q) luajit -bg -n $(patsubst obj/jit_%.o, jit.%, $@) $< $@


$(RMOBJS): %.md: %.src.md
$(RMOBJS): obj/%: %
$(E) "MARKDOWN $@"
$(Q) scripts/process-markdown $< > $@
$(Q) scripts/process-markdown $< $@
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lukego This might have broken things? It worked before but now I get:

MARKDOWN  obj/program/lwaftr/doc/README.ndp.md
make: *** [obj/program/lwaftr/doc/README.ndp.md] Error 1


$(INCOBJ): obj/%_inc.o: %.inc Makefile | $(OBJDIR)
$(E) "INC $@"
Expand Down Expand Up @@ -182,22 +181,22 @@ obj/jit_vmprof.o: extra/vmprof.c | $(OBJDIR)
$(E) "C $@"
$(Q) gcc $(DEBUG) -Wl,-E -O2 -I ../lib/luajit/src -c -Wall -Werror -o $@ $<

book: doc/snabbswitch.pdf doc/snabbswitch.html doc/snabbswitch.epub
book: obj/doc/snabbswitch.pdf obj/doc/snabbswitch.html obj/doc/snabbswitch.epub

doc/snabbswitch.md: markdown Makefile doc/genbook.sh
obj/doc/snabbswitch.markdown: markdown Makefile doc/genbook.sh
(cd doc; ./genbook.sh) > $@

doc/snabbswitch.pdf: doc/snabbswitch.md
obj/doc/snabbswitch.pdf: obj/doc/snabbswitch.markdown
$(E) "PANDOC $@"
$(Q) (cd doc; pandoc --template=template.latex --latex-engine=lualatex -V fontsize=10pt -V monofont=droidsansmono -V monoscale=.70 -V verbatimspacing=.85 -V mainfont=droidserif -V sansfont=droidsans -V documentclass:book -V geometry:top=1.0in -V geometry:bottom=0.75in -S --toc --chapters -o snabbswitch.pdf snabbswitch.md)
$(Q) (cd doc; pandoc --template=template.latex --latex-engine=lualatex -V fontsize=10pt -V monofont=droidsansmono -V monoscale=.70 -V verbatimspacing=.85 -V mainfont=droidserif -V sansfont=droidsans -V documentclass:book -V geometry:top=1.0in -V geometry:bottom=0.75in -S --toc --chapters -o ../$@ ../$<)

doc/snabbswitch.html: doc/snabbswitch.md
obj/doc/snabbswitch.html: obj/doc/snabbswitch.markdown
$(E) "PANDOC $@"
$(Q) (cd doc; pandoc --self-contained --css="style.css" -S -s --toc --chapters -o snabbswitch.html snabbswitch.md)
$(Q) (cd doc; pandoc --self-contained --css="style.css" -S -s --toc --chapters -o ../$@ ../$<)

doc/snabbswitch.epub: doc/snabbswitch.md
obj/doc/snabbswitch.epub: obj/doc/snabbswitch.markdown
$(E) "PANDOC $@"
$(Q) (cd doc; pandoc --self-contained --css="style.css" -S -s --toc --chapters -o snabbswitch.epub snabbswitch.md)
$(Q) (cd doc; pandoc --self-contained --css="style.css" -S -s --toc --chapters -o ../$@ ../$<)

CLEAN = snabb snabbswitch obj bin doc/snabbswitch.* doc/.images/* testlog programs.inc

Expand Down
30 changes: 28 additions & 2 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ quickly realize your network designs and its really fast too!
Furthermore, Snabb Switch is extensible and encourages you to grow the
ecosystem to match your requirements.

![Architecture](.images/Architecture.png)
DIAGRAM: Architecture
+---------------------+
| Your Network Design |
+----*-----*-----*----+
| | |

(Built in and custom Apps and Libraries)

| | |
+-----*-----*-----*-----+
| Snabb Switch Core |
+-----------------------+

The Snabb Switch Core forms a runtime environment (*engine*) which
executes your *design*. A design is simply a Lua script used to drive the
Expand All @@ -22,7 +33,22 @@ you might expect. Apps, on the other hand, are code objects that
implement a specific interface, which is used by the Snabb Switch engine
to organize an *App Network*.

![Network](.images/Network.png)
DIAGRAM: Network
+---------+
| |
+->* Filter0 *--+
| | | |
| +---------+ |
+---+----+ | | +----+---+
| *--+ +->* |
| NIC0 | | NIC1 |
| *<-+ +--* |
+---+----+ | | +----+---+
| +---------+ |
| | | |
+--* Filter1 *<-+
| |
+---------+

Usually, a Snabb Switch design will create a series of apps, interconnect
these in a desired way using *links* and finally pass the resulting app
Expand Down
Loading