forked from vicoapp/vico
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
792 lines (703 loc) · 19.2 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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
ARCH ?= x86_64
CONFIGURATION ?= DEBUG
ifeq ($(ARCH),i386)
BITS = 32
else
BITS = 64
endif
VPATH = app app/en.lproj json oniguruma oniguruma/enc universalchardet lemon \
util par help plblockimp/Source plblockimp/Source/x86_$(BITS) \
$(shell mkdir -p $(DERIVEDDIR) && echo $(DERIVEDDIR))
.SUFFIXES:
JSON_OBJC_SRCS = \
NSObject+JSON.m \
SBJsonParser.m \
SBJsonStreamParser.m \
SBJsonStreamParserAdapter.m \
SBJsonStreamParserState.m \
SBJsonStreamWriter.m \
SBJsonStreamWriterState.m \
SBJsonTokeniser.m \
SBJsonWriter.m
OBJC_SRCS = \
ExAddress.m \
ExCommand.m \
ExCommandCompletion.m \
ExMap.m \
ExParser.m \
ExTextField.m \
MHTextIconCell.m \
NSArray-patterns.m \
NSEvent-keyAdditions.m \
NSMenu-additions.m \
NSObject+SPInvocationGrabbing.m \
NSOutlineView-vimotions.m \
NSScanner-additions.m \
NSString-additions.m \
NSString-scopeSelector.m \
NSTableView-vimotions.m \
NSTask-streaming.m \
NSURL-additions.m \
NSView-additions.m \
NSWindow-additions.m \
Nu.m \
PSMMetalTabStyle.m \
PSMOverflowPopUpButton.m \
PSMProgressIndicator.m \
PSMRolloverButton.m \
PSMTabBarCell.m \
PSMTabBarControl.m \
PSMTabDragAssistant.m \
SFTPConnection.m \
SFTPConnectionPool.m \
TMFileURLProtocol.m \
TxmtURLProtocol.m \
ViAppController.m \
ViBgView.m \
ViBufferCompletion.m \
ViBufferedStream.m \
ViBundle.m \
ViBundleCommand.m \
ViBundleItem.m \
ViBundleSnippet.m \
ViBundleStore.m \
ViCommand.m \
ViCommandMenuItemView.m \
ViCommandOutputController.m \
ViCompletion.m \
ViCompletionController.m \
ViCompletionView.m \
ViCompletionWindow.m \
ViDocument.m \
ViDocumentController.m \
ViDocumentView.m \
ViError.m \
ViEventManager.m \
ViFile.m \
ViFileCompletion.m \
ViFileExplorer.m \
ViFileURLHandler.m \
ViHTTPURLHandler.m \
ViJumpList.m \
ViKeyManager.m \
ViLanguage.m \
ViLayoutManager.m \
ViMacro.m \
ViMap.m \
ViMark.m \
ViMarkInspector.m \
ViMarkManager.m \
ViOutlineView.m \
ViParser.m \
ViPathCell.m \
ViPathComponentCell.m \
ViPathControl.m \
ViPreferencePane.m \
ViPreferencePaneAdvanced.m \
ViPreferencePaneBundles.m \
ViPreferencePaneEdit.m \
ViPreferencePaneGeneral.m \
ViPreferencePaneTheme.m \
ViPreferencesController.m \
ViProject.m \
ViRegexp.m \
ViRegisterManager.m \
ViRulerView.m \
ViSFTPURLHandler.m \
ViScope.m \
ViSeparatorCell.m \
ViSnippet.m \
ViSymbolController.m \
ViSymbolTransform.m \
ViSyntaxCompletion.m \
ViSyntaxContext.m \
ViSyntaxMatch.m \
ViSyntaxParser.m \
ViTabController.m \
ViTagsDatabase.m \
ViTaskRunner.m \
ViTextStorage.m \
ViTextView-bundle_commands.m \
ViTextView-cursor.m \
ViTextView-ex_commands.m \
ViTextView-snippets.m \
ViTextView-vi_commands.m \
ViTextView.m \
ViTheme.m \
ViThemeStore.m \
ViToolbarPopUpButtonCell.m \
ViTransformer.m \
ViURLManager.m \
ViViewController.m \
ViWebView.m \
ViWindow.m \
ViWindowController.m \
ViWordCompletion.m \
main.m \
$(JSON_OBJC_SRCS)
OBJCXX_SRCS = \
ViCharsetDetector.mm
C_SRCS = \
regcomp.c \
regenc.c \
regerror.c \
regexec.c \
regext.c \
reggnu.c \
regparse.c \
regposerr.c \
regposix.c \
regsyntax.c \
regtrav.c \
regversion.c \
st.c \
ascii.c \
big5.c \
cp1251.c \
euc_jp.c \
euc_kr.c \
euc_tw.c \
gb18030.c \
iso8859_1.c \
iso8859_10.c \
iso8859_11.c \
iso8859_13.c \
iso8859_14.c \
iso8859_15.c \
iso8859_16.c \
iso8859_2.c \
iso8859_3.c \
iso8859_4.c \
iso8859_5.c \
iso8859_6.c \
iso8859_7.c \
iso8859_8.c \
iso8859_9.c \
koi8.c \
koi8_r.c \
sjis.c \
unicode.c \
utf16_be.c \
utf16_le.c \
utf32_be.c \
utf32_le.c \
utf8.c \
trampoline_table.c \
blockimp.c \
blockimp_x86_$(BITS)_config.c \
blockimp_x86_$(BITS)_stret_config.c
S_SRCS = \
blockimp_x86_$(BITS).s \
blockimp_x86_$(BITS)_stret.s
DERIVED_C_SRCS = \
scope_selector.c
ALL_C_SRCS = $($(CONFIGURATION)_C_SRCS) $(C_SRCS) $(DERIVED_C_SRCS)
CXX_SRCS = \
CharDistribution.cpp \
JpCntx.cpp \
LangBulgarianModel.cpp \
LangCyrillicModel.cpp \
LangGreekModel.cpp \
LangHebrewModel.cpp \
LangHungarianModel.cpp \
LangThaiModel.cpp \
nsBig5Prober.cpp \
nsCharSetProber.cpp \
nsEUCJPProber.cpp \
nsEUCKRProber.cpp \
nsEUCTWProber.cpp \
nsEscCharsetProber.cpp \
nsEscSM.cpp \
nsGB2312Prober.cpp \
nsHebrewProber.cpp \
nsLatin1Prober.cpp \
nsMBCSGroupProber.cpp \
nsMBCSSM.cpp \
nsSBCSGroupProber.cpp \
nsSBCharSetProber.cpp \
nsSJISProber.cpp \
nsUTF8Prober.cpp \
nsUniversalDetector.cpp
XIBS = \
AdvancedPrefs.xib \
BundlePrefs.xib \
CommandOutputWindow.xib \
CompletionWindow.xib \
EditPrefs.xib \
GeneralPrefs.xib \
MainMenu.xib \
MarkInspector.xib \
PreferenceWindow.xib \
ThemePrefs.xib \
ViDocument.xib \
ViDocumentWindow.xib \
WaitProgress.xib
NU = \
app/ex.nu \
app/keys.nu \
app/vico.nu \
nu/beautify.nu \
nu/bridgesupport.nu \
nu/cblocks.nu \
nu/cocoa.nu \
nu/console.nu \
nu/coredata.nu \
nu/doc.nu \
nu/fscript.nu \
nu/generate.nu \
nu/help.nu \
nu/match.nu \
nu/math.nu \
nu/menu.nu \
nu/nibtools.nu \
nu/nu.nu \
nu/template.nu \
nu/test.nu
IMAGES = \
Images/AliasBadgeIcon.icns \
Images/TabClose_Front.tif \
Images/TabClose_Front_Pressed.tif \
Images/TabClose_Front_Rollover.tif \
Images/TabCloseModified_Front.png \
Images/TabCloseModified_Front_Pressed.png \
Images/TabCloseModified_Front_Rollover.png \
Images/TabNewMetal.png \
Images/TabNewMetalPressed.png \
Images/TabNewMetalRollover.png \
Images/actionbarbg.png \
Images/actionmenu.png \
Images/add.png \
Images/bookmark.png \
Images/class.png \
Images/define.png \
Images/function.png \
Images/header.png \
Images/module.png \
Images/overflowImage.tiff \
Images/overflowImagePressed.tif \
Images/pi.png \
Images/resizehandle.png \
Images/tag.png \
vico.icns
VICO_BUNDLES = \
ack
TM_BUNDLES = \
c \
css \
diff \
html \
java \
javascript \
json \
objective-c \
perl \
php \
python \
ruby-on-rails \
ruby \
shellscript \
source \
sql \
text \
xml \
yaml
BUNDLES = \
$(addsuffix, .vico-bundle,$(VICO_BUNDLES)) \
$(addsuffix, .tmbundle,$(TM_BUNDLES))
# Resource files are rsync'd to the application bundle
RESOURCES = \
Support \
Themes \
Bundles \
$(IMAGES) \
app/symbol-icons.plist \
$(NU) \
par/par.doc \
Credits.txt
# Include sources for crash reporter
OBJC_SRCS += \
GenerateFormData.m \
SFBCrashReporter.m \
SFBCrashReporterWindowController.m \
SFBSystemInformation.m
XIBS += SFBCrashReporterWindow.xib
ifneq ($(CONFIGURATION),DEBUG)
BUNDLE_USERS = vicoapp textmate
BUNDLE_REPOS = $(addprefix $(RESDIR)/,$(addsuffix -bundles.json,$(BUNDLE_USERS)))
.PHONY: $(BUNDLE_REPOS)
endif
TOOL_OBJC_SRCS = \
vico.m \
$(JSON_OBJC_SRCS)
LEMON_C_SRCS = \
lemon.c
PAR_C_SRCS = \
buffer.c \
charset.c \
errmsg.c \
par.c \
reformat.c
HELP_SRCS = \
basics.md \
change.md \
change_indent.md \
delete.md \
dot.md \
ex.md \
ex_cmds.md \
ex_ranges.md \
explorer.md \
indent_settings.md \
insert.md \
jumplist.md \
line_search.md \
move_chars.md \
move_lines.md \
move_symbols.md \
move_words.md \
movement.md \
open_line.md \
operators.md \
remote.md \
scrolling.md \
searching.md \
splits.md \
ssh_keygen.md \
symbols.md \
terminal.md \
visual.md
XCODEROOT = $(shell xcode-select -print-path)
CC = xcrun clang
CXX = xcrun clang++
IBTOOL = xcrun ibtool
REPO_VERSION := $(shell git log --oneline | wc -l | sed 's/ //g')
SHORT_VERSION = r$(REPO_VERSION)
ifeq ($(CONFIGURATION),DEBUG)
CFLAGS = -O0
OBJCFLAGS =
ARCHS = $(ARCH)
else
CFLAGS = -Os -DNDEBUG
ARCHS = i386 x86_64
endif
CFLAGS += -fvisibility=hidden -gdwarf-2
# warning flags
CFLAGS += -Wreturn-type \
-Wparentheses \
-Wswitch \
-Wno-unused-parameter \
-Wunused-variable \
-Wunused-value \
-Wno-sign-conversion
CFLAGS += -Wall -Werror
# oniguruma, par, and lemon has too many of these issues
OBJCFLAGS += -Wshorten-64-to-32
# Flags for PLBlockIMP
CFLAGS += -DPL_BLOCKIMP_PRIVATE
SDK = $(XCODEROOT)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
ARCH_CFLAGS = -arch $(ARCH) -isysroot $(SDK) -mmacosx-version-min=10.6 -fasm-blocks
CFLAGS += $(ARCH_CFLAGS)
LDFLAGS += $(ARCH_CFLAGS)
OBJCPPFLAGS = -include-pch $(OBJDIR)/Vico-prefix.objc.pth
OBJCXXPPFLAGS = -include-pch $(OBJDIR)/Vico-prefix.objcxx.pth
CPPFLAGS = -Iapp -Ijson -Ioniguruma -Iuniversalchardet -I$(DERIVEDDIR) -F. -Iplblockimp/Source
LDFLAGS += -F.
TOOL_LDLIBS = -framework ApplicationServices -framework Foundation
APP_LDLIBS = -lcrypto -lresolv -lffi
APP_FRAMEWORKS = Carbon WebKit Cocoa
PAR_LDLIBS =
# Use Sparkle updates for all builds
APP_FRAMEWORKS += Sparkle
RESOURCES += sparkle_pub.pem
SPARKLE_FWDIR = $(BUILDDIR)/sparkle
SPARKLE_FW = $(SPARKLE_FWDIR)/Sparkle.framework
CPPFLAGS += -F$(SPARKLE_FWDIR)
LDFLAGS += -F$(SPARKLE_FWDIR)
# Crash Reporter requires AddressBook framework for getting the users email address
APP_FRAMEWORKS += AddressBook
# paths
BUILDDIR=$(CURDIR)/build/$(CONFIGURATION)
OBJDIR=$(BUILDDIR)/obj/$(ARCH)
OBJDIR_32=$(BUILDDIR)/obj/i386
OBJDIR_64=$(BUILDDIR)/obj/x86_64
DEPDIR=$(BUILDDIR)/dep/$(ARCH)
DERIVEDDIR=$(BUILDDIR)/derived/$(ARCH)
APPDIR=$(BUILDDIR)/Vico.app
BINDIR=$(APPDIR)/Contents/MacOS
RESDIR=$(APPDIR)/Contents/Resources
FWDIR=$(APPDIR)/Contents/Frameworks
INFOPLIST=$(APPDIR)/Contents/Info.plist
NIBDIR=$(RESDIR)/en.lproj
# object files
OBJC_OBJS = $(addprefix $(OBJDIR)/,$(OBJC_SRCS:.m=.o))
OBJCXX_OBJS = $(addprefix $(OBJDIR)/,$(OBJCXX_SRCS:.mm=.o))
C_OBJS = $(addprefix $(OBJDIR)/,$(ALL_C_SRCS:.c=.o))
S_OBJS = $(addprefix $(OBJDIR)/,$(S_SRCS:.s=.o))
CXX_OBJS = $(addprefix $(OBJDIR)/,$(CXX_SRCS:.cpp=.o))
OBJS = $(OBJC_OBJS) $(OBJCXX_OBJS) $(C_OBJS) $(CXX_OBJS) $(S_OBJS)
TOOL_OBJC_OBJS = $(addprefix $(OBJDIR)/,$(TOOL_OBJC_SRCS:.m=.o))
TOOL_OBJS = $(TOOL_OBJC_OBJS)
PAR_C_OBJS = $(addprefix $(OBJDIR)/,$(PAR_C_SRCS:.c=.o))
PAR_OBJS = $(PAR_C_OBJS)
LEMON_C_OBJS = $(addprefix $(OBJDIR)/,$(LEMON_C_SRCS:.c=.o))
LEMON_OBJS = $(LEMON_C_OBJS)
NIBS = $(addprefix $(NIBDIR)/,$(XIBS:.xib=.nib))
HELP_HTMLS = $(addprefix $(HELP_EN)/,$(HELP_SRCS:.md=.html))
# Build rules
DEPS = -MMD -MT $@ -MF $(addsuffix .d,$(basename $@))
$(OBJDIR)/%.o: %.m
$(CC) $(CFLAGS) $(OBJCFLAGS) $(OBJCPPFLAGS) $(CPPFLAGS) $(DEPS) $< -c -o $@
$(OBJDIR)/%.o: %.mm
$(CXX) $(CFLAGS) $(OBJCFLAGS) $(OBJCXXPPFLAGS) $(CPPFLAGS) $(DEPS) $< -c -o $@
$(OBJDIR)/%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(DEPS) $< -c -o $@
$(OBJDIR)/%.o: %.s
$(CC) -x assembler-with-cpp $(CFLAGS) $(CPPFLAGS) $(DEPS) $< -c -o $@
$(OBJDIR)/%.o: %.cpp
$(CXX) $(CFLAGS) $(CPPFLAGS) $(DEPS) $< -c -o $@
$(NIBDIR)/%.nib: %.xib
mkdir -p $(NIBDIR)
$(IBTOOL) --errors --warnings --notices \
--output-format human-readable-text \
--compile $@ $< \
--sdk $(SDK)
$(HELP_EN)/%.html: %.md
mkdir -p $(@D)
help/md2html $< > $@
.PHONY: app
app: $(NIBS) $(RESOURCES) $(BUNDLE_REPOS) $(INFOPLIST) help \
$(APPDIR)/Contents/PkgInfo submodules $(SPARKLE_FW)
for arch in $(ARCHS); do \
$(MAKE) binaries ARCH=$$arch; \
done
mkdir -p $(BINDIR)
if test "$(ARCH)" = "$(ARCHS)"; then \
cp $(OBJDIR)/Vico $(BINDIR); \
cp $(OBJDIR)/vicotool $(BINDIR); \
cp $(OBJDIR)/par $(BINDIR); \
else \
lipo -create $(OBJDIR_32)/Vico $(OBJDIR_64)/Vico -output $(BINDIR)/Vico; \
lipo -create $(OBJDIR_32)/vicotool $(OBJDIR_64)/vicotool -output $(BINDIR)/vicotool; \
lipo -create $(OBJDIR_32)/par $(OBJDIR_64)/par -output $(BINDIR)/par; \
dsymutil $(BINDIR)/Vico -o $(BUILDDIR)/Vico.app.dSYM; \
fi
rsync -a --delete --exclude ".git" --exclude ".DS_Store" $(RESOURCES) $(RESDIR)
rsync -a --delete --exclude ".git" --exclude ".DS_Store" $(SPARKLE_FW) $(FWDIR)
cp -f app/en.lproj/Credits.rtf $(RESDIR)/en.lproj/Credits.rtf
cp -f app/en.lproj/InfoPlist.strings $(RESDIR)/en.lproj/InfoPlist.strings
# find $(RESDIR)/Bundles \( -iname "*.plist" -or -iname "*.tmCommand" -or -iname "*.tmSnippet" -or -iname "*.tmPreferences" \) -exec /usr/bin/plutil -convert binary1 "{}" \;
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $(REPO_VERSION)" $(INFOPLIST)
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $(SHORT_VERSION)" $(INFOPLIST)
submodules: $(BUILDDIR)/gitmodules.stamp
$(BUILDDIR)/gitmodules.stamp:
git submodule update --init --recursive -- .
touch $@
$(SPARKLE_FW): $(BUILDDIR)/sparkle/Sparkle.stamp
$(BUILDDIR)/sparkle/Sparkle.stamp:
xcodebuild -project "$(CURDIR)/sparkle/Sparkle.xcodeproj" \
-target Sparkle -configuration Release -parallelizeTargets \
CONFIGURATION_BUILD_DIR="$(BUILDDIR)/sparkle" \
OBJROOT="$(BUILDDIR)/sparkle" \
SYMROOT="$(BUILDDIR)/sparkle"
touch $@
binaries: $(OBJDIR)/Vico $(OBJDIR)/vicotool $(OBJDIR)/par
$(OBJC_OBJS): $(OBJDIR)/Vico-prefix.objc.pth
$(OBJCXX_OBJS): $(OBJDIR)/Vico-prefix.objcxx.pth
$(OBJDIR)/Vico-prefix.objc.pth: app/Vico-Prefix.pch
mkdir -p $(OBJDIR)
$(CC) -x objective-c-header $(CFLAGS) $(OBJCFLAGS) $< -o $@
$(OBJDIR)/Vico-prefix.objcxx.pth: app/Vico-Prefix.pch
mkdir -p $(OBJDIR)
$(CC) -x objective-c++-header $(CFLAGS) $(OBJCFLAGS) $< -o $@
$(OBJDIR)/lemon: $(LEMON_OBJS)
$(CC) $(LDFLAGS) $^ -o $@
app/scope_selector.c app/scope_selector.h: scope_selector.lemon $(OBJDIR)/lemon
mkdir -p $(@D)
LEMPAR=lemon/lempar.c $(OBJDIR)/lemon -s $<
$(OBJDIR)/NSString-scopeSelector.o: app/scope_selector.h
$(OBJDIR)/Vico: $(OBJS)
mkdir -p $(OBJDIR)
$(CXX) $(LDFLAGS) $(LDLIBS) $(APP_LDLIBS) $(addprefix -framework ,$(APP_FRAMEWORKS)) $^ -o $@
$(OBJDIR)/vicotool: $(TOOL_OBJS)
mkdir -p $(OBJDIR)
$(CC) $(LDFLAGS) $(TOOL_LDLIBS) $^ -o $@
$(OBJDIR)/par: $(PAR_OBJS)
mkdir -p $(OBJDIR)
$(CC) $(LDFLAGS) $(PAR_LDLIBS) $^ -o $@
%-bundles.json:
mkdir -p $(@D)
@echo "downloading bundle repository for $(*F)"
if curl -s "https://api.github.com/users/$(*F)" | grep -q '"type":"Organization"'; then \
repourl="https://api.github.com/orgs/$(*F)/repos"; \
else \
repourl="https://api.github.com/users/$(*F)/repos"; \
fi; \
curl --fail -s $$repourl > $@
$(OBJDIR)/blockimp.o: $(DERIVEDDIR)/blockimp_x86_$(BITS).h
$(DERIVEDDIR)/blockimp_x86_$(BITS).h \
$(DERIVEDDIR)/blockimp_x86_$(BITS).s \
$(DERIVEDDIR)/blockimp_x86_$(BITS)_stret.s \
$(DERIVEDDIR)/blockimp_x86_$(BITS)_config.c \
$(DERIVEDDIR)/blockimp_x86_$(BITS)_stret_config.c: blockimp_x86_$(BITS).tramp blockimp_x86_$(BITS)_stret.tramp
mkdir -p $(DERIVEDDIR)
@echo "Generating trampolines for arch $(ARCH)"
cd plblockimp/Source/x86_$(BITS) && \
for inp in $^; do \
echo "Generating trampolines: $$inp"; \
CURRENT_ARCH=$(ARCH) \
INPUT_FILE_PATH=$$(basename $$inp) \
INPUT_FILE_BASE=$${INPUT_FILE_PATH%.tramp} \
"$(CURDIR)/plblockimp/Other Sources/gentramp.sh" $(DERIVEDDIR); \
done
$(INFOPLIST): app/Vico-Info.plist
cp -f $< $@
CF_PKGTYPE = $(shell /usr/libexec/PlistBuddy -c "Print :CFBundlePackageType" app/Vico-Info.plist)
CF_SIGNATURE = $(shell /usr/libexec/PlistBuddy -c "Print :CFBundleSignature" app/Vico-Info.plist)
$(APPDIR)/Contents/PkgInfo: app/Vico-Info.plist
/bin/echo -n "$(CF_PKGTYPE)$(CF_SIGNATURE)" > $@
eval `stat -s $@` && test $$st_size -eq 8
TMPDMG = $(BUILDDIR)/vico-tmp.dmg
VOLNAME = vico-$(SHORT_VERSION)
DMGFILE = $(VOLNAME).dmg
DMG = $(BUILDDIR)/$(DMGFILE)
DMGDIR = "$(BUILDDIR)/Vico $(SHORT_VERSION)"
APPCAST_BASE = http://www.vicoapp.com/relnotes
DOWNLOAD_BASE = http://www.vicoapp.com/download
KSIZE = $(shell du -ks $(APPDIR) | cut -f1)
SIZE = $(shell echo $$(($(KSIZE) * 1024)) )
SPARKLE_PKEY = sparkle_priv.pem
SIGNATURE = $(shell /usr/bin/openssl dgst -sha1 -binary < $(DMG) | \
/usr/bin/openssl dgst -dss1 -sign $(SPARKLE_PKEY) | \
/usr/bin/openssl enc -base64)
APPCAST_XML = $(DMG).xml
dmg: $(DMG)
$(DMG): app
@echo "Creating disk image $(VOLNAME)"
/bin/rm -rf $(TMPDMG) $(DMGDIR) $(DMG)
mkdir -p $(DMGDIR)
/bin/cp -a $(APPDIR) $(DMGDIR)
ln -s /Applications $(DMGDIR)/Applications
hdiutil makehybrid -o $(TMPDMG) $(DMGDIR) -hfs
hdiutil convert -format UDBZ $(TMPDMG) -o $(DMG)
/bin/rm -rf $(TMPDMG) $(DMGDIR)
ls -lh $(DMG)
#### Create and sign a zip file for automatic updates.
appcast: $(DMG)
@sed -e 's,@SHORT_VERSION@,$(SHORT_VERSION),g' \
-e 's,@REPO_VERSION@,$(REPO_VERSION),g' \
-e 's,@RELNOTES_LINK@,$(APPCAST_BASE)/$(SHORT_VERSION),g' \
-e 's/@DATE@/$(shell LC_TIME=en_US date +"%a, %d %b %G %T %z")/g' \
-e 's,@DOWNLOAD_FILE@,$(DOWNLOAD_BASE)/$(DMGFILE),g' \
-e 's,@SIGNATURE@,$(SIGNATURE),g' \
-e 's,@SIZE@,$(SIZE),g' < appcast.xml.in > $(APPCAST_XML)
@cat $(APPCAST_XML)
RELEASE_TAG ?= $(shell git rev-parse --short HEAD)
RELEASE_DIR = build/$(CONFIGURATION)-$(RELEASE_TAG)
.PHONY: checkout
checkout:
@echo release directory is $(RELEASE_DIR)
@if test -d $(RELEASE_DIR); then echo "release directory already exists"; exit 1; fi
@echo checking out sources for '$(RELEASE_TAG)'
git clone . $(RELEASE_DIR)
cd $(RELEASE_DIR) && git co $(RELEASE_TAG)
release: checkout
$(MAKE) -C $(RELEASE_DIR) appcast
# include automatic dependencies...
-include $(OBJS:.o=.d)
# convenience targets
run: app
$(BINDIR)/Vico $(CURDIR)
gdb: app
gdb $(BINDIR)/Vico
leaks: app
MallocStackLogging=YES \
$(BINDIR)/Vico $(CURDIR)
zombie: app
NSZombieEnabled=YES NSDebugEnabled=YES \
$(BINDIR)/Vico $(CURDIR)
test:
xcodebuild -configuration Debug -target Tests
test_snippets:
export OTHER_TEST_FLAGS="-SenTest TestViSnippet" && \
xcodebuild -configuration Debug -target Tests
test_scopes:
export OTHER_TEST_FLAGS="-SenTest TestScopeSelectors" && \
xcodebuild -configuration Debug -target Tests
api:
rm -rf doc/html
appledoc --project-name "Vico API" \
--project-company "Martin Hedenfalk" \
--company-id se.bzero \
--no-repeat-first-par \
--output doc \
--create-html \
--no-create-docset \
--merge-categories \
app/ExCommand.h \
app/ExMap.h \
app/ExParser.h \
app/NSEvent-keyAdditions.h \
app/NSString-additions.h \
app/NSView-additions.h \
app/ViCommand.h \
app/ViDocument.h \
app/ViDocumentView.h \
app/ViEventManager.h \
app/ViKeyManager.h \
app/ViLanguage.h \
app/ViMap.h \
app/ViMark.h \
app/ViParser.h \
app/ViPreferencePane.h \
app/ViPreferencesController.h \
app/ViRegisterManager.h \
app/ViScope.h \
app/ViTabController.h \
app/ViTextStorage.h \
app/ViTextView.h \
app/ViViewController.h \
app/ViWindowController.h
syncapi: api
rsync -av --delete doc/html/ www:/var/www/feedback.vicoapp.com/public/api
tarball:
git archive --prefix=vico-$(RELEASE_TAG)/ $(RELEASE_TAG) > vico-$(RELEASE_TAG).tar.gz
HELP_FILES = \
index.html \
$(HELP_SRCS) \
shared/help.css \
shared/icon_hand.png \
shared/icon_hand_32.png \
shared/icon_hand_64.png \
help-Info.plist \
help-InfoPlist.strings
help: $(DERIVEDDIR)/help.stamp
HELP_RESDIR = $(RESDIR)/Vico.help/Contents/Resources
HELP_EN = $(HELP_RESDIR)/English.lproj
$(DERIVEDDIR)/help.stamp: $(HELP_FILES)
mkdir -p $(HELP_EN)
cp -f help/index.html $(HELP_EN)/VicoHelp.html
rsync -a --delete --exclude ".DS_Store" help/shared $(HELP_RESDIR)
cp -f help/help-Info.plist $(HELP_RESDIR)/../Info.plist
cp -f help/help-InfoPlist.strings $(HELP_EN)/InfoPlist.strings
for md in $(HELP_SRCS); do \
./help/md2html help/$$md > $(HELP_EN)/$${md%.md}.html; \
done
hiutil -vg -s en -Caf $(HELP_EN)/Vico.helpindex $(HELP_EN)
touch $(DERIVEDDIR)/help.stamp
HELP_SRC = $(CURDIR)/help
WWW_HELP_DST = $(CURDIR)/help/www
WWW_HELP_EN = $(WWW_HELP_DST)/en
wwwhelp:
rm -rf $(CURDIR)/help/www
mkdir -p $(WWW_HELP_EN)
cp -rf $(HELP_SRC)/shared $(WWW_HELP_DST)
cd $(WWW_HELP_EN) && $(HELP_SRC)/md2html.www $(HELP_SRC)/*.md
syncwwwhelp: wwwhelp
rsync -avr $(WWW_HELP_DST)/ www.vicoapp.com:/var/www/vicoapp.com/help/
synchelp: help
rsync -avr $(HELP_RESDIR)/ www.vicoapp.com:/var/www/vicoapp.com/help
clean:
rm -rf $(OBJDIR) $(APPDIR)
distclean:
rm -rf $(BUILDDIR)
.PHONY: build clean