Skip to content

Commit

Permalink
Updated Makefile to properly respect change timestamps
Browse files Browse the repository at this point in the history
Also:
 - fixed .PHONY
 - added 'make clean'
 - added missing help for html format
  • Loading branch information
berdandy committed Apr 3, 2018
1 parent c9dd5c6 commit 014a0fa
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 2,389 deletions.
46 changes: 36 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ BOOKNAME = ebook

# Default targets

all: html epub docx
## all : Generate all supported document types (updated files only)

all: html epub pdf docx

## clean : Delete all generated files

clean: html_clean epub_clean pdf_clean docx_clean

# `make help` displays all lines beginning with two hash signs

Expand All @@ -15,9 +21,14 @@ help : Makefile

# Build targets

## html : Generate an HTML file.
## html : Generate an HTML file.

html:
html: $(BOOKNAME).html

html_clean:
rm -f $(BOOKNAME).html

$(BOOKNAME).html: $(BOOKNAME).md style.css
pandoc $(BOOKNAME).md \
-t html \
-o $(BOOKNAME).html \
Expand All @@ -26,19 +37,29 @@ html:
--section-divs \
--standalone

## epub : Generate an EPUB file.
## epub : Generate an EPUB file.

epub: $(BOOKNAME).epub

epub:
epub_clean:
rm -f $(BOOKNAME).epub

$(BOOKNAME).epub: $(BOOKNAME).md images/cover.jpg style-epub.css
pandoc $(BOOKNAME).md \
-t epub \
-o $(BOOKNAME).epub \
--epub-cover-image="images/cover.jpg" \
--css="style-epub.css" \
--standalone

## pdf : Generate a PDF file.
## pdf : Generate a PDF file.

pdf: $(BOOKNAME).pdf

pdf_clean:
rm -f $(BOOKNAME).pdf

pdf:
$(BOOKNAME).pdf: $(BOOKNAME).md
pandoc $(BOOKNAME).md \
-o $(BOOKNAME).pdf \
-V documentclass=scrbook \
Expand All @@ -51,14 +72,19 @@ pdf:
--pdf-engine=lualatex \
--table-of-contents

## docx : Generate a Word file.
## docx : Generate a Word file.

docx: $(BOOKNAME).docx

docx_clean:
rm -f $(BOOKNAME).docx

docx:
$(BOOKNAME).docx: $(BOOKNAME).md style.docx
pandoc $(BOOKNAME).md \
-o $(BOOKNAME).docx \
--reference-doc=style.docx \
--table-of-contents

# Actions that do not correspond to files

.PHONY: help
.PHONY: help html pdf docx epub html_clean pdf_clean docx_clean epub_clean
Binary file removed ebook.docx
Binary file not shown.
Binary file removed ebook.epub
Binary file not shown.
Loading

0 comments on commit 014a0fa

Please sign in to comment.