forked from fletcher/MultiMarkdown-4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
240 lines (186 loc) · 8.88 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# This makefile works on Mac OS, Ubuntu, Fedora, and presumably other *.nix'es
# Feel free to submit pull requests if you have a proposed change.
# Please explain your change so I'll understand what you need, and why -
# I don't claim to be an expert at this aspect!
# - Fletcher T. Penney
CFLAGS ?= -Wall -g -O3 -include GLibFacade.h
PROGRAM = multimarkdown
VERSION = 4.5
OBJS= multimarkdown.o parse_utilities.o parser.o GLibFacade.o writer.o text.o html.o latex.o memoir.o beamer.o lyx.o lyxbeamer.o opml.o odf.o critic.o rng.o rtf.o transclude.o
# Common prefix for installation directories.
# NOTE: This directory must exist when you start the install.
prefix = /usr/local
exec_prefix = $(prefix)
# Where to put the executable
bindir = $(exec_prefix)/bin
GREG= greg/greg
ALL : $(PROGRAM) enumMap.txt
%.o : %.c parser.h
$(CC) -c $(CFLAGS) -o $@ $<
parser.c : parser.leg greg/greg parser.h
greg/greg -o parser.c parser.leg
$(GREG): greg
$(MAKE) -C greg
$(PROGRAM) : $(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS)
install: $(PROGRAM)
install -m 0755 multimarkdown $(prefix)/bin
install-scripts:
install -m 0755 scripts/* $(prefix)/bin
clean:
rm -f $(PROGRAM) $(OBJS) parser.c enumMap.txt speed*.txt; \
rm -rf mac_installer/Package_Root/usr/local/bin mac_installer/Support_Root mac_installer/*.pkg; \
rm -f mac_installer/Resources/*.html; \
rm -rf build
# Build for windows on a *nix machine with MinGW installed
windows: parser.c
/usr/bin/i586-mingw32msvc-cc -c -Wall -O3 *.c
/usr/bin/i586-mingw32msvc-cc *.o -Wl,--dy -o multimarkdown.exe
# Test program against MMD Test Suite
test: $(PROGRAM)
cd MarkdownTest; \
./MarkdownTest.pl --Script=../$(PROGRAM) --Tidy --Flags="--compatibility"; \
echo ""; \
echo "** It's expected that we fail the \"Ordered and unordered lists\" test **"; \
echo "";
test-mmd: $(PROGRAM)
cd MarkdownTest; \
./MarkdownTest.pl --Script=../$(PROGRAM) --testdir=MultiMarkdownTests
test-compat: $(PROGRAM)
cd MarkdownTest; \
./MarkdownTest.pl --Script=../$(PROGRAM) --testdir=CompatibilityTests --Flags="--compatibility"
test-latex: $(PROGRAM)
cd MarkdownTest; \
./MarkdownTest.pl --Script=../$(PROGRAM) --testdir=MultiMarkdownTests --Flags="-t latex" --ext=".tex"
test-beamer: $(PROGRAM)
cd MarkdownTest; \
./MarkdownTest.pl --Script=../$(PROGRAM) --testdir=BeamerTests --Flags="-t beamer" --ext=".tex"
test-memoir: $(PROGRAM)
cd MarkdownTest; \
./MarkdownTest.pl --Script=../$(PROGRAM) --testdir=MemoirTests --Flags="-t memoir" --ext=".tex"
test-lyx: $(PROGRAM)
cd MarkdownTest; \
./MarkdownTest.pl --Script=../$(PROGRAM) --testdir=MultiMarkdownTests --Flags="-t lyx" --ext=".lyx"
test-lyx-beamer: $(PROGRAM)
cd MarkdownTest; \
./MarkdownTest.pl --Script=../$(PROGRAM) --testdir=BeamerTests --Flags="-t lyx" --ext=".lyx"
test-opml: $(PROGRAM)
cd MarkdownTest; \
./MarkdownTest.pl --Script=../$(PROGRAM) --testdir=MultiMarkdownTests --Flags="-t opml" --ext=".opml"
test-odf: $(PROGRAM)
cd MarkdownTest; \
./MarkdownTest.pl --Script=../$(PROGRAM) --testdir=MultiMarkdownTests --Flags="-t odf" --ext=".fodt"
test-xslt: $(PROGRAM)
cd MarkdownTest; \
./MarkdownTest.pl --Script=/bin/cat --testdir=MultiMarkdownTests \
--TrailFlags="| ../Support/bin/mmd2tex-xslt" --ext=".tex"; \
./MarkdownTest.pl --Script=/bin/cat --testdir=BeamerTests \
--TrailFlags="| ../Support/bin/mmd2tex-xslt" --ext=".tex"; \
./MarkdownTest.pl --Script=/bin/cat --testdir=MemoirTests \
--TrailFlags="| ../Support/bin/mmd2tex-xslt" --ext=".tex"; \
test-critic-accept: $(PROGRAM)
cd MarkdownTest; \
./MarkdownTest.pl --Script=../$(PROGRAM) --testdir=CriticMarkup --Flags="-a" --ext=".htmla"
test-critic-reject: $(PROGRAM)
cd MarkdownTest; \
./MarkdownTest.pl --Script=../$(PROGRAM) --testdir=CriticMarkup --Flags="-r" --ext=".htmlr"
test-all: $(PROGRAM) test test-mmd test-compat test-latex test-beamer test-memoir test-opml test-odf test-critic-accept test-critic-reject test-lyx test-lyx-beamer
test-memory: $(PROGRAM)
valgrind --leak-check=full ./$(PROGRAM) MarkdownTest/Tests/*.text MarkdownTest/MultiMarkdownTests/*.text > /dev/null
test-memory-latex: $(PROGRAM)
valgrind --leak-check=full ./$(PROGRAM) -t latex MarkdownTest/Tests/*.text MarkdownTest/MultiMarkdownTests/*.text > /dev/null
test-memory-beamer: $(PROGRAM)
valgrind --leak-check=full ./$(PROGRAM) -t beamer MarkdownTest/Tests/*.text MarkdownTest/MultiMarkdownTests/*.text > /dev/null
test-memory-memoir: $(PROGRAM)
valgrind --leak-check=full ./$(PROGRAM) -t memoir MarkdownTest/Tests/*.text MarkdownTest/MultiMarkdownTests/*.text > /dev/null
test-memory-lyx: $(PROGRAM)
valgrind --leak-check=full ./$(PROGRAM) -t lyx MarkdownTest/Tests/*.text MarkdownTest/MultiMarkdownTests/*.text MarkdownTest/BeamerTests/*.text > /dev/null
test-memory-odf: $(PROGRAM)
valgrind --leak-check=full ./$(PROGRAM) -t odf MarkdownTest/Tests/*.text MarkdownTest/MultiMarkdownTests/*.text > /dev/null
test-memory-opml: $(PROGRAM)
valgrind --leak-check=full ./$(PROGRAM) -t opml MarkdownTest/Tests/*.text MarkdownTest/MultiMarkdownTests/*.text > /dev/null
enumMap.txt: parser.h
./enumsToPerl.pl libMultiMarkdown.h enumMap.txt
speed.txt: MarkdownTest/Tests/Markdown\ Documentation\ -\ Basics.text
@ cp MarkdownTest/Tests/Markdown\ Documentation\ -\ Basics.text speed.txt
speed2.txt: speed.txt
@ cat speed.txt speed.txt > speed2.txt
speed4.txt: speed2.txt
@ cat speed2.txt speed2.txt > speed4.txt
speed8.txt: speed4.txt
@ cat speed4.txt speed4.txt > speed8.txt
speed16.txt: speed8.txt
@ cat speed8.txt speed8.txt > speed16.txt
speed32.txt: speed16.txt
@ cat speed16.txt speed16.txt > speed32.txt
speed64.txt: speed32.txt
@ cat speed32.txt speed32.txt > speed64.txt
speed128.txt: speed64.txt
@ cat speed64.txt speed64.txt > speed128.txt
speed256.txt: speed128.txt
@ cat speed128.txt speed128.txt > speed256.txt
speed512.txt: speed256.txt
@ cat speed256.txt speed256.txt > speed512.txt
# Compare regular with compatibility mode
test-speed: $(PROGRAM) speed512.txt
time ./$(PROGRAM) speed512.txt > /dev/null
time ./$(PROGRAM) -c speed512.txt > /dev/null
# Compare with peg-markdown (if installed)
test-speed-jgm: $(PROGRAM) speed512.txt
time ./$(PROGRAM) speed512.txt > /dev/null
time ./$(PROGRAM) -c speed512.txt > /dev/null
time peg-markdown speed512.txt > /dev/null
# Compare with original Markdown.pl
# running tests on Markdown.pl with larger files will take a *long* time
test-speed-gruber: speed64.txt
time ./$(PROGRAM) -c speed64.txt > /dev/null
time MarkdownTest/Markdown.pl speed64.txt > /dev/null
# Build using Xcode (more compatible across legacy OS/Hardware)
xcode:
xcodebuild
cp build/Release/multimarkdown .
# Build Mac Installer
mac-installer: xcode
mkdir -p mac_installer/Package_Root/usr/local/bin
mkdir -p mac_installer/Support_Root/Library/Application\ Support
mkdir -p mac_installer/Resources
rm -rf mac_installer/Support_Root
cp build/Release/multimarkdown scripts/mmd* mac_installer/Package_Root/usr/local/bin/
./multimarkdown README.md > mac_installer/Resources/README.html
./multimarkdown mac_installer/Resources/Welcome.txt > mac_installer/Resources/Welcome.html
./multimarkdown LICENSE > mac_installer/Resources/License.html
./multimarkdown mac_installer/Resources/Support_Welcome.txt > mac_installer/Resources/Support_Welcome.html
git clone Support mac_installer/Support_Root/Library/Application\ Support/MultiMarkdown
cd mac_installer; /Applications/PackageMaker.app/Contents/MacOS/PackageMaker \
--doc "Make Support Installer.pmdoc" \
--title "MultiMarkdown Support Files" \
--version $(VERSION) \
--filter "\.DS_Store" \
--filter "\.git" \
--id net.fletcherpenney.MMD-Support.pkg \
--domain user \
--out "MultiMarkdown-Support-Mac-$(VERSION).pkg" \
--no-relocate; \
/Applications/PackageMaker.app/Contents/MacOS/PackageMaker \
--doc "Make OS X Installer.pmdoc" \
--title "MultiMarkdown" \
--version $(VERSION) \
--filter "\.DS_Store" \
--filter "\.git" \
--id net.fletcherpenney.multimarkdown.pkg \
--out "MultiMarkdown-Mac-$(VERSION).pkg"
cd mac_installer; zip -r MultiMarkdown-Mac-$(VERSION).zip MultiMarkdown-Mac-$(VERSION).pkg
cd mac_installer; zip -r MultiMarkdown-Support-Mac-$(VERSION).zip MultiMarkdown-Support-Mac-$(VERSION).pkg
# Prepare README and other files to create the BitRock installer
win-prep:
mkdir -p windows_installer
cp multimarkdown.exe windows_installer/
cp README.md windows_installer/README.txt
./multimarkdown LICENSE > windows_installer/LICENSE.html
# After creating the installer with BitRock, package it up
win-installer:
zip -r windows_installer/MultiMarkdown-Windows-$(VERSION).zip windows_installer/MMD-windows-$(VERSION).exe -x windows_installer/MultiMarkdown*.zip
cd windows_installer; zip -r MultiMarkdown-Windows-Portable-$(VERSION).zip *.bat multimarkdown.exe README.txt LICENSE.html -x install_multimarkdown.bat
# Can make the portable version without BitRock
win-portable:
cd windows_installer; zip -r MultiMarkdown-Windows-Portable-$(VERSION).zip *.bat multimarkdown.exe README.txt LICENSE.html -x install_multimarkdown.bat