Skip to content

Commit

Permalink
build: update utils and framework to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
cebarobot committed Feb 23, 2025
1 parent 54c7f42 commit 2c688e0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
36 changes: 23 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
DOC = xiangshan-user-guide
VERSION = $(shell git describe --always)

PREFACE_MD = docs/index.md
MAIN_MD = pandoc-main.md
SRCS = $(wildcard docs/*.md)
SRCS = $(shell find docs -name '*.md')

SVG_FIGS := $(wildcard docs/figs/*.svg)
PDF_FIGS := $(patsubst docs/figs/%.svg, build/docs/figs/%.pdf, $(SVG_FIGS))
SVG_FIGS := $(shell find docs -name '*.svg')
PDF_FIGS := $(patsubst %.svg,build/%.pdf,$(SVG_FIGS))

DEPS =
DEPS += $(wildcard utils/*.lua)
Expand All @@ -24,30 +26,38 @@ PANDOC_LATEX_FLAGS += --top-level-division=chapter
PANDOC_LATEX_FLAGS += --pdf-engine=xelatex
PANDOC_LATEX_FLAGS += --lua-filter=utils/pandoc_filters/svg_to_pdf.lua
PANDOC_LATEX_FLAGS += --template=utils/template.tex
PANDOC_LATEX_FLAGS += --include-before-body=preface.tex

PANDOC_HTML_FLAGS += --embed-resources
PANDOC_HTML_FLAGS += --shift-heading-level-by=1

all: xiangshan-user-guide.pdf xiangshan-user-guide.html
all: $(DOC).pdf $(DOC).html

clean:
rm -f xiangshan-user-guide.tex xiangshan-user-guide.pdf *.aux *.log *.toc
rm -f $(DOC).tex $(DOC).pdf *.aux *.log *.toc
rm -rf build

build/docs/figs/%.pdf: docs/figs/%.svg
mkdir -p build/docs/figs
init:
git submodule update --init

build/docs/%.pdf: docs/%.svg
mkdir -p $(dir $@)
rsvg-convert -f pdf -o $@ $<

xiangshan-user-guide.tex: $(MAIN_MD) $(SRCS) $(DEPS)
preface.tex: $(PREFACE_MD)
pandoc $< $(PANDOC_FLAGS) -o $@
sed -i 's/@{}//g' $@

$(DOC).tex: preface.tex $(MAIN_MD) $(SRCS) $(DEPS)
pandoc $(MAIN_MD) $(PANDOC_FLAGS) $(PANDOC_LATEX_FLAGS) -s -o $@
sed -i 's/@{}//g' $@

xiangshan-user-guide.html: $(MAIN_MD) $(SRCS) $(DEPS) $(SVG_FIGS)
$(DOC).html: $(MAIN_MD) $(SRCS) $(DEPS) $(SVG_FIGS)
pandoc -s $(MAIN_MD) $(PANDOC_FLAGS) $(PANDOC_HTML_FLAGS) -o $@

xiangshan-user-guide.pdf: xiangshan-user-guide.tex $(PDF_FIGS)
xelatex $^
xelatex $^
xelatex $^
$(DOC).pdf: $(DOC).tex $(PDF_FIGS)
xelatex $<
xelatex $<
xelatex $<

.PHONY: all clean
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# 前言 {-}
# 前言 {.unnumbered .unlisted}

## 版本信息 {-}
## 版本信息 {.unnumbered .unlisted}

| 日期 | 版本 | 说明 |
| ---- | ---- | ---------- |
| | | 第一次发布 |

## 声明 {-}
## 声明 {.unnumbered .unlisted}

版权所有 © 2024 香山开源处理器团队·北京开源芯片研究院

Expand Down
1 change: 0 additions & 1 deletion pandoc-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ i18n-applicable: "适用于"


``` {.include}
docs/index.md
docs/introduction.md
docs/processor.md
docs/instruction-set.md
Expand Down
2 changes: 1 addition & 1 deletion utils

0 comments on commit 2c688e0

Please sign in to comment.