forked from fletcher/MultiMarkdown-6
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
131 lines (109 loc) · 3.83 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
BUILD_DIR = build
DOC_DIR = documentation
XCODE_BUILD_DIR = build-xcode
XCODE_DEBUG_BUILD_DIR = build-xcode-debug
# The release target will perform additional optimization
.PHONY : release
release: $(BUILD_DIR)
cd $(BUILD_DIR); \
cmake -DCMAKE_BUILD_TYPE=Release ..
# Also build a shared library
.PHONY : shared
shared: $(BUILD_DIR)
cd $(BUILD_DIR); \
cmake -DCMAKE_BUILD_TYPE=Release -DSHAREDBUILD=1 ..
# Build zip file package
.PHONY : zip
zip: $(BUILD_DIR)
cd $(BUILD_DIR); touch README.html; \
cmake -DCMAKE_BUILD_TYPE=Release -DZIP=1 ..
# debug target enables CuTest unit testing
.PHONY : debug
debug: $(BUILD_DIR)
cd $(BUILD_DIR); \
cmake -DTEST=1 DCMAKE_BUILD_TYPE=DEBUG ..
# analyze target enables use of clang's scan-build (if installed)
# will then need to run 'scan-build make' to compile and analyze
# 'scan-build -V make' will show the results graphically in your
# web browser
.PHONY : analyze
analyze: $(BUILD_DIR)
cd $(BUILD_DIR); \
scan-build cmake -DTEST=1 DCMAKE_BUILD_TYPE=DEBUG ..
.PHONY : map
map:
cd $(BUILD_DIR); \
../tools/enumsToPerl.pl ../Sources/libMultiMarkdown/include/libMultiMarkdown.h enumMap.txt;
# Create xcode project
# You can then build within XCode, or using the commands:
# xcodebuild -configuration Debug
# xcodebuild -configuration Release
.PHONY : xcode
xcode: $(XCODE_BUILD_DIR)
cd $(XCODE_BUILD_DIR); \
cmake -G Xcode ..
.PHONY : xcode-debug
xcode-debug: $(XCODE_DEBUG_BUILD_DIR)
cd $(XCODE_DEBUG_BUILD_DIR); \
cmake -G Xcode -DTEST=1 ..
# Build Swift debug variant
.PHONY : swift
swift: $(BUILD_DIR)
swift build -c debug --build-path ${BUILD_DIR} -Xcc -fbracket-depth=264
# Build Swift release variant
.PHONY : swift-release
swift-release: $(BUILD_DIR)
swift build -c release --build-path ${BUILD_DIR} -Xcc -fbracket-depth=264 -Xcc -DNDEBUG=1
# Cross-compile for Windows using MinGW on *nix
.PHONY : windows
windows: $(BUILD_DIR)
cd $(BUILD_DIR); touch README.html; \
cmake -DCMAKE_TOOLCHAIN_FILE=../tools/Toolchain-MinGW-w64-64bit.cmake -DCMAKE_BUILD_TYPE=Release ..
# Build Windows zip file using MinGW on *nix
.PHONY : windows-zip
windows-zip: $(BUILD_DIR)
cd $(BUILD_DIR); touch README.html; \
cmake -DCMAKE_TOOLCHAIN_FILE=../tools/Toolchain-MinGW-w64-64bit.cmake -DCMAKE_BUILD_TYPE=Release -DZIP=1 ..
# Cross-compile for Windows using MinGW on *nix (32-bit)
.PHONY : windows-32
windows-32: $(BUILD_DIR)
cd $(BUILD_DIR); touch README.html; \
cmake -DCMAKE_TOOLCHAIN_FILE=../tools/Toolchain-MinGW-w64-32bit.cmake -DCMAKE_BUILD_TYPE=Release ..
# Build Windows zip file using MinGW on *nix (32-bit)
.PHONY : windows-zip-32
windows-zip-32: $(BUILD_DIR)
cd $(BUILD_DIR); touch README.html; \
cmake -DCMAKE_TOOLCHAIN_FILE=../tools/Toolchain-MinGW-w64-32bit.cmake -DCMAKE_BUILD_TYPE=Release -DZIP=1 ..
# Build the documentation using doxygen
.PHONY : documentation
documentation:
-mkdir $(DOC_DIR) 2>/dev/null; \
cd $(DOC_DIR); \
cmake -DDOCUMENTATION=1 ..; cd ..; \
doxygen $(DOC_DIR)/doxygen.conf
.PHONY : gh-pages
gh-pages: documentation
cp -r $(BUILD_DIR)/documentation/html/* documentation/
# Clean out the build directory
.PHONY : clean
clean:
rm -rf $(BUILD_DIR)/*
# Create build directory if it doesn't exist
$(BUILD_DIR): CHANGELOG
-mkdir $(BUILD_DIR) 2>/dev/null
-cd $(BUILD_DIR); rm -rf *
# Build xcode directories if they don't exist
$(XCODE_BUILD_DIR):
-mkdir $(XCODE_BUILD_DIR) 2>/dev/null
-cd $(XCODE_BUILD_DIR); rm -rf *
$(XCODE_DEBUG_BUILD_DIR):
-mkdir $(XCODE_DEBUG_BUILD_DIR) 2>/dev/null
-cd $(XCODE_DEBUG_BUILD_DIR); rm -rf *
# Generate a list of changes since last commit to 'master' branch
.PHONY : CHANGELOG
CHANGELOG:
-git log master..develop --format="* %s" | sort | uniq > CHANGELOG-UNRELEASED
# Use astyle
.PHONY : astyle
astyle:
astyle --options=.astylerc "Sources/libMultiMarkdown/*.c" "Sources/multimarkdown/*.c" "Sources/libMultiMarkdown/*.h" "Sources/libMultiMarkdown/include/*.h"