-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
106 lines (98 loc) · 3.06 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
OS ?= $(shell uname -s)
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
ifeq ($(OS),Darwin)
CC := clang
SED := gsed
else ifeq ($(OS),Linux)
CC := gcc
else ifeq ($(OS),Windows_NT)
CC := cl
endif
ifndef CC
$(error Unsupported target OS '$(OS)')
endif
ifndef SED
SED := sed
endif
SOURCES := $(call rwildcard,source/,*.d)
LIBS_PATH := lib
.DEFAULT_GOAL := docs
all: docs
#################################################
# Subprojects
#################################################
# wgpu-native binaries ships with static libraries 🎉
ifeq ($(OS),Darwin)
LIB_WGPU := libwgpu_native.a
else ifeq ($(OS),Linux)
LIB_WGPU := libwgpu_native.a
else ifeq ($(OS),Windows_NT)
LIB_WGPU := wgpu_native.lib
endif
ifndef LIB_WGPU
$(error Unsupported target OS '$(OS)')
endif
subprojects/wgpu: subprojects/wgpu.Makefile
@make --no-print-directory -C subprojects -f wgpu.Makefile
ifneq ($(OS),Windows_NT)
file subprojects/wgpu/$(LIB_WGPU)
else
IF EXIST subprojects/wgpu/$(LIB_WGPU) ECHO subprojects/wgpu/$(LIB_WGPU) exists.
endif
subprojects/wgpu/$(LIB_WGPU): subprojects/wgpu
wgpu: subprojects/wgpu/$(LIB_WGPU)
.PHONY: wgpu
#################################################
# Test Coverage
#################################################
cover: $(SOURCES)
dub test --build=unittest-cov
.PHONY: cover
#################################################
# Documentation
#################################################
PACKAGE_VERSION := 0.3.1
docs/sitemap.xml: $(SOURCES)
dub build -b ddox
@echo "Performing cosmetic changes..."
# Navigation Sidebar
@$(SED) -i -e "/<nav id=\"main-nav\">/r views/nav.html" -e "/<nav id=\"main-nav\">/d" `find docs -name '*.html'`
# Page Titles
@$(SED) -i "s/<\/title>/ - wgpu-d<\/title>/" `find docs -name '*.html'`
# Index
@$(SED) -i "s/API documentation/API Reference/g" docs/index.html
@$(SED) -i -e "/<h1>API Reference<\/h1>/r views/index.html" -e "/<h1>API Reference<\/h1>/d" docs/index.html
# License Link
@$(SED) -i "s/3-Clause BSD License/<a href=\"https:\/\/opensource.org\/licenses\/BSD-3-Clause\">3-Clause BSD License<\/a>/" `find docs -name '*.html'`
# Footer
@$(SED) -i -e "/<p class=\"faint\">Generated using the DDOX documentation generator<\/p>/r views/footer.html" -e "/<p class=\"faint\">Generated using the DDOX documentation generator<\/p>/d" `find docs -name '*.html'`
# Dub Package Version
@echo Latest tag: `git describe --tags --abbrev=0`
@$(SED) -i "s/DUB_VERSION/$(PACKAGE_VERSION)/g" `find docs -name '*.html'`
@echo Done
docs: docs/sitemap.xml
ifeq ($(OS),Windows_NT)
$(error Build documentation on *nix!)
endif
.PHONY: docs
clean:
ifneq ($(OS),Windows_NT)
clean: clean-docs
else
$(error Build documentation on *nix!)
endif
dub clean
@rm -rf bin lib
@echo "Cleaning code coverage reports..."
@rm -f -- *.lst
.PHONY: clean
DOCS_HTML := $(call rwildcard,docs/,*.html)
clean-docs:
ifeq ($(OS),Windows_NT)
$(error Build documentation on *nix!)
endif
@echo "Cleaning generated documentation..."
@rm -f docs.json
@rm -f docs/sitemap.xml docs/file_hashes.json
@rm -rf $(DOCS_HTML)
.PHONY: clean-docs