-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
1140 lines (996 loc) · 46.5 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
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Top-level makefile for Apple's fork of gdb
# If this Makefile does not work, try the one in ./src
OLD_GDB_VERSION = 6.3.50-20050815
export GDB_VERSION = 6.3.50-$(shell date "+%Y%m%d")
GDB_RC_VERSION = 1824
OLD_BINUTILS_VERSION = 2.13-20021117
export BINUTILS_VERSION = 2.13-$(shell date "+%Y%m%d")
BINUTILS_RC_VERSION = 46
# Keep line below uncommented for debugging shell commands
SHELL = /bin/sh -ex
.PHONY: all clean configure build install installsrc installhdrs headers \
build-core build-binutils build-gdb \
install-frameworks-headers \
install-frameworks-macosx \
install-binutils-macosx \
install-gdb-fat \
install-chmod-macosx install-chmod-macosx-noprocmod \
install-clean install-source check \
cross-installhdrs \
cross-install-frameworks-headers \
cross-install-frameworks-headers-finalize
SUBDIRS = src bin macsbug libcheckpoint
# Get the correct setting for SYSTEM_DEVELOPER_TOOLS_DOC_DIR if
# the platform-variables.make file exists.
OS=MACOS
XCODE_APP_CONTENTS_DIR=/Applications/Xcode.app/Contents
SYSTEM_DEVELOPER_TOOLS_DOC_DIR=$(XCODE_APP_CONTENTS_DIR)/Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.DeveloperTools.docset/Contents/Resources/Documents/documentation/DeveloperTools
ifndef RC_ARCHS
RC_ARCHS=$(shell /usr/bin/arch)
endif
ifndef SRCROOT
SRCROOT=.
endif
ifndef OBJROOT
OBJROOT=./obj
endif
ifndef SYMROOT
SYMROOT=./sym
endif
ifndef DSTROOT
DSTROOT=./dst
endif
INSTALL=$(SRCROOT)/src/install-sh
CANONICAL_ARCHS := $(foreach arch,$(RC_ARCHS),$(foreach os,$(RC_OS),$(foreach release,$(RC_RELEASE),$(os):$(arch):$(release))))
CANONICAL_ARCHS := $(subst teflon:ppc:Rhapsody,powerpc-apple-rhapsody,$(CANONICAL_ARCHS))
CANONICAL_ARCHS := $(subst teflon:i386:Rhapsody,i386-apple-rhapsody,$(CANONICAL_ARCHS))
CANONICAL_ARCHS := $(subst macos:i386:$(RC_RELEASE),i386-apple-darwin,$(CANONICAL_ARCHS))
CANONICAL_ARCHS := $(subst macos:x86_64:$(RC_RELEASE),x86_64-apple-darwin,$(CANONICAL_ARCHS))
CANONICAL_ARCHS := $(subst macos:ppc:$(RC_RELEASE),powerpc-apple-darwin,$(CANONICAL_ARCHS))
CANONICAL_ARCHS := $(subst macos:arm:$(RC_RELEASE),arm-apple-darwin,$(CANONICAL_ARCHS))
CANONICAL_ARCHS := $(subst macos:armv4:$(RC_RELEASE),arm-apple-darwin,$(CANONICAL_ARCHS))
CANONICAL_ARCHS := $(subst macos:armv4t:$(RC_RELEASE),arm-apple-darwin,$(CANONICAL_ARCHS))
CANONICAL_ARCHS := $(subst macos:armv5:$(RC_RELEASE),arm-apple-darwin,$(CANONICAL_ARCHS))
CANONICAL_ARCHS := $(subst macos:armv5t:$(RC_RELEASE),arm-apple-darwin,$(CANONICAL_ARCHS))
CANONICAL_ARCHS := $(subst macos:armv6:$(RC_RELEASE),arm-apple-darwin,$(CANONICAL_ARCHS))
CANONICAL_ARCHS := $(subst macos:armv6t:$(RC_RELEASE),arm-apple-darwin,$(CANONICAL_ARCHS))
CANONICAL_ARCHS := $(subst macos:armv6t2:$(RC_RELEASE),arm-apple-darwin,$(CANONICAL_ARCHS))
CANONICAL_ARCHS := $(subst macos:armv7:$(RC_RELEASE),arm-apple-darwin,$(CANONICAL_ARCHS))
CANONICAL_ARCHS := $(subst macos:armv7t:$(RC_RELEASE),arm-apple-darwin,$(CANONICAL_ARCHS))
CANONICAL_ARCHS := $(subst macos:armv7s:$(RC_RELEASE),arm-apple-darwin,$(CANONICAL_ARCHS))
CANONICAL_ARCHS := $(subst powerpc-apple-darwin i386-apple-darwin,i386-apple-darwin powerpc-apple-darwin,$(CANONICAL_ARCHS))
CANONICAL_ARCHS := $(sort $(CANONICAL_ARCHS))
SRCTOP = $(shell cd $(SRCROOT) && pwd)
OBJTOP = $(shell (test -d $(OBJROOT) || $(INSTALL) -c -d $(OBJROOT)) && cd $(OBJROOT) && pwd)
SYMTOP = $(shell (test -d $(SYMROOT) || $(INSTALL) -c -d $(SYMROOT)) && cd $(SYMROOT) && pwd)
DSTTOP = $(shell (test -d $(DSTROOT) || $(INSTALL) -c -d $(DSTROOT)) && cd $(DSTROOT) && pwd)
ARCH_SAYS := $(shell /usr/bin/arch)
ifeq (i386,$(ARCH_SAYS))
BUILD_ARCH := i386-apple-darwin
else
ifeq (ppc,$(ARCH_SAYS))
BUILD_ARCH := powerpc-apple-darwin
else
ifeq (arm,$(ARCH_SAYS))
BUILD_ARCH := arm-apple-darwin
else
BUILD_ARCH := $(ARCH_SAYS)
endif
endif
endif
GDB_VERSION_STRING = $(GDB_VERSION) (Apple version gdb-$(GDB_RC_VERSION))
BINUTILS_VERSION_STRING = "$(BINUTILS_VERSION) (Apple version binutils-$(BINUTILS_RC_VERSION))"
GDB_BINARIES = gdb
GDB_FRAMEWORKS = gdb
GDB_MANPAGES =
BINUTILS_FRAMEWORKS = bfd binutils
BINUTILS_MANPAGES =
FRAMEWORKS = $(GDB_FRAMEWORKS) $(BINUTILS_FRAMEWORKS)
ifndef BINUTILS_BUILD_ROOT
BINUTILS_BUILD_ROOT = $(SDKROOT)
endif
BINUTILS_FRAMEWORK_PATH = $(BINUTILS_BUILD_ROOT)/System/Library/PrivateFrameworks
BINUTILS_LIB_PATH = $(BINUTILS_BUILD_ROOT)/usr/lib
BFD_FRAMEWORK = $(BINUTILS_FRAMEWORK_PATH)/bfd.framework
BFD_HEADERS = $(BFD_FRAMEWORK)/Headers
LIBERTY_FRAMEWORK = $(BINUTILS_FRAMEWORK_PATH)/liberty.framework
LIBERTY_HEADERS = $(LIBERTY_FRAMEWORK)/Headers
OPCODES_FRAMEWORK = $(BINUTILS_FRAMEWORK_PATH)/opcodes.framework
OPCODES_HEADERS = $(OPCODES_FRAMEWORK)/Headers
BINUTILS_FRAMEWORK = $(BINUTILS_FRAMEWORK_PATH)/binutils.framework
BINUTILS_HEADERS = $(BINUTILS_FRAMEWORK)/Headers
READLINE_FRAMEWORK = $(BINUTILS_FRAMEWORKS)/readline.framework
READLINE_HEADERS = $(READLINE_FRAMEWORK)/Headers
EFENCE_FRAMEWORK = $(BINUTILS_FRAMEWORKS)/electric-fence.framework
EFENCE_HEADERS = $(EFENCE_FRAMEWORK)/Headers
INTL_FRAMEWORK = $(BINUTILS_BUILD_ROOT)/usr/lib/libintl.dylib
INTL_HEADERS = $(BINUTILS_BUILD_ROOT)/usr/include
ifndef SDKROOT_FOR_BUILD
export SDKROOT_FOR_BUILD = $(shell xcodebuild -version -sdk macosx Path 2>/dev/null | head -1)
endif
ifndef SDKROOT
export SDKROOT = $(SDKROOT_FOR_BUILD)
endif
export AR = $(shell (xcrun -find ar 2>/dev/null || echo "ar"))
export CC = $(shell (xcrun -find clang 2>/dev/null || xcrun -find gcc 2>/dev/null || echo "cc"))
export CPP = $(shell (xcrun -find cpp 2>/dev/null || echo "cpp")) -I$(SDKROOT_FOR_BUILD)/usr/include
export CXX = $(shell (xcrun -find clang++ 2>/dev/null || xcrun -find g++ 2>/dev/null || echo "c++"))
export LD = $(shell (xcrun -find ld 2>/dev/null || echo "ld"))
export LIBTOOL = $(shell (xcrun -find libtool 2>/dev/null || echo "libtool"))
export MAKE = $(shell (xcrun -find make 2>/dev/null || echo "make"))
export NM = $(shell (xcrun -find nm 2>/dev/null || echo "nm"))
export RANLIB = $(shell (xcrun -find ranlib 2>/dev/null || echo "ranlib"))
export TAR = $(shell (xcrun -find gnutar 2>/dev/null || xcrun -find tar 2>/dev/null || echo "tar"))
ifndef RM
export RM = rm
endif
export CC_FOR_BUILD = $(shell (xcrun -find clang 2>/dev/null || xcrun -find gcc 2>/dev/null || echo "cc"))
export CCFLAGS_FOR_BUILD = -I$(SDKROOT_FOR_BUILD)/usr/include
export LDFLAGS_FOR_BUILD = -isysroot $(SDKROOT_FOR_BUILD)
ifndef CDEBUGFLAGS
CDEBUGFLAGS = -ggdb -Os -funwind-tables -fasynchronous-unwind-tables -D_DARWIN_UNLIMITED_STREAMS
endif
CFLAGS = $(CDEBUGFLAGS) $(RC_CFLAGS)
HOST_ARCHITECTURE = UNKNOWN
RC_CFLAGS_NOARCH = $(strip $(shell echo $(RC_CFLAGS) | sed -e 's/-arch [a-z0-9_]*//g'))
SYSTEM_FRAMEWORK = -L../intl -L./intl -L../intl/.libs -L./intl/.libs -lintl -framework System
FRAMEWORK_PREFIX =
FRAMEWORK_SUFFIX =
FRAMEWORK_VERSION = A
FRAMEWORK_VERSION_SUFFIX =
CONFIG_DIR=UNKNOWN
CONF_DIR=UNKNOWN
DEVEXEC_DIR=UNKNOWN
LIBEXEC_BINUTILS_DIR=UNKNOWN
LIBEXEC_GDB_DIR=UNKNOWN
LIBEXEC_LIB_DIR=UNKNOWN
MAN_DIR=UNKNOWN
PRIVATE_FRAMEWORKS_DIR=UNKNOWN
NATIVE_TARGET = unknown--unknown
NATIVE_TARGETS = $(foreach arch1,$(CANONICAL_ARCHS),$(arch1)--$(arch1))
CROSS_TARGETS = $(strip $(foreach hostarch, $(CANONICAL_ARCHS), $(foreach targarch, $(filter-out $(hostarch), $(CANONICAL_ARCHS)), $(hostarch)--$(targarch))))
PPC_TARGET=UNKNOWN
I386_TARGET=UNKNOWN
# Old comment:
# If the special TARGET_ONLY_EXTRA_ARCHS variable is set to arm, like
# someone had done
#
# sudo ~rc/bin/buildit -arch i386 -arch x86_64 `pwd` TARGET_ONLY_EXTRA_ARCHS=arm
#
# then build an arm cross-debugger for every native debugger that we
# build. This cross debugger does not require an arm compiler, arm libraries
# or an arm SDK -- the gdb binary runs exclusively on the native host.
# New comment:
# Unconditionally add a cross-arm debugger to every native host.
# (i.e. setting TARGET_ONLY_EXTRA_ARCHS no longer does anything)
CROSS_TARGETS := $(strip $(CROSS_TARGETS) $(foreach hostarch, $(CANONICAL_ARCHS), $(hostarch)--arm-apple-darwin))
CROSS_TARGETS := $(filter-out x86_64-apple-darwin--i386-apple-darwin, $(CROSS_TARGETS))
CROSS_TARGETS := $(filter-out i386-apple-darwin--x86_64-apple-darwin, $(CROSS_TARGETS))
# We do NOT want to build a ppc cross anything gdb; Apple assumes that
# no one will need that these days.
CROSS_TARGETS := $(filter-out powerpc-apple-darwin--x86_64-apple-darwin, $(CROSS_TARGETS))
CROSS_TARGETS := $(filter-out powerpc-apple-darwin--i386-apple-darwin, $(CROSS_TARGETS))
CROSS_TARGETS := $(filter-out powerpc-apple-darwin--arm-apple-darwin, $(CROSS_TARGETS))
# Similarly, Apple assumes that no one needs an arm x x86-64 debugger,
# for instance.
CROSS_TARGETS := $(filter-out arm-apple-darwin--x86_64-apple-darwin, $(CROSS_TARGETS))
CROSS_TARGETS := $(filter-out arm-apple-darwin--arm-apple-darwin, $(CROSS_TARGETS))
CROSS_TARGETS := $(filter-out arm-apple-darwin--i386-apple-darwin, $(CROSS_TARGETS))
CROSS_TARGETS := $(filter-out arm-apple-darwin--powerpc-apple-darwin, $(CROSS_TARGETS))
CROSS_TARGETS := $(sort $(CROSS_TARGETS))
# These can be set to control the flags passed to the configure scripts
# in the various subdirectories:
CONFIG_VERBOSE=-v
CONFIG_ENABLE_GDBTK=--enable-gdbtk=no
CONFIG_ENABLE_GDBMI=--enable-gdbmi
CONFIG_ENABLE_BUILD_WARNINGS=--enable-build-warnings --disable-werror
CONFIG_ENABLE_TUI=--disable-tui
CONFIG_ALL_BFD_TARGETS=--enable-targets#=all
CONFIG_ALL_BFD_APPLE_TARGETS=--enable-targets=m68k-apple-aux,powerpc-apple-rhapsody,arm-apple-darwin,i386-apple-darwin,x86_64-apple-darwin,powerpc-apple-macos,powerpc64-apple-darwin,powerpc64-apple-macos
CONFIG_64_BIT_BFD=--enable-64-bit-bfd
CONFIG_WITH_MMAP=--with-mmap
CONFIG_ENABLE_SHARED=--disable-shared
CONFIG_MAINTAINER_MODE=#--enable-maintainer-mode
CONFIG_SILENT_RULES=
CONFIG_DEP_TRACK=--disable-dependency-tracking
CONFIG_BUILD=--build=$(BUILD_ARCH)
CONFIG_OTHER_OPTIONS?=--disable-serial-configure --with-x --enable-carbon-framework --enable-debug-symbols-framework
# The code below looks like it is intended for building the ARM native debugger.
# When this is done in B&I we get passed in these settings,
# RC_CFLAGS: -arch armv6 -pipe
# RC_ARCHS: armv6
# RC_OS: macos
# RC_RELEASE "BigBear"
# RC_PRODUCT "P2"
# RC_PURPLE "YES"
# RC_armv6 "YES"
# RC_arm ""
# TRAIN "BigBear"
# HOST_ARCHITECTURE=armv6
# SDKROOT='/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.Internal.sdk'
#
ifneq ($(findstring macosx,$(CANONICAL_ARCHS))$(findstring darwin,$(CANONICAL_ARCHS)),)
CC = clang -arch $(HOST_ARCHITECTURE)
CC_FOR_BUILD = clang
# Unset this when building Canadian Cross. (e.g. an arm native gdb built on an
# i386 system) This will have a setting like "10.5" which is not valid on the
# iPhone OS platform and our compiler will get linker errors when running
# autoconf tests.
MACOSX_DEPLOYMENT_TARGET=
ifndef CDEBUGFLAGS
CDEBUGFLAGS = -ggdb -Os
endif
# The -Wno-error=deprecated-declarations flag is not recognized by some
# compilers; disable it on a per-release basis.
ifeq (Leopard,$(RC_RELEASE))
OS_DEP_CFLAGS =
else
ifeq (SnowLeopard,$(RC_RELEASE))
OS_DEP_CFLAGS = -Wno-error=deprecated-declarations
else
OS_DEP_CFLAGS =
endif
endif
CFLAGS = $(strip $(RC_NONARCH_CFLAGS) $(CDEBUGFLAGS) -Wall -Wimplicit $(OS_DEP_CFLAGS) -funwind-tables -fasynchronous-unwind-tables)
HOST_ARCHITECTURE = $(shell echo $* | sed -e 's/--.*//' -e 's/powerpc/ppc/' -e 's/-apple-macosx.*//' -e 's/-apple-macos.*//' -e 's/-apple-darwin.*//')
endif
MACOSX_FLAGS = \
CONFIG_DIR=private/etc \
CONF_DIR=usr/share/gdb \
DEVEXEC_DIR=usr/bin \
LIBEXEC_BINUTILS_DIR=usr/libexec/binutils \
LIBEXEC_GDB_DIR=usr/libexec/gdb \
LIB_DIR=usr/lib \
MAN_DIR=usr/share/man \
PRIVATE_FRAMEWORKS_DIR=System/Library/PrivateFrameworks \
SOURCE_DIR=System/Developer/Source/Commands/gdb
CONFIGURE_OPTIONS = $(filter-out ,\
$(CONFIG_VERBOSE) \
$(CONFIG_ENABLE_GDBTK) \
$(CONFIG_ENABLE_GDBMI) \
$(CONFIG_ENABLE_BUILD_WARNINGS) \
$(CONFIG_ENABLE_TUI) \
$(CONFIG_ALL_BFD_TARGETS) \
$(CONFIG_64_BIT_BFD) \
$(CONFIG_WITH_MMAP) \
$(CONFIG_ENABLE_SHARED) \
$(CONFIG_MAINTAINER_MODE) \
$(CONFIG_DEP_TRACK) \
$(CONFIG_BUILD) \
$(CONFIG_OTHER_OPTIONS))
MAKE_OPTIONS = \
prefix='/usr'
EFLAGS = $(filter-out ,\
CFLAGS='$(CFLAGS)' \
CC='$(CC)' \
CPP='$(CPP)' \
CXX='$(CXX)' \
LD='$(LD)' \
AR='$(AR)' \
RANLIB='$(RANLIB)' \
NM='$(NM)' \
CC_FOR_BUILD='$(CC_FOR_BUILD)' \
HOST_ARCHITECTURE='$(HOST_ARCHITECTURE)' \
SDKROOT='$(SDKROOT)' \
BINUTILS_FRAMEWORK_PATH='$(BINUTILS_FRAMEWORK_PATH)' \
SRCROOT='$(SRCROOT)' \
$(MAKE_OPTIONS))
SFLAGS = $(EFLAGS)
FFLAGS = \
$(SFLAGS) \
SYSTEM_FRAMEWORK='$(SYSTEM_FRAMEWORK)' \
FRAMEWORK_PREFIX='$(FRAMEWORK_PREFIX)' \
FRAMEWORK_SUFFIX='$(FRAMEWORK_SUFFIX)' \
FRAMEWORK_VERSION_SUFFIX='$(FRAMEWORK_VERSION_SUFFIX)'
FRAMEWORK_TARGET=stamp-framework-headers all
framework=-L../$(patsubst liberty,libiberty,$(1)) -l$(patsubst liberty,iberty,$(1))
FSFLAGS = $(SFLAGS)
CONFIGURE_ENV = $(EFLAGS)
MAKE_ENV = $(EFLAGS)
ifndef MAKE
MAKE = make
endif
SUBMAKE = $(MAKE_ENV) $(MAKE)
_all: all
crossarm: LIBEXEC_GDB_DIR=usr/libexec/gdb
crossarm: CDEBUGFLAGS ?= -gdwarf-2 -D__DARWIN_UNIX03=0
crossarm:;
echo "BUILDING CROSSARM"; \
$(RM) -v $(SYMROOT)/$(LIBEXEC_GDB_DIR)/gdb-arm-apple-darwin
for i in $(RC_ARCHS); do \
$(RM) -r $(OBJROOT)/$${i}-apple-darwin--arm-apple-darwin; \
$(INSTALL) -c -d $(OBJROOT)/$${i}-apple-darwin--arm-apple-darwin; \
sdk_cc=`xcrun -sdk $(SDKROOT) -find clang`; \
(cd $(OBJROOT)/$${i}-apple-darwin--arm-apple-darwin/ && \
$(CONFIGURE_ENV) CC="$${sdk_cc} -arch $${i}" $(MACOSX_FLAGS) $(SRCTOP)/src/configure \
--host=$${i}-apple-darwin \
--target=arm-apple-darwin \
--build=$(BUILD_ARCH) \
CFLAGS=" -isystem $(SDKROOT)/usr/include $(CDEBUGFLAGS)" \
$(CONFIGURE_OPTIONS) \
); \
mkdir -p $(SYMROOT)/$(LIBEXEC_GDB_DIR); \
mkdir -p $(DSTROOT)/$(LIBEXEC_GDB_DIR); \
$(SUBMAKE) $(MACOSX_FLAGS) -C $(OBJROOT)/$${i}-apple-darwin--arm-apple-darwin configure-gdb; \
$(SUBMAKE) $(MACOSX_FLAGS) -C $(OBJROOT)/$${i}-apple-darwin--arm-apple-darwin \
-W version.in VERSION='$(GDB_VERSION_STRING)' GDB_RC_VERSION='$(GDB_RC_VERSION)' all-gdb; \
if [ -e $(SYMROOT)/$(LIBEXEC_GDB_DIR)/gdb-arm-apple-darwin ] ; then \
lipo -create $(SYMROOT)/$(LIBEXEC_GDB_DIR)/gdb-arm-apple-darwin $(OBJROOT)/$${i}-apple-darwin--arm-apple-darwin/gdb/gdb -output $(SYMROOT)/$(LIBEXEC_GDB_DIR)/gdb-arm-apple-darwin; \
else \
lipo -create $(OBJROOT)/$${i}-apple-darwin--arm-apple-darwin/gdb/gdb -output $(SYMROOT)/$(LIBEXEC_GDB_DIR)/gdb-arm-apple-darwin; \
fi;\
done;
(cd $(SYMROOT)/$(LIBEXEC_GDB_DIR)/ ; dsymutil gdb-arm-apple-darwin)
strip -S -o $(DSTROOT)/$(LIBEXEC_GDB_DIR)/gdb-arm-apple-darwin \
$(SYMROOT)/$(LIBEXEC_GDB_DIR)/gdb-arm-apple-darwin
chown root:wheel $(DSTROOT)/$(LIBEXEC_GDB_DIR)/gdb-arm-apple-darwin
chmod 755 $(DSTROOT)/$(LIBEXEC_GDB_DIR)/gdb-arm-apple-darwin
mkdir -p ${DSTROOT}/usr/bin
sed -e 's/version=.*/version=$(GDB_VERSION)-$(GDB_RC_VERSION)/' \
< $(SRCROOT)/gdb.sh > ${DSTROOT}/usr/bin/gdb
chmod 755 ${DSTROOT}/usr/bin/gdb
.PHONY: crossarm
#
# cross
#
# Build only a cross targets for host architectures. RC_ARCHS specifies
# all of the host architectures to build for, and RC_CROSS_ARCHS specifies
# all of the cross architectures to build for. This can save time when
# building a cross target as you do NOT have to build all permutations of
# RC_ARCHS.
#
# SDKROOT can be used to specify a system root for cross builds, and
# the current macos is used will be used for others.
#
# The command below used to build a cross i386 gdb to be hosted on ppc:
#
# sudo ~rc/bin/buildit -noinstallhdrs -arch ppc -target cross /path/to/gdb \
# RC_CROSS_ARCHS=i386
#
# The command below will build a cross armv6 gdb to be hosted on i386, ppc,
# and natively on armv6:
#
# sudo ~rc/bin/buildit `pwd` -arch ppc -arch i386 -arch armv5 \
# -target cross -project gdb -release RELEASENAME \
# SDKROOT=/path/to/sdk/some.sdk RC_CROSS_ARCHS=armv6
#
cross: LIBEXEC_GDB_DIR=usr/libexec/gdb
cross:;
$(SUBMAKE) $(MACOSX_FLAGS) install-gdb-macosx-common
echo "BUILDING CROSS $(RC_CROSS_ARCHS) for HOST $(RC_ARCHS)"; \
set -e; for cross_arch in $(RC_CROSS_ARCHS); do \
cross_arch_full=$${cross_arch}; \
if [[ "$${cross_arch}" =~ arm.* ]] ; then \
cross_arch=arm; \
fi; \
target_arch_vendor_os="$${cross_arch}-apple-darwin"; \
curr_symroot_output_file="$(SYMROOT)/$(LIBEXEC_GDB_DIR)/gdb-$${target_arch_vendor_os}" ; \
for host_arch in $(RC_ARCHS); do \
host_arch_full="$${host_arch}"; \
if [[ "$${host_arch}" =~ arm.* ]] ; then \
host_arch="arm"; \
fi; \
echo "BUILDING CROSS $${cross_arch_full} for HOST $${host_arch_full}"; \
host_arch_vendor_os="$${host_arch}-apple-darwin"; \
curr_objroot="$(OBJROOT)/$${host_arch_full}-apple-darwin--$${cross_arch_full}-apple-darwin"; \
$(RM) -r "$${curr_objroot}"; \
$(INSTALL) -c -d "$${curr_objroot}"; \
if [[ "$${host_arch}" == "arm" ]] ; then \
sdk_cc=`xcrun -sdk $(SDKROOT) -find clang`; \
sdk_cxx=`xcrun -sdk $(SDKROOT) -find clang++`; \
sdk_cflags=" -isysroot $(SDKROOT)"; \
sdk_cxxflags=" -isysroot $(SDKROOT)"; \
else \
sdk_cc="clang"; \
sdk_cxx="clang++"; \
sdk_cflags=" -isysroot $(SDKROOT_FOR_BUILD)"; \
sdk_cxxflags=" -isysroot $(SDKROOT_FOR_BUILD)"; \
fi; \
(cd "$${curr_objroot}"/ && \
$(CONFIGURE_ENV) \
CC="$${sdk_cc} -arch $${host_arch_full}$${sdk_cflags}" \
CXX="$${sdk_cxx} -arch $${host_arch_full}$${sdk_cxxflags}" \
$(MACOSX_FLAGS) $(SRCTOP)/src/configure \
--host=$${host_arch_vendor_os} \
--target=$${target_arch_vendor_os} \
--build=$(BUILD_ARCH) \
CFLAGS="$(CDEBUGFLAGS)" \
$(CONFIGURE_OPTIONS) \
); \
mkdir -p $(SYMROOT)/$(LIBEXEC_GDB_DIR); \
mkdir -p $(DSTROOT)/$(LIBEXEC_GDB_DIR); \
$(SUBMAKE) $(MACOSX_FLAGS) -C "$${curr_objroot}" configure-gdb; \
$(SUBMAKE) $(MACOSX_FLAGS) -C "$${curr_objroot}" \
-W version.in VERSION='$(GDB_VERSION_STRING)' GDB_RC_VERSION='$(GDB_RC_VERSION)' all-gdb; \
if [ -e "$${curr_symroot_output_file}" ] ; then \
lipo -create "$${curr_symroot_output_file}" "$${curr_objroot}/gdb/gdb" -output "$${curr_symroot_output_file}"; \
else \
lipo -create "$${curr_objroot}/gdb/gdb" -output "$${curr_symroot_output_file}"; \
fi; \
done; \
(cd $(SYMROOT)/$(LIBEXEC_GDB_DIR)/ ; dsymutil gdb-$${target_arch_vendor_os}); \
strip -S -o $(DSTROOT)/$(LIBEXEC_GDB_DIR)/gdb-$${target_arch_vendor_os} "$${curr_symroot_output_file}"; \
done; \
mkdir -p ${DSTROOT}/usr/bin; \
sed -e 's/version=.*/version=$(GDB_VERSION)-$(GDB_RC_VERSION)/' \
< $(SRCROOT)/gdb.sh > ${DSTROOT}/usr/bin/gdb; \
chmod 755 ${DSTROOT}/usr/bin/gdb; \
stat ${DSTROOT}/usr/bin/gdb
.PHONY: cross
cross-installhdrs:
$(SUBMAKE) $(MACOSX_FLAGS) install-clean ; \
echo BUILDING CROSS $(RC_CROSS_ARCHS) for HOST $(RC_ARCHS); \
for cross_arch in $(RC_CROSS_ARCHS); do \
cross_arch_full=$${cross_arch}; \
if [[ "$${cross_arch}" =~ arm.* ]] ; then \
cross_arch=arm; \
fi; \
target_arch_vendor_os="$${cross_arch}-apple-darwin"; \
for host_arch in $(RC_ARCHS); do \
host_arch_full="$${host_arch}"; \
if [[ "$${host_arch}" =~ arm.* ]] ; then \
host_arch="arm"; \
fi; \
echo "BUILDING CROSS $${cross_arch_full} for HOST $${host_arch_full}"; \
host_arch_vendor_os="$${host_arch}-apple-darwin"; \
curr_objroot="$(OBJROOT)/$${host_arch_full}-apple-darwin--$${cross_arch_full}-apple-darwin"; \
$(RM) -r "$${curr_objroot}"; \
$(INSTALL) -c -d "$${curr_objroot}"; \
if [[ "$${host_arch}" == "arm" ]] ; then \
sdk_cc=`xcrun -sdk $(SDKROOT) -find clang`; \
sdk_cxx=`xcrun -sdk $(SDKROOT) -find clang++`; \
sdk_cflags=" -isysroot $(SDKROOT)"; \
sdk_cxxflags=" -isysroot $(SDKROOT)"; \
else \
sdk_cc="clang"; \
sdk_cxx="clang++"; \
sdk_cflags=" -isysroot $(SDKROOT_FOR_BUILD)"; \
sdk_cxxflags=" -isysroot $(SDKROOT_FOR_BUILD)"; \
fi; \
(cd "$${curr_objroot}"/ && \
$(CONFIGURE_ENV) \
CC="$${sdk_cc} -arch $${host_arch_full}$${sdk_cflags}" \
CXX="$${sdk_cxx} -arch $${host_arch_full}$${sdk_cxxflags}" \
$(MACOSX_FLAGS) $(SRCTOP)/src/configure \
--host=$${host_arch_vendor_os} \
--target=$${target_arch_vendor_os} \
--build=$(BUILD_ARCH) \
CFLAGS="$(CDEBUGFLAGS)" \
$(CONFIGURE_OPTIONS) \
); \
$(SUBMAKE) $${curr_objroot}/stamp-build-headers ; \
$(SUBMAKE) $(MACOSX_FLAGS) CURRENT_ROOT=$(SYMROOT) CROSS_ARCH=$${cross_arch} CROSS_ARCH_FULL=$${cross_arch_full} HOST_ARCH=$${host_arch} HOST_ARCH_FULL=$${host_arch_full} cross-install-frameworks-headers ; \
$(SUBMAKE) $(MACOSX_FLAGS) CURRENT_ROOT=$(DSTROOT) CROSS_ARCH=$${cross_arch} CROSS_ARCH_FULL=$${cross_arch_full} HOST_ARCH=$${host_arch} HOST_ARCH_FULL=$${host_arch_full} cross-install-frameworks-headers ; \
done; \
done; \
$(SUBMAKE) CURRENT_ROOT=$(SYMROOT) $(MACOSX_FLAGS) cross-install-frameworks-headers-finalize ; \
$(SUBMAKE) CURRENT_ROOT=$(DSTROOT) $(MACOSX_FLAGS) cross-install-frameworks-headers-finalize ; \
$(OBJROOT)/%/stamp-rc-configure:
$(RM) -r $(OBJROOT)/$*
$(INSTALL) -c -d $(OBJROOT)/$*
(cd $(OBJROOT)/$* && \
$(CONFIGURE_ENV) $(SRCTOP)/src/configure \
--host=$(shell echo $* | sed -e 's/--.*//') \
--target=$(shell echo $* | sed -e 's/.*--//') \
$(CONFIGURE_OPTIONS) \
)
touch $@
$(OBJROOT)/%/stamp-rc-configure-cross:
$(RM) -r $(OBJROOT)/$*
$(INSTALL) -c -d $(OBJROOT)/$*
(cd $(OBJROOT)/$* && \
$(CONFIGURE_ENV) $(SRCTOP)/src/configure \
--host=$(shell echo $* | sed -e 's/--.*//') \
--target=$(shell echo $* | sed -e 's/.*--//') \
$(CONFIGURE_OPTIONS) \
)
touch $@
$(OBJROOT)/%/stamp-build-headers:
$(SUBMAKE) -C $(OBJROOT)/$* configure-intl configure-libiberty configure-bfd configure-opcodes configure-gdb
$(SUBMAKE) -C $(OBJROOT)/$*/libiberty $(FFLAGS) stamp-framework-headers
$(SUBMAKE) -C $(OBJROOT)/$*/bfd $(FFLAGS) headers stamp-framework-headers
$(SUBMAKE) -C $(OBJROOT)/$*/opcodes $(FFLAGS) stamp-framework-headers
$(SUBMAKE) -C $(OBJROOT)/$* $(FFLAGS) stamp-framework-headers-binutils
$(SUBMAKE) -C $(OBJROOT)/$*/gdb/doc $(MFLAGS) VERSION='$(GDB_VERSION_STRING)'
$(SUBMAKE) -C $(OBJROOT)/$* $(MFLAGS) stamp-framework-headers-gdb
touch $@
$(OBJROOT)/%/stamp-build-core:
$(SUBMAKE) -C $(OBJROOT)/$* configure-intl configure-libiberty configure-bfd configure-opcodes
$(SUBMAKE) -C $(OBJROOT)/$*/intl $(SFLAGS) libintl.la
$(SUBMAKE) -C $(OBJROOT)/$*/libiberty $(FFLAGS) $(FRAMEWORK_TARGET)
$(SUBMAKE) -C $(OBJROOT)/$*/bfd $(FFLAGS) headers
$(SUBMAKE) -C $(OBJROOT)/$*/bfd $(FFLAGS) $(FRAMEWORK_TARGET)
$(SUBMAKE) -C $(OBJROOT)/$*/opcodes $(FFLAGS) $(FRAMEWORK_TARGET)
$(SUBMAKE) -C $(OBJROOT)/$* configure-readline configure-intl
$(SUBMAKE) -C $(OBJROOT)/$*/readline $(MFLAGS) all $(FRAMEWORK_TARGET)
$(SUBMAKE) -C $(OBJROOT)/$*/intl $(MFLAGS)
touch $@
$(OBJROOT)/%/stamp-build-binutils:
$(SUBMAKE) -C $(OBJROOT)/$* configure-binutils
$(SUBMAKE) -C $(OBJROOT)/$*/binutils $(FSFLAGS) VERSION='$(BINUTILS_VERSION)' VERSION_STRING='$(BINUTILS_VERSION_STRING)' all
$(SUBMAKE) -C $(OBJROOT)/$* $(FFLAGS) stamp-framework-headers-binutils
touch $@
$(OBJROOT)/%/stamp-build-gdb:
$(SUBMAKE) -C $(OBJROOT)/$* configure-gdb
$(SUBMAKE) -C $(OBJROOT)/$*/gdb -W version.in $(MFLAGS) $(FSFLAGS) VERSION='$(GDB_VERSION_STRING)' GDB_RC_VERSION='$(GDB_RC_VERSION)' gdb
ifeq "$(CANONICAL_ARCHS)" "arm-apple-darwin"
$(SUBMAKE) -C $(OBJROOT)/$* configure-gdbserver
$(SUBMAKE) -C $(OBJROOT)/$*/gdb/gdbserver $(MFLAGS) $(FSFLAGS) VERSION='$(GDB_VERSION_STRING)' gdbserver
endif
$(OBJROOT)/%/stamp-build-gdb-framework:
$(SUBMAKE) -C $(OBJROOT)/$* $(FFLAGS) stamp-framework-headers-gdb
$(OBJROOT)/%/stamp-build-gdb-docs:
$(SUBMAKE) -C $(OBJROOT)/$*/gdb/doc $(MFLAGS) VERSION='$(GDB_VERSION_STRING)' gdb.info
touch $@
TEMPLATE_HEADERS = config.h tm.h xm.h nm.h
install-frameworks-headers:
$(INSTALL) -c -d $(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)
set -e; for i in $(FRAMEWORKS); do \
framedir=$(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/$${i}.framework; \
$(INSTALL) -c -d $${framedir}/Versions/A/PrivateHeaders; \
$(INSTALL) -c -d $${framedir}/Versions/A/Headers; \
ln -sf A $${framedir}/Versions/Current; \
ln -sf Versions/Current/PrivateHeaders $${framedir}/PrivateHeaders; \
ln -sf Versions/Current/Headers $${framedir}/Headers; \
done
set -e; for i in $(FRAMEWORKS); do \
l=`echo $${i} | sed -e 's/liberty/libiberty/;' -e 's/binutils/\./;' -e 's/gdb/\./;'`; \
(cd $(OBJROOT)/$(firstword $(NATIVE_TARGETS))/$${l}/$${i}.framework/Versions/A \
&& $(TAR) --exclude=CVS --exclude=.svn -cf - Headers) \
| \
(cd $(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/$${i}.framework/Versions/A \
&& $(TAR) -xf -); \
done
set -e; for i in gdb; do \
l=`echo $${i} | sed -e 's/liberty/libiberty/;' -e 's/binutils/\./;' -e 's/gdb/\./;'`; \
rm -rf $(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/$${i}.framework/Versions/A/Headers/machine; \
mkdir -p $(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/$${i}.framework/Versions/A/Headers/machine; \
for j in $(NATIVE_TARGETS); do \
mkdir -p $(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/$${i}.framework/Versions/A/Headers/machine/$${j}; \
(cd $(OBJROOT)/$${j}/$${l}/$${i}.framework/Versions/A/Headers/machine \
&& $(TAR) --exclude=CVS --exclude=.svn -cf - *) \
| \
(cd $(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/$${i}.framework/Versions/A/Headers/machine/$${j} \
&& $(TAR) -xf -) \
done; \
for h in $(TEMPLATE_HEADERS); do \
hg=`echo $${h} | sed -e 's/\.h//' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
rm -f $(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/$${i}.framework/Versions/A/Headers/$${h}; \
ln -s machine/$${h} $(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/$${i}.framework/Versions/A/Headers/$${h}; \
cat template.h | sed -e "s/@file@/$${h}/g" -e "s/@FILEGUARD@/_CONFIG_$${hg}_H_/" \
> $(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/$${i}.framework/Versions/A/Headers/machine/$${h}; \
done; \
done
cross-install-frameworks-headers-finalize:
cd "$(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/gdb.framework/Versions/A/Headers/machine" \
&& cross_dirs=`find . -type d`; \
set -e; for h in $(TEMPLATE_HEADERS); do \
hg=`echo $${h} | sed -e 's/\.h//' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
aggregate_cross_file=$(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/gdb.framework/Versions/A/Headers/machine/$${h}; \
echo "#ifndef _CONFIG_$${hg}_H_\n#define _CONFIG_$${hg}_H_\n#include <mach/mach.h>\n" > "$${aggregate_cross_file}" ; \
for cross_dir in $${cross_dirs}; do \
cross_dir=`echo $${cross_dir} | sed -e 's/^\.//' -e 's/\///'`; \
if [[ -n "$${cross_dir}" && -e "$${cross_dir}/$${h}" ]]; then \
host_arch=`echo "$${cross_dir}" | sed -e 's/\([^-]*\).*/\1/'`; \
cross_arch=`echo "$${cross_dir}" | sed -e 's/.*--\([^-]*\).*/\1/'`; \
if [[ "$${host_arch}" == "$${cross_arch}" ]]; then \
echo "#if defined (NM_NEXTSTEP) && defined (TM_NEXTSTEP) && defined (__$${host_arch}__)" >> "$${aggregate_cross_file}" ; \
echo "#include \"machine/$${cross_dir}/$${h}\"" >> "$${aggregate_cross_file}" ; \
else \
cross_arch_caps=`echo "$${cross_arch}" | sed -e 's/ppc/POWERPC/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
echo "#if !defined (NM_NEXTSTEP) && defined (TM_NEXTSTEP) && defined (TARGET_$${cross_arch_caps}) && defined (__$${host_arch}__)" >> "$${aggregate_cross_file}" ; \
echo "#include \"machine/$${cross_dir}/$${h}\"" >> "$${aggregate_cross_file}" ; \
fi ; \
fi ; \
done ; \
echo "#else\n#error unknown architecture\n#endif\n\n#endif\n" >> "$${aggregate_cross_file}" ; \
done
cross-install-frameworks-headers:
$(INSTALL) -c -d $(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)
set -e; for i in $(FRAMEWORKS); do \
framedir=$(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/$${i}.framework; \
$(INSTALL) -c -d $${framedir}/Versions/A/PrivateHeaders; \
$(INSTALL) -c -d $${framedir}/Versions/A/Headers; \
ln -sf A $${framedir}/Versions/Current; \
ln -sf Versions/Current/PrivateHeaders $${framedir}/PrivateHeaders; \
ln -sf Versions/Current/Headers $${framedir}/Headers; \
done
set -e; for i in $(FRAMEWORKS); do \
l=`echo $${i} | sed -e 's/liberty/libiberty/;' -e 's/binutils/\./;' -e 's/gdb/\./;'`; \
(cd "$(OBJROOT)/$(HOST_ARCH_FULL)-apple-darwin--$(CROSS_ARCH_FULL)-apple-darwin/$${l}/$${i}.framework/Versions/A" \
&& $(TAR) --exclude=CVS --exclude=.svn -cf - Headers) \
| \
(cd "$(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/$${i}.framework/Versions/A" \
&& $(TAR) -xf -); \
done
rm -rf "$(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/gdb.framework/Versions/A/Headers/machine/$(HOST_ARCH)-apple-darwin--$(CROSS_ARCH)-apple-darwin"; \
mkdir -p "$(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/gdb.framework/Versions/A/Headers/machine/$(HOST_ARCH)-apple-darwin--$(CROSS_ARCH)-apple-darwin"; \
(cd "$(OBJROOT)/$(HOST_ARCH_FULL)-apple-darwin--$(CROSS_ARCH_FULL)-apple-darwin/gdb.framework/Versions/A/Headers/machine" && $(TAR) --exclude=CVS --exclude=.svn -cf - *) \
| (cd "$(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/gdb.framework/Versions/A/Headers/machine/$(HOST_ARCH)-apple-darwin--$(CROSS_ARCH)-apple-darwin" && $(TAR) -xf -);
cross-install-frameworks-headers-remove:
for h in $(TEMPLATE_HEADERS); do \
hg=`echo $${h} | sed -e 's/\.h//' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
rm -f $(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/gdb.framework/Versions/A/Headers/$${h}; \
ln -s machine/$${h} $(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/gdb.framework/Versions/A/Headers/$${h}; \
cat template.h | sed -e "s/@file@/$${h}/g" -e "s/@FILEGUARD@/_CONFIG_$${hg}_H_/" \
> $(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/gdb.framework/Versions/A/Headers/machine/$${h}; \
done;
install-frameworks-resources:
$(INSTALL) -c -d $(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)
set -e; for i in $(GDB_FRAMEWORKS); do \
framedir=$(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/$${i}.framework; \
$(INSTALL) -c -d $${framedir}/Versions/A/Resources; \
ln -sf Versions/Current/Resources $${framedir}/Resources; \
$(INSTALL) -c -d $${framedir}/Versions/A/Resources/English.lproj; \
cat $(SRCROOT)/Info-macos.template | sed -e "s/@NAME@/$$i/g" -e 's/@VERSION@/$(GDB_RC_VERSION)/g' > \
$${framedir}/Versions/A/Resources/Info-macos.plist; \
done
set -e; for i in $(BINUTILS_FRAMEWORKS); do \
framedir=$(CURRENT_ROOT)/$(PRIVATE_FRAMEWORKS_DIR)/$${i}.framework; \
$(INSTALL) -c -d $${framedir}/Versions/A/Resources; \
ln -sf Versions/Current/Resources $${framedir}/Resources; \
$(INSTALL) -c -d $${framedir}/Versions/A/Resources/English.lproj; \
cat $(SRCROOT)/Info-macos.template | sed -e "s/@NAME@/$$i/g" -e 's/@VERSION@/$(BINUTILS_RC_VERSION)/g' > \
$${framedir}/Versions/A/Resources/Info-macos.plist; \
done
install-frameworks-macosx:
find . -name '*.framework' -print
$(SUBMAKE) CURRENT_ROOT=$(SYMROOT) install-frameworks-headers
$(SUBMAKE) CURRENT_ROOT=$(DSTROOT) install-frameworks-headers
$(SUBMAKE) CURRENT_ROOT=$(SYMROOT) install-frameworks-resources
$(SUBMAKE) CURRENT_ROOT=$(DSTROOT) install-frameworks-resources
install-gdb-common:
set -e; for dstroot in $(SYMROOT) $(DSTROOT); do \
\
$(INSTALL) -c -d $${dstroot}/$(DEVEXEC_DIR); \
$(INSTALL) -c -d $${dstroot}/$(CONFIG_DIR); \
$(INSTALL) -c -d $${dstroot}/$(CONF_DIR); \
$(INSTALL) -c -d $${dstroot}/$(MAN_DIR); \
\
docroot="$${dstroot}/$(SYSTEM_DEVELOPER_TOOLS_DOC_DIR)/gdb"; \
\
$(INSTALL) -c -d "$${docroot}"; \
\
$(INSTALL) -c -m 644 $(SRCROOT)/doc/refcard.pdf "$${docroot}/refcard.pdf"; \
\
done;
install-gdb-macosx-common: install-gdb-common
if test ! -e $(SRCROOT)/texi2html && test -e texi2html; then \
cp -v texi2html $(SRCROOT); \
fi
set -e; for dstroot in $(SYMROOT) $(DSTROOT); do \
\
$(INSTALL) -c -d $${dstroot}/$(LIBEXEC_GDB_DIR); \
\
docroot="$${dstroot}/$(SYSTEM_DEVELOPER_TOOLS_DOC_DIR)/gdb"; \
\
for i in gdb gdbint stabs; do \
$(INSTALL) -c -d "$${docroot}/$${i}"; \
if test ! -e $${docroot}/$${i}/texithtml; then \
cp -v $(SRCROOT)/texi2html $${docroot}/$${i}; \
fi; \
(cd "$${docroot}/$${i}" && \
$(SRCROOT)/texi2html \
-split_chapter \
-I$(OBJROOT)/$(firstword $(NATIVE_TARGETS))/gdb/doc \
-I$(SRCROOT)/src/readline/doc \
-I$(SRCROOT)/src/gdb/mi \
$(SRCROOT)/src/gdb/doc/$${i}.texinfo); \
done; \
\
$(INSTALL) -c -d $${dstroot}/$(MAN_DIR)/man1; \
$(INSTALL) -c -m 644 $(SRCROOT)/src/gdb/gdb.1 $${dstroot}/$(MAN_DIR)/man1/gdb.1; \
perl -pi -e 's,GDB_DOCUMENTATION_DIRECTORY,$(SYSTEM_DEVELOPER_TOOLS_DOC_DIR)/gdb,' $${dstroot}/$(MAN_DIR)/man1/gdb.1; \
\
$(INSTALL) -c -d $${dstroot}/usr/local/OpenSourceLicenses; \
$(INSTALL) -c -d $${dstroot}/usr/local/OpenSourceVersions; \
$(INSTALL) -c -m 644 $(SRCROOT)/gdb.plist $${dstroot}/usr/local/OpenSourceVersions; \
$(INSTALL) -c -m 644 $(SRCROOT)/gdb.txt $${dstroot}/usr/local/OpenSourceLicenses; \
\
$(INSTALL) -c -d $${dstroot}/$(CONFIG_DIR); \
$(INSTALL) -c -m 644 $(SRCROOT)/gdb.conf $${dstroot}/$(CONFIG_DIR)/gdb.conf; \
\
$(INSTALL) -c -d $${dstroot}/$(CONF_DIR); \
for j in $(SRCROOT)/conf/*.gdb; do \
$(INSTALL) -c -m 644 $$j $${dstroot}/$(CONF_DIR)/; \
done; \
\
sed -e 's/version=.*/version=$(GDB_VERSION)-$(GDB_RC_VERSION)/' \
< $(SRCROOT)/gdb.sh > $${dstroot}/usr/bin/gdb; \
chmod 755 $${dstroot}/usr/bin/gdb; \
\
done;
install-gdb-macosx: install-gdb-macosx-common
set -e; for target in $(filter-out x86_64-apple-darwin, $(CANONICAL_ARCHS)); do \
lipo -create $(OBJROOT)/$${target}--$${target}/gdb/gdb \
-output $(SYMROOT)/$(LIBEXEC_GDB_DIR)/gdb-$${target}; \
dsymutil -o $(SYMROOT)/$(LIBEXEC_GDB_DIR)/gdb-$${target}.dSYM \
$(SYMROOT)/$(LIBEXEC_GDB_DIR)/gdb-$${target}; \
strip -S -o $(DSTROOT)/$(LIBEXEC_GDB_DIR)/gdb-$${target} \
$(SYMROOT)/$(LIBEXEC_GDB_DIR)/gdb-$${target}; \
cp $(DSTROOT)/$(LIBEXEC_GDB_DIR)/gdb-$${target} $(SYMROOT)/$(LIBEXEC_GDB_DIR)/gdb-$${target}; \
done
# When this target is invoked, NATIVE is the binary that we will be
# outputting and HOSTCOMBOS are the binaries that will be combined into
# that. For instance,
#
# HOSTCOMBOS == i386-apple-darwin--i386-apple-darwin x86_64-apple-darwin--x86_64-apple-darwin powerpc-apple-darwin--i386-apple-darwin
# NATIVE == i386-apple-darwin
# NATIVE i386 is a special case where we add the x86_64-apple-darwin
# variant manually.
install-gdb-fat: install-gdb-macosx-common
lipo -create $(patsubst %,$(OBJROOT)/%/gdb/gdb,$(HOSTCOMBOS)) \
-output $(SYMROOT)/$(LIBEXEC_GDB_DIR)/gdb-$(NATIVE)
dsym-and-strip-fat-gdbs:
set -e; for target in $(filter-out x86_64-apple-darwin, $(ARCHS_TO_INSTALL)); do \
dsymutil -o $(SYMROOT)/$(LIBEXEC_GDB_DIR)/gdb-$${target}.dSYM \
$(SYMROOT)/$(LIBEXEC_GDB_DIR)/gdb-$${target}; \
strip -S -o $(DSTROOT)/$(LIBEXEC_GDB_DIR)/gdb-$${target} \
$(SYMROOT)/$(LIBEXEC_GDB_DIR)/gdb-$${target}; \
cp $(DSTROOT)/$(LIBEXEC_GDB_DIR)/gdb-$${target} \
$(SYMROOT)/$(LIBEXEC_GDB_DIR)/gdb-$${target}; \
if echo $${target} | egrep '^[^-]*-apple-darwin' > /dev/null; then \
echo "stripping __objcInit"; \
echo "__objcInit" > /tmp/macosx-syms-to-remove; \
strip -R /tmp/macosx-syms-to-remove -X $(DSTROOT)/$(LIBEXEC_GDB_DIR)/gdb-$${target} || true; \
rm -f /tmp/macosx-syms-to-remove; \
fi; \
done
# At some point this should be some lipo & fat kind of thing. Only ARM for now...
install-gdbserver:
set -e; for dstroot in $(SYMROOT) $(DSTROOT); do \
$(INSTALL) -c -m 755 $(OBJROOT)/$(ARM_TARGET)--$(ARM_TARGET)/gdb/gdbserver/gdbserver $${dstroot}/usr/bin/gdbserver; \
done # FIXME: where is ARM_TARGET supposed to be set?
strip -S $(DSTROOT)/usr/bin/gdbserver
install-binutils-macosx:
set -e; for i in $(BINUTILS_BINARIES); do \
instname=`echo $${i} | sed -e 's/\\-new//'`; \
lipo -create $(patsubst %,$(OBJROOT)/%/binutils/$${i},$(NATIVE_TARGETS)) \
-output $(SYMROOT)/$(LIBEXEC_BINUTILS_DIR)/$${instname}; \
strip -S -o $(DSTROOT)/$(LIBEXEC_BINUTILS_DIR)/$${instname} $(SYMROOT)/$(LIBEXEC_BINUTILS_DIR)/$${instname}; \
done
# "procmod" was a new group (2005-09-27) which was not initially present on
# all the systems, so we use a '-' prefix on that loop for now so that the
# errors do NOT halt the build.
install-chmod-macosx:
set -e; if [ `whoami` = 'root' ]; then \
for dstroot in $(SYMROOT) $(DSTROOT); do \
chown -R root:wheel $${dstroot}; \
chmod -R u=rwX,g=rX,o=rX $${dstroot}; \
chmod a+x $${dstroot}/$(LIBEXEC_GDB_DIR)/*; \
chmod a+x $${dstroot}/$(DEVEXEC_DIR)/*; \
done; \
fi
-set -e; if [ `whoami` = 'root' ]; then \
for dstroot in $(SYMROOT) $(DSTROOT); do \
chgrp procmod $${dstroot}/$(LIBEXEC_GDB_DIR)/gdb* && chmod g+s $${dstroot}/$(LIBEXEC_GDB_DIR)/gdb*; \
chgrp procmod $${dstroot}/$(LIBEXEC_GDB_DIR)/plugins/MacsBug/MacsBug_plugin && chmod g+s $${dstroot}/$(LIBEXEC_GDB_DIR)/plugins/MacsBug/MacsBug_plugin; \
done; \
fi
install-chmod-macosx-noprocmod:
set -e; for dstroot in $(SYMROOT) $(DSTROOT); do \
chown -R root:wheel $${dstroot}; \
chmod -R u=rwX,g=rX,o=rX $${dstroot}; \
chmod a+x $${dstroot}/$(LIBEXEC_GDB_DIR)/*; \
chmod a+x $${dstroot}/$(DEVEXEC_DIR)/*; \
chmod 755 $${dstroot}/$(LIBEXEC_GDB_DIR)/gdb-*-apple-darwin; \
done
install-source:
$(INSTALL) -c -d $(DSTROOT)/$(SOURCE_DIR)
$(TAR) --exclude=CVS --exclude=.git --exclude=.svn -C $(SRCROOT) -cf - . | $(TAR) -C $(DSTROOT)/$(SOURCE_DIR) -xf -
all: build
if test -e src/Makefile; then unset CPP && $(MAKE) -C src; fi
mostlyclean:
if test -e src/Makefile; then \
unset CPP && $(MAKE) -i -C src mostlyclean; fi
if test -e libcheckpoint/Makefile; then \
$(MAKE) -C libcheckpoint mostlyclean; fi
if test -e macsbug/Makefile; then \
$(MAKE) -C macsbug mostlyclean; fi
clean: mostlyclean
if test -e src/Makefile; then \
unset CPP && $(MAKE) -i -C src clean; fi
if test -e libcheckpoint/Makefile; then \
$(MAKE) -C libcheckpoint clean; fi
if test -e macsbug/Makefile; then \
$(MAKE) -C macsbug clean; fi
$(RM) -r $(OBJROOT)
$(RM) -v *~ stamp-* build-aux/*~
$(RM) -v .DS_Store autoscan.log hs_err_pid*.log
$(RM) -r autom4te.cache || rmdir autom4te.cache
distclean: clean
if test -e src/Makefile; then \
unset CPP && $(MAKE) -i -C src distclean; fi
if test -e libcheckpoint/Makefile; then \
$(MAKE) -C libcheckpoint distclean; fi
if test -e macsbug/Makefile; then \
$(MAKE) -C macsbug distclean; fi
$(RM) -v config.status config.log config.h hs_err*.log
-if test -d .git && test -w .git; then $(RM) .git/COMMIT_EDITMSG~; fi
maintainer-clean: distclean
if test -e src/Makefile && test -r src/Makefile; then \
unset CPP && $(MAKE) -i -C src maintainer-clean; fi
if test -e libcheckpoint/Makefile; then \
$(MAKE) -i -C libcheckpoint maintainer-clean; fi
$(RM) -v configure config.h.* hs*.log aclocal.m4
.PHONY: mostlyclean distclean maintainer-clean
clean-gdb:
if test -r src/Makefile && test -r src/gdb/Makefile; then \
unset CPP && $(MAKE) -i -C src clean-gdb; fi
echo "may need to perform further cleaning of gdb..."
.PHONY: clean-gdb
check-args:
ifneq (,$(filter-out i386-apple-darwin, $(filter-out powerpc-apple-darwin, $(filter-out x86_64-apple-darwin, $(filter-out arm-apple-darwin, $(CANONICAL_ARCHS))))))
echo "Unknown architecture string: \"$(CANONICAL_ARCHS)\""
exit 1
endif
.PHONY: check-args
configure-headers:
ifneq ($(NATIVE_TARGETS),)
$(SUBMAKE) $(patsubst %,$(OBJROOT)/%/stamp-rc-configure, $(NATIVE_TARGETS))
endif
configure:
ifneq ($(NATIVE_TARGETS),)
$(SUBMAKE) $(patsubst %,$(OBJROOT)/%/stamp-rc-configure, $(NATIVE_TARGETS))
endif
ifneq ($(CROSS_TARGETS),)
$(SUBMAKE) $(patsubst %,$(OBJROOT)/%/stamp-rc-configure-cross, $(CROSS_TARGETS))
endif
if test ! -e configure; then \
if test -e configure.sh; then \
cp -v configure.sh configure; \
elif test -d .git && test -x "`which git`"; then \
if test -n "`git status -s configure | grep D`"; then \
echo "configure appears to have been deleted; attempting to restore it..."; \
git restore configure; \
fi; \
else \
for mysubdir in $(SRCROOT) $(OBJROOT) $(SYMROOT) $(DSTROOT) $(SRCTOP) $(OBJTOP) $(SYMTOP) $(DSTTOP); do \
if test -d $${mysubdir} && test -e $${mysubdir}/configure; then \
echo "attempting to restore configure by copying from $${mysubdir}..."; \
cp -v $${mysubdir}/configure configure; break; \
fi; \
done; \
if test ! -e configure; then \
echo "unsure how to restore configure, so just touching it"; \
touch configure; \
fi; \
if test ! -x configure; then \
echo "...and making sure it is executable"; \
chmod +x configure; \
fi; \
fi; \
else \
which stat && stat configure; \
fi
build-headers: configure
$(SUBMAKE) configure-headers
ifneq ($(NATIVE_TARGETS),)
$(SUBMAKE) $(patsubst %,$(OBJROOT)/%/stamp-build-headers, $(NATIVE_TARGETS))
endif
# This CROSS_TARGETS thing had previously been commented out:
ifneq ($(CROSS_TARGETS),)
$(SUBMAKE) $(patsubst %,$(OBJROOT)/%/stamp-build-headers, $(CROSS_TARGETS))
endif