Skip to content

Commit 8bcdb3f

Browse files
author
Sam Kleinman
committed
build: splitting out compatibility and simplyfying timestamps
1 parent f919e25 commit 8bcdb3f

File tree

2 files changed

+29
-19
lines changed

2 files changed

+29
-19
lines changed

bin/makefile.compatibility

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Fixing `sed` for OS X
2+
UNAME := $(shell uname)
3+
4+
ifeq ($(UNAME), Linux)
5+
SED_ARGS_FILE = -i -r
6+
SED_ARGS_REGEX = -r
7+
endif
8+
9+
ifeq ($(UNAME), Darwin)
10+
SED_ARGS_FILE = -i "" -E
11+
SED_ARGS_REGEX = -E
12+
endif
13+
14+
ifeq ($(shell test -f /etc/arch-release && echo arch || echo Linux),arch)
15+
PYTHONBIN = python2
16+
else
17+
PYTHONBIN = python
18+
endif

makefile

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ MAKEFLAGS += -j
33
MAKEFLAGS += -r
44
MAKEFLAGS += --no-print-directory
55

6+
# includes
7+
include bin/makefile.compatibility
8+
69
# Build directory tweaking.
710
output = build
811
public-output = $(output)/public
@@ -15,26 +18,22 @@ manual-branch = master
1518
current-branch := $(shell git symbolic-ref HEAD 2>/dev/null | cut -d "/" -f "3" )
1619
last-commit := $(shell git rev-parse --verify HEAD)
1720

21+
timestamp := $(shell date +%Y%m%d%H%M)
22+
1823
ifeq ($(current-branch),$(manual-branch))
1924
current-if-not-manual = $(manual-branch)
2025
else
2126
current-if-not-manual = $(current-branch)
2227
endif
2328

24-
# Fixing `sed` for OS X
25-
UNAME := $(shell uname)
26-
ifeq ($(UNAME), Linux)
27-
SED_ARGS_FILE = -i -r
28-
SED_ARGS_REGEX = -r
29-
endif
30-
ifeq ($(UNAME), Darwin)
31-
SED_ARGS_FILE = -i "" -E
32-
SED_ARGS_REGEX = -E
33-
endif
34-
3529
# Sphinx variables.
3630
SPHINXOPTS = -c ./
3731
SPHINXBUILD = sphinx-build
32+
33+
ifdef NITPICK
34+
SPHINXOPTS += -n -w $(branch-output)/build.$(timestamp).log
35+
endif
36+
3837
PAPER = letter
3938
PAPEROPT_a4 = -D latex_paper_size=a4
4039
PAPEROPT_letter = -D latex_paper_size=letter
@@ -292,12 +291,6 @@ epub:
292291
#
293292
######################################################################
294293

295-
ifeq ($(shell test -f /etc/arch-release && echo arch || echo Linux),arch)
296-
PYTHONBIN = python2
297-
else
298-
PYTHONBIN = python
299-
endif
300-
301294
$(branch-output)/sitemap.xml.gz:$(branch-output)/dirhtml
302295

303296
SITEMAPBUILD = $(PYTHONBIN) bin/sitemap_gen.py
@@ -437,8 +430,7 @@ PDFLATEXCOMMAND = TEXINPUTS=".:$(branch-output)/latex/:" pdflatex --interaction
437430
#
438431
##########################################################################
439432

440-
ARCHIVE_DATE := $(shell date +%s)
441-
archive:$(public-output).$(ARCHIVE_DATE).tar.gz
433+
archive:$(public-output).$(timestamp).tar.gz
442434
@echo [archive]: created $< archive.
443435
$(public-output).$(ARCHIVE_DATE).tar.gz:$(public-output)
444436
tar -czvf $@ $<

0 commit comments

Comments
 (0)