-
Notifications
You must be signed in to change notification settings - Fork 9
/
GNUmakefile.master
1764 lines (1439 loc) · 49.2 KB
/
GNUmakefile.master
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
# $Id: GNUmakefile.master,v 1.165 1995/01/03 22:24:25 peabody Exp $
# GNUmakefile.master for all of Portfolio
#
# Copyright (c) 1992, 1993, The 3DO Company, Inc.
# All rights reserved.
# This document is proprietary and confidential
#
# This file contains the standard build targets and variable values
# for building ARM objects, link libraries, folios and other ARM
# executables, and copying the above (and more) into the proper
# location in the release directory.
#
# It should be included at the bottom of the local GNUmakefile for
# each package that uses standard rules and variables.
#
# ========================================================================
# Object Classes
#
# boot: bootable-cd/rom-over-cd modules
#
# fs cacheing on
# external misc code
# optical link not supported
# debugger not supported
# /remote not supported
#
# object files: *.bo
# executables: *.boot
#
# dev: development station modules
#
# fs cacheing on
# external misc code
# optical link supported
# debugger supported
# /remote supported
#
# object files: *.do
# executables: *.dev
#
# rom: rom execution modules
#
# fs cacheing off
# misc code linked in
# optical link not supported
# debugger not supported
# /remote not supported
#
# object files: *.ro
# executables: *.rom
#
# ========================================================================
# Default build target
#
# It is possible that no target has been defined before including this
# file. If so, then we normally build the "all" target.
#
masterdefault: all
# Some special flags are used to avoid rerunning of certain bulk
# command lists. These targets are listed here.
fakes= .tree.here .tree.std .mark.here .pop.here .includes
# Some targets should get built even if someone touches the
# file of that name.
.PHONY: all devs install devinstall \
pop libs devlibs therest moredevs \
installincludes installlibs installtherest \
installdevlibs installmoredevs
# Progress Monitoring
#
ifndef SAYCMD
SAYCMD= echo
endif
ifndef SAYPRG
SAYPRG= echo
endif
export SAYCMD SAYPRG
# If MARK_REL is set, everything at the top of the RCS tree will
# be labelled with it. Do this only once, from the command line,
# when doing the initial build for a release.
# MARK_REL=
export MARK_REL
# If BUILD_REL is set, all RCS CO operations will get the
# version marked with the specified release. If it is
# not set, "most recent" versions of files will be used.
# It should be set to the value used in MARK_REL during a release
# build.
ifndef BUILD_REL
ifdef MARK_REL
BUILD_REL= ${MARK_REL}
endif
endif
export BUILD_REL
# RELEASE is the name of the release in progress. It should be
# advanced by editing this master file after each release has been
# delivered; thus, between releases, it should be the name of the next
# release to be built.
ifndef RELEASE
ifdef BUILD_REL
RELEASE= ${BUILD_REL}
else
RELEASE= under_construction
endif
endif
export RELEASE
# MARKFLAG controls how names are applied to releases. Normally we
# just use "-n" so as to not override preexisting labels, but this can
# be changed by specifying MARKFLAG in the environment or on the
# command line.
ifndef MARKFLAG
MARKFLAG= -n
endif
# Sometimes we want to check out one release, and mark it with a
# different name. Do this by specifying the old name in BUILD_REL and
# the new name in MARK_REL.
ifdef BUILD_REL
ifdef MARK_REL
ifneq (${BUILD_REL},${MARK_REL})
PARENT_REL=${BUILD_REL}
endif
endif
endif
ifdef MARK_REL
SETMARK= rcs ${MARKFLAG}${MARK_REL}':'${PARENT_REL}
endif
# RELEASEDIR is the top of the build tree under which constructed
# objects will be placed. This can and should be set to the absolute
# path name of the top of the build tree for a full build. It should
# only be set to the group-wide tree if you *know* what you are going
# to be tossing up to the main tree is OK for other engineers to be
# using internally.
# The fanciness with ".top" is just a set of symlinks that always get
# us to the top of our build tree for complete builds, or to the top of
# the reference release tree (usually /opera/under_construction) for
# single-package builds.
RELEASEDIR= .top
# It is often useful to know the real pathname of the directory in
# which we are currently building. Use ${HERE}.
HERE= `/bin/pwd`
# Some modules that get built into the system are prebuilt and just
# need to be copied from a central location, ARCHIVEDIR.
ARCHIVEDIR= /opera/archive
# Changes to support the PowerPC - kevinh
#
# We add a number of new build flags, but we want to keep this build
# working on ARM. Therefore we provide rational defaults...
#
# New build options
#
# CPU_ARM - for ARM
# CPU_POWERPC - for PPC
# CPU_POWERPC32 - 32 bit PPC family (601, 603, 602, 604)
# CPU_POWERPC64 - 64 bit PPC family (620)
# CPU_POWERPC602 - The 602
# ASIC_OPERA - for Opera
# ASIC_ANVIL - for Anvil
# ASIC_BULLDOG - for Bulldog
# SYSTEM_CART - Cartridge build
# SYSTEM_CD - CD build
# We try to be smart about recognizing the RS/6000, because we know it only
# builds bulldog binaries.
ifeq ($(shell uname -s), AIX)
BULLDOG_TEAM=1
endif
ifdef BULLDOG_TEAM
CPU_POWERPC = -DCPU_POWERPC
CPU_POWERPC32 = -DCPU_POWERPC32
ASIC_OPERA = -DASIC_OPERA # We use pup
SYSTEM_CD = -DSYSTEM_CD
else
CPU_ARM = -DCPU_ARM
SYSTEM_CD = -DSYSTEM_CD
ASIC_ANVIL = -DASIC_ANVIL # Turn on ANVIL support by default
endif
# Many utilities used in the build process may be renamed or replaced
# or moved to another location; by keeping their names here instead of
# in the rules, it makes fixing us up easier.
# Normally, use the new compiler.
# To use the old compiler, switch
# ARMCOMPBIN to /usr/local/armbin and
# change ARMCC to $(ARMCOMPBIN)/ncc
ifndef ARMCOMPBIN
ARMCOMPBIN= /opera/arm1.61
endif
ifndef ARMCC
ARMCC= $(ARMCOMPBIN)/armcc
endif
ifndef ARMAS
ARMAS= $(ARMCOMPBIN)/armasm
endif
ifndef ARMAR
ARMAR= $(ARMCOMPBIN)/armlib
endif
ifndef ARMLD
ARMLD= $(ARMCOMPBIN)/armlink
endif
export ARMCC ARMAS ARMAR ARMLD
ifdef CPU_POWERPC
CC= fakecc
AS= fakecc
AR= ar
LD= ld
else
CC= ${ARMCC}
AS= ${ARMAS}
AR= ${ARMAR}
LD= ${ARMLD}
endif
# Misc. Arm development utilities are still
# to be found in armbin, everywhere.
# NOTE: the compilers in /usr/local/armbin
# are not the most up-to-date.
ARMBIN= /usr/local/armbin
ifndef MAKEPRIV
MAKEPRIV= $(ARMBIN)/rsapriv.940602
endif
ifndef STRIP
STRIP= $(ARMBIN)/stripaif
endif
ifndef P2COMP
P2COMP= $(ARMBIN)/p2comp
endif
ifndef BUMPREV
BUMPREV= $(ARMBIN)/BumpRev
endif
LOCALBIN= /usr/local/bin
ifndef MODBIN
ifdef CPU_POWERPC
MODBIN= fixup3do
else
MODBIN= $(LOCALBIN)/modbin
endif
endif
ADX= ${LOCALBIN}/adx
RCSUPDATE= ${LOCALBIN}/rcsupdate
RCSCHECK= ${LOCALBIN}/rcscheck
# We even use macros for system utilities, because we might
# want to add some flags.
#MD= /bin/mkdir -p
MD= /usr/local/bin/mkmacdir
RM= /bin/rm -f
CP= /bin/cp
MV= /bin/mv
LN= /bin/ln -s
SLN= /bin/ln -s
HLN= /bin/ln
export MD RM CP MV LN
# The CO macro is used for checking things out; note the use of the
# BUILD_REL variable here to force checkout a named revision if one
# has been specified.
COV= co -r${BUILD_REL} ${CO_OPTS}
CO= co -q -r${BUILD_REL} ${CO_OPTS}
# This set of files assumes a more recent GNUMake than is available
# currently in /usr/local. Also, we expand PAR into a paralell job
# specifier for faster builds (when using local disk). Thus, when you
# start at the top and say "gnumake PAR=4", the subdirectories are
# built using a parallel build (in this case, four jobs wide).
MAKE= gmake ${PAR:%=-j %}
# ========================================================================
# The NOTHING macro is useful when you want to override a default
# to be absolutely nothing. "FOO =" will not do it, as that really
# makes the macro undefined. use "FOO= $(NOTHING)" and the defaults
# will not be used.
NOTHING=
# ========================================================================
# Constructing CFLAGS
# Hardware Options
HWOPTS = $(ASIC_ANVIL) $(ASIC_OPERA) $(ASIC_BULLDOG) \
$(CPU_ARM) $(CPU_POWERPC) $(CPU_POWERPC32) $(CPU_POWERPC64) \
$(CPU_POWERPC602) $(SYSTEM_CD) $(SYSTEM_CART)
# ARM C Compiler Option Summary
# Think about PowerPC when you use these options... ;-)
# -M produce makefile dependencies
# -W supress all warnings
# -Wa disable "use of = in a condition context"
# -Wd disable "deprecated declaration foo() - give arg types"
# -Wf disable "inventing extern int foo()"
# -Wn disable "implicit narrowing cast"
# -Wv disable "implicit return in non-void context"
# -bi compile for big-endian hardware
# -fa check for data flow anomalies
# -fc enable "limited pcc" support
# -fe check that externs are unique in first six case-insensitive chars
# -ff do not embed function names in code area
# -fh check that externs are declared for use, and that all scoped statics are used.
# -fi intersperse '#include "file"' in listing files as appropriate
# -fj intersperse '#include <file>' in listing files as appropriate
# -fk use K&R search rules for include files
# -fm report preprocessor symbols defined but not used
# -fp report explicit casts of integers into pointers
# -fu listing text is before preprocessor, not after
# -fv report all unused declarations, including those from headers
# -fw allow string literals to be writable.
# -fx turn on extra warnings (short ints and enums)
# -g produce debug information
# -gf produce debug information for functions and global variables
# -gl produce debug information for each source line
# -gv produce debug information for all variables
# -wp do not warn about non-ANSI files in #include <foofile.h>
#
# -za1 no unaligned word load/stores
# -zo put each function in its own link area
#
# pragma stuff: mostly 0=no and 1=yes:
# -zpa# warn implicit fn decls (default=1)
# -zpc# check_memory_accesses (default=0)
# -zpd# warn_deprecated (default=1)
# -zpe# continue_after_hash_error (default=0)
# -zpi# include_only_once (default=0)
# -zpj# optimize_crossjump (default=1)
# -zpm# optimize_multiple_loads (default=1)
# -zpp# profile (default=0; 2=statements)
# -zps# check_stack (check=0, nocheck=1; default=1)
# -zpt# force_top_level (default=0)
# -zpv# check_formats (default=0, printf=1, scanf=2)
# -zpy# side_effects (yes=0, no=1; default=1)
# -zpz# optimize_cse (default=1)
ARMCFLAGS = -bi -fa -za1 -wp
PPCCFLAGS = -qcpluscmt
ifdef CPU_POWERPC
CFLAGS= ${CDEFS} ${CCDEBUG} ${CCOPTIMIZE} \
$(PPCCFLAGS) \
$(INCLUDES:%=-I%) \
${HWOPTS}
else
CFLAGS= ${CDEFS} ${CCDEBUG} ${CCOPTIMIZE} \
$(ARMCFLAGS) \
${FF} ${ZPS} ${APCS} ${WA} ${ZO} \
$(INCLUDES:%=-J%) \
${HWOPTS}
endif
CFLAGSB= ${CBDEFS} ${CFLAGS} -DBOOTABLECD -DRUNTIME -DPRODUCTION
CFLAGSD= ${CDDEFS} ${CFLAGS} -DDEVELOPMENT
CFLAGSR= ${CRDEFS} ${CFLAGS} -DROMBUILD -DRUNTIME -DPRODUCTION
# CDEFS is the list of additional options that will be used in the
# local directory when building; the default is nothing. Use this for
# things like "-DARMC", "-DDEBUG=1", and so on, which you want to use
# on both the development and runtime versions of your executables.
#
# ifndef CDEFS
# CDEFS=
# endif
# CBDEFS is just like CDEFS but it is added when the bootable-cd
# versions of objects are being created. NOTE: The -DBOOTABLECD
# flag is forced on the CFLAGSB line (as are -DRUNTIME and
# -DPRODUCTION for now, but these symbols are deprecated in favor of
# using "not DEVELOPMENT").
# ifndef CBDEFS
# CBDEFS=
# endif
# CDDEFS is just like CDEFS but it is added when the development
# versions of objects are being created. NOTE: The -DDEVELOPMENT
# flag is forced on the CFLAGSD line.
# ifndef CDDEFS
# CDDEFS=
# endif
# CRDEFS is just like CDEFS but it is added when the runtime versions
# of objects are being created. Note: -DROMBUILD is forced on the
# CFLAGSR line (as are -DRUNTIME and -DPRODUCTION for now, but these
# symbols are deprecated in favor of using "not DEVELOPMENT").
# ifndef CRDEFS
# CRDEFS=
# endif
ifndef CCOPTIMIZE
ifndef CPU_POWERPC
CCOPTIMIZE= -Otime
else
CCOPTIMIZE= -O
endif
endif
ifndef FF
FF= -ff
endif
ifndef ZPS
ZPS= -zps0
endif
# ZO is used to turn on the "-zo" flag, which makes each function into
# its own link area. This is usually turned off, but should probably
# be turned on for link libraries (it may save space elsewhere).
# XXX- is there an analog in PowerPC land for this? If not, shouldn't
# we simply make sure that our libraries are broken up into separate
# files anyway?
# ifndef ZO
# ZO=
# endif
# INCLUDES controls where we get our included files from; note that
# we grab ${INCS_TARG} as well. See below.
# If the local GNUmakefile sets up LOCAL_INCLUDES, it is a list
# of directories to be searched after the current directory and
# the "./includes" directory.
INCLUDES= . includes ${LOCAL_INCLUDES} ${INCS_TARG}
# ========================================================================
# Constructing SFLAGS
ifdef CPU_ARM
#
# ARM assembler
#
SFLAGS= -bigend -Apcs 3/32bit${SWST} ${NOWARN} $(INCLUDES:%=-I%)
SBSTD= -PD "BOOTABLECD SETA 1" -PD "DEVELOPMENT SETA 0" -PD "ROMBUILD SETA 0"
SDSTD= -PD "BOOTABLECD SETA 0" -PD "DEVELOPMENT SETA 1" -PD "ROMBUILD SETA 0"
SRSTD= -PD "BOOTABLECD SETA 0" -PD "DEVELOPMENT SETA 0" -PD "ROMBUILD SETA 1"
else
#
# PowerPC assembler
#
SFLAGS= -c
SBSTD= -DBOOTABLECD=1 -DDEVELOPMENT=0 -DROMBUILD=0
SDSTD= -DBOOTABLECD=0 -DDEVELOPMENT=1 -DROMBUILD=0
SRSTD= -DBOOTABLECD=0 -DDEVELOPMENT=0 -DROMBUILD=1
endif
SFLAGSB= ${SFLAGS} ${SBDEFS} ${SBSTD}
SFLAGSD= ${SFLAGS} ${SDDEFS} ${SDSTD}
SFLAGSR= ${SFLAGS} ${SRDEFS} ${SRSTD}
# Most assemblies use /SWST; disable this with
# "SWST= ${NOTHING}".
ifndef SWST
SWST= /SWST
endif
# Most assemblies use -NOW; disable this with
# "NOWARN= ${NOTHING}".
ifndef NOWARN
NOWARN= -NOW
endif
# ========================================================================
# Constructing LFLAGS
ifdef CPU_ARM
LFLAGS= ${LDDEBUG} ${LTYPE} ${MAP} -B ${BASEADDR} ${RELOC}
endif
# Nearly every link produces AIF, but you can override this
# using "target_LTYPE= -BIN".
LTYPE= ${firstword ${$@_LTYPE} -AIF}
# Most links link at address 0x0;
# override this for any target using "target_BASE= 0xVALUE".
BASEADDR= ${firstword ${$@_BASE} 0x0}
# Most links use "-map" but this can be changed.
# To use -MAP, use "MAP= -MAP"
# to turn it off, use "MAP= ${NOTHING}"
ifndef MAP
MAP= -map
endif
# Most links use "-R"
# to turn it off, use "RELOC= ${NOTHING}"
ifndef RELOC
RELOC= -R
endif
# ========================================================================
# Installation Target Directories
# default example class
ifndef EXAMPLE_CLASS
EXAMPLE_CLASS= misc
endif
EXAMPLE_TARG= ${RELEASEDIR}/examples/${EXAMPLE_CLASS}
EXAMPLE_XTARG= ${RELEASEDIR}/examples/${EXAMPLE_CLASS}${EXAMPLE_XDIR:%=/%}
INCS_TARG= ${RELEASEDIR}/includes
TEST_TARG= ${RELEASEDIR}/testprograms
UTIL_TARG= ${RELEASEDIR}/utils
HDW_BTARG= ${RELEASEDIR}/bootablecd/hardware
HDW_DTARG= ${RELEASEDIR}/developer/hardware
HDW_RTARG= ${RELEASEDIR}/runtime/hardware
LIBS_BTARG= ${RELEASEDIR}/bootablecd/libs
LIBS_DTARG= ${RELEASEDIR}/developer/libs
LIBS_RTARG= ${RELEASEDIR}/runtime/libs
PGMS_BTARG= ${RELEASEDIR}/bootablecd/programs
PGMS_DTARG= ${RELEASEDIR}/developer/programs
PGMS_RTARG= ${RELEASEDIR}/runtime/programs
# ========================================================================
# STARTUPCODE defaults to cstartup.o. This can be overriden, usually to
# threadstartup.o for executables that are to be started as a thread.
#
# You can use "target.dev_STARTUPCODE" and "target_STARTUPCODE"; this
# rule choses the first word it sees.
#
ifndef STARTUPCODE
STARTUPCODE= ${firstword ${$@_STARTUPCODE} ${${basename $@}_STARTUPCODE} cstartup.o}
endif
# LIBCRT0 is the list of files we tack onto the beginning of the link
# that we get from the proper library directory.
LIBCRT0= ${STARTUPCODE} copyright.o
# Local .s files can be specified in LCRT0_SSRC, and their objects
# will be placed first on the link line.
LBCRT0= ${LCRT0_SSRC:%.s=%.bo}
LDCRT0= ${LCRT0_SSRC:%.s=%.do}
LRCRT0= ${LCRT0_SSRC:%.s=%.ro}
BCRT0= ${LBCRT0} ${LIBCRT0:%=${RELEASEDIR}/bootablecd/libs/%}
DCRT0= ${LDCRT0} ${LIBCRT0:%=${RELEASEDIR}/developer/libs/%}
RCRT0= ${LRCRT0} ${LIBCRT0:%=${RELEASEDIR}/runtime/libs/%}
# ${target_LIBS} specifies libraries on a per-target basis that are to
# be linked at the end of the link line.
# LINK_LIBS specifies libraries that are to be searched for all link
# targets (after the per-target librarires).
DOLINK_BLIBS= ${$@_LIBS:%.lib=${LIBS_BTARG}/%.lib} \
${LINK_BLIBS:%.lib=${LIBS_BTARG}/%.lib} \
${LINK_LIBS:%.lib=${LIBS_BTARG}/%.lib}
DOLINK_DLIBS= ${$@_LIBS:%.lib=${LIBS_DTARG}/%.lib} \
${LINK_DLIBS:%.lib=${LIBS_DTARG}/%.lib} \
${LINK_LIBS:%.lib=${LIBS_DTARG}/%.lib}
DOLINK_RLIBS= ${$@_LIBS:%.lib=${LIBS_RTARG}/%.lib} \
${LINK_RLIBS:%.lib=${LIBS_RTARG}/%.lib} \
${LINK_LIBS:%.lib=${LIBS_RTARG}/%.lib}
DOLINK_ALIBS= ${$@_LIBS:%.lib=${LIBS_DTARG}/%.lib} \
${ARMBIN_LINK_LIBS:%.lib=${LIBS_DTARG}/%.lib} \
${LINK_DLIBS:%.lib=${LIBS_DTARG}/%.lib} \
${LINK_LIBS:%.lib=${LIBS_DTARG}/%.lib}
# The user supplies RCSFILES for the list of files under RCS so we can
# manipulate them (version marking, checkout, cleanup, printing, &c.)
# We toss some of the files, where we know the names, in for free.
REVRCS := ${wildcard RCS/*.rev,v}
REVFILES= ${REVRCS:RCS/%.rev,v=%.rev}
RCSMORE= ${INCS_HERE} \
${INCS_DOWN:%=includes/%} \
${LOCAL_INCS} \
${LIB_DATE:%=%.c} \
${OTHERFILES} \
${DOCS} \
${DEPFILE} \
${REVFILES}
RCSSORT= ${sort ${RCSFILES} ${RCSMORE}}
HFILES= ${filter %.h, ${RCSSORT}}
CFILES= ${filter %.c, ${RCSSORT}}
SFILES= ${filter %.s, ${RCSSORT}}
AFILES= ${filter %.a, ${RCSSORT}}
IFILES= ${filter %.i, ${RCSSORT}}
XFILES= ${filter-out %.h %.c %.s %.a %.i, ${RCSSORT}}
ALLPROGS= ${HDW} ${PGMS} \
${LOCALS} ${DLOCALS} ${RLOCALS} \
${EXAMPLES} ${TESTS} ${UTILS} \
${BHDW} ${DHDW} ${RHDW} \
${BPGMS} ${DPGMS} ${RPGMS}
NOROMS= ${filter-out %.rom, ${ALLPROGS}}
DEVEXEC= ${filter %.dev, ${ALLPROGS}}
ROMEXEC= ${filter %.rom, ${ALLPROGS}}
ARMEXEC= ${filter %.arm, ${ALLPROGS}}
TODEP= ${AUTODEPEND} ${EXAMPLES} \
${DEVEXEC} ${ROMEXEC} ${ARMEXEC} \
${LIBS} ${BLIBS} ${DLIBS} ${RLIBS} \
${EXAMPLE_LIBS} ${EXAMPLE_DLIBS}
DEPSORT= ${sort ${TODEP:%=.dep.%}}
# Most installations are done by removing the target, then copying the
# source to the target. If you want to change this, change it here.
copyit= ${RM} $@; ${CP} $< $@
# Some installations are done by removing the target, then hard-
# linking the source to the target. If you want to change this,
# change it here. NOTE: ".top" may resolve to some place on another
# file system, where a hardlink is not possible. If the link can not
# be created, just copy the file.
linkit= ${RM} $@; ${HLN} $< $@ || ${CP} $< $@
ifneq (0, ${words ${LIB_DATE}})
# If we have a datefile, ${ccdateD} and ${ccdateR} expand to the rules
# to check out and compile this file.
STDLIB_DATEFLAGS=-DWHATSTRING="\"`.top/scripts/genwhat.sh ${basename $@} $@ $(RELEASE)`\"" \
-DNOW="\"`date`\"" \
-DOPERAVERSION="\"$(RELEASE)\""
ccldate= [ -f ${LIB_DATE}.c ] || co -q -r ${LIB_DATE}.c; \
${CC} ${STDLIB_DATEFLAGS} ${LIB_DATEFLAGS} ${CFLAGS} -c -o ${LIB_DATE}[email protected] ${LIB_DATE}.c;
rmldate= ; ${RM} ${LIB_DATE}[email protected]
${LIB_DATE}.c:: ; [ -f ${LIB_DATE}.c ] || co -q -r ${LIB_DATE}.c
endif
# The standard rule for building a link library is ${linklib}; note
# that the list of objects must be in ${target_OBJS}.
ifdef CPU_POWERPC
ARBITS= rc $@
else
ARBITS= -c -o $@
endif
linklib= ${ccldate} \
$(AR) $(ARBITS) ${LIB_DATE:%=%[email protected]} ${$@_OBJS} \
${rmldate}
ifneq (0, ${words ${DATE}})
# If we have a datefile, ${ccdateD} and ${ccdateR} expand to the rules
# to check out and compile this file.
STDDATEFLAGS= -DWHATSTRING="\"`.top/scripts/genwhat.sh ${basename $@} $@ $(RELEASE)`\"" \
-DNOW="\"`date`\"" \
-DOPERAVERSION="\"$(RELEASE)\""
ccdate= ${CC} ${STDDATEFLAGS} ${DATEFLAGS} ${CFLAGS} -c -o ${DATE}[email protected] .top/${DATE}.c;
rmdate= ; ${RM} ${DATE}[email protected]
.top/${DATE}.c:
(cd .top; co -q -r ${DATE}.c)
endif
ifndef MBTIME
MBTIME= -time now
endif
ifndef MBNAME
MBNAME= -name ${firstword ${$@_MODNAME} ${${basename $@}_MODNAME} ${basename $@}}
endif
ifndef automodbin
automodbin= ; ${MODBIN} $@ ${MBTIME} ${MBNAME} ${MBFLAGS} ${MBDEBUG} ${${basename $@}_MODBIN} ${$@_MODBIN} || exit 1
endif
modbin= -@echo '*** $$''{modbin} can be removed from rule for $@ in '"`pwd`"
# ${linkboot} links the current target using:
# ${target_OBJS} list of objects
# ${target_LIBS} per-target library files
# ${LINK_LIBS} global library files
ifndef CPU_ARM
linkboot= ${ccdate} \
${RM} $@; \
${LD} ${LFLAGS} -o $@ ${BCRT0} \
${$@_OBJS} ${DATE:%=%[email protected]} ${DOLINK_BLIBS} || \
exit 1 \
${rmdate}
else
linkboot= ${ccdate} \
${RM} $@; \
${LD} ${LFLAGS} -S [email protected] -o $@ ${BCRT0} \
${$@_OBJS} ${DATE:%=%[email protected]} ${DOLINK_BLIBS} | tee [email protected] || \
exit 1 \
${automodbin} \
${rmdate}
endif
# ${linkdev} links the current target using:
# ${target_OBJS} list of objects
# ${target_LIBS} per-target library files
# ${LINK_LIBS} global library files
ifndef CPU_ARM
linkdev= ${ccdate} \
${RM} $@; \
${LD} ${LFLAGS} -o $@ ${DCRT0} \
${$@_OBJS} ${DATE:%=%[email protected]} ${DOLINK_DLIBS} || \
exit 1 \
${rmdate}
else
linkdev= ${ccdate} \
${RM} $@; \
${LD} ${LFLAGS} -S [email protected] -o $@ ${DCRT0} \
${$@_OBJS} ${DATE:%=%[email protected]} ${DOLINK_DLIBS} | tee [email protected] || \
exit 1 \
${automodbin} \
${rmdate}
endif
# ${linkrom} is just like ${linkdev} but the runtime objects and
# libraries are used instead of the development versions.
ifndef CPU_ARM
linkrom= ${ccdate} \
${RM} $@; \
${LD} ${LFLAGS} -o $@ ${RCRT0} \
${$@_OBJS} ${DATE:%=%[email protected]} ${DOLINK_RLIBS} || \
exit 1 \
${rmdate}
else
linkrom= ${ccdate} \
${RM} $@; \
${LD} ${LFLAGS} -S [email protected] -o $@ ${RCRT0} \
${$@_OBJS} ${DATE:%=%[email protected]} ${DOLINK_RLIBS} | tee [email protected] || \
exit 1 \
${automodbin} \
${rmdate}
endif
# this is useful when the objects are on the dependency
# line, and there is no ${whatever_OBJS} variable.
ifndef CPU_ARM
linkprog= ${ccdate} \
${RM} $@; \
${LD} ${LFLAGS} -o $@ ${DCRT0} \
$*.o ${DATE:%=%[email protected]} ${DOLINK_ALIBS} || \
exit 1 \
${rmdate}
else
linkprog= ${ccdate} \
${RM} $@; \
${LD} ${LFLAGS} -S $*.sym -o $@ ${DCRT0} \
$*.o ${DATE:%=%[email protected]} ${DOLINK_ALIBS} | tee $*.map || \
exit 1 \
${automodbin} \
${rmdate}
endif
# Include the ${compress} rule if you want to make the program into a
# self-expanding compressed binary.
ifdef NO_COMPRESSION
compress= true
else
compress= ${RM} [email protected]; ${MV} $@ [email protected]; ${P2COMP} [email protected] $@; ${RM} [email protected]
endif
# Include ${stripaif} if you want to strip the AIF.
stripaif= ${RM} [email protected]; ${MV} $@ [email protected]; ${STRIP} [email protected] -o $@ -s [email protected]; ${RM} [email protected]
# Include ${setrev} if you have a "target.rev" file; this rule will
# get it from RCS, and use modbin to set the version and revision of
# the file.
setrev= ${CO} ${basename $@}.rev; \
${MODBIN} $@ \
-version `head -1 ${basename $@}.rev` \
-revision `tail -1 ${basename $@}.rev`
# Include ${setpriv} if the executable is to run in privileged mode.
# Include ${signit} if the executable merely has an RSA signature appended.
# ========================================================================
INCS_FROM_DOWN= ${INCS_DOWN:%=${INCS_TARG}/%}
INCS_FROM_HERE= ${INCS_HERE:%=${INCS_TARG}/%}
# ========================================================================
# We must disable some built-in rules.
% : %.c
%.s : %.c
# RCS File Management
# -- We do not want to blindly update our local files
# when the RCS files change!
# If you want to see the RCS diffs when a file is made obsolete by a
# change checked into RCS, use this flag to gmake:
# gmake RCSCHECK_SHOW_DIFFS=true ...
#
# or, to make this semipermanent from your shell,
# setenv RCSCHECK_SHOW_DIFFS true (csh, tcsh)
# export RCSCHECK_SHOW_DIFFS=true (ksh, bash?)
ifndef RCSCHECK_SHOW_DIFFS
RCSCHECK_SHOW_DIFFS= false
endif
# To automatically update your files from RCS when RCS is
# updated by someone else, use this flag to gmake:
# gmake RCSCHECK_AUTO_UPDATE=true ...
#
# or, to make this semipermanent from your shell,
# setenv RCSCHECK_AUTO_UPDATE true (csh, tcsh)
# export RCSCHECK_AUTO_UPDATE=true (ksh, bash?)
ifndef RCSCHECK_AUTO_UPDATE
RCSCHECK_AUTO_UPDATE= false
endif
# To stop the build when an out-of-date file is found and is
# not updated, use this flag to gmake:
# gmake RCSCHECK_FAIL_STOPS=true ...
#
# or, to make this semipermanent from your shell,
# setenv RCSCHECK_FAIL_STOPS true (csh, tcsh)
# export RCSCHECK_FAIL_STOPS=true (ksh, bash?)
ifndef RCSCHECK_FAIL_STOPS
RCSCHECK_FAIL_STOPS= false
endif
# Some of the situations encountered in the RCS check are
# not normally particularly interesting; for instance, a
# file not existing, or a silent update. If you want to be
# notified about these, use this flag to gmake:
# gmake RCSCHECK_VERBOSE=true ...
#
# or, to make this semipermanent from your shell,
# setenv RCSCHECK_VERBOSE true (csh, tcsh)
# export RCSCHECK_VERBOSE=true (ksh, bash?)
ifndef RCSCHECK_VERBOSE
RCSCHECK_VERBOSE= false
endif
# To disable the RCS check completely, use this flag to gmake:
# gmake RCSCHECK_DISABLE=true ...
#
# or, to make this semipermanent from your shell,
# setenv RCSCHECK_DISABLE true (csh, tcsh)
# export RCSCHECK_DISABLE=true (ksh, bash?)
ifndef RCS_VECHO
RCS_VECHO= true
endif
ifndef RCSCHECK_DISABLE
% : RCS/%,v
@if [ ! -f $@ ] ; \
then if ${RCSCHECK_VERBOSE} ; \
then ${RCS_VECHO} "*** The file '$(HERE)/$@' does not exist," ; \
${RCS_VECHO} "||| Retrieving it from RCS." ; \
${RCS_VECHO} "||| It may be missing from your RCSFILES variable." ; \
${COV} $@ ; \
else ${CO} $@ ; \
fi ; \
else if [ x"`readlink $@`" = x"" ] ; \
then if [ -w $@ ] ; \
then if ${RCSCHECK_VERBOSE} ; \
then ${RCS_VECHO} "*** The RCS file for $(HERE)/$@ has been modified," ; \
${RCS_VECHO} "||| but your copy of it is writable." ; \
fi ; \
touch -f $@ ; \
else if rcsdiff -r${BUILD_REL} -c $@ >[email protected] 2>&1 ; \
then if ${RCSCHECK_VERBOSE} ; \
then ${RCS_VECHO} "*** The RCS file for $(HERE)/$@ was modified," ; \
${RCS_VECHO} "||| but no changes to $(HERE)/$@ are required." ; \
fi ; \
touch -f $@ ; \
else echo "*** Your copy of $(HERE)/$@ has been obsoleted." ; \
if ${RCSCHECK_SHOW_DIFFS} ; \
then echo "||| differences to $(HERE)/$@ follow:" ; \
sed 's/^/||| /' <[email protected] ; \
fi ; \
if ${RCSCHECK_AUTO_UPDATE} ; \
then echo "*** updating $(HERE)/$@ from RCS" ; \
${COV} $@ ; \
else if ${RCSCHECK_FAIL_STOPS} ; \
then exit 1 ; \
fi ; \
fi ; \
fi ; \
${RM} [email protected] ; \
fi ; \
fi ; \
fi
endif
# Now, for our new pattern rules ... first, to build (see comment below):
%.lst : %.c ; $(CC) $(CFLAGSD) -S $< -o $@
%.o : %.c ; $(CC) $(CFLAGS) -c $< -o $@
%.bo : %.c ; $(CC) $(CFLAGSB) -c $< -o $@
%.do : %.c ; $(CC) $(CFLAGSD) -c $< -o $@
%.ro : %.c ; $(CC) $(CFLAGSR) -c $< -o $@
%.o : %.s ; $(AS) $(SFLAGS) $< -o $@
%.bo : %.s ; $(AS) $(SFLAGSB) $< -o $@
%.do : %.s ; $(AS) $(SFLAGSD) $< -o $@
%.ro : %.s ; $(AS) $(SFLAGSR) $< -o $@
# WARNING: The above rules were used to derive rules in the filesystem
# GNUmakefile that are designed for building with BARF included. If
# you change these rules, be sure to change the rules in
# src/filesystem/GNUmakefile similarly. Apologies for this
# abomination, but this is how it has to be done until we can rework
# it after the Teamware conversion happens.
# (and some oddball ones for dipir)
%.ao : %.c ; ${CC} ${CFLAGS} -c -DAPP_DIGEST $< -o $@
%.xo : %.c ; ${CC} ${CFLAGS} -c -DAPP_DIGEST -DCOMBINE $< -o $@
%.to : %.c ; ${CC} ${CFLAGS} -c -DAPP_DIGEST -DCOMBINE -DTESTBUILD $< -o $@
# Rules for automagic generation of dependencies. (See comment below.)
.dep.%.o : %.c ; $(CC) $(CFLAGS) -c $< -o $*.o -M > $@
.dep.%.bo : %.c ; $(CC) $(CFLAGSB) -c $< -o $*.bo -M > $@
.dep.%.do : %.c ; $(CC) $(CFLAGSD) -c $< -o $*.do -M > $@
.dep.%.ro : %.c ; $(CC) $(CFLAGSR) -c $< -o $*.ro -M > $@
.dep.%.o : %.s ; $(AS) $(SFLAGS) $< -o $*.o -D [email protected] >/dev/null 2>&1 && \
awk '{ for (f=2; f<=NF; ++f) printf "%s %s\n", $$1, $$f; }' < [email protected] > $@ && \